コード例 #1
0
ファイル: BOM.aspx.cs プロジェクト: qimengcheng/xi
 protected void Button23_Click(object sender, EventArgs e)
 {
     if (TextBox10.Text == "")
     {
         ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true);
         return;
     }
     if (Label11.Text == "新增")
     {
         Guid id = new Guid(Label1.Text);
         try
         {
             int a = bom.Insert_BOM(id, TextBox10.Text, DropDownList2.SelectedItem.Text, Session["UserName"].ToString());
             TextBox10.Text       = "";
             Panel31.Visible      = false;
             GridView2.DataSource = bom.Query_BOM(new Guid(Label1.Text));
             GridView2.DataBind();
             UpdatePanel3.Update();
             if (a == -1)
             {
                 ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('已存在该BOM,新增失败.')", true);
             }
         }
         catch
         {
             ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('新增失败!')", true);
         }
     }
     if (Label11.Text == "修改")
     {
         try
         {
             Guid id = new Guid(Label13.Text);
             bom.Update_BOM(id, TextBox10.Text, DropDownList2.SelectedItem.Text, Session["UserName"].ToString());
             TextBox10.Text       = "";
             Panel31.Visible      = false;
             GridView2.DataSource = bom.Query_BOM(new Guid(Label1.Text));
             GridView2.DataBind();
             UpdatePanel3.Update();
         }
         catch
         {
             ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('修改失败!')", true);
         }
     }
 }