//重置 protected void Btn_ResetIQCItems_Click(object sender, EventArgs e) { TxtIQCItems.Text = ""; DdlstNeedValue.ClearSelection(); Grid2Cond = ""; cond2 = " IMMBD_MaterialID='" + Convert.ToString(id2) + "' "; BindGrid2M(cond2); UpdatePanel_IQCItemsMgt.Update(); }
//检索栏检索按钮 protected void Btn_SearchIQCItems_Click(object sender, EventArgs e) { Grid2Cond = ""; //表示grid2绑定模糊查询数据 cond2 = " IMMBD_MaterialID='" + Convert.ToString(id2) + "' "; if (TxtIQCItems.Text != "") { cond2 = cond2 + " and IQCIT_Items like '%'+ Ltrim(Rtrim('" + TxtIQCItems.Text + "'))+'%'"; } if (DdlstNeedValue.SelectedItem.ToString() != "请选择") { cond2 = cond2 + " and IQCIT_NeedValue='" + DdlstNeedValue.SelectedItem.ToString() + "'"; } BindGrid2M(cond2); UpdatePanel_IQCItemsMgt.Update(); }
//检索栏关闭按钮 protected void Btn_ClsIQCItems_Click(object sender, EventArgs e) { TxtIQCItems.Text = ""; DdlstNeedValue.ClearSelection(); Panel_IQCItemsMgt.Visible = false; UpdatePanel_IQCItemsMgt.Update(); TxtStandard.Text = ""; TxtRemarks.Text = ""; Panel_SearchStandard.Visible = false; UpdatePanel_SearchStandard.Update(); Txt_EditItems.Text = ""; Ddl_EditValues.ClearSelection(); Panel_EditItems.Visible = false; UpdatePanel_EditItems.Update(); Panel_EditStandard.Visible = false; UpdatePanel_EditStandard.Update(); }
//操作Gridview的命令行 protected void Grid_IQCItems_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edt_ItemValue") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_IQCItems.SelectedIndex = row.RowIndex; GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); id3 = new Guid(e.CommandArgument.ToString()); BindGrid3(id3); Grid3Cond = "id";//用id表示grid3绑定id检索,用空表示grid3绑定模糊检索 Panel_SearchStandard.Visible = true; UpdatePanel_SearchStandard.Update(); } if (e.CommandName == "Edt_Item") { edit2 = "edit"; GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_IQCItems.SelectedIndex = row.RowIndex; GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); Guid guid = new Guid(e.CommandArgument.ToString()); iQCBasicDataInfo = iQCBasicDataL.Search_IQCItemsTable_ID(guid)[0]; Txt_EditItems.Text = iQCBasicDataInfo.IQCIT_Items; id2 = iQCBasicDataInfo.IMMBD_MaterialID; idItem = iQCBasicDataInfo.IQCIT_ID; if (iQCBasicDataInfo.IQCIT_NeedValue == "是") { Ddl_EditValues.SelectedValue = "1"; } else if (iQCBasicDataInfo.IQCIT_NeedValue == "否") { Ddl_EditValues.SelectedValue = "2"; } Panel_EditItems.Visible = true; UpdatePanel_EditItems.Update(); } if (e.CommandName == "Delete_Item") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_IQCItems.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); try { iQCBasicDataL.Delete_IQCItemsTable(guid); } catch (Exception exc) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('删除失败!" + exc + "')", true); } ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('删除成功!')", true); if (guid == id3)//若删除的检验项目打开了子级检验标准,则关闭子级窗口 { TxtStandard.Text = ""; TxtRemarks.Text = ""; Panel_SearchStandard.Visible = false; UpdatePanel_SearchStandard.Update(); } Grid2Cond = ""; cond2 = " IMMBD_MaterialID='" + Convert.ToString(id2) + "' "; BindGrid2M(cond2); UpdatePanel_IQCItemsMgt.Update(); } }
protected void Btn_EditSubmitIQCItems_Click(object sender, EventArgs e) { if (edit2 == "") { if (Txt_EditItems.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } if (Ddl_EditValues.SelectedItem.ToString() == "请选择") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } IQCBasicDataInfo IQC = new IQCBasicDataInfo(); IQC.IMMBD_MaterialID = id2; IQC.IQCIT_Items = Txt_EditItems.Text; IQC.IQCIT_NeedValue = Ddl_EditValues.SelectedItem.ToString(); try { if (iQCBasicDataL.Insert_IQCItemsTable(IQC) <= 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); Txt_EditItems.Text = ""; Ddl_EditValues.ClearSelection(); Grid2Cond = ""; cond2 = " IMMBD_MaterialID='" + Convert.ToString(id2) + "' "; BindGrid2M(cond2); UpdatePanel_IQCItemsMgt.Update(); } if (edit2 != "") { if (Txt_EditItems.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } if (Ddl_EditValues.SelectedItem.ToString() == "请选择") { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } iQCBasicDataInfo.IQCIT_ID = idItem; iQCBasicDataInfo.IMMBD_MaterialID = id2; iQCBasicDataInfo.IQCIT_Items = Txt_EditItems.Text; iQCBasicDataInfo.IQCIT_NeedValue = Ddl_EditValues.SelectedItem.ToString(); try { if (iQCBasicDataL.Update_IQCItemsTable(iQCBasicDataInfo) <= 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); edit2 = ""; Txt_EditItems.Text = ""; Ddl_EditValues.ClearSelection(); Grid2Cond = ""; cond2 = " IMMBD_MaterialID='" + Convert.ToString(id2) + "' "; BindGrid2M(cond2); UpdatePanel_IQCItemsMgt.Update(); Panel_EditItems.Visible = false; } UpdatePanel_EditItems.Update(); }
//操作Gridview的命令行 protected void Grid_Material_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edt_Item") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); id2 = new Guid(e.CommandArgument.ToString()); BindGrid2(id2); Grid2Cond = "id";//用id表示grid2绑定id检索,用空表示grid2绑定模糊检索 TxtIQCItems.Text = ""; DdlstNeedValue.ClearSelection(); Panel_IQCItemsMgt.Visible = true; UpdatePanel_IQCItemsMgt.Update(); } if (e.CommandName == "Delete_Item") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); try { if (iQCBasicDataL.Delete_IMMaterialBasicData_IQC(guid) <= 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); if (guid == id2)//如果点击的检验项目维护与所删除的是同一列,则关闭子级窗口 { TxtIQCItems.Text = ""; DdlstNeedValue.ClearSelection(); Panel_IQCItemsMgt.Visible = false; UpdatePanel_IQCItemsMgt.Update(); TxtStandard.Text = ""; TxtRemarks.Text = ""; Panel_SearchStandard.Visible = false; UpdatePanel_SearchStandard.Update(); } BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); } if (e.CommandName == "Chs_Item") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Grid_Material.SelectedIndex = row.RowIndex; Guid guid = new Guid(e.CommandArgument.ToString()); try { if (iQCBasicDataL.Insert_IMMaterialBasicData_IQC(guid) <= 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); BindGrid1(cond1); UpdatePanel_GridMaterial.Update(); } }