protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "editt")
     {
         Image1.Visible = true;
         Image2.Visible = true;
         Image3.Visible = true;
         Image4.Visible = true;
         Image5.Visible = true;
         Image6.Visible = true;
         int xy = Convert.ToInt32(e.CommandArgument);
         Div1.Visible      = true;
         Button9.Text      = "确定";
         GridView1.Visible = false;
         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;
         }
         TextBox10.Text = GridView1.Rows[xy].Cells[1].Text;
         Model.PositionType pos = new DAL.PositionTypeDAO().getPositionTypeByid(GridView1.Rows[xy].Cells[1].Text);
         TextBox11.Text     = pos.PositionTypeName;
         TextBox12.Text     = pos.Length;
         TextBox13.Text     = pos.Width;
         TextBox14.Text     = pos.Height;
         TextBox15.Text     = pos.Remark;
         TextBox10.ReadOnly = true;
     }
     if (e.CommandName == "deletee")
     {
         Model.PositionType delete = new Model.PositionType();
         int x = Convert.ToInt32(e.CommandArgument);
         delete.PositionTypeId = GridView1.Rows[x].Cells[1].Text;
         bool yy = new DAL.ChestDAO().deleteChestByNum(delete.PositionTypeId);
         if (yy)
         {
             ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true);
             rg.Refresh("select * from Positiontype order by num", "PositionTypeId", GridView1);
         }
         else
         {
             ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true);
         }
     }
 }
示例#2
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            bool xx = new DAL.ChestDAO().deleteChests();

            if (xx)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true);
                rg.Refresh("select * from Chest order by num", "chestNum", GridView1);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true);
            }
        }
示例#3
0
        protected void Button200_Click(object sender, EventArgs e)
        {
            ideas.Style["display"] = "none";
            bool yy = new DAL.ChestDAO().deleteChestByNum(Session["delete"].ToString());

            Session["delete"] = "";
            if (yy)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true);
                rg.Refresh("select * from Chest", "chestNum", GridView1);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true);
            }
        }
示例#4
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "editt")
     {
         Image1.Visible = true;
         Image2.Visible = true;
         Image3.Visible = true;
         Image4.Visible = true;
         Image5.Visible = true;
         int xy = Convert.ToInt32(e.CommandArgument);
         Div1.Visible      = true;
         Button9.Text      = "确定";
         GridView1.Visible = false;
         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;
         }
         TextBox10.Text = GridView1.Rows[xy].Cells[1].Text;
         Model.Chest pos = new DAL.ChestDAO().getChestByNum(GridView1.Rows[xy].Cells[1].Text);
         TextBox11.Text = pos.ChestName;
         TextBox12.Text = pos.M;
         TextBox2.Text  = pos.Height;
         TextBox13.Text = pos.RoomNum;
         string        xx  = pos.CreateTime.ToString();
         string        yy  = pos.UpdateTime.ToString();
         StringBuilder sb1 = new StringBuilder();
         StringBuilder sb2 = new StringBuilder();
         foreach (char x in xx)
         {
             if (Convert.ToInt32(x) != 32)
             {
                 sb1.Append(x);
             }
             else if (Convert.ToInt32(x) == 32)
             {
                 break;
             }
         }
         foreach (char x in yy)
         {
             if (Convert.ToInt32(x) != 32)
             {
                 sb2.Append(x);
             }
             else if (Convert.ToInt32(x) == 32)
             {
                 break;
             }
         }
         TextBox14.Text    = pos.Remark;
         TextBox15.Text    = sb1.ToString();
         TextBox16.Text    = sb2.ToString();
         TextBox1.ReadOnly = true;
     }
     if (e.CommandName == "deletee")
     {
         Model.Chest delete = new Chest();
         int         x      = Convert.ToInt32(e.CommandArgument);
         delete.ChestNum        = GridView1.Rows[x].Cells[1].Text;
         ideas.Style["display"] = "inline";
         Session["delete"]      = delete.ChestNum;
     }
 }
示例#5
0
        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;
            }
            }
        }