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 GvList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "OpenEdit") { DataDictionaryEntry dde = null; switch ((DictionaryName)this.ViewState["DicName"]) { case DictionaryName.QiProductFamily: ProductFamily pf = ProductFamilyDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = pf.Code; this.TxtTitleEdit.Text = pf.Title; this.TxtSortEdit.Text = pf.Sort.ToString(); this.CbVisibleEdit.Checked = pf.Visible; this.ViewState["Code"] = pf.Code; this.TxtBuEdit.Text = pf.BU; this.UacOwnerEdit.Value = pf.MailList; ScriptManager.RegisterStartupScript(this.GvList, this.GvList.GetType(), this.UacOwnerEdit.ClientID, this.UacOwnerEdit.GetJsInitFunction(false) + ";", true); break; case DictionaryName.QiAttachCategory: dde = QiAttachCategoryDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.QiProblemType: dde = QiProblemTypeDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.QiRootCause1: dde = QiRootCause1DicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.QiRootCause2: QiRootCause2 qrc2 = QiRootCause2DicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = qrc2.Code; this.TxtTitleEdit.Text = qrc2.Title; this.TxtSortEdit.Text = qrc2.Sort.ToString(); this.CbVisibleEdit.Checked = qrc2.Visible; this.ViewState["Code"] = qrc2.Code; //this.TxtParentEdit.Text = qrc2.RootCauseTitle(); break; case DictionaryName.QiRootCause3: QiRootCause3 qrc3 = QiRootCause3DicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = qrc3.Code; this.TxtTitleEdit.Text = qrc3.Title; this.TxtSortEdit.Text = qrc3.Sort.ToString(); this.CbVisibleEdit.Checked = qrc3.Visible; this.ViewState["Code"] = qrc3.Code; //this.TxtParentEdit.Text = qrc3.RootCauseTitle(); break; case DictionaryName.QiCloseLoopCategory: dde = CloseLoopCategoryDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.QiCloseLoopDepartment: dde = CloseLoopDepartmentDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.RcMailGroup: RcMailGroup rm = RcMailGroupDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = rm.Code; this.TxtTitleEdit.Text = rm.Title; this.TxtSortEdit.Text = rm.Sort.ToString(); this.CbVisibleEdit.Checked = rm.Visible; this.ViewState["Code"] = rm.Code; this.TxtBuEdit.Text = rm.BU; this.UacOwnerEdit.Value = rm.MailList; ScriptManager.RegisterStartupScript(this.GvList, this.GvList.GetType(), this.UacOwnerEdit.ClientID, this.UacOwnerEdit.GetJsInitFunction(false) + ";", true); break; case DictionaryName.EwgInitIssueStatus: dde = EwgInitIssueStatusDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.EwgMeetingTeam: dde = EwgMeetingTeamDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.EwgFolder: dde = EwgFolderDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.LeDept: dde = LeDeptDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.LeProblemSource: dde = LeProblemSourceDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.LeProblemFactory: dde = LeProblemFactoryDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; case DictionaryName.LePart: dde = LePartDicMgr.GetByCode(e.CommandArgument.ToString()); this.TxtCodeEdit.Text = dde.Code; this.TxtTitleEdit.Text = dde.Title; this.TxtSortEdit.Text = dde.Sort.ToString(); this.CbVisibleEdit.Checked = dde.Visible; this.ViewState["Code"] = dde.Code; break; } this.MpeEdit.Show(); } }