protected void BtnSaveEdit_Click(object sender, EventArgs e) { try { DataDictionaryEntry dde = null; switch ((DictionaryName)this.ViewState["DicName"]) { case DictionaryName.QiProductFamily: ProductFamily pf = ProductFamilyDicMgr.GetByCode(this.ViewState["Code"].ToString()); pf.Title = this.TxtTitleEdit.Text; pf.Sort = Convert.ToInt32(this.TxtSortEdit.Text); pf.Visible = this.CbVisibleEdit.Checked; pf.MailList = this.UacOwnerEdit.Value; ProductFamilyDicMgr.GetInstance().Update(pf); break; case DictionaryName.QiAttachCategory: QiAttachCategory qac = QiAttachCategoryDicMgr.GetByCode(this.ViewState["Code"].ToString()); qac.Title = this.TxtTitleEdit.Text; qac.Sort = Convert.ToInt32(this.TxtSortEdit.Text); qac.Visible = this.CbVisibleEdit.Checked; QiAttachCategoryDicMgr.GetInstance().Update(qac); break; case DictionaryName.QiProblemType: dde = QiProblemTypeDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; QiProblemTypeDicMgr.GetInstance().Update(dde); break; case DictionaryName.QiRootCause1: dde = QiRootCause1DicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; QiRootCause1DicMgr.GetInstance().Update(dde); break; case DictionaryName.QiRootCause2: QiRootCause2 qrc2 = QiRootCause2DicMgr.GetByCode(this.ViewState["Code"].ToString()); qrc2.Title = this.TxtTitleEdit.Text = dde.Title; qrc2.Sort = Convert.ToInt32(this.TxtSortEdit.Text); qrc2.Visible = this.CbVisibleEdit.Checked; QiRootCause2DicMgr.GetInstance().Update(qrc2); break; case DictionaryName.QiRootCause3: QiRootCause3 qrc3 = QiRootCause3DicMgr.GetByCode(this.ViewState["Code"].ToString()); qrc3.Title = this.TxtTitleEdit.Text = dde.Title; qrc3.Sort = Convert.ToInt32(this.TxtSortEdit.Text); qrc3.Visible = this.CbVisibleEdit.Checked; QiRootCause3DicMgr.GetInstance().Update(qrc3); break; case DictionaryName.QiCloseLoopCategory: dde = CloseLoopCategoryDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; CloseLoopCategoryDicMgr.GetInstance().Update(dde); break; case DictionaryName.QiCloseLoopDepartment: dde = CloseLoopDepartmentDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; CloseLoopDepartmentDicMgr.GetInstance().Update(dde); break; case DictionaryName.RcMailGroup: RcMailGroup rm = RcMailGroupDicMgr.GetByCode(this.ViewState["Code"].ToString()); rm.Title = this.TxtTitleEdit.Text; rm.Sort = Convert.ToInt32(this.TxtSortEdit.Text); rm.Visible = this.CbVisibleEdit.Checked; rm.MailList = this.UacOwnerEdit.Value; RcMailGroupDicMgr.GetInstance().Update(rm); break; case DictionaryName.EwgInitIssueStatus: dde = EwgInitIssueStatusDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; EwgInitIssueStatusDicMgr.GetInstance().Update(dde); break; case DictionaryName.EwgMeetingTeam: dde = EwgMeetingTeamDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; EwgMeetingTeamDicMgr.GetInstance().Update(dde); break; case DictionaryName.EwgFolder: dde = EwgFolderDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; EwgFolderDicMgr.GetInstance().Update(dde); break; case DictionaryName.EwgInitIssuePhase: dde = EwgInitIssuePhaseDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; EwgInitIssuePhaseDicMgr.GetInstance().Update(dde); break; case DictionaryName.LeDept: dde = LeDeptDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; LeDeptDicMgr.GetInstance().Update(dde); break; case DictionaryName.LeProblemSource: dde = LeProblemSourceDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; LeProblemSourceDicMgr.GetInstance().Update(dde); break; case DictionaryName.LeProblemFactory: dde = LeProblemFactoryDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; LeProblemFactoryDicMgr.GetInstance().Update(dde); break; case DictionaryName.LePart: dde = LePartDicMgr.GetByCode(this.ViewState["Code"].ToString()); dde.Title = this.TxtTitleEdit.Text; dde.Sort = Convert.ToInt32(this.TxtSortEdit.Text); dde.Visible = this.CbVisibleEdit.Checked; LePartDicMgr.GetInstance().Update(dde); break; } MessageHelper.RegShowJSAjax(this.BtnSaveEdit, "Success!", this.Page); } catch (ApplicationException aex) { MessageHelper.RegShowJSAjax(this.BtnSaveEdit, aex.Message, this.Page); } catch (Exception ex) // Ajax无法使用默认异常处理程序处理异常 { ErrorHelper.ExceptionHanderForAjax(ex, this.BtnSaveEdit, this.Page); } this.BindData(); this.MpeEdit.Hide(); }
protected void BtnSaveAdd_Click(object sender, EventArgs e) { try { DataDictionaryEntry dde = null; switch ((DictionaryName)this.ViewState["DicName"]) { case DictionaryName.QiProductFamily: ProductFamily pf = ProductFamilyDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now, this.DdlBuAdd.SelectedValue, ""); ProductFamilyDicMgr.GetInstance().Add(pf); break; case DictionaryName.QiAttachCategory: QiAttachCategory qac = QiAttachCategoryDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now, true); QiAttachCategoryDicMgr.GetInstance().Add(qac); break; case DictionaryName.QiProblemType: dde = QiProblemTypeDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); QiProblemTypeDicMgr.GetInstance().Add(dde); break; case DictionaryName.QiRootCause1: dde = QiRootCause1DicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); QiRootCause1DicMgr.GetInstance().Add(dde); break; case DictionaryName.QiRootCause2: QiRootCause2 qrc2 = QiRootCause2DicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.DdlParentAdd.SelectedValue, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); QiRootCause2DicMgr.GetInstance().Add(qrc2); break; case DictionaryName.QiRootCause3: QiRootCause3 qrc3 = QiRootCause3DicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.DdlParentAdd.SelectedValue, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); QiRootCause3DicMgr.GetInstance().Add(qrc3); break; case DictionaryName.QiCloseLoopCategory: dde = CloseLoopCategoryDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); CloseLoopCategoryDicMgr.GetInstance().Add(dde); break; case DictionaryName.QiCloseLoopDepartment: dde = CloseLoopDepartmentDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); CloseLoopDepartmentDicMgr.GetInstance().Add(dde); break; case DictionaryName.RcMailGroup: RcMailGroup rm = RcMailGroupDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now, this.DdlBuAdd.SelectedValue, ""); RcMailGroupDicMgr.GetInstance().Add(rm); break; case DictionaryName.EwgInitIssueStatus: dde = EwgInitIssueStatusDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); EwgInitIssueStatusDicMgr.GetInstance().Add(dde); break; case DictionaryName.EwgMeetingTeam: dde = EwgMeetingTeamDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); EwgMeetingTeamDicMgr.GetInstance().Add(dde); break; case DictionaryName.EwgFolder: dde = EwgFolderDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); EwgFolderDicMgr.GetInstance().Add(dde); break; case DictionaryName.EwgInitIssuePhase: dde = EwgInitIssuePhaseDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); EwgInitIssuePhaseDicMgr.GetInstance().Add(dde); break; case DictionaryName.LeDept: dde = LeDeptDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); LeDeptDicMgr.GetInstance().Add(dde); break; case DictionaryName.LeProblemSource: dde = LeProblemSourceDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); LeProblemSourceDicMgr.GetInstance().Add(dde); break; case DictionaryName.LeProblemFactory: dde = LeProblemFactoryDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); LeProblemFactoryDicMgr.GetInstance().Add(dde); break; case DictionaryName.LePart: dde = LePartDicMgr.GetInstance().CreateEntry( this.TxtCodeAdd.Text, this.TxtTitleAdd.Text, Convert.ToInt32(this.TxtSortAdd.Text), true, UserHelper.UserName, DateTime.Now); LePartDicMgr.GetInstance().Add(dde); break; } this.TxtCodeAdd.Text = ""; this.TxtTitleAdd.Text = ""; this.TxtSortAdd.Text = ""; MessageHelper.RegShowJSAjax(this.BtnSaveAdd, "Success!", this.Page); } catch (ApplicationException aex) { MessageHelper.RegShowJSAjax(this.BtnSaveAdd, aex.Message, this.Page); } catch (Exception ex) // Ajax无法使用默认异常处理程序处理异常 { ErrorHelper.ExceptionHanderForAjax(ex, this.BtnSaveAdd, this.Page); } this.BindData(); this.MpeAdd.Hide(); }