protected override void AfterAdd(DataRow row) { appDB.ddLookupRow dr = (appDB.ddLookupRow)row; string ObjectName = this.myddLookupDT.TableName; dr.LookupId = myA.PKIDGet(ObjectName, 10); dr.LookupType = "GEN"; dr.Cache = true; dr.IncludeObsolete = false; dr.UseFileContext = false; }
public DataTable Codes(string name, FileManager fm) { if (myddLookupDT.Count == 0) { Load(); } appDB.ddLookupRow[] dlrs = (appDB.ddLookupRow[])myddLookupDT.Select("LookupName='" + name + "'"); if (dlrs.Length == 1) { DataTable dtList; appDB.ddLookupRow dlr = dlrs[0]; string sListname = name + myA.AppMan.Language; if (dlr.Cache && myA.myColCodes.ContainsKey(sListname)) { return((DataTable)myA.myColCodes[sListname]); } WhereClause wc = new WhereClause(); if (dlr.UseFileContext && fm != null && !fm.IsVirtualFM) { wc.Add("Fileid", "=", fm.CurrentFileId); } if (!dlr.IncludeObsolete) { wc.Add("Obsolete", "=", 0); } if (!dlr.IsWhereClauseNull()) { wc.And(dlr.WhereClause); } switch (dlr.LookupType) { case "SP": if (dlr.UseFileContext && fm != null && !fm.IsVirtualFM) { dtList = myA.AppMan.ExecuteDataset(dlr.Source, fm.CurrentFileId).Tables[0]; } else { dtList = myA.AppMan.ExecuteDataset(dlr.Source, System.DBNull.Value).Tables[0]; } break; case "SQL": dtList = myA.GetGeneralRec(dlr.Source); break; case "VIEW": case "TABLE": dtList = myA.GetGeneralRec(dlr.Source, wc); break; case "GEN": default: wc.Add("LookupId", "=", dlr.LookupId); DataView dv = new DataView(myA.DB.ddGeneric, wc.Filter(), "", DataViewRowState.CurrentRows); dtList = dv.ToTable(); dtList.Columns.Remove("LookupId"); dtList.Columns.Remove("ParentId"); dtList.PrimaryKey = new DataColumn[] { dtList.Columns["GenericId"] }; //dtList = myA.GetGeneralRec("vddGenericList",wc); break; } string sort = ""; if (!dlr.IsSortcolumnsNull()) { sort = dlr.Sortcolumns; } else { sort = dtList.Columns[0].ColumnName; } DataView dv1 = new DataView(dtList, "", sort, DataViewRowState.CurrentRows); dtList = dv1.ToTable(); if (dtList.PrimaryKey.Length == 0) { if (!dlr.IsPKNameNull()) { dtList.PrimaryKey = new DataColumn[] { dtList.Columns[dlr.PKName] }; } else { dtList.PrimaryKey = new DataColumn[] { dtList.Columns[0] }; } } if (dlr.Cache) { myA.myColCodes.Add(sListname, dtList); } return(dtList); } else { throw new AtriumException(name + " is not a valid lookup table"); } }
public void LoadTOC() { pnlDockTop.Height = defaultTopHeight; if (fmCurrent.DB.FileXRef.Select("LinkType=0 and fileid=" + fmCurrent.CurrentFileId.ToString()).Length > 0) { pnlBrowseFiles.Enabled = true; } else { pnlBrowseFiles.Enabled = false; } if (fmCurrent.DB.FileXRef.Select("LinkType=1").Length > 0 || fmCurrent.DB.FileXRef.Select("LinkType=2 and fileid=" + fmCurrent.CurrentFileId).Length > 0) { pnlXRefs.Enabled = true; } else { pnlXRefs.Enabled = false; } SetTooltipsForLinks(); SetFileStatusColor(fmCurrent.CurrentFile.StatusCode); officeDB.OfficeRow orOwnerOffice = null; try { orOwnerOffice = fmCurrent.AtMng.GetOffice(fmCurrent.CurrentFile.OwnerOfficeId).CurrentOffice; lnkJumpToOwnerFile.Tag = orOwnerOffice.OfficeFileId; lnkJumpToOwnerFile.Enabled = (orOwnerOffice.OfficeFileId != fileId); } catch (Exception xoo) { lnkJumpToOwnerFile.Enabled = false; } officeDB.OfficeRow orLeadOffice = null; if (!fmCurrent.CurrentFile.IsLeadOfficeIdNull()) { try { orLeadOffice = fmCurrent.AtMng.GetOffice(fmCurrent.CurrentFile.LeadOfficeId).CurrentOffice; lnkJumpToLeadFile.Visible = true; lnkJumpToLeadFile.Tag = orLeadOffice.OfficeFileId; lnkJumpToLeadFile.Enabled = (orLeadOffice.OfficeFileId != fileId); } catch (Exception xlo) { lnkJumpToLeadFile.Enabled = false; } } else { lnkJumpToLeadFile.Visible = false; } if (!fmCurrent.CurrentFile.IsFullFileNumberNull()) { lblFullNumberValue.Text = fmCurrent.CurrentFile.FullFileNumber; } else { lblFullNumberValue.Text = ""; } lblFilenameValue.Text = fmCurrent.CurrentFile.Name; atriumDB.ActivityRow ar = fmCurrent.GetActivity().GetCurrentCaseStatus(DateTime.Today.AddDays(100)); int csId = 0; if (ar != null) { csId = ar.CaseStatusId; lblStatusDateValue.Text = ar.ActivityDate.ToString("yyyy/MM/dd"); } else { lblStatusDateValue.Text = "N/A"; } // WI 75873 DataRow drProgram = null; if (programId > 0) { DataTable dt = Atmng.GetFile().Codes("Dim2"); DataRow[] dr = dt.Select("ProgramId = " + programId.ToString()); drProgram = dr[0]; appDB.ddLookupRow dlr = (appDB.ddLookupRow)Atmng.DB.ddLookup.Select("LookupName='Dim2'")[0]; lblProgram.Text = dlr["Description" + Atmng.AppMan.Language].ToString(); } else { lblProgram.Visible = false; lblProgramValue.Visible = false; pnlDockTop.Height -= defaultRowHeight; } // -- End // WI 75873 //Shared Folder START lblSharedFolder.Visible = false; lnkSharedFolder.Visible = false; string sharedPath = string.Empty; if (programId == 3) { sharedPath = Atmng.GetSetting(AppStringSetting.DataExchangeNetworkPath) + fmCurrent.CurrentFile.FullFileNumber.Replace("-", @"\"); } else if (programId == 2) { sharedPath = Atmng.GetSetting(AppStringSetting.ISDataExchangeNetworkPath) + fmCurrent.CurrentFile.FullFileNumber.Replace("-", @"\"); } if (sharedPath != string.Empty && System.IO.Directory.Exists(sharedPath)) { lnkSharedFolder.Text = sharedPath; lblSharedFolder.Visible = true; lnkSharedFolder.Visible = true; } else { pnlDockTop.Height -= defaultRowHeight; } //Shared Folder END lblTypeValue.Text = fmCurrent.AtMng.CodeDB.FileType.FindByFileTypeCode(fmCurrent.CurrentFile.FileType)["FileTypeDesc" + Atmng.AppMan.languageCamel].ToString(); lblStatusValue.Text = fmCurrent.AtMng.CodeDB.Status.FindByStatusCode(fmCurrent.CurrentFile.StatusCode)["StatusDesc" + Atmng.AppMan.languageCamel].ToString(); lblCaseStatusValue.Text = fmCurrent.AtMng.CodeDB.CaseStatus.FindByCaseStatusId(csId)["CaseStatusDesc" + Atmng.AppMan.languageCamel].ToString(); if (drProgram != null) { lblProgramValue.Text = (string)drProgram["ProgramDescription" + Atmng.AppMan.languageCamel].ToString(); } if (orOwnerOffice != null) { setOfficeTooltip(lnkJumpToOwnerFile, orOwnerOffice); } if (orLeadOffice != null) { setOfficeTooltip(lnkJumpToLeadFile, orLeadOffice); } //CLAS if (fmCurrent.GetCLASMng() != null && !fmCurrent.CurrentFile.IsOpponentIDNull()) { lmDatasets.CLAS.DebtorRow orDB = fmCurrent.GetCLASMng().GetDebtor().FindLoad(fmCurrent.CurrentFile.OpponentID); if (!orDB.IsNull("SIN")) { lblSINValue.Text = atriumBE.DebtorBE.FormattedSIN(orDB.SIN); } else { lblSINValue.Text = ""; } lnkSINLabel.Visible = true; lblSINValue.Visible = true; if (!fmCurrent.CurrentFile.IsLeadParalegalIDNull()) { lmDatasets.officeDB.OfficerRow orPL = fmCurrent.AtMng.GetOffice(fmCurrent.CurrentFile.OwnerOfficeId).GetOfficer().FindLoad(fmCurrent.CurrentFile.LeadParalegalID); lblParaLegalValue.Text = orPL.LastName + ", " + orPL.FirstName + " (" + orPL.OfficerCode + ")"; lblParalegal.Visible = true; lblParaLegalValue.Visible = true; } else { lblParaLegalValue.Text = ""; lblParalegal.Visible = false; lblParaLegalValue.Visible = false; } } else { //no CLAS; hide row lnkSINLabel.Visible = false; lblSINValue.Visible = false; lblParalegal.Visible = false; lblParaLegalValue.Visible = false; pnlDockTop.Height -= defaultRowHeight; } ParentFile.uiPanel0.Text = fmCurrent.CurrentFile.Name; ucBrowse1.FileContextMenu.UsedInTreeView = false; if (fmCurrent.CurrentFile.FileStructXml != null) { tvContents.Nodes.Clear(); System.Xml.XmlDocument xdToc = new System.Xml.XmlDocument(); xdToc.InnerXml = fmCurrent.CurrentFile.FileStructXml; LoadTOCNode(tvContents.Nodes, xdToc.DocumentElement); tvContents.ExpandAll(); tvContents.Nodes[0].EnsureVisible(); } }