void frmPlotDriver_Shown(object sender, EventArgs e) { if (IsPlotting) { if (AppVars.objPolicyConfiguration.EnablePDA.ToBool()) { ComboFunctions.FillFreezePlottedDriverNoCombo(ddl_Driver); } else { ComboFunctions.FillDriverNoCombo(ddl_Driver); } ComboFunctions.FillZonesPlottedCombo(ddlZone); ComboFunctions.FillVehicleCombo(ddlVehicle); } else { Pg_Ordering.Item.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; Pg_Main.Text = "Un-Plot"; ddlZone.Enabled = false; ddlVehicle.Enabled = false; lblZone.Enabled = false; var list1 = General.GetQueryable <Fleet_DriverQueueList>(a => a.DriverId != null && a.Status == true); var query = from a in list1 orderby a.QueueDateTime select new { Id = a.Id, DriverNo = a.Fleet_Driver.DriverNo + " - " + a.Fleet_Driver.DriverName, }; ComboFunctions.FillCombo(query.ToList(), ddl_Driver, "DriverNo", "Id"); } ddl_Driver.RootElement.Focus(); ddl_Driver.RootElement.Children[0].Focus(); IsFormLoaded = true; if (DriverId != 0) { DriverQueueBO objMaster = new DriverQueueBO(); objMaster.GetByPrimaryKey(DriverId); ddl_Driver.SelectedValue = objMaster.Current.DriverId.ToInt(); ddlZone.SelectedValue = objMaster.Current.ZoneId.ToInt(); ddlVehicle.SelectedValue = objMaster.Current.FleetMasterId.ToInt(); } }
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); } } }
private bool Logout(long id, int?driverId) { bool rtn = false; try { DriverQueueBO objMaster = new DriverQueueBO(); objMaster.GetByPrimaryKey(id); if (objMaster.Current != null) { objMaster.Current.LogoutDateTime = DateTime.Now; objMaster.Current.Status = false; objMaster.Save(); rtn = true; if (objMaster.Current.Fleet_Driver.HasPDA.ToBool()) { new Thread(delegate() { General.SendMessageToPDA("request force logout=" + objMaster.Current.Fleet_Driver.DriverNo + "=" + driverId); }).Start(); // SendMessage("request force logout=" + objMaster.Current.Fleet_Driver.DriverNo); } } } catch (Exception ex) { //ENUtils.ShowMessage(ex.Message); } return(rtn); }
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); } } }