private static ExportRecord CreateFromCollectImportRecord(CollectImportRecord c_record) { ExportRecord record = new ExportRecord(); if (c_record.Comment1 != null) { record.Comment1 = ('"' + c_record.Comment1.TrimEnd() + '"'); } if (c_record.Comment2 != null) { record.Comment2 = ('"' + c_record.Comment2.TrimEnd() + '"'); } if (c_record.Comment3 != null) { record.Comment3 = ('"' + c_record.Comment3.TrimEnd() + '"'); } if (c_record.Comment4 != null) { record.Comment4 = ('"' + c_record.Comment4.TrimEnd() + '"'); } if (c_record.Comment5 != null) { record.Comment5 = ('"' + c_record.Comment5.TrimEnd() + '"'); } if (c_record.Comment6 != null) { record.Comment6 = ('"' + c_record.Comment6.TrimEnd() + '"'); } if (c_record.Comment7 != null) { record.Comment7 = ('"' + c_record.Comment7.TrimEnd() + '"'); } if (c_record.Comment8 != null) { record.Comment8 = ('"' + c_record.Comment8.TrimEnd() + '"'); } record.Date = c_record.Date; record.Date2 = c_record.Date2; record.Date3 = c_record.Date3; record.Driver = c_record.Driver + ",,,"; record.File = c_record.File; record.Identifier = c_record.Identifier + " "; record.Other_Code = c_record.Other_Code; record.Portal_Reason = c_record.Portal_Reason; record.Time = c_record.Time; return(record); }
private CollectImportRecord FixPssos(CollectImportRecord r, SmartTransRecord record, DriverDB db) { if (record.Description != null) { if (record.Description.Contains("Form 25 - Property Seizure and Sale Order")) { if (record.Reasons != null) { if (record.Reasons.Contains("Completed PSSO")) { r.Identifier = "Completed2"; if (record.Reasons.Contains("Completed PSSO - Individual Person")) { r.Portal_Reason = "Person 18"; r.Other_Code = "19"; r.Comment1 = "Individual Person 18 - Residence"; r.Driver = db.FindDriverCode(record.Driver); } else if (record.Reasons.Contains("Completed PSSO - Individual Business")) { r.Portal_Reason = "Person 18"; r.Other_Code = "20"; r.Comment1 = "Individual Person 18 - Business"; r.Driver = db.FindDriverCode(record.Driver); } else { r.Portal_Reason = "OTHER"; r.Other_Code = "OTHER"; r.Comment1 = "Other"; r.Driver = db.FindDriverCode(record.Driver); } } } } } return(r); }
public void ComputeFields(DriverDB db) { CollectRecords = new List <CollectImportRecord>(); foreach (var record in ImportRecords) { CollectImportRecord r = new CollectImportRecord(); string reason = "OTHER", other_Code = "OTHER"; if (record.Description != null) { if (record.Description.Length > 0) { r.CompletedCount = ComputeCompletedCount(record.Description.Substring(0, 1)); r.AttemptedCount = ComputeAttemptedCount(record.Description.Substring(1, 1)); } } r.Identifier = ComputeIdentifier(record.Status, r.CompletedCount, r.AttemptedCount); //r.Identifier = "OTHER"; // collect initials for driver, look up from driver db if (r.Identifier.Contains("Completed")) { r.Driver = db.FindDriverCode(record.Driver); } r.File = record.OrderNumber; r.Date = record.DeliveryDate.Value.ToShortDateString(); //r.Time = record.ETA; r.Time = record.Departure; //r.Comment1 = RemoveXMLCode(record.Reasons); var tempReasons = RemoveXMLCode(record.Reasons); // here //r.Comment1 = tempReasons; var tempComments = record.DriverComment; r = CalculateComments(record, r, tempComments, tempReasons); //if (record.Reasons != null) // ComputeReasonandOtherCode(record.Reasons, out reason, out other_Code); if (tempReasons != null) { ComputeReasonandOtherCode(tempReasons, out reason, out other_Code); } r.Portal_Reason = reason; r.Other_Code = other_Code; r = FixPssos(r, record, db); if (r.Identifier == "Completed2") { r.Comment8 = "Property Placed Under Seizure"; } else { r.Comment8 = ""; } r.Date2 = record.DeliveryDate.Value.ToShortDateString(); r.Date3 = record.DeliveryDate.Value.ToShortDateString(); CollectRecords.Add(r); } }
private CollectImportRecord CalculateComments(SmartTransRecord record, CollectImportRecord r, string tempComments, string tempReasons) { // int stringLength = record.Reasons.Length; int commentLength = 0; int ReasonLineCount = 0; if (tempComments != null) { tempComments = tempComments.Replace("\r", string.Empty).Replace("\n", string.Empty); commentLength = tempComments.Length; } if (tempReasons != null) { ReasonLineCount = tempReasons.Length; } if (ReasonLineCount < 60) { r.Comment1 = tempReasons; if (commentLength < 60) { r.Comment2 = tempComments; } else if (commentLength < 120) { r.Comment2 = tempComments.Substring(0, 60); r.Comment3 = tempComments.Substring(60, (commentLength - 60)); // this number is the remainder } else if (commentLength < 180) { r.Comment2 = tempComments.Substring(0, 60); r.Comment3 = tempComments.Substring(60, 60); r.Comment4 = tempComments.Substring(120, (commentLength - 120)); // this number is the remainder } else if (commentLength < 240) { r.Comment2 = tempComments.Substring(0, 60); r.Comment3 = tempComments.Substring(61, 60); r.Comment4 = tempComments.Substring(121, 60); r.Comment5 = tempComments.Substring(181, (commentLength - 181)); // this number is the remainder } else if (commentLength < 300) { r.Comment2 = tempComments.Substring(0, 60); r.Comment3 = tempComments.Substring(61, 60); r.Comment4 = tempComments.Substring(121, 60); r.Comment5 = tempComments.Substring(181, 60); r.Comment6 = tempComments.Substring(241, (commentLength - 241)); // this number is the remainder } } else if (ReasonLineCount < 120) { r.Comment1 = tempReasons.Substring(0, 60); r.Comment2 = tempReasons.Substring(60, (ReasonLineCount - 60)); // this number is the remainder if (commentLength < 60) { r.Comment3 = tempComments; } else if (commentLength < 120) { r.Comment3 = tempComments.Substring(0, 60); r.Comment4 = tempComments.Substring(60, (commentLength - 60)); // this number is the remainder } else if (commentLength < 180) { r.Comment3 = tempComments.Substring(0, 60); r.Comment4 = tempComments.Substring(60, 60); r.Comment5 = tempComments.Substring(120, (commentLength - 120)); // this number is the remainder } else if (commentLength < 240) { r.Comment3 = tempComments.Substring(0, 60); r.Comment4 = tempComments.Substring(61, 60); r.Comment5 = tempComments.Substring(121, 60); r.Comment6 = tempComments.Substring(181, (commentLength - 181)); // this number is the remainder } else if (commentLength < 300) { r.Comment3 = tempComments.Substring(0, 60); r.Comment4 = tempComments.Substring(61, 60); r.Comment5 = tempComments.Substring(121, 60); r.Comment6 = tempComments.Substring(181, 60); r.Comment7 = tempComments.Substring(241, (commentLength - 241)); // this number is the remainder } } else if (ReasonLineCount < 180) { r.Comment1 = tempReasons.Substring(0, 60); r.Comment2 = tempReasons.Substring(60, 60); r.Comment3 = tempReasons.Substring(120, (ReasonLineCount - 120)); // this number is the remainder if (commentLength < 60) { r.Comment4 = tempComments; } else if (commentLength < 120) { r.Comment4 = tempComments.Substring(0, 60); r.Comment5 = tempComments.Substring(60, (commentLength - 60)); // this number is the remainder } else if (commentLength < 180) { r.Comment4 = tempComments.Substring(0, 60); r.Comment5 = tempComments.Substring(60, 60); r.Comment6 = tempComments.Substring(120, (commentLength - 120)); // this number is the remainder } else if (commentLength < 240) { r.Comment4 = tempComments.Substring(0, 60); r.Comment5 = tempComments.Substring(61, 60); r.Comment6 = tempComments.Substring(121, 60); r.Comment7 = tempComments.Substring(181, (commentLength - 181)); // this number is the remainder } else if (commentLength < 300) { r.Comment4 = tempComments.Substring(0, 60); r.Comment5 = tempComments.Substring(61, 60); r.Comment6 = tempComments.Substring(121, 60); r.Comment7 = tempComments.Substring(181, 60); r.Comment8 = tempComments.Substring(241, (commentLength - 241)); // this number is the remainder } } else if (ReasonLineCount < 240) { r.Comment1 = tempReasons.Substring(0, 60); r.Comment2 = tempReasons.Substring(61, 60); r.Comment3 = tempReasons.Substring(121, 60); r.Comment4 = tempReasons.Substring(181, (ReasonLineCount - 181)); // this number is the remainder } else if (ReasonLineCount < 300) { r.Comment1 = tempReasons.Substring(0, 60); r.Comment2 = tempReasons.Substring(61, 60); r.Comment3 = tempReasons.Substring(121, 60); r.Comment4 = tempReasons.Substring(181, 60); r.Comment5 = tempReasons.Substring(241, (ReasonLineCount - 241)); // this number is the remainder } else { r.Comment1 = tempReasons.Substring(0, 60); r.Comment2 = tempReasons.Substring(61, 60); r.Comment3 = tempReasons.Substring(121, 60); r.Comment4 = tempReasons.Substring(181, 60); r.Comment5 = tempReasons.Substring(241, 60); r.Comment6 = tempReasons.Substring(301, (ReasonLineCount - 301)); // this number is the remainder } return(r); }