Exemplo n.º 1
0
 //操作Gridview的命令行
 protected void Grid_ETTestItem_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Edt_ExpItem")
     {
         GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
         Grid_ETTestItem.SelectedIndex = row.RowIndex;
         Panel_NewExpItem.Visible      = true;
         UpdatePanel_NewExpItem.Update();
         LblState.Text = "Edit";
         GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
         //this.Grid_BDOrgSheet_1.Rows[gvr.RowIndex].BackColor = System.Drawing.Color.SkyBlue;
         //Session["index"] = gvr.RowIndex;
         id = new Guid(e.CommandArgument.ToString());
         ExpSampleType_ExpItems exp = expTestL.Search_ExpItems_ID(id)[0];
         LblNewExpItem.Text       = exp.EI_ExpItem + " 编辑";
         TxtAddTestItem.Text      = exp.EI_ExpItem;
         TxtAddTestCondition.Text = exp.EI_ExpCondtition;
         TxtAddTestMethold.Text   = exp.EI_ExpMethold;
         UpdatePanel_NewExpItem.Update();
     }
     if (e.CommandName == "Delete_ExpItem")
     {
         GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
         Grid_ETTestItem.SelectedIndex = row.RowIndex;
         Guid guid = new Guid(e.CommandArgument.ToString());
         expTestL.Delete_ExpItems(guid);
         BindGridview(Bindc1, Bindc2, Bindc3);
         UpdatePanel_GridViewItem.Update();
     }
 }
Exemplo n.º 2
0
 //检索栏新增按钮
 protected void Btn_NEW_ETExpItem_Click(object sender, EventArgs e)
 {
     Clear();
     LblNewExpItem.Text       = "新建实验项目";
     Panel_NewExpItem.Visible = true;
     UpdatePanel_NewExpItem.Update();
     LblState.Text = "New";
 }
Exemplo n.º 3
0
 //维护窗口提交按钮
 protected void BtnOK_ETItem_Click(object sender, EventArgs e)
 {
     if (LblState.Text == "New")
     {
         if (TxtAddTestItem.Text == "")
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true);
             return;
         }
         else
         {
             expSampleType_ExpItems.EI_ExpItem = TxtAddTestItem.Text;
         }
         if (TxtAddTestCondition.Text == "")
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true);
             return;
         }
         else
         {
             expSampleType_ExpItems.EI_ExpCondtition = TxtAddTestCondition.Text;
         }
         if (TxtAddTestMethold.Text == "")
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true);
             return;
         }
         else
         {
             expSampleType_ExpItems.EI_ExpMethold = TxtAddTestMethold.Text;
         }
         try
         {
             if (expTestL.Insert_ExpItems(expSampleType_ExpItems) <= 0)
             {
                 ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该实验项目已经存在!')", true);
                 return;
             }
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('编辑失败!" + ex + "')", true);
             return;
         }
         ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('提交成功!')", true);
         Clear();
         Bindc1 = Bindc2 = Bindc3 = "";
         BindGridview(Bindc1, Bindc2, Bindc3);
         Panel_NewExpItem.Visible = false;
         UpdatePanel_NewExpItem.Update();
         UpdatePanel_GridViewItem.Update();
     }
     else if (LblState.Text == "Edit")
     {
         ExpSampleType_ExpItems Exp1 = new ExpSampleType_ExpItems();
         Exp1.EI_ExpItemID = id;
         Exp1.EI_IsDeleted = false;
         if (TxtAddTestItem.Text == "")
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true);
             return;
         }
         else
         {
             Exp1.EI_ExpItem = TxtAddTestItem.Text;
         }
         if (TxtAddTestCondition.Text == "")
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true);
             return;
         }
         else
         {
             Exp1.EI_ExpCondtition = TxtAddTestCondition.Text;
         }
         if (TxtAddTestMethold.Text == "")
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true);
             return;
         }
         else
         {
             Exp1.EI_ExpMethold = TxtAddTestMethold.Text;
         }
         try
         {
             if (expTestL.Update_ExpItems(Exp1) <= 0)
             {
                 ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该实验项目已经存在!')", true);
                 return;
             }
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('编辑失败!" + ex + "')", true);
             return;
         }
         ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('提交成功!')", true);
         Clear();
         BindGridview(Bindc1, Bindc2, Bindc3);
         UpdatePanel_NewExpItem.Update();
         UpdatePanel_GridViewItem.Update();
         Panel_NewExpItem.Visible = false;
     }
 }