//操作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(); } }
//GridView中编辑、删除 protected void Grid_SampleType_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit_Sampletype") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_SampleType.SelectedIndex = row.RowIndex; Clear(); Panel_NewSampletype.Visible = true; UpdatePanel_NewSampletype.Update(); LblState.Text = "Edit"; id = new Guid(e.CommandArgument.ToString()); ExpSampleType_ExpItems ST = expTestL.Search_ExpSampleType_ID(id)[0]; LblNewSampletype.Text = ST.EST_SampleType + " 编辑"; TxtNewSampletype.Text = ST.EST_SampleType; UpdatePanel_NewSampletype.Update(); } if (e.CommandName == "Delete_Sampletype") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_SampleType.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); expTestL.Delete_ExpSampleType(guid); BindGridview(Bindc); UpdatePanel_SampleType.Update(); } }
public DataSet Search_ExpItems(ExpSampleType_ExpItems A)//模糊检索实验项目 { SqlParameter[] parm = new SqlParameter[3]; parm[0] = new SqlParameter("@EI_ExpItem", SqlDbType.VarChar, 40); parm[0].Value = A.EI_ExpItem; parm[1] = new SqlParameter("@EI_ExpCondtition", SqlDbType.VarChar, 200); parm[1].Value = A.EI_ExpCondtition; parm[2] = new SqlParameter("@EI_ExpMethold", SqlDbType.VarChar, 200); parm[2].Value = A.EI_ExpMethold; return(SqlHelper.GetDataSet(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_S_ExpItems_One", parm)); }
public int Update_ExpSampleType(ExpSampleType_ExpItems expSampleType_ExpItems)//修改样品类型 { SqlParameter[] parm = new SqlParameter[2]; parm[0] = new SqlParameter("@EST_SampleTypeID", SqlDbType.UniqueIdentifier); parm[0].Value = expSampleType_ExpItems.EST_SampleTypeID; parm[1] = new SqlParameter("@EST_SampleType", SqlDbType.VarChar, 60); parm[1].Value = expSampleType_ExpItems.EST_SampleType; return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_U_ExpSampleType", parm)); }
public int Insert_ExpItems(ExpSampleType_ExpItems A)//插入新的实验项目 { SqlParameter[] parm = new SqlParameter[3]; parm[0] = new SqlParameter("@EI_ExpItem", SqlDbType.VarChar, 40); parm[0].Value = A.EI_ExpItem; parm[1] = new SqlParameter("@EI_ExpCondtition", SqlDbType.VarChar, 200); parm[1].Value = A.EI_ExpCondtition; parm[2] = new SqlParameter("@EI_ExpMethold", SqlDbType.VarChar, 200); parm[2].Value = A.EI_ExpMethold; return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_I_ExpItems", parm)); }
public int Update_ExpItems(ExpSampleType_ExpItems A)//修改实验项目 { SqlParameter[] parm = new SqlParameter[4]; parm[0] = new SqlParameter("@EI_ExpItemID", SqlDbType.UniqueIdentifier); parm[0].Value = A.EI_ExpItemID; parm[1] = new SqlParameter("@EI_ExpItem", SqlDbType.VarChar, 40); parm[1].Value = A.EI_ExpItem; parm[2] = new SqlParameter("@EI_ExpCondtition", SqlDbType.VarChar, 200); parm[2].Value = A.EI_ExpCondtition; parm[3] = new SqlParameter("@EI_ExpMethold", SqlDbType.VarChar, 200); parm[3].Value = A.EI_ExpMethold; return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_U_ExpItems", parm)); }
//维护窗口提交按钮 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; } }
//维护窗口,提交按钮 protected void BtnSubmit_Click(object sender, EventArgs e) { if (LblState.Text == "New") { expSampleType_ExpItems.EST_SampleTypeID = Guid.NewGuid(); if (TxtNewSampletype.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else if (TextLength(TxtNewSampletype.Text) > 50) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请输入字数不要超过25个!')", true); return; } else { expSampleType_ExpItems.EST_SampleType = TxtNewSampletype.Text; } expSampleType_ExpItems.EST_IsDeleted = false; try { if (expTestL.Insert_ExpSampleType(expSampleType_ExpItems) <= 0) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该样品类型已经存在!')", true); return; } //expTestL.Insert_ExpSampleType(expSampleType_ExpItems); } catch (Exception exc) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('新增失败!" + exc + "')", true); } ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('提交成功!')", true); Clear(); Bindc = ""; BindGridview(Bindc); Panel_NewSampletype.Visible = false; UpdatePanel_SampleType.Update(); UpdatePanel_NewSampletype.Update(); } if (LblState.Text == "Edit") { ExpSampleType_ExpItems ST = new ExpSampleType_ExpItems(); if (TxtNewSampletype.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } else if (TextLength(TxtNewSampletype.Text) > 50) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('请输入字数不要超过25个!')", true); return; } else { ST.EST_SampleType = TxtNewSampletype.Text; } ST.EST_SampleTypeID = id; try { if (expTestL.Update_ExpSampleType(ST) <= 0) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('该样品类型已经存在!')", true); return; } //expTestL.Update_ExpSampleType(ST); } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('编辑失败!" + ex + "')", true); return; } ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('提交成功!')", true); Clear(); BindGridview(Bindc); Panel_NewSampletype.Visible = false; UpdatePanel_SampleType.Update(); UpdatePanel_NewSampletype.Update(); } }
public int Update_ExpItems(ExpSampleType_ExpItems A)//修改实验项目 { return(pspt.Update_ExpItems(A)); }
public int Insert_ExpItems(ExpSampleType_ExpItems A)//插入新的实验项目 { return(pspt.Insert_ExpItems(A)); }
public DataSet Search_ExpItems(ExpSampleType_ExpItems Exp)//模糊检索实验项目 { return(pspt.Search_ExpItems(Exp)); }
public int Update_ExpSampleType(ExpSampleType_ExpItems expSampleType_ExpItems)//修改样品类型 { return(pspt.Update_ExpSampleType(expSampleType_ExpItems)); }
public int Insert_ExpSampleType(ExpSampleType_ExpItems expSampleType_ExpItems)//插入新的样品类型 { return(pspt.Insert_ExpSampleType(expSampleType_ExpItems)); }