protected void Page_Load(object sender, System.EventArgs e) { Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.Plan, eSystemPortion.AddEditResource); if (!IsPostBack) { if (Request.QueryString["resourceId"] != null && Request.QueryString["date"] != null && Request.QueryString["date"] != "undefined") { int resourceId = Convert.ToInt32(Request.QueryString["resourceId"]); Facade.IDriver facDriver = new Facade.Resource(); cboDriver.Text = facDriver.GetDriverForResourceId(resourceId).Individual.FullName; cboDriver.SelectedValue = resourceId.ToString(); string date = Request.QueryString["date"]; rdiDate.SelectedDate = new DateTime(Convert.ToInt32(date.Substring(6, 4)), Convert.ToInt32(date.Substring(3, 2)), Convert.ToInt32(date.Substring(0, 2))); // Get the start time for the driver for this date and populate the time control. DataSet dsStartTime = facDriver.GetStartTimesForDateAndDriver(resourceId, rdiDate.SelectedDate.Value); if (dsStartTime.Tables[0].Rows.Count > 0) { rdiStartTime.SelectedDate = (DateTime)dsStartTime.Tables[0].Rows[0]["StartDateTime"]; txtNotes.Text = dsStartTime.Tables[0].Rows[0]["Notes"].ToString(); } } else { rdiDate.SelectedDate = DateTime.UtcNow; } } }
protected void Page_Load(object sender, EventArgs e) { m_driverResourceId = Convert.ToInt32(Request.QueryString["resourceId"]); if (!IsPostBack) { Facade.IDriver facDriver = new Facade.Resource(); lblDriverName.Text = facDriver.GetDriverForResourceId(m_driverResourceId).Individual.FullName; txtTravelNotes.Text = facDriver.GetTravelNotes(m_driverResourceId); } }
private void PopulateRequest() { if (m_request == null) { Facade.IDriver facDriver = new Facade.Resource(); Entities.Driver driver = facDriver.GetDriverForResourceId(Convert.ToInt32(cboDrivers.SelectedValue)); m_request = new Entities.DriverRequest(driver, txtRequestText.Text, dteRequestDate.SelectedDate.Value); } else { m_request.Text = txtRequestText.Text; m_request.AppliesTo = dteRequestDate.SelectedDate.Value; } }
protected void Page_Load(object sender, System.EventArgs e) { Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage, eSystemPortion.AddEditResource); m_resourceId = Convert.ToInt32(Request.QueryString["resourceId"]); m_requestId = Convert.ToInt32(Request.QueryString["requestId"]); m_request = (Entities.DriverRequest)ViewState[C_REQUEST_VS]; if (!IsPostBack) { if (m_requestId > 0) { m_isUpdate = true; Facade.IDriverRequest facDriverRequest = new Facade.Resource(); m_request = facDriverRequest.GetForRequestId(m_requestId); ViewState[C_REQUEST_VS] = m_request; txtRequestText.Text = m_request.Text; dteRequestDate.SelectedDate = m_request.AppliesTo; m_resourceId = m_request.Driver.ResourceId; cboDrivers.Text = m_request.Driver.Individual.FullName; cboDrivers.SelectedValue = m_resourceId.ToString(); } else if (m_resourceId > 0) { Facade.IDriver facDriver = new Facade.Resource(); cboDrivers.Text = facDriver.GetDriverForResourceId(m_resourceId).Individual.FullName; cboDrivers.SelectedValue = m_resourceId.ToString(); } } if (m_request != null) { m_isUpdate = true; cboDrivers.Enabled = false; btnAdd.Text = "Update Request"; } else { btnAdd.Text = "Add Request"; } lblConfirmation.Visible = false; }
protected void Page_Load(object sender, System.EventArgs e) { Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage); m_resourceId = Convert.ToInt32(Request.QueryString["resourceId"]); string date = Request.QueryString["fromDateTime"]; m_startDate = new DateTime(Convert.ToInt32(date.Substring(4, 4)), Convert.ToInt32(date.Substring(2, 2)), Convert.ToInt32(date.Substring(0, 2)), Convert.ToInt32(date.Substring(8, 2)), Convert.ToInt32(date.Substring(10, 2)), 0); if (!IsPostBack) { Facade.IDriver facDriver = new Facade.Resource(); lblDriver.Text = facDriver.GetDriverForResourceId(m_resourceId).Individual.FullName; lblStartDate.Text = m_startDate.ToString("dd/MM/yy"); FilterRequests(); } lblConfirmation.Visible = false; }
private void DisplayCommunication(int driverCommunicationId) { // Load the communication Entities.DriverCommunication communication = null; Entities.Driver driver = null; using (Facade.IDriver facDriver = new Facade.Resource()) { communication = ((Facade.IDriverCommunication)facDriver).GetForDriverCommunicationId(driverCommunicationId); int driverId = facDriver.GetDriverForDriverCommunicationId(driverCommunicationId); driver = facDriver.GetDriverForResourceId(driverId); } if (communication != null && driver != null) { lblDriverFullName.Text = driver.Individual.FullName; lblCommunicationStatus.Text = Utilities.UnCamelCase(communication.DriverCommunicationStatus.ToString()); lblCommunicationType.Text = Utilities.UnCamelCase(communication.DriverCommunicationType.ToString()); lblCommunicationComments.Text = communication.Comments.Replace("START PLACE", "<br>START PLACE").Replace("STOP", "<br>STOP"); lblCommunicationText.Text = communication.Text; lblCommunicationNumberUsed.Text = communication.NumberUsed; } }
private void btnSelectDriver_Click(object sender, EventArgs e) { btnSelectDriver.DisableServerSideValidation(); if (Page.IsValid) { int resourceId = Convert.ToInt32(cboDriver.SelectedValue); bool alreadySelected = false; // Make sure each driver is only present once foreach (Entities.Driver thisDriver in m_drivers) { if (thisDriver.ResourceId == resourceId) { alreadySelected = true; } } if (!alreadySelected) { // Retrieve the driver Facade.IDriver facDriver = new Facade.Resource(); Entities.Driver driver = facDriver.GetDriverForResourceId(resourceId); // Add the driver to the collection and refresh the viewstate m_drivers.Add(driver); ViewState[C_DRIVER_COLLECTION] = m_drivers; } // Reset the dbcombo cboDriver.Text = ""; cboDriver.SelectedValue = ""; // Rebind the drivers BindDrivers(); } }
protected void Page_Load(object sender, System.EventArgs e) { Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage); m_resourceId = Convert.ToInt32(Request.QueryString["resourceId"]); m_resourceType = (eResourceType)Convert.ToInt32(Request.QueryString["resourceTypeId"]); string date = Request.QueryString["fromDateTime"]; m_startDate = new DateTime(Convert.ToInt32(date.Substring(4, 4)), Convert.ToInt32(date.Substring(2, 2)), Convert.ToInt32(date.Substring(0, 2)), Convert.ToInt32(date.Substring(8, 2)), Convert.ToInt32(date.Substring(10, 2)), 0); if (!IsPostBack) { switch (m_resourceType) { case eResourceType.Driver: Facade.IDriver facDriver = new Facade.Resource(); lblResource.Text = facDriver.GetDriverForResourceId(m_resourceId).Individual.FullName; break; case eResourceType.Vehicle: Facade.IVehicle facVehicle = new Facade.Resource(); lblResource.Text = facVehicle.GetForVehicleId(m_resourceId).RegNo; break; case eResourceType.Trailer: Facade.ITrailer facTrailer = new Facade.Resource(); lblResource.Text = facTrailer.GetForTrailerId(m_resourceId).TrailerRef; break; } Facade.IJob facJob = new Facade.Job(); m_dsFutureJobs = facJob.GetFutureJobs(m_resourceId, ((Entities.CustomPrincipal)Page.User).IdentityId); dgBasicJobs.DataSource = m_dsFutureJobs; dgBasicJobs.DataBind(); } }
void cboVehicle_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) { ((Telerik.Web.UI.RadComboBox)sender).Items.Clear(); Telerik.Web.UI.RadComboBoxItem rcItem = new Telerik.Web.UI.RadComboBoxItem(); DataSet ds = null; string[] clientArgs = e.Context["FilterString"].ToString().Split(':'); if (e.Context["FilterString"] != null) { if (clientArgs[0] == "true") { // Get the Drivers usual vehicle Facade.IDriver facDriver = new Facade.Resource(); Entities.Driver driver = facDriver.GetDriverForResourceId(int.Parse(clientArgs[1])); Entities.Vehicle vehicle = ((Facade.IVehicle)facDriver).GetForVehicleId(driver.AssignedVehicleId); if (vehicle != null) { rcItem.Text = vehicle.RegNo; rcItem.Value = vehicle.ResourceId.ToString(); rcItem.Selected = true; ((Telerik.Web.UI.RadComboBox)sender).Items.Add(rcItem); } } else { int controlAreaId = 0; int[] trafficAreas = new int[clientArgs.Length - 1]; controlAreaId = int.Parse(clientArgs[0]); for (int i = 1; i < clientArgs.Length; i++) { trafficAreas[i - 1] = int.Parse(clientArgs[i]); } Facade.IResource facResource = new Facade.Resource(); ds = facResource.GetAllResourcesFiltered(e.Text, eResourceType.Vehicle, controlAreaId, trafficAreas, true); } } else { Facade.IResource facResource = new Facade.Resource(); ds = facResource.GetAllResourcesFiltered(e.Text, eResourceType.Vehicle, false); } if (ds != null) { int itemsPerRequest = 20; int itemOffset = e.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > ds.Tables[0].Rows.Count) { endOffset = ds.Tables[0].Rows.Count; } DataTable dt = ds.Tables[0]; for (int i = itemOffset; i < endOffset; i++) { rcItem = new Telerik.Web.UI.RadComboBoxItem(); rcItem.Text = dt.Rows[i]["Description"].ToString(); rcItem.Value = dt.Rows[i]["ResourceId"].ToString(); ((Telerik.Web.UI.RadComboBox)sender).Items.Add(rcItem); } if (dt.Rows.Count > 0) { e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString()); } } }
private void LoadCommunication() { Facade.IInstruction facInstrucion = new Facade.Instruction(); var jobInstructions = facInstrucion.GetForJobId(_jobId); var instruction = jobInstructions.Single(i => i.InstructionID == _instructionID); // Get the driver. Facade.IDriver facDriver = new Facade.Resource(); Entities.Driver driver = facDriver.GetDriverForResourceId(_driverId); var communicationTypes = Utilities.GetEnumPairs <eDriverCommunicationType>(); // We don't offer the option to communicate by Tough Touch if the driver doesn't have a passcode or the vehicle doesn't have a Tough Touch installed. if (string.IsNullOrWhiteSpace(driver.Passcode) || instruction.Vehicle == null || !instruction.Vehicle.IsTTInstalled) { communicationTypes.Remove((int)eDriverCommunicationType.ToughTouch); } cboCommunicationType.DataSource = communicationTypes; cboCommunicationType.DataBind(); cboCommunicationType.Items.Insert(0, new ListItem("-- Select a communication type --", "")); cboCommunicationType.Attributes.Add("onchange", "cboCommunicationTypeIndex_Changed();"); cboCommunicationStatus.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eDriverCommunicationStatus))); cboCommunicationStatus.DataBind(); RadioButton rb = null; Entities.ContactCollection contacts = new Entities.ContactCollection(); if (driver != null && driver.Individual.Contacts != null) { contacts = driver.Individual.Contacts; } // Get the vehicle the driver is currently assigned to. Facade.IJourney facJourney = new Facade.Journey(); Entities.Vehicle currentVehicle = facJourney.GetCurrentVehicleForDriver(_driverId); if (currentVehicle != null) { contacts.Add(new Entities.Contact(eContactType.MobilePhone, currentVehicle.CabPhoneNumber)); } Entities.ContactCollection cs = new Orchestrator.Entities.ContactCollection(); rb = new RadioButton(); bool numberSelected = false; foreach (Entities.Contact contact in contacts) { if (contact.ContactDetail.Length > 0) { rb = new RadioButton(); rb.GroupName = "rblNumbers"; rb.Text = contact.ContactDetail; rb.Attributes.Add("onclick", "setNumberUsed('" + contact.ContactDetail + "');"); if (contact.ContactType == eContactType.MobilePhone || contact.ContactType == eContactType.PersonalMobile || contact.ContactType == eContactType.Telephone) { if (!numberSelected) { rb.Checked = true; txtNumber.Text = contact.ContactDetail; numberSelected = true; } } plcNumbers.Controls.Add(rb); plcNumbers.Controls.Add(new LiteralControl("<br/>")); } } rb = new RadioButton(); rb.Text = "Other"; rb.GroupName = "rblNumbers"; rb.Attributes.Add("onclick", "enableOtherTextBox();"); plcNumbers.Controls.Add(rb); bool isInvolvedInLoad = false; foreach (Entities.Instruction i in jobInstructions) { if (i.Driver != null && i.Driver.ResourceId == _driverId) { if ((eInstructionType)i.InstructionTypeId == eInstructionType.Load) { isInvolvedInLoad = true; } } } trLoadOrder.Visible = isInvolvedInLoad; if (isInvolvedInLoad) { var loadComments = BuildLoadComments(_driverId, jobInstructions); lblLoadOrder.Text = loadComments; trLoadOrder.Visible = !string.IsNullOrWhiteSpace(loadComments); } var legPlan = new Facade.Instruction().GetLegPlan(jobInstructions, false); txtComments.Text = GetComments(legPlan, eDriverCommunicationType.Phone); txtSMSText.Text = GetComments(legPlan, eDriverCommunicationType.Text); var defaultCommunicationTypeID = driver.DefaultCommunicationTypeID == 0 ? (int)eDriverCommunicationType.Phone : driver.DefaultCommunicationTypeID; //lookup the communication type in the drop down, dont select if it doesnt exist - this should only happen if the driver whos default method of communitication // is tough touch but has now moved into a vechicial without one being installed if (cboCommunicationType.Items.FindByValue(defaultCommunicationTypeID.ToString()) != null) { cboCommunicationType.Items.FindByValue(defaultCommunicationTypeID.ToString()).Selected = true; } Facade.IControlArea facControlArea = new Facade.Traffic(); cboControlArea.DataSource = facControlArea.GetAll(); cboControlArea.DataBind(); for (int instructionIndex = jobInstructions.Count - 1; instructionIndex >= 0; instructionIndex--) { if (jobInstructions[instructionIndex].Driver != null && jobInstructions[instructionIndex].Driver.ResourceId == _driverId) { hidLastInstructionInvolvedWith.Value = jobInstructions[instructionIndex].InstructionOrder.ToString(); cboControlArea.ClearSelection(); cboControlArea.Items.FindByValue(jobInstructions[instructionIndex].Point.Address.TrafficArea.ControlAreaId.ToString()).Selected = true; BindTrafficAreas(Convert.ToInt32(cboControlArea.SelectedValue), jobInstructions[instructionIndex].Point.Address.TrafficArea.TrafficAreaId); break; } } ShowPCVS(); }