예제 #1
0
        private void btnSaveOrder_Click(object sender, EventArgs e)
        {
            DriverQueueBO objBO = new DriverQueueBO();

            objBO.CheckDataValidation = false;
            try
            {
                int cnt = 0;
                foreach (RadListDataItem item in lstOrderedDrvs.Items)
                {
                    objBO.GetByPrimaryKey(item.Value);

                    if (objBO.Current != null)
                    {
                        cnt += 10;

                        objBO.Current.QueueDateTime = DateTime.Now.AddMilliseconds(cnt);

                        objBO.Save();
                    }
                }

                //  General.RefreshWaitingDrivers();

                CloseForm();
            }
            catch (Exception ex)
            {
                if (objBO.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objBO.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }
예제 #2
0
        private void PlotDriver(int?driverId, int?zoneId, int?FleetId)
        {
            DriverQueueBO objMaster = null;

            try
            {
                Fleet_DriverQueueList objPlottedDriver = General.GetObject <Fleet_DriverQueueList>(c => c.Status == true && c.DriverId == driverId);

                objMaster = new DriverQueueBO();
                if (objPlottedDriver == null)
                {
                    objMaster.New();
                    objMaster.Current.LoginDateTime = DateTime.Now;
                }
                else
                {
                    objMaster.GetByPrimaryKey(objPlottedDriver.Id);
                }

                objMaster.Current.FleetMasterId = FleetId;
                objMaster.Current.ZoneId        = zoneId;
                objMaster.Current.DriverId      = driverId;
                objMaster.Current.Status        = true;


                if (objMaster.Current.Fleet_Driver == null || objMaster.Current.Fleet_Driver.HasPDA.ToBool() == false)
                {
                    objMaster.Current.QueueDateTime = DateTime.Now;
                }

                objMaster.Save();

                if (objMaster.Current.Fleet_Driver.HasPDA.ToBool())
                {
                    if (zoneId != null)
                    {
                        string zoneName = ddlZone.Text.ToUpper().Trim();


                        if (objMaster.Current.CurrentJobId != null)
                        {
                            string msg         = string.Empty;
                            string pickUpPlot  = string.Empty;
                            string dropOffPlot = string.Empty;

                            if (AppVars.objPolicyConfiguration.DefaultClientId.ToStr() == "AbbeyCarsleeds")
                            {
                                pickUpPlot = objMaster.Current.ZoneId != null ? "<<<" + objMaster.Current.Booking.Gen_Zone1.ZoneName.ToStr() : "";

                                if (zoneName.Contains("("))
                                {
                                    zoneName = zoneName.Remove(zoneName.IndexOf("("));
                                }

                                if (zoneName.Contains("."))
                                {
                                    zoneName = zoneName.Substring(zoneName.IndexOf(".") + 1);
                                }

                                dropOffPlot = objMaster.Current.Booking.DropOffZoneId != null ? "<<<" + zoneName.Trim() : "";
                            }

                            string mobNo = objMaster.Current.Booking.CustomerMobileNo;
                            if (string.IsNullOrEmpty(mobNo))
                            {
                                mobNo = " ";
                            }


                            msg = (!string.IsNullOrEmpty(objMaster.Current.Booking.FromDoorNo) ? objMaster.Current.Booking.FromDoorNo + "-" + objMaster.Current.Booking.FromAddress + pickUpPlot : objMaster.Current.Booking.FromAddress + pickUpPlot) +
                                  ">>" +
                                  (!string.IsNullOrEmpty(objMaster.Current.Booking.ToDoorNo) ? objMaster.Current.Booking.ToDoorNo + "-" + objMaster.Current.Booking.ToAddress + dropOffPlot : objMaster.Current.Booking.ToAddress + dropOffPlot) +
                                  ">>" +
                                  string.Format("{0:dd/MM/yyyy   HH:mm}", objMaster.Current.Booking.PickupDateTime) +
                                  ">>" +
                                  objMaster.Current.Booking.CustomerName +
                                  ">>" +
                                  mobNo;


                            // For TCP Connection
                            if (AppVars.objPolicyConfiguration.IsListenAll.ToBool() && !string.IsNullOrEmpty(AppVars.objPolicyConfiguration.ListenerIP.ToStr().Trim()))
                            {
                                new Thread(delegate()
                                {
                                    General.SendMessageToPDA("request pda=" + driverId + "=" + objMaster.Current.CurrentJobId + "=" + "Update Job>>" + driverId + ">>" + objMaster.Current.CurrentJobId + ">>" + msg + "=8");
                                }).Start();
                            }

                            new TaxiDataContext().stp_UpdateJobDropOffPlot(objMaster.Current.CurrentJobId, driverId, zoneId);

                            new BroadcasterData().BroadCastToAll(RefreshTypes.REFRESH_DASHBOARD_DRIVER);
                        }
                    }
                }
                else
                {
                    General.RefreshListWithoutSelected <frmDriverLoginList>("frmDriverLoginList1");
                    //  General.RefreshWaitingDrivers();
                }


                this.PlottedDriverId = driverId;
                this.Plotted         = true;

                this.Close();
            }

            catch (Exception ex)
            {
                if (objMaster.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objMaster.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }