protected void Button6_Click(object sender, EventArgs e) { double xx = new Warehouse.Tools.chestSum().Sum(ListBox2.SelectedItem.Value); double yy = Convert.ToDouble(quu.tiqu(new Warehouse.Tools.queryV().query("select M from Room where roomNum='" + ListBox2.SelectedItem.Value + "'"))) * Convert.ToDouble(quu.tiqu(new Warehouse.Tools.queryV().query("select Height from Room where roomNum='" + ListBox2.SelectedItem.Value + "'"))); if (yy > xx) { TextBox13.Text = ListBox2.SelectedItem.Value; TextBox10.Text = new Warehouse.Tools.chestNum().protect_chestNum(ListBox2.SelectedItem.Value); Image1.ImageUrl = "~/Image/对号.png"; Image1.Visible = true; Image4.ImageUrl = "~/Image/对号.png"; Image4.Visible = true; } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('位置已满,请选择其他库位!');", true); } }
protected void Button9_Click(object sender, EventArgs e) { switch (Button9.Text) { case "增加": { Warehouse.Tools.apartV ap = new Tools.apartV(); Warehouse.Tools.queryV qu = new Tools.queryV(); double xxx = new Warehouse.Tools.chestSum().Sum(ListBox2.SelectedItem.Value); double yy = Convert.ToDouble(quu.tiqu(new Warehouse.Tools.queryV().query("select M from Room where roomNum='" + ListBox2.SelectedItem.Value + "'"))) * Convert.ToDouble(quu.tiqu(new Warehouse.Tools.queryV().query("select Height from Room where roomNum='" + ListBox2.SelectedItem.Value + "'"))); if (yy - xxx >= Convert.ToDouble(quu.tiqu(TextBox12.Text)) * Convert.ToDouble(quu.tiqu(TextBox2.Text))) { if (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png") { try { Model.Chest add = new Model.Chest(); DAL.Query nn = new DAL.Query(); int n = nn.query("chest"); add.Num = (n + 1).ToString(); add.ChestNum = TextBox10.Text; add.ChestName = TextBox11.Text; add.M = quu.tiqu(TextBox12.Text).ToString(); add.Height = quu.tiqu(TextBox2.Text).ToString(); add.RoomNum = TextBox13.Text; add.Remark = TextBox14.Text; add.CreateTime = DateTime.Now; add.UpdateTime = DateTime.Now; bool xx = new DAL.ChestDAO().addChest(add); if (xx == true) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');", true); Div1.Visible = false; GridView1.Visible = true; rg.Refresh("select * from Chest order by num", "chestNum", GridView1); if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; Button5.Visible = true; ListBox1.Visible = true; TextBox1.Visible = true; } else if (GridView1.Visible == false) { Button1.Visible = false; Button4.Visible = false; Button5.Visible = false; ListBox1.Visible = false; TextBox1.Visible = false; Div1.Visible = true; } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true); } } catch { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true); } } else { Response.Write("<script>window.location.href='#div_kkk'</script>"); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('可放位置不足,请选择其他房间或总体积小于" + (yy - xxx).ToString() + "!');", true); } } break; case "确定": { Button btn = sender as Button; Model.Chest update = new Chest(); update.ChestNum = TextBox10.Text; update.ChestName = TextBox11.Text; update.M = quu.tiqu(TextBox12.Text).ToString(); update.Height = quu.tiqu(TextBox2.Text).ToString(); update.RoomNum = TextBox13.Text; update.Remark = TextBox14.Text; update.CreateTime = Convert.ToDateTime(TextBox15.Text); update.UpdateTime = DateTime.Now; bool xx = new DAL.ChestDAO().updateChest(update); if (xx && (Image1.ImageUrl == "~/Image/对号.png" && Image2.ImageUrl == "~/Image/对号.png" && Image3.ImageUrl == "~/Image/对号.png" && Image4.ImageUrl == "~/Image/对号.png" && Image5.ImageUrl == "~/Image/对号.png")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改成功!');", true); Div1.Visible = false; GridView1.Visible = true; rg.Refresh("select * from Chest order by num", "chestNum", GridView1); if (GridView1.Visible == true) { Button1.Visible = true; Button4.Visible = true; Button5.Visible = true; ListBox1.Visible = true; TextBox1.Visible = true; } else if (GridView1.Visible == false) { Button1.Visible = false; Button4.Visible = false; Button5.Visible = false; ListBox1.Visible = false; TextBox1.Visible = false; Div1.Visible = true; } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改失败!');", true); } break; } } }