private void _addCustomCategory(SqlDataReader dr, ObjectImporterNode oin) { switch (this._areaName) { case "csox": this._addCsoxCategoryInfo(dr, oin); break; case "internalaudit": this._addInternalAuditCategoryInfo(dr, oin); break; case "insurance": this._addInsuranceCategoryInfo(dr, oin); break; case "erm": this._addErmCategoryInfo(dr, oin); break; case "tax": this._addTaxCategoryInfo(dr, oin); break; default: break; } }
public void CreateFileOIXML() { string qryStr = String.Format("SELECT * FROM vw_{0}_files ORDER BY TargetPath ASC, ObjectName ASC", this.AreaName); SqlCommand cmd = null; SqlDataReader dr = null; using (SqlConnection connSQL = new SqlConnection(Utils.GetDatabaseConnectionString(DatabaseType.MSSQLTrusted))) { connSQL.Open(); cmd = new SqlCommand(qryStr, connSQL); dr = cmd.ExecuteReader(); this._processedItems = 0; this._documents = new List <ObjectImporterNode>(); while (dr.Read()) { ObjectImporterNode oin = new ObjectImporterNode(); oin.Action = "create"; oin.Type = "document"; oin.Title = dr.GetValueOrDefault <string>("ObjectName"); oin.Location = dr.GetValueOrDefault <string>("TargetPath"); oin.Created = dr.GetValueOrDefault <DateTime>("CreateDate"); oin.ProviderFilePath = dr.GetValueOrDefault <string>("ProviderPath"); this._documents.Add(oin); this._processedItems++; if (this._processedItems % 100 == 0) { _logger.Info(String.Format("Processed {0} document objects.", this._processedItems)); } //using batches of 1000 if (this._processedItems % 1000 == 0) { //let's output the xml file and clear our folder list this._outputDocumentNodeXML(this._processedItems, this._documents); //after outputtting the xml for these folders let's clear our list and continue this._documents.Clear(); } } //there may be some items left in the list to output if (this._documents.Count > 0) { //let's output the xml file and clear our folder list this._outputDocumentNodeXML(999999, this._documents); } } }
private void _addErmCategoryInfo(SqlDataReader dr, ObjectImporterNode oin) { ObjectImporterCategory customCategory = new ObjectImporterCategory { CategoryName = "Tax And Finance:CORP-TAF-General" }; customCategory.AddCategoryAttribute("End Year", Convert.ToString(dr["EndYear"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Legal Corporate Entity", Convert.ToString(dr["CorporateEntity"]), false, AttributeClearMode.DoNotClear, true); oin.AddNodeCategory(customCategory); }
private void _addInternalAuditCategoryInfo(SqlDataReader dr, ObjectImporterNode oin) { ObjectImporterCategory customCategory = new ObjectImporterCategory { CategoryName = "Tax And Finance:CORP-TAF-Internal Audit" }; customCategory.AddCategoryAttribute("Working Year", Convert.ToString(dr["WorkingYear"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Country", Convert.ToString(dr["Country"]), false, AttributeClearMode.DoNotClear, true); oin.AddNodeCategory(customCategory); }
private void _addTaxCategoryInfo(SqlDataReader dr, ObjectImporterNode oin) { ObjectImporterCategory customCategory = new ObjectImporterCategory { CategoryName = "Tax And Finance:CORP-TAF-Tax" }; customCategory.AddCategoryAttribute("Start Year", Convert.ToString(dr["StartYear"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("End Year", Convert.ToString(dr["EndYear"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Legal Corporate Entity", Convert.ToString(dr["CorporateEntity"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Document Author", Convert.ToString(dr["Author"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Tax Form Type", Convert.ToString(dr["TaxFormType"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Property Tax Type", Convert.ToString(dr["PropertyTaxFormType"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Property Tax Year", Convert.ToString(dr["PropertyTaxYear"]), false, AttributeClearMode.DoNotClear, true); customCategory.AddCategoryAttribute("Municipality", Convert.ToString(dr["District"]).Trim(), false, AttributeClearMode.DoNotClear, true); oin.AddNodeCategory(customCategory); }
public void CreateFolderOIXML() { string qryStr = String.Format("SELECT * FROM vw_{0}_folders ORDER BY [TargetPath] ASC, [ObjectName] ASC", this.AreaName); SqlCommand cmd = null; SqlDataReader dr = null; using (SqlConnection connSQL = new SqlConnection(Utils.GetDatabaseConnectionString(DatabaseType.MSSQLTrusted))) { connSQL.Open(); cmd = new SqlCommand(qryStr, connSQL); dr = cmd.ExecuteReader(); this._processedItems = 0; this._folders = new List <ObjectImporterNode>(); while (dr.Read()) { ObjectImporterNode oin = new ObjectImporterNode(); oin.Action = "create"; oin.Type = "folder"; oin.Title = dr.GetValueOrDefault <string>("ObjectName"); oin.Location = dr.GetValueOrDefault <string>("TargetPath"); oin.Created = dr.GetValueOrDefault <DateTime>("CreateDate"); if (oin.Created == DateTime.MinValue) { //if the value for created is null, the datetime will come across as the min datetime value //so in this scenario set the create date to today date/time oin.Created = DateTime.Now; } this._addCustomCategory(dr, oin); this._folders.Add(oin); this._processedItems++; if (this._processedItems % 100 == 0) { _logger.Info(String.Format("Processed {0} folder objects.", this._processedItems)); } if (this._processedItems % 1000 == 0) { //let's output the xml file and clear our folder list this._outputFolderNodeXML(this._processedItems, this._folders); //after outputtting the xml for these folders let's clear our list and continue this._folders.Clear(); } } //there may be some items left in the list to output if (this._folders.Count > 0) { //let's output the xml file and clear our folder list this._outputFolderNodeXML(999999, this._folders); } } }