protected void Button200_Click(object sender, EventArgs e) { bool xx = new DAL.GoodsDAO().deleteGoodsByNum(Session["delete"].ToString()); if (xx) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true); ideas.Style["display"] = "none"; Div1.Visible = false; GridView1.Visible = true; if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; ListBox11.Visible = true; TextBox1.Visible = true; Button5.Visible = true; } rg.Refresh("select * from Goods order by num", "goodsNum", GridView1); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true); } }
protected void Button4_Click(object sender, EventArgs e) { bool xx = new DAL.GoodsDAO().deleteGoodes(); if (xx) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true); Div1.Visible = false; GridView1.Visible = true; if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; ListBox11.Visible = true; TextBox1.Visible = true; Button5.Visible = true; } rg.Refresh("select * from Goods order by num", "goodsNum", GridView1); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true); } }
protected void Button66_Click(object sender, EventArgs e) { if (Button66.Text == "增加") { if (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png" && Image6.ImageUrl == "~/Image/对号.png" && Image7.ImageUrl == "~/Image/对号.png" && Image8.ImageUrl == "~/Image/对号.png" && Image9.ImageUrl == "~/Image/对号.png" && Image10.ImageUrl == "~/Image/对号.png") { Model.Goods add = new Model.Goods(); DAL.Query qu = new DAL.Query(); int n = qu.query("Goods"); add.Num = n + 1; add.GoodsNum = TextBox11.Text; add.GoodsTypeNum = TextBox9.Text; add.GoodsName = TextBox12.Text; add.GoodsStyle = ListBox6.SelectedItem.Text; add.GoodsColor = ListBox7.SelectedItem.Text; add.GoodsSmell = ListBox8.SelectedItem.Text; add.GoodsShape = ListBox9.SelectedItem.Text; add.GoodsPer = ListBox14.SelectedItem.Text; add.GoodsCondition = ListBox10.SelectedItem.Text; add.Max = TextBox2.Text; bool xx = new DAL.GoodsDAO().addGoods(add); if (xx) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');", true); Div1.Visible = false; GridView1.Visible = true; if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; ListBox11.Visible = true; TextBox1.Visible = true; Button5.Visible = true; } rg.Refresh("select * from Goods order by num", "goodsNum", GridView1); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true); } } else { Response.Write("<script>window.location.href='#div_kkk'</script>"); } } else if (Button66.Text == "确定") { if (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png" && Image6.ImageUrl == "~/Image/对号.png" && Image7.ImageUrl == "~/Image/对号.png" && Image8.ImageUrl == "~/Image/对号.png" && Image9.ImageUrl == "~/Image/对号.png" && Image10.ImageUrl == "~/Image/对号.png") { Model.Goods add = new Model.Goods(); add.GoodsNum = TextBox11.Text; add.GoodsTypeNum = TextBox9.Text; add.GoodsName = TextBox12.Text; add.GoodsStyle = ListBox6.SelectedItem.Text; add.GoodsColor = ListBox7.SelectedItem.Text; add.GoodsSmell = ListBox8.SelectedItem.Text; add.GoodsShape = ListBox9.SelectedItem.Text; add.GoodsPer = ListBox14.SelectedItem.Text; add.GoodsCondition = ListBox10.SelectedItem.Text; add.Max = TextBox2.Text; bool xx = new DAL.GoodsDAO().updateGoods(add); if (xx) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改成功!');", true); Div1.Visible = false; GridView1.Visible = true; if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; ListBox11.Visible = true; TextBox1.Visible = true; Button5.Visible = true; } rg.Refresh("select * from Goods order by num", "goodsNum", GridView1); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改失败!');", true); } } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "editt") { int xy = Convert.ToInt32(e.CommandArgument); Div1.Visible = true; Button66.Text = "确定"; Div1.Visible = true; GridView1.Visible = false; if (GridView1.Visible == false) { Button1.Visible = false; Button4.Visible = false; ListBox11.Visible = false; TextBox1.Visible = false; Button5.Visible = false; } TextBox11.Text = GridView1.Rows[xy].Cells[1].Text; TextBox12.Text = GridView1.Rows[xy].Cells[2].Text; Model.Goods pos = new DAL.GoodsDAO().getGoodsByNum(GridView1.Rows[xy].Cells[1].Text); TextBox9.Text = new DAL.GoodsTypeDAO().getGoodsTypeByNum(pos.GoodsTypeNum).GoodsTypeName; for (int i = 0; i < ListBox6.Items.Count; i++) { if (ListBox6.Items[i].Text == pos.GoodsStyle) { string str = ListBox6.Items[0].Text; ListBox6.Items[0].Text = ListBox6.Items[i].Text; ListBox6.Items[i].Text = str; } } for (int i = 0; i < ListBox7.Items.Count; i++) { if (ListBox7.Items[i].Text == pos.GoodsColor) { string str = ListBox7.Items[0].Text; ListBox7.Items[0].Text = ListBox7.Items[i].Text; ListBox7.Items[i].Text = str; } } for (int i = 0; i < ListBox8.Items.Count; i++) { if (ListBox8.Items[i].Text == pos.GoodsSmell) { string str = ListBox8.Items[0].Text; ListBox8.Items[0].Text = ListBox8.Items[i].Text; ListBox8.Items[i].Text = str; } } for (int i = 0; i < ListBox9.Items.Count; i++) { if (ListBox9.Items[i].Text == pos.GoodsShape) { string str = ListBox9.Items[0].Text; ListBox9.Items[0].Text = ListBox9.Items[i].Text; ListBox9.Items[i].Text = str; } } for (int i = 0; i < ListBox14.Items.Count; i++) { if (ListBox14.Items[i].Text == pos.GoodsPer) { string str = ListBox14.Items[0].Text; ListBox14.Items[0].Text = ListBox14.Items[i].Text; ListBox14.Items[i].Text = str; } } for (int i = 0; i < ListBox10.Items.Count; i++) { if (ListBox10.Items[i].Text == pos.GoodsCondition) { string str = ListBox10.Items[0].Text; ListBox10.Items[0].Text = ListBox10.Items[i].Text; ListBox10.Items[i].Text = str; } } TextBox2.Text = GridView1.Rows[xy].Cells[7].Text; Image1.Visible = true; Image2.Visible = true; Image3.Visible = true; Image4.Visible = true; Image5.Visible = true; Image6.Visible = true; Image7.Visible = true; Image8.Visible = true; Image9.Visible = true; Image10.Visible = true; Image1.ImageUrl = "~/Image/对号.png"; Image2.ImageUrl = "~/Image/对号.png"; Image3.ImageUrl = "~/Image/对号.png"; Image4.ImageUrl = "~/Image/对号.png"; Image5.ImageUrl = "~/Image/对号.png"; Image6.ImageUrl = "~/Image/对号.png"; Image7.ImageUrl = "~/Image/对号.png"; Image8.ImageUrl = "~/Image/对号.png"; Image9.ImageUrl = "~/Image/对号.png"; Image10.ImageUrl = "~/Image/对号.png"; Button9.Visible = false; ListBox5.Visible = false; } if (e.CommandName == "deletee") { Model.GoodsType delete = new Model.GoodsType(); int x = Convert.ToInt32(e.CommandArgument); delete.GoodsTypeNum = GridView1.Rows[x].Cells[1].Text; ideas.Style["display"] = "inline"; Session["delete"] = delete.GoodsTypeNum; } }