public static void Delete(QiRootCause3 entry) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"DELETE FROM {1} WHERE [Code] = N'{0}'", entry.Code, DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiRootCause3))); try { db.ExecuteNonQuery(dbCommand); } catch (System.Data.SqlClient.SqlException sex) // 只捕获SqlException,其余抛出继续传播 { DBHelper.ParseSqlException(sex, true); } }
public static void Insert(QiRootCause3 entry) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"INSERT INTO {5} VALUES (N'{0}', N'{1}', {2}, '{3}', GETDATE(), 0, '{4}')", entry.Code, entry.Title, entry.Sort, entry.Updator, entry.RootCause2, DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiRootCause3))); try { db.ExecuteNonQuery(dbCommand); } catch (System.Data.SqlClient.SqlException sex) // 只捕获SqlException,其余抛出继续传播 { DBHelper.ParseSqlException(sex, false); } }
public static void Update(QiRootCause3 entry) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(String.Format(@"UPDATE {6} SET [Title] = '{1}' ,[Sort] = {2} ,[Optor] = '{3}',[OpTime] = GETDATE(), [Deleted] = {4}, [Cause2] = '{5}' WHERE [Code] = N'{0}'", entry.Code, entry.TitleT, entry.SortT, entry.UpdatorT, entry.VisibleT ? 0 : 1, entry.PCodeT, DataDictionaryEntryDa.GetDictionaryTableName(DictionaryName.QiRootCause3))); try { db.ExecuteNonQuery(dbCommand); } catch (System.Data.SqlClient.SqlException sex) // 只捕获SqlException,其余抛出继续传播 { DBHelper.ParseSqlException(sex, false); } }
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(); }
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(); } }
public void Remove(QiRootCause3 entry) { QiRootCause3Da.Delete(entry); }
public void Edit(QiRootCause3 entry) { QiRootCause3Da.Update(entry); }
public void Add(QiRootCause3 entry) { QiRootCause3Da.Insert(entry); }