FineUI 官方论坛
标题: 求大神指导下 [打印本页]
作者: Mr.Z 时间: 2013-5-16 00:04
标题: 求大神指导下
管理员账号管理模块
protected voidbtnAdd_Click(object sender, EventArgs e)
{
SqlConnection conn = newSqlConnection(SqlHelper.connstring);
string sql = string.Format("insertinto guanliyuan(name,Password) values('" + this.txtName.Text +"','" + txtPwd.Text + "')");
SqlCommand comm = new SqlCommand(sql,conn);
conn.Open();
comm.ExecuteNonQuery();
conn.Close();
this.lblinfo.Text = "添加成功!";
}
网上商城商品评价管理
protected voidButton1_Click(object sender, EventArgs e)
{
if (Session["username"] ==null)
{
Alert.AlertAndRedirect("对不起您还没有登录","Login.aspx");
}
else
{
string strid =Page.Request.QueryString["id"];
string sql = "insert into PingLun(GoodsId,leibie,Titiles,youdian,quedian,shiyongXinDe,Adduser)values('"+ strid + "','" + DropDownList1.SelectedItem.Text + "','" +TextBox1.Text + "','" + TextBox2.Text + "','" +TextBox3.Text + "','" + TextBox4.Text + "','" +Session["username"].ToString() + "')";
dbcoment.RunSql(sql);
Alert.AlertAndRedirect("评论成功","ShowGoodsContent.aspx?id=" + strid);
}
}
用户账号管理模块
protected voidLinkButton1_Click(object sender, EventArgs e)
{
data.RunSql("insert intohuiyuan(Daan,wenti,password,username,Sex,Tel,ADdress,nianling,Ds)values('"+ txtdanan.Text + "','" + txtwwenti.Text + "','" +TextBox1.Text + "','" + txtname.Text + "','" +DropDownList1.SelectedItem.Text + "','" + txtTel.Text +"','" + txtbanquan.Text + "','" + tb_birth.Value +"','" + txtds.Text + "')");
Alert.AlertAndRedirect("注册成功请登录!","Login.aspx");
}
用户登录的主要代码如下:
protected voidImageButton1_Click(object sender, ImageClickEventArgs e)
{
SqlHelper data = new SqlHelper();
SqlDataReader dr;
dr = data.GetDataReader("select *from [huiyuan] where username='" +TxtUserName.Text.Trim() + "'and password='" + TxtPassword.Text.Trim()+ "'");
if (dr.Read())
{
Session["username"] =dr["username"].ToString();
Session["userid"] =dr["id"].ToString();
Response.Redirect("Default.aspx");
}
else
{
Alert.AlertAndRedirect("账号或者密码不对请重新登录!","Login.aspx");
}
}
网上商城商品管理模块
protected void btnAdd_Click(object sender,EventArgs e)
{
string sqlstr = "insert intoshangpin"
+ "(GoodsName,GoodsPrice,GoodsTypeID,GoodsIntroduce,GoodsPhoto)"
+ "values('" +txtGName.Text.Trim() + "'," + txtGPrice.Text.Trim()
+ ",'" +ddlGType.SelectedValue + "','" + TextBox1.Value.Trim() +"','" + pic.Text + "')";
sqloperate.RunSql(sqlstr);
Alert.AlertAndRedirect("添加成功","GoodsManger.aspx");
}
protected void Button1_Click(objectsender, EventArgs e)
{
string res;
upload up = new upload();
res = up.Up(file1, "../uploadfiles/");
this.Label1.Visible = true;
this.Label1.Text =up.Resup[Convert.ToInt32(res)];
this.pic.Text = up.s;
Image1.ImageUrl ="../uploadfiles/" + pic.Text;
}
网上商城新闻管理模块
protected voidbtnAdd_Click(object sender, EventArgs e)
{
lblError.Text = "";
string sTitle =txtTitle.Text.ToString().Trim();
string sContent =TextBox1.Value.ToString();
if (sTitle.Length < 1 ||sContent.Length < 1)
{
lblError.Text = "标题和内容不能为空!";
return;
}
InsertNews(sTitle, sContent);
lblError.Text = "添加成功!";
txtTitle.Text = "";
TextBox1.Value = "";
}
private void InsertNews(string sTitle, stringsContent)
{
SqlConnection myConnection = newSqlConnection(ConfigurationManager.ConnectionStrings["sqlcon"].ConnectionString);
string cmdText = "INSERT INTOxinwen(Title,Content)VALUES('" + sTitle + "','" + sContent +"')";
SqlCommand myCommand = newSqlCommand(cmdText, myConnection);
try
{
myConnection.Open();
myCommand.ExecuteNonQuery();
}
catch (SqlException ex)
{
throw new Exception(ex.Message, ex);
}
finally
{
myConnection.Close();
}
}
网上商城订单管理模块
private void BinderOrder()
{
string sqlstr = "select * fromdingdan";
gvOrderInfo.DataKeyNames = new string[]{ "OrderID" };
sqloperate.gvDataBind(gvOrderInfo,sqlstr);
SqlHelper data = new SqlHelper();
SqlDataReader dr1;
dr1 = data.GetDataReader("select OrderID from dingdan ");
if (dr1.Read())
{
string sqlstrtprice = "selectsum(GoodsPrice*shuliang) as tprice from dingdan"
SqlDataReader dr;
dr = data.GetDataReader(sqlstrtprice);
dr.Read();
labMoney.Text =Convert.ToString(int.Parse(dr["tprice"].ToString()));
}
else
{
labMoney.Text = "0";
}
}
求大神指导下各个模块的算法 要是没算法的说下各个模块具体什么意思 谢谢
作者: djn 时间: 2013-5-16 08:58
什么鸟意思,增删改查有毛算法的啊
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/) |
Powered by Discuz! X3.4 |