private void associatedObjectCB_SelectedIndexChanged(object sender, EventArgs e) { if (cbAssociatedObject.SelectedValue == null) { cbAssociatedField.DataSource = null; } else { DataTable dtField = AtMng.GetGeneralRec("Select * from vddField where tableName='" + cbAssociatedObject.SelectedValue.ToString() + "'"); UIHelper.ComboBoxInit(dtField, cbAssociatedField, "FieldName", "FieldName"); cbAssociatedField.DataBindings[0].ReadValue(); //associatedFieldCB.ResetText(); } }
public fLookup(Form f, bool showOnlyDataAdminTables) : base(f) { InitializeComponent(); DataTable dtTables; if (showOnlyDataAdminTables) { dtTables = AtMng.GetGeneralRec("Select TableId, TableName from ddTable where tblGroup = 'DATAADMIN' order by tablename "); isSysAdmin = false; } else { dtTables = AtMng.GetGeneralRec("Select TableId, TableName from ddTable where tblGroup = 'DATAADMIN' or tblGroup = 'ADMIN' order by tablename "); isSysAdmin = true; } gridEX1.DataSource = dtTables; gridEX1.DataMember = ""; UIHelper.SetDataTableAsGridDataSource(gridEX1, dtTables); uiPanel2.Closed = true; }
public DataTable Codes(string codeName, object vWhere, bool noCache) { string sListname = codeName + this.AppMan.Language; DataTable olist = new DataTable(codeName); WhereClause wc = new WhereClause(); if (!noCache) { if (this.MyColCodes.ContainsKey(sListname)) { return((DataTable)this.MyColCodes[sListname]); } } switch (codeName.ToUpper()) { case "VOUTCOME": case "OUTCOME": if (vWhere == null) { int decID = 1; if (GetSSTMng().DB.SSTCase.Count > 0 && !GetSSTMng().DB.SSTCase[0].IsDecisionTypeNull()) { decID = GetSSTMng().DB.SSTCase[0].DecisionType; } if (GetSSTMng().DB.SSTDecision.Count > 0) { SST.SSTDecisionRow[] sdrs = (SST.SSTDecisionRow[])GetSSTMng().GetSSTDecision().GetCurrentRow(); if (sdrs.Length == 1) { decID = sdrs[0].DecisionType; } } wc.Add("DecisionType", "=", decID); wc.Add("Obsolete", "=", 0); olist = this.AtMng.GetGeneralRec("select * from vOutcomeList " + wc.Clause() + " order by sortkey"); noCache = true; } else { wc = (WhereClause)vWhere; wc.Add("Obsolete", "=", 0); olist = this.AtMng.GetGeneralRec("select * from vOutcomeList " + wc.Clause() + " order by sortkey"); } break; case "SSTPARTYTYPE": int prgId = 0; if (GetSSTMng().DB.SSTCase.Rows.Count > 0) { prgId = GetSSTMng().GetSSTCase().EffectiveProgram(GetSSTMng().DB.SSTCase[0]); } wc.Add("ProgramId", "=", prgId); wc.Add("Obsolete", "=", 0); olist = this.AtMng.GetGeneralRec("vSSTContactTypeList", wc); noCache = true; break; case "CHILDFILETYPE": appDB.EFileSearchRow pfr = this.EFile.GetEfileParentRow(this.CurrentFile); if (pfr != null) { string ft = pfr.FileType; wc.Add("ParentFileType", "=", ft); sListname += ft; } else { string ft = this.CurrentFile.FileType; wc.Add("ParentFileType", "=", ft); sListname += ft; } if (this.MyColCodes.ContainsKey(sListname)) { return((DataTable)this.MyColCodes[sListname]); } olist = this.AtMng.GetGeneralRec("vFileTypeList", wc); break; case "CHILDMETATYPE": appDB.EFileSearchRow pfr1 = this.EFile.GetEfileParentRow(this.CurrentFile); if (pfr1 != null) { string mt = pfr1.MetaType; wc.Add("ParentMetaType", "=", mt); sListname += mt; } else { string mt = this.CurrentFile.MetaType; wc.Add("ParentMetaType", "=", mt); sListname += mt; } if (this.MyColCodes.ContainsKey(sListname)) { return((DataTable)this.MyColCodes[sListname]); } olist = this.AtMng.GetGeneralRec("vMetaTypeList", wc); break; case "PROVINCE": if (vWhere != null) { wc = (WhereClause)vWhere; } wc.Add("Obsolete", "=", 0); olist = this.AtMng.GetGeneralRec(codeName, wc); if (1 == 1) { DataColumn[] keys = new DataColumn[1]; keys[0] = olist.Columns["ProvinceCode"]; olist.PrimaryKey = keys; } break; case "VOFFICECLIENTLIST": olist = this.AtMng.GetGeneralRec("vOfficeClientList", wc); olist.PrimaryKey = new DataColumn[] { olist.Columns["OfficeID"] }; break; case "VOFFICELIST": case "OFFICELIST": case "AGENTLIST": olist = this.AtMng.GetGeneralRec("vOfficeList", wc); olist.PrimaryKey = new DataColumn[] { olist.Columns["OfficeID"] }; break; case "AGENTLISTSPECIAL": olist = this.AtMng.GetGeneralRec("Select * from Office as a inner join address as ad on a.addressid=ad.addressid"); break; case "VOFFICERLIST": case "OFFICERLIST": if (vWhere == null) { olist = this.AtMng.GetGeneralRec("vOfficerList", wc); } else if (vWhere.GetType() == typeof(WhereClause)) { olist = this.AtMng.GetGeneralRec("vOfficerList", (WhereClause)vWhere); } else if ((bool)vWhere == true) { wc.Add("CurrentEmployee", "=", 1); olist = this.AtMng.GetGeneralRec("vOfficerList", wc); } olist.PrimaryKey = new DataColumn[] { olist.Columns["OfficerID"] }; break; case "LAWYERLIST": wc.Add("CurrentEmployee", "=", 1); olist = AtMng.GetGeneralRec("vLawyerList", wc); olist.PrimaryKey = new DataColumn[] { olist.Columns["OfficerID"] }; break; case "OWNERLIST": olist = this.OfficerByOffice(this.CurrentFile.OwnerOfficeId, true, true); break; case "AGENTLOGGEDONOFFLIST": olist = this.OfficerByOffice(this.AtMng.OfficeLoggedOn.OfficeId, true, true); break; case "OFFICERACCESSLIST": wc.Add("FileId", "=", this.CurrentFile.FileId); wc.Add("CurrentEmployee", "=", 1); olist = this.AtMng.GetGeneralRec("vOfficerAccessList", wc); olist.PrimaryKey = new DataColumn[] { olist.Columns["OfficerID"] }; break; case "LEADLIST": case "AGENTOFFLIST": olist = this.OfficerByOffice(this.CurrentFile.LeadOfficeId, true, true); break; default: if (vWhere == null) { return(AtMng.GetddLookup().Codes(codeName, this)); } else { olist = this.AtMng.GetGeneralRec(codeName, (WhereClause)vWhere); } break; } switch (codeName.ToUpper()) { case "SELJUDGMENT": break; case "SELWRIT": break; default: if (!noCache) { this.MyColCodes.Add(sListname, olist); } break; } if (olist.PrimaryKey.Length == 0) { olist.PrimaryKey = new DataColumn[] { olist.Columns[0] }; } return(olist); }
public void ImportConfig(string file) { //this method provides a mechanism for moving config data from one install to another ActivityConfig newConfig = new ActivityConfig(); newConfig.ReadXml(file); if (newConfig.ACSeries.Count == 0) { throw new atLogic.AtriumException("The file you tried to import is not an Activity Config export."); } bool okToDelete = AtMng.GetSetting(AppBoolSetting.AllowActivityDeleteOnConfigPush); try { AtMng.acMng.isMerging = true; //process deletes //check for used acseries first! string filt = ""; string used = ""; foreach (ActivityConfig.ACSeriesRow trgDr in DB.ACSeries) { if (newConfig.ACSeries.PrimaryKey[0].DataType == typeof(string)) { filt = newConfig.ACSeries.PrimaryKey[0].ColumnName + "='" + trgDr[newConfig.ACSeries.PrimaryKey[0].ColumnName].ToString() + "'"; } else { filt = newConfig.ACSeries.PrimaryKey[0].ColumnName + "=" + trgDr[newConfig.ACSeries.PrimaryKey[0].ColumnName].ToString(); } System.Data.DataRow[] srcDr = newConfig.ACSeries.Select(filt, ""); if (srcDr.Length == 0) { if (trgDr.StepType == (int)atriumBE.StepType.Activity) { int count = (int)AtMng.DALMngr.ExecuteScalarSQL("select count(*) from vactivity where acseriesid=" + trgDr.ACSeriesId.ToString()); if (count > 0) { if (okToDelete) { System.Data.DataTable dtA = AtMng.GetGeneralRec("select activityid,ts from vactivity where acseriesid=" + trgDr.ACSeriesId.ToString()); foreach (System.Data.DataRow drA in dtA.Rows) { AtMng.DALMngr.ExecuteSP("ActivityDelete", drA[0], null, drA[1]); } } else { used += trgDr.StepCode + "; "; } } } //look in officemandate and remove foreach (ActivityConfig.OfficeMandateRow omr in trgDr.GetOfficeMandateRows()) { omr.Delete(); } } } if (used.Length > 0) { DB.OfficeMandate.RejectChanges(); throw new Exception("The following steps have been used and can't be deleted:\n\r" + used); } DeleteFromTable(DB.Menu, newConfig.Menu); DeleteFromTable(DB.ACTaskType, newConfig.ACTaskType); DeleteFromTable(DB.OfficeMandate, newConfig.OfficeMandate); DeleteFromTable(DB.ActivityField, newConfig.ActivityField); DeleteFromTable(DB.ACDependency, newConfig.ACDependency); DeleteFromTable(DB.ACBF, newConfig.ACBF); DeleteFromTable(DB.ACFileType, newConfig.ACFileType); DeleteFromTable(DB.ACConvert, newConfig.ACConvert); DeleteFromTable(DB.ACMenu, newConfig.ACMenu); DeleteFromTable(DB.ACDisb, newConfig.ACDisb); DeleteFromTable(DB.ACSeries, newConfig.ACSeries); DeleteFromTable(DB.ActivityCode, newConfig.ActivityCode); DeleteFromTable(DB.Series, newConfig.Series); DeleteFromTable(DB.ACMajor, newConfig.ACMajor); DeleteFromTable(DB.ACDocumentation, newConfig.ACDocumentation); DeleteFromTable(DB.ACControlType, newConfig.ACControlType); DeleteFromTable(DB.ACDependencyType, newConfig.ACDependencyType); DeleteFromTable(DB.ACSeriesType, newConfig.ACSeriesType); DeleteFromTable(DB.SeriesPackage, newConfig.SeriesPackage); DeleteFromTable(DB.SeriesStatus, newConfig.SeriesStatus); //atLogic.BusinessProcess bpD = AtMng.GetBP(); //bpD.AddForUpdate(DB.OfficeMandate); //bpD.AddForUpdate(DB.ActivityField); //bpD.AddForUpdate(DB.ACDependency); //bpD.AddForUpdate(DB.ACBF); //bpD.AddForUpdate(DB.ACConvert); //bpD.AddForUpdate(DB.ACFileType); //bpD.AddForUpdate(DB.ACDisb); //bpD.AddForUpdate(DB.ACMenu); //bpD.AddForUpdate(DB.ACSeries); //bpD.AddForUpdate(DB.ActivityCode); //bpD.AddForUpdate(DB.Series); //bpD.AddForUpdate(DB.ACMajor); //bpD.AddForUpdate(DB.ACDocumentation); //bpD.AddForUpdate(DB.ACControlType); //bpD.AddForUpdate(DB.ACDependencyType); //bpD.AddForUpdate(DB.ACSeriesType); //bpD.AddForUpdate(DB.ACTaskType); //bpD.AddForUpdate(DB.SeriesStatus); //bpD.AddForUpdate(DB.SeriesPackage); //bpD.AddForUpdate(DB.Menu); //bpD.Update(); //process tables for add and update ImportTable(DB.Menu, newConfig.Menu); ImportTable(DB.ACTaskType, newConfig.ACTaskType); ImportTable(DB.ACMajor, newConfig.ACMajor); ImportTable(DB.Series, newConfig.Series); ImportTable(DB.ActivityCode, newConfig.ActivityCode); ImportTable(DB.ACSeries, newConfig.ACSeries); ImportTable(DB.ActivityField, newConfig.ActivityField); ImportTable(DB.ACBF, newConfig.ACBF); ImportTable(DB.ACDependency, newConfig.ACDependency); ImportTable(DB.ACFileType, newConfig.ACFileType); ImportTable(DB.ACConvert, newConfig.ACConvert); ImportTable(DB.ACMenu, newConfig.ACMenu); ImportTable(DB.ACDisb, newConfig.ACDisb); ImportTable(DB.OfficeMandate, newConfig.OfficeMandate); ImportTable(DB.ACDocumentation, newConfig.ACDocumentation); ImportTable(DB.ACControlType, newConfig.ACControlType); ImportTable(DB.ACDependencyType, newConfig.ACDependencyType); ImportTable(DB.ACSeriesType, newConfig.ACSeriesType); ImportTable(DB.SeriesPackage, newConfig.SeriesPackage); ImportTable(DB.SeriesStatus, newConfig.SeriesStatus); atLogic.BusinessProcess bp = AtMng.GetBP(); bp.AddForUpdate(DB.Menu); bp.AddForUpdate(DB.ACTaskType); bp.AddForUpdate(DB.ACMajor); bp.AddForUpdate(DB.Series); bp.AddForUpdate(DB.ActivityCode); bp.AddForUpdate(DB.ACSeries); bp.AddForUpdate(DB.ActivityField); bp.AddForUpdate(DB.ACDependency); bp.AddForUpdate(DB.ACBF); bp.AddForUpdate(DB.ACConvert); bp.AddForUpdate(DB.ACFileType); bp.AddForUpdate(DB.ACDisb); bp.AddForUpdate(DB.ACMenu); bp.AddForUpdate(DB.OfficeMandate); bp.AddForUpdate(DB.ACDocumentation); bp.AddForUpdate(DB.ACControlType); bp.AddForUpdate(DB.ACDependencyType); bp.AddForUpdate(DB.ACSeriesType); bp.AddForUpdate(DB.SeriesStatus); bp.AddForUpdate(DB.SeriesPackage); bp.Update(); AtMng.acMng.isMerging = false;; } catch (Exception x) { DB.RejectChanges(); AtMng.acMng.isMerging = false; throw x; } }