Example #1
0
 public static void RemoveAssist(Guid _AssistID)
 {
     MiscData.Assist thisFoundAssist = Assists.Find(delegate(MiscData.Assist a) { return(a.AssistID == _AssistID); });
     if (thisFoundAssist != null)
     {
         Assists.Remove(thisFoundAssist);
     }
 }
Example #2
0
 public static MiscData.Assist FindAssistByID(Guid _AssistID)
 {
     MiscData.Assist thisFoundAssist = Assists.Find(delegate(MiscData.Assist a) { return(a.AssistID == _AssistID); });
     return(thisFoundAssist);
 }
Example #3
0
        private static ArrayList GetAssistParams(MiscData.Assist thisAssist)
        {
            ArrayList arrParams  = new ArrayList();
            string    AssistID   = thisAssist.AssistID.ToString();
            string    IncidentID = thisAssist.IncidentID.ToString();
            string    DriverID;

            if (thisAssist.DriverID == null)
            {
                DriverID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                DriverID = thisAssist.DriverID.ToString();
            }
            string FleetVehicleID;

            if (thisAssist.FleetVehicleID == null)
            {
                FleetVehicleID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                FleetVehicleID = thisAssist.FleetVehicleID.ToString();
            }
            string DispatchTime;

            if (thisAssist.DispatchTime == null)
            {
                DispatchTime = DateTime.Now.ToString();
            }
            else
            {
                DispatchTime = thisAssist.DispatchTime.ToString();
            }
            string CustomerWaitTime = thisAssist.CustomerWaitTime.ToString();
            string VehiclePositionID;

            if (thisAssist.VehiclePositionID == null)
            {
                VehiclePositionID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                VehiclePositionID = thisAssist.VehiclePositionID.ToString();
            }
            string IncidentTypeID;

            if (thisAssist.IncidentTypeID == null)
            {
                IncidentTypeID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                IncidentTypeID = thisAssist.IncidentTypeID.ToString();
            }
            string TrafficSpeedID;

            if (thisAssist.TrafficSpeedID == null)
            {
                TrafficSpeedID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                TrafficSpeedID = thisAssist.TrafficSpeedID.ToString();
            }

            /*
             * string ServiceTypeID;
             * if (thisAssist.ServiceTypeID == null)
             * {
             *  ServiceTypeID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
             * }
             * else
             * {
             *  ServiceTypeID = thisAssist.ServiceTypeID.ToString();
             * }
             *              */
            string DropZone;

            if (string.IsNullOrEmpty(thisAssist.DropZone))
            {
                DropZone = "NA";
            }
            else
            {
                DropZone = thisAssist.DropZone;
            }
            string Make;

            if (string.IsNullOrEmpty(thisAssist.Make))
            {
                Make = "NA";
            }
            else
            {
                Make = thisAssist.Make;
            }
            string VehicleTypeID;

            if (thisAssist.VehicleTypeID == null)
            {
                VehicleTypeID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                VehicleTypeID = thisAssist.VehicleTypeID.ToString();
            }
            string Color;

            if (string.IsNullOrEmpty(thisAssist.Color))
            {
                Color = "NA";
            }
            else
            {
                Color = thisAssist.Color;
            }
            string LicensePlate;

            if (string.IsNullOrEmpty(thisAssist.LicensePlate))
            {
                LicensePlate = "NA";
            }
            else
            {
                LicensePlate = thisAssist.LicensePlate;
            }
            string State;

            if (string.IsNullOrEmpty(thisAssist.State))
            {
                State = "NA";
            }
            else
            {
                State = thisAssist.State;
            }
            string TowLocationID;

            if (thisAssist.TowLocationID == null)
            {
                TowLocationID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                TowLocationID = thisAssist.TowLocationID.ToString();
            }
            string TipDetail;

            if (string.IsNullOrEmpty(thisAssist.TipDetail))
            {
                TipDetail = "NA";
            }
            else
            {
                TipDetail = thisAssist.TipDetail;
            }
            string CustomerLastName;

            if (string.IsNullOrEmpty(thisAssist.CustomerLastName))
            {
                CustomerLastName = "NA";
            }
            else
            {
                CustomerLastName = thisAssist.CustomerLastName;
            }
            string Comments;

            if (string.IsNullOrEmpty(thisAssist.Comments))
            {
                Comments = "NA";
            }
            else
            {
                Comments = thisAssist.Comments;
            }
            string x1097;

            if (thisAssist.x1097 == null)
            {
                x1097 = DateTime.Now.ToString();
            }
            else
            {
                x1097 = thisAssist.x1097.ToString();
            }
            string x1098;

            if (thisAssist.x1098 == null || thisAssist.x1098 == DateTime.Parse("01/01/0001 00:00:00"))
            {
                x1098 = "01/01/2001 00:00:00";
            }
            else
            {
                x1098 = thisAssist.x1098.ToString();
            }
            string OnSiteTime;

            if (thisAssist.OnSiteTime == null || thisAssist.OnSiteTime == DateTime.Parse("01/01/0001 00:00:00"))
            {
                OnSiteTime = "01/01/2001 00:00:00";
            }
            else
            {
                OnSiteTime = thisAssist.OnSiteTime.ToString();
            }
            string ContractorID;

            if (thisAssist.ContractorID == null)
            {
                ContractorID = new Guid("00000000-0000-0000-0000-000000000000").ToString();
            }
            else
            {
                ContractorID = thisAssist.ContractorID.ToString();
            }
            string LogNumber;

            if (string.IsNullOrEmpty(thisAssist.LogNumber))
            {
                LogNumber = "NA";
            }
            else
            {
                LogNumber = thisAssist.LogNumber;
            }

            string SurveyNum;

            if (string.IsNullOrEmpty(thisAssist.SurveyNum))
            {
                SurveyNum = "NA";
            }
            else
            {
                SurveyNum = thisAssist.SurveyNum;
            }

            string AssistNumber;

            if (string.IsNullOrEmpty(thisAssist.AssistNumber))
            {
                AssistNumber = "NA";
            }
            else
            {
                AssistNumber = thisAssist.AssistNumber;
            }

            arrParams.Add("@AssistID~" + AssistID);
            arrParams.Add("@IncidentID~" + IncidentID);
            arrParams.Add("@DriverID~" + DriverID);
            arrParams.Add("@FleetVehicleID~" + FleetVehicleID);
            arrParams.Add("@DispatchTime~" + DispatchTime);
            arrParams.Add("@CustomerWaitTime~" + CustomerWaitTime);
            arrParams.Add("@VehiclePositionID~" + VehiclePositionID);
            arrParams.Add("@IncidentTypeID~" + IncidentTypeID);
            arrParams.Add("@TrafficSpeedID~" + TrafficSpeedID);
            //arrParams.Add("@ServiceTypeID~" + ServiceTypeID);
            arrParams.Add("@DropZone~" + DropZone);
            arrParams.Add("@Make~" + Make);
            arrParams.Add("@VehicleTypeID~" + VehicleTypeID);
            arrParams.Add("@Color~" + Color);
            arrParams.Add("@LicensePlate~" + LicensePlate);
            arrParams.Add("@State~" + State);
            arrParams.Add("@StartOD~" + thisAssist.StartOD);
            arrParams.Add("@EndOD~" + thisAssist.EndOD);
            arrParams.Add("@TowLocationID~" + TowLocationID);
            arrParams.Add("@Tip~" + thisAssist.Tip);
            arrParams.Add("@TipDetail~" + TipDetail);
            arrParams.Add("@CustomerLastName~" + CustomerLastName);
            arrParams.Add("@Comments~" + Comments);
            arrParams.Add("@IsMDC~" + thisAssist.IsMDC);
            arrParams.Add("@x1097~" + x1097);
            arrParams.Add("@x1098~" + x1098);
            arrParams.Add("@ContractorID~" + ContractorID);
            arrParams.Add("@LogNumber~" + LogNumber);
            arrParams.Add("@Lat~" + thisAssist.Lat.ToString());
            arrParams.Add("@Lon~" + thisAssist.Lon.ToString());
            arrParams.Add("@OnSiteTime~" + OnSiteTime);
            arrParams.Add("@SurveyNum~" + SurveyNum);
            arrParams.Add("@AssistNumber~" + AssistNumber);
            return(arrParams);
        }
Example #4
0
        public static void AddAssist(MiscData.Assist thisAssist)
        {
            if (thisAssist.IncidentID == null || thisAssist.IncidentID == new Guid("00000000-0000-0000-0000-000000000000"))
            {
                return; //assists must be assigned to incidents
            }
            MiscData.Assist thisFoundAssist = Assists.Find(delegate(MiscData.Assist a) { return(a.AssistID == thisAssist.AssistID); });
            if (thisFoundAssist == null)
            {
                Assists.Add(thisAssist);
            }
            else
            {
                var _assist = Assists.Find(a => a.AssistID == thisAssist.AssistID);
                _assist.IncidentID        = thisAssist.IncidentID;
                _assist.DriverID          = thisAssist.DriverID;
                _assist.FleetVehicleID    = thisAssist.FleetVehicleID;
                _assist.DispatchTime      = thisAssist.DispatchTime;
                _assist.CustomerWaitTime  = thisAssist.CustomerWaitTime;
                _assist.VehiclePositionID = thisAssist.VehiclePositionID;
                _assist.IncidentTypeID    = thisAssist.IncidentTypeID;
                _assist.TrafficSpeedID    = thisAssist.TrafficSpeedID;
                _assist.DropZone          = thisAssist.DropZone;
                _assist.Make             = thisAssist.Make;
                _assist.VehicleTypeID    = thisAssist.VehicleTypeID;
                _assist.Color            = thisAssist.Color;
                _assist.LicensePlate     = thisAssist.LicensePlate;
                _assist.State            = thisAssist.State;
                _assist.StartOD          = thisAssist.StartOD;
                _assist.EndOD            = thisAssist.EndOD;
                _assist.TowLocationID    = thisAssist.TowLocationID;
                _assist.Tip              = thisAssist.Tip;
                _assist.TipDetail        = thisAssist.TipDetail;
                _assist.CustomerLastName = thisAssist.CustomerLastName;
                _assist.Comments         = thisAssist.Comments;
                _assist.IsMDC            = thisAssist.IsMDC;
                _assist.x1097            = thisAssist.x1097;
                _assist.x1098            = thisAssist.x1098;
                _assist.ContractorID     = thisAssist.ContractorID;
                _assist.LogNumber        = thisAssist.LogNumber;
                _assist.SelectedServices = thisAssist.SelectedServices;
                _assist.OnSiteTime       = thisAssist.OnSiteTime;
                _assist.AssistComplete   = thisAssist.AssistComplete;
                _assist.SurveyNum        = thisAssist.SurveyNum;
                _assist.AssistNumber     = thisAssist.AssistNumber;
                _assist.Lat              = thisAssist.Lat;
                _assist.Lon              = thisAssist.Lon;
            }
            ArrayList arrParams = new ArrayList();

            SQL.SQLCode mySQL = new SQL.SQLCode();
            mySQL.RunProc("LogAssist", GetAssistParams(thisAssist)); //first shot updates assist data
            ArrayList arrSTCleanse = new ArrayList();

            arrSTCleanse.Add("@AssistID~" + thisAssist.AssistID); //clear old service type data before adding new.  This makes sure we maintain most accurate data
            mySQL.RunProc("CleanseServiceTypes", arrSTCleanse);
            if (thisAssist.SelectedServices != null)
            {
                for (int i = 0; i < thisAssist.SelectedServices.Count(); i++)
                {
                    ArrayList arrSrvTypes = new ArrayList();
                    arrSrvTypes.Add("@AssistID~" + thisAssist.AssistID);
                    arrSrvTypes.Add("@ServiceTypeID~" + thisAssist.SelectedServices[i].ToString());
                    mySQL.RunProc("LogServiceTypes", arrSrvTypes);
                }
            }
        }