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);
            }
        }