private void BindRates() { int collectionPoint = 0; if (cboCollectionPoint.SelectedValue != "") { collectionPoint = Convert.ToInt32(cboCollectionPoint.SelectedValue); } int deliveryPoint = 0; if (cboDeliveryPoint.SelectedValue != "") { deliveryPoint = Convert.ToInt32(cboDeliveryPoint.SelectedValue); } int client = 0; if (cboJobClient.SelectedValue != "") { client = Convert.ToInt32(cboJobClient.SelectedValue); } using (Facade.IJobRate facJobRate = new Facade.Job()) { DataView dv = new DataView(facJobRate.GetRates(collectionPoint, deliveryPoint, client, chkShowEnded.Checked).Tables[0]); string sortExpression = String.Empty; sortExpression = SortCriteria + " " + SortDirection; dv.Sort = sortExpression.Trim(); dgRates.DataSource = dv; } dgRates.DataBind(); }
private Entities.FacadeResult SubContractSpecificLegs(Entities.JobSubContractor jobSubContractor, DateTime lastUpdateDateTime, string userID) { Facade.IJobSubContractor facJobSubContractor = new Facade.Job(); if (!m_isUpdate) { List <int> instructionIDs = new List <int>(); foreach (GridItem gdi in grdLegs.SelectedItems) { int instructionID = int.Parse(gdi.OwnerTableView.DataKeyValues[gdi.ItemIndex]["InstructionID"].ToString()); instructionIDs.Add(instructionID); } if (chkUseSubContractorTrailer.Checked) { return(facJobSubContractor.Create(m_jobId, instructionIDs, new List <int>(), jobSubContractor, lastUpdateDateTime, userID, chkForceRemoveResources.Checked)); } else { return(facJobSubContractor.Create(m_jobId, instructionIDs, new List <int>(), jobSubContractor, int.Parse(cboTrailer.SelectedValue), lastUpdateDateTime, userID, chkForceRemoveResources.Checked)); } } else { return(GenerateValidationError("UnableToUpdate", "Unable to update sub-contracted information in this way")); } }
private void UpdateReferences() { int identityId = int.Parse(cboClient.SelectedValue); List <Entities.JobReference> references = new List <Entities.JobReference>(); Facade.IOrganisationReference facOrganisationReference = new Facade.Organisation(); foreach (RepeaterItem item in repReferences.Items) { int referenceId = Convert.ToInt32(((HtmlInputHidden)item.FindControl("hidOrganisationReferenceId")).Value); string referenceValue = ((TextBox)item.FindControl("txtReferenceValue")).Text; // Create a new reference and add it to the reference collection Entities.JobReference jobReference = new Entities.JobReference(); jobReference.JobId = m_jobId; jobReference.Value = referenceValue; jobReference.OrganisationReference = facOrganisationReference.GetReferenceForOrganisationReferenceId(referenceId); references.Add(jobReference); } Facade.IJob facJob = new Facade.Job(); facJob.ChangeClient(m_jobId, identityId, references, ((Entities.CustomPrincipal)Page.User).UserName); mwhelper.CloseForm = true; mwhelper.CausePostBack = true; mwhelper.OutputData = "<changeClient />"; }
private void PopulateControls() { Facade.IJobRate facJobRate = new Facade.Job(); Entities.JobRate jobRate = facJobRate.GetRateForRateId(m_rateId); if (jobRate != null) { // Delivery point Facade.IPoint facPoint = new Facade.Point(); Entities.Point point = facPoint.GetPointForPointId(jobRate.DeliveryPointId); cboDeliveryPoint.Text = point.Description; cboDeliveryPoint.SelectedValue = jobRate.DeliveryPointId.ToString(); cboDelivery.Text = point.OrganisationName; cboDelivery.SelectedValue = point.IdentityId.ToString(); // Collection point point = facPoint.GetPointForPointId(jobRate.CollectionPointId); cboCollectionPoint.Text = point.Description; cboCollectionPoint.SelectedValue = jobRate.CollectionPointId.ToString(); cboCollection.Text = point.OrganisationName; cboCollection.SelectedValue = point.IdentityId.ToString(); txtFullLoadRate.Text = jobRate.FullLoadRate.ToString("C"); txtMultiDropRate.Text = jobRate.MultiDropRate.ToString("C"); dteStartDate.SelectedDate = jobRate.StartDate; dteStartDate.Text = jobRate.StartDate.ToString(); if (!(jobRate.EndDate.ToString() == "01/01/1753 00:00:00")) { dteEndDate.SelectedDate = jobRate.EndDate; dteEndDate.Text = jobRate.EndDate.ToString(); } } }
private static bool CommunicateInstructionsForSubContractor(int jobID, int subContractorId, string userId) { if (!Globals.Configuration.SubContractorCommunicationsRequired) { return(false); } Entities.DriverCommunication communication = new Entities.DriverCommunication(); communication.Comments = "Communicated via Deliveries ScreSubcontractorCommunicationsRequireden"; communication.DriverCommunicationStatus = eDriverCommunicationStatus.Accepted; string mobileNumber = "unknown"; communication.DriverCommunicationType = eDriverCommunicationType.Manifest; communication.NumberUsed = mobileNumber; Facade.IInstruction facInstruction = new Facade.Instruction(); List <int> instructionIds = facInstruction.GetInstructionIDsForSubContractor(jobID, subContractorId, false); Facade.IJobSubContractor facJob = new Facade.Job(); foreach (int instructionId in instructionIds) { communication.DriverCommunicationId = facJob.CreateCommunication(jobID, subContractorId, communication, userId); } return(true); }
private void LoadData() { using (Facade.IJob facJob = new Facade.Job()) m_dsJobsData = facJob.GetDemurrageJobs(((Entities.CustomPrincipal)Page.User).IdentityId); dgJobs.DataSource = m_dsJobsData; dgJobs.DataBind(); }
void btnDeleteExtra_Click(object sender, EventArgs e) { Facade.IJobExtra facExtra = new Facade.Job(); facExtra.DeleteExtra(m_extraId); this.ReturnValue = bool.TrueString; this.Close("DeleteExtra"); }
private void BindJobData() { using (Facade.IJob facJob = new Facade.Job()) m_dsJobsData = facJob.GetJobsWithProblemAlerts(((Entities.CustomPrincipal)Page.User).IdentityId); dgBasicJobs.DataSource = m_dsJobsData.Tables[0]; dgBasicJobs.DataBind(); }
private void LoadJob() { Facade.IJob facJob = new Facade.Job(); Facade.IInstruction facInstruction = new Facade.Instruction(); m_job = facJob.GetJob(m_jobId, true, true); ViewState[C_JOB_VS] = m_job; }
private void LoadReport(string sortExpression) { Facade.Job facJob = new Facade.Job(); int identityId = 0; if (cboClient.SelectedValue != "") { identityId = int.Parse(cboClient.SelectedValue); } DataSet dsCallInLog = facJob.GetCallInLog(Convert.ToInt32(cboControlArea.SelectedValue), identityId); DataView dv = dsCallInLog.DefaultViewManager.CreateDataView(dsCallInLog.Tables[0]); if (this.SortExpression != string.Empty) { dv.Sort = this.SortExpression + " " + this.SortDirection; } this.gvJobs.DataSource = dv; this.gvJobs.DataBind(); bool gpsActive = bool.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["GPS.Active"]); if (!gpsActive) { gvJobs.Columns[12].Visible = false; } if (dsCallInLog.Tables[0].Rows.Count > 0) { //// Configure the report settings collection NameValueCollection reportParams = new NameValueCollection(); reportParams.Add("selectUrl", "CallInLog.aspx?prepop=true&ca=" + cboControlArea.SelectedValue + "&oi=" + cboClient.SelectedValue); // Configure the Session variables used to pass data to the report Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.CallInLog; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = dsCallInLog; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = reportParams; // Show the user control //reportViewer.Visible = true; //reportViewer.IdentityId = identityId; //dgJobs.DataSource = dsCallInLog.Tables[0]; //dgJobs.DataBind(); lblCallInCount.Text = dsCallInLog.Tables[0].Rows.Count.ToString(); } else { lblError.Text = "No runs found"; lblError.Visible = true; //reportViewer.Visible = false; //dgJobs.Visible = false; } }
public void OrderPlanChange(int orderID, int instructionTypeID, int?instructionID, int vehicleResourceID, DateTime arrivalDateTime) { using (var uow = DIContainer.CreateUnitOfWork()) { if (instructionID.HasValue) { Facade.IInstruction facInstruction = new Facade.Instruction(); Facade.IJob facJob = new Facade.Job(); var instructionRepo = DIContainer.CreateRepository <IInstructionRepository>(uow); var jobID = instructionRepo.Find(instructionID.Value).JobID; var job = facJob.GetJob(jobID, true, true); var instruction = job.Instructions.Find(i => i.InstructionID == instructionID.Value); var changeTimes = instruction.PlannedArrivalDateTime != arrivalDateTime; var changeVehicle = instruction.Vehicle.ResourceId != vehicleResourceID; var userName = HttpContext.Current.User.Identity.Name; if (changeVehicle) { var result = facInstruction.PlanInstruction(new[] { instructionID.Value }, jobID, -1, vehicleResourceID, -1, job.LastUpdateDate, userName); if (!result.Success) { throw new ApplicationException( string.Format( "Could not update vehicle on run {0} due to the following infringements: {1}", jobID, string.Join("\n", result.Infringements.Select(i => i.Description)))); } } if (changeTimes) { instruction.PlannedArrivalDateTime = arrivalDateTime; instruction.PlannedDepartureDateTime = arrivalDateTime.AddMinutes(15); var result = facJob.UpdatePlannedTimes(jobID, job.Instructions, job.LastUpdateDate, userName); if (!result.Success) { throw new ApplicationException( string.Format( "Could not update planned times on run {0} due to the following infringements: {1}", jobID, string.Join("\n", result.Infringements.Select(i => i.Description)))); } } } else { var repo = DIContainer.CreateRepository <IOrderRepository>(uow); repo.AddUpdateOrderPrePlan(orderID, (eInstructionType)instructionTypeID, vehicleResourceID, arrivalDateTime); uow.SaveChanges(); } } }
protected void repOrderSubbyRates_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = e.Item.DataItem as DataRowView; Repeater repReferences = e.Item.FindControl("repReferences") as Repeater; Repeater repOrderSubbyRates = sender as Repeater; DataTable referenceData = (repOrderSubbyRates.DataSource as DataSet).Tables[1]; RadNumericTextBox rntSubContractRate = e.Item.FindControl("rntSubContractRate") as RadNumericTextBox; TextBox txtSubcontractReference = e.Item.FindControl("txtSubcontractReference") as TextBox; CheckBox chkIsAttended = e.Item.FindControl("chkIsAttended") as CheckBox; if (drv["SubbyForeignRate"] != DBNull.Value) { rntSubContractRate.Text = ((decimal)drv["SubbyForeignRate"]).ToString(); bool canBeChanged = (bool)drv["CanBeChanged"]; rntSubContractRate.Enabled = canBeChanged; txtSubcontractReference.Enabled = canBeChanged; chkIsAttended.Enabled = canBeChanged; } else { rntSubContractRate.Text = (new decimal(0)).ToString(); } int orderID = int.Parse(drv["OrderID"].ToString()); DataRow[] references = referenceData.Select("OrderID = " + orderID.ToString()); List <DataRow> listReferences = new List <DataRow>(references); // Add the customer order number and delivery order number! DataRow deliveryOrderNumber = referenceData.NewRow(); deliveryOrderNumber["OrderID"] = orderID; deliveryOrderNumber["Description"] = "Delivery Order Number"; deliveryOrderNumber["Reference"] = drv["DeliveryOrderNumber"].ToString(); listReferences.Insert(0, deliveryOrderNumber); DataRow customerOrderNumber = referenceData.NewRow(); customerOrderNumber["OrderID"] = orderID; customerOrderNumber["Description"] = "Customer Order Number"; customerOrderNumber["Reference"] = drv["CustomerOrderNumber"].ToString(); listReferences.Insert(0, customerOrderNumber); int jobSubContractID = (int)drv["JobSubContractID"]; Facade.IJobSubContractor facJobSubContractor = new Facade.Job(); Entities.JobSubContractor jobSubContract = facJobSubContractor.GetSubContractorForJobSubContractId(jobSubContractID); rntSubContractRate.Culture = new CultureInfo(jobSubContract.LCID); if (jobSubContractID > 0) { txtSubcontractReference.Text = drv["Reference"].ToString(); chkIsAttended.Checked = bool.Parse(drv["IsAttended"].ToString()); } repReferences.DataSource = listReferences; repReferences.DataBind(); } }
private void LoadData() { using (Facade.IJob facJob = new Facade.Job()) m_dsJobsData = facJob.GetBookInJobs(((Entities.CustomPrincipal)Page.User).IdentityId); dgJobsToBookIn.DataSource = m_dsJobsData; dgJobsToBookIn.PageSize = m_dsJobsData.Tables[0].Rows.Count; dgJobsToBookIn.DataBind(); }
private void LoadJob() { // Load the job Facade.IJob facJob = new Facade.Job(); m_job = facJob.GetJob(m_jobId); // Store the job in the session Session[wizard.C_JOB] = m_job; }
private void LoadJob() { using (Facade.IJob facJob = new Facade.Job()) { m_job = facJob.GetJob(m_jobId); this.JobTypeID = (int)m_job.JobType; ViewState[C_JOB_VS] = m_job; } }
private void FindOrder() { // Search for orders based on Date Range Status and text // Determine the parameters List <int> orderStatusIDs = new List <int>(); orderStatusIDs.Add((int)eOrderStatus.Approved); orderStatusIDs.Add((int)eOrderStatus.Delivered); bool searchCustomFields = true; if (PFInvoice != null && PFInvoice.InvoiceType == eInvoiceType.PFDepotCharge) { orderStatusIDs.Add((int)eOrderStatus.Invoiced); } List <int> businessTypeIDs = new List <int>(); foreach (ListItem li in cblBusinessType.Items) { if (li.Selected) { businessTypeIDs.Add(int.Parse(li.Value)); } } // Retrieve the client id, resource id, and sub-contractor identity id. int clientID = 0, resourceID = 0, subContractorIdentityID = 0; int.TryParse(cboClient.SelectedValue, out clientID); int.TryParse(cboResource.SelectedValue, out resourceID); int.TryParse(cboSubContractor.SelectedValue, out subContractorIdentityID); // Find the orders. if (dteStartDate.SelectedDate == null) { dteStartDate.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 01); } if (dteEndDate.SelectedDate == null || dteEndDate.SelectedDate < dteStartDate.SelectedDate) { dteEndDate.SelectedDate = DateTime.Today; } if (chkSearchByOrderID.Checked) { searchCustomFields = false; } Facade.IOrder facOrder = new Facade.Order(); Facade.IJobSubContractor facJSC = new Facade.Job(); DataSet orderData = facOrder.Search(orderStatusIDs, (DateTime)dteStartDate.SelectedDate, (DateTime)dteEndDate.SelectedDate, txtSearch.Text, true, true, true, true, clientID, resourceID, subContractorIdentityID, businessTypeIDs, 0, 0, 0, searchCustomFields); var queryResultsSet = orderData.Tables[0].AsEnumerable(); grdOrders.DataSource = queryResultsSet; grdOrders.DataBind(); }
private void LoadUnCommunicatedLegs() { // Populate the legs. Facade.IJob facJob = new Facade.Job(); DataView dv = facJob.GetTrafficSheetForJobId(m_jobId).Tables[1].DefaultView; dv.RowFilter = "InstructionStateId = 2"; dgTrafficSheet.DataSource = dv; dgTrafficSheet.DataBind(); }
private void BindJobData(eTrafficSheetGrouping grouping) { var trafficAreaIDs = m_trafficSheetFilter.TrafficAreaIDs.ToArray(); var jobStates = new int[m_trafficSheetFilter.JobStates.Count]; for (int i = 0; i < m_trafficSheetFilter.JobStates.Count; i++) { if (m_trafficSheetFilter.JobStates[i] is eJobState) { jobStates[i] = (int)(eJobState)m_trafficSheetFilter.JobStates[i]; } else { jobStates[i] = (int)(long)m_trafficSheetFilter.JobStates[i]; } } // Refilter the jobs normally using (Facade.IJob facJob = new Facade.Job()) m_dsJobsData = facJob.GetJobsForControlAreaPeriod(m_trafficSheetFilter.ControlAreaId, trafficAreaIDs, jobStates, false, m_trafficSheetFilter.OnlyShowMyJobs, m_trafficSheetFilter.OnlyShowJobsWithPCVs, m_trafficSheetFilter.OnlyShowJobsWithDemurrage, m_trafficSheetFilter.OnlyShowJobsWithDemurrageAwaitingAcceptance, ((Entities.CustomPrincipal)Page.User).IdentityId, m_trafficSheetFilter.FilterStartDate, m_trafficSheetFilter.FilterEnddate, m_trafficSheetFilter.BusinessTypes); // Sort and Bind DataView dvJobsData = new DataView(m_dsJobsData.Tables[0]); switch (grouping) { case eTrafficSheetGrouping.Organisation: dgBasicJobs.GroupBy = "OrganisationName"; break; case eTrafficSheetGrouping.DepotCode: dgBasicJobs.GroupBy = "DepotCode"; break; default: dgBasicJobs.GroupBy = "OrganisationName"; break; } //if (((SortCriteria + " " + SortDirection).Trim().Length > 0) && (SortCriteria.StartsWith(dgBasicJobs.GroupingColumn))) // dvJobsData.Sort = SortCriteria + " " + SortDirection; // else // dvJobsData.Sort = dgBasicJobs.GroupingColumn + ", JobStartsAt"; dgBasicJobs.DataSource = dvJobsData; dgBasicJobs.DataBind(); // Display job count lblJobCount.Visible = true; lblJobCount.Text = "You have <b>" + dvJobsData.Table.Rows.Count + "</b> run" + (dvJobsData.Table.Rows.Count == 1 ? "" : "s") + " displayed."; }
protected void btnUpdateJobState_Click(object sender, System.EventArgs e) { bool retVal = false; Facade.IJob facJob = new Facade.Job(); string userName = ((Entities.CustomPrincipal)Page.User).UserName; if (m_job.JobType == eJobType.Groupage) { m_job.IsPriced = chkBookingInComplete.Checked; facJob.Update(m_job, userName); } if (chkBookingInComplete.Checked) { if (m_job.IsPriced) { retVal = facJob.UpdateState(m_job.JobId, eJobState.ReadyToInvoice, userName); } else { retVal = facJob.UpdateState(m_job.JobId, eJobState.BookingInComplete, userName); } chkBookingInComplete.Checked = true; pnlUnassignedPODs.Enabled = false; pnlUpdateJob.Enabled = true; DisplayProgress(); } else if (!chkBookingInComplete.Checked) { m_job.JobState = eJobState.BookingInIncomplete; retVal = facJob.UpdateState(m_job.JobId, eJobState.BookingInIncomplete, userName); chkBookingInComplete.Checked = false; pnlUnassignedPODs.Enabled = true; pnlUpdateJob.Enabled = true; pnlProgress.Visible = false; } if (retVal) { lblConfirmation.Text = "The job has been updated successfully."; } else { lblConfirmation.Text = "The job has not been successfully updated."; } lblConfirmation.Visible = true; }
private void btnAssign_Click(object sender, EventArgs e) { ArrayList arrJobId = null; string jobIdCSV = string.Empty; string userName = ((Entities.CustomPrincipal)Page.User).UserName; btnAssign.DisableServerSideValidation(); arrJobId = GetJobsSelected(); if (arrJobId.Count == 0) { foreach (object item in arrJobId) { if (jobIdCSV != String.Empty) { jobIdCSV += ","; } jobIdCSV += (item); } lblAssignUpdate.Text = "No jobs have be selected to assign invoice number, please select jobs to assign."; lblAssignUpdate.ForeColor = Color.Red; return; } else { // Add the invoice number to the selected jobs ids. Facade.IJobSubContractor facSub = new Facade.Job(); Entities.FacadeResult result = facSub.AssignInvoiceNumber(txtInvoiceNumber.Text, hidSelectedJobs.Value, userName); //brInvoice.ValidateSubContractors(jobIdCSV); if (result.Success) { lblAssignUpdate.Text = "The jobs have been assigned the customers invoice number"; lblAssignUpdate.ForeColor = Color.Blue; txtInvoiceNumber.Text = string.Empty; LoadGrid(); } else { // Display errors infringementDisplay.Infringements = result.Infringements; infringementDisplay.DisplayInfringments(); lblAssignUpdate.Text = "The jobs have been failed to assign the customers invoice number"; lblAssignUpdate.ForeColor = Color.Red; } } }
private void BindJobData() { Facade.IJob facJob = new Facade.Job(); m_dsJobsData = facJob.GetJobsWithoutCollectionDateChanges("1543,1547", ((Entities.CustomPrincipal)Page.User).IdentityId); if (m_dsJobsData != null && m_dsJobsData.Tables.Count != 0) { dgJobs.DataSource = m_dsJobsData; dgJobs.UnSelectAll(); dgJobs.GroupBy = "JobState"; dgJobs.DataBind(); } }
private void ShowPCVS() { Facade.IJob facJob = new Facade.Job(); Entities.Job _job = facJob.GetJob(_jobId); if (_job.PCVs.Count > 0) { pnlPCVS.Visible = true; } else { pnlPCVS.Visible = false; } }
void btnConfirm_Click(object sender, EventArgs e) { int newControlAreaId = Convert.ToInt32(cboControlArea.SelectedValue); int newTrafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue); bool success = true; if (newControlAreaId != m_instruction.ControlAreaId || newTrafficAreaId != m_instruction.TrafficAreaId) { // Update the control area and traffic area for the leg, and it's following legs if the checkbox is checked. // If the checkbox is checked, the resources on the leg are moved onto the receiving planner's resource list. Facade.IJob facJob = new Facade.Job(); // The end instruction of the leg should always be passed when calling SetControlArea. This is different from // m_instruction, which is the start instruction of the leg. The Start instruction of the leg detertmines the // traffic area responsible for planning the leg. int instructionOrder = m_instruction.InstructionOrder + 1; if (m_instruction.InstructionOrder == 0) { // The instruction is the 1st on the job // Edge case: ensure it is not the only one (ie. collection only job) // If it is then we shouldn't increment the instruction order when calling SetControlArea. Facade.IInstruction facInstruction = new Facade.Instruction(); Entities.InstructionCollection instructions = facInstruction.GetForJobId(m_instruction.JobId); if (instructions.Count == 1) { instructionOrder--; } } Entities.FacadeResult result = facJob.SetControlArea(m_instruction.JobId, newControlAreaId, newTrafficAreaId, instructionOrder, chkApplyToAllFollowingInstructions.Checked, m_lastUpdateDate, ((Entities.CustomPrincipal)Page.User).UserName); success = result.Success; if (!success) { // Display the infringements. idErrors.Infringements = result.Infringements; idErrors.DisplayInfringments(); idErrors.Visible = true; trErrors.Visible = true; } } if (success) { this.ReturnValue = "refresh"; this.Close(); } }
void repLegSubbyRates_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = e.Item.DataItem as DataRowView; RadNumericTextBox rntSubContractRate = e.Item.FindControl("rntSubContractRate") as RadNumericTextBox; HtmlTableRow rowSubbedOrders = e.Item.FindControl("rowSubbedOrders") as HtmlTableRow; Repeater repOrderSubbyRates = e.Item.FindControl("repOrderSubbyRates") as Repeater; TextBox txtSubcontractReference = e.Item.FindControl("txtSubcontractReference") as TextBox; CheckBox chkIsAttended = e.Item.FindControl("chkIsAttended") as CheckBox; if (drv["JobSubContractID"] == DBNull.Value) { rntSubContractRate.Visible = false; chkIsAttended.Visible = false; txtSubcontractReference.Visible = false; rowSubbedOrders.Visible = true; Facade.IOrder facOrder = new Facade.Order(); repOrderSubbyRates.DataSource = facOrder.GetSubbedOrdersForInstructionID((int)drv["InstructionId"]); repOrderSubbyRates.DataBind(); } else { rntSubContractRate.Visible = true; txtSubcontractReference.Visible = true; chkIsAttended.Visible = true; rowSubbedOrders.Visible = false; repOrderSubbyRates.Visible = false; rntSubContractRate.Text = ((decimal)drv["SubbyForeignRateForLeg"]).ToString(); int jobSubContractID = (int)drv["JobSubContractID"]; Facade.IJobSubContractor facJobSubContractor = new Facade.Job(); if (jobSubContractID > 0) { txtSubcontractReference.Text = drv["Reference"].ToString(); chkIsAttended.Checked = bool.Parse(drv["IsAttended"].ToString()); } // If the rate isn't editabel then the Reference and IsAttended flag isn't editable either. bool rateEditable = facJobSubContractor.IsRateEditable(jobSubContractID); rntSubContractRate.Enabled = rateEditable; txtReference.Enabled = rateEditable; chkIsAttended.Enabled = rateEditable; Entities.JobSubContractor jobSubContract = facJobSubContractor.GetSubContractorForJobSubContractId(jobSubContractID); rntSubContractRate.Culture = new CultureInfo(jobSubContract.LCID); } } }
private void btnNext_Click(object sender, EventArgs e) { if (Page.IsValid) { m_job.JobType = eJobType.Normal; if (m_job.Charge == null) { m_job.Charge = new Entities.JobCharge(); } m_job.Charge.JobChargeType = (eJobChargeType)Enum.Parse(typeof(eJobChargeType), cboChargeType.SelectedValue.Replace(" ", "")); if (m_job.Charge.JobChargeType == eJobChargeType.Job || m_job.Charge.JobChargeType == eJobChargeType.PerPallet) { m_job.Charge.JobChargeAmount = Decimal.Parse(txtChargeAmount.Text, System.Globalization.NumberStyles.Currency); } else { m_job.Charge.JobChargeAmount = 0; } m_job.IsStockMovement = chkIsStockMovement.Checked; Session[wizard.C_JOB] = m_job; if (m_isUpdate) { string userId = ((Entities.CustomPrincipal)Page.User).UserName; Facade.IJob facJob = new Facade.Job(); facJob.Update(m_job, userId); Session[wizard.C_JOB] = null; GoToStep("JD"); } else { bool jumpToDetails = Session[wizard.C_JUMP_TO_DETAILS] != null && ((bool)Session[wizard.C_JUMP_TO_DETAILS]); Session[wizard.C_JUMP_TO_DETAILS] = false; if (jumpToDetails) { GoToStep("JD"); } else { GoToStep("JR"); } } } }
private List <Entities.SubContractorDataItem> GetReadyToInvoiceForDates() { int identityID = 0; int.TryParse(cboSubContractor.SelectedValue, out identityID); // If all business types are selected then pass down an empty list - the stored procedure will then not filter on business type which will result in better performance var businessTypeIDs = chkBusinessType.AllBusinessTypesSelected ? Enumerable.Empty <int>() : chkBusinessType.SelectedBusinessTypeIDs; using (Facade.IJobSubContractor facJobSubContractor = new Facade.Job()) { return(facJobSubContractor.GetJobSubContractorsReadyToInvoice(rdiStartDate.SelectedDate, rdiEndDate.SelectedDate, identityID, businessTypeIDs)); } }
private void LoadJob() { using (Facade.IJob facJob = new Facade.Job()) { m_job = facJob.GetJob(m_jobId, true); if (m_job.JobState == eJobState.Cancelled) { Response.Redirect("../../Job/job.aspx?wiz=true&jobId=" + m_job.JobId.ToString() + "&csid=" + this.CookieSessionID); } } ViewState[C_JOB_VS] = m_job; }
private void dgRates_ItemCommand(object source, DataGridCommandEventArgs e) { switch (e.CommandName.ToLower()) { case "end": // End the rate's applicability. Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.AddEditRate); using (Facade.IJobRate facJobRate = new Facade.Job()) facJobRate.EndRate(Convert.ToInt32(e.Item.Cells[0].Text), ((Entities.CustomPrincipal)Page.User).UserName); BindRates(); break; } }
private void dgJobs_UpdateCommand(object source, DataGridCommandEventArgs e) { int jobId = Convert.ToInt32(e.Item.Cells[0].Text); string receiptNumber = ((TextBox)e.Item.Cells[2].Controls[0]).Text; Facade.IJob facJob = new Facade.Job(); Entities.Job job = facJob.GetJob(jobId); job.ReturnReceiptNumber = receiptNumber; facJob.Update(job, ((Entities.CustomPrincipal)Page.User).UserName); dgJobs.EditItemIndex = -1; PopulateJobs(); }
private void btnGenerateCsv_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } int depotId = 0; int.TryParse(cboDepot.SelectedValue, out depotId); int vehicleId = 0; int.TryParse(cboVehicle.SelectedValue, out vehicleId); RevenuePerVehicleReportData reportData; Facade.IJob facJob = new Facade.Job(); if (depotId == 0 && vehicleId == 0) //All Depots - All Vehicles { reportData = facJob.GetRevenuePerVehicleData(dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value); } else if (depotId != 0 && vehicleId == 0) //Single Depot - All Vehicle { reportData = facJob.GetRevenuePerVehicleData(dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value, depotId); } else //Doesn't Matter - Single Vehicle { reportData = facJob.GetRevenuePerVehicleData(dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value, depotId, vehicleId); } var vehicles = reportData.Depots.SelectMany(dptSummary => dptSummary.Vehicles); List <CsvExport.PropertyMapping <VehicleRevenue> > mappings = new List <CsvExport.PropertyMapping <VehicleRevenue> >(); if (vehicleId == 0) { mappings.Add(new CsvExport.PropertyMapping <VehicleRevenue>("Depot", t => t.DepotName)); mappings.Add(new CsvExport.PropertyMapping <VehicleRevenue>("Vehicle", t => t.VehicleName)); } else { mappings.Add(new CsvExport.PropertyMapping <VehicleRevenue>("Vehicle", t => t.DepotName)); mappings.Add(new CsvExport.PropertyMapping <VehicleRevenue>("Driver", t => t.VehicleName)); } mappings.Add(new CsvExport.PropertyMapping <VehicleRevenue>("Revenue", t => t.Revenue_Formatted)); mappings.Add(new CsvExport.PropertyMapping <VehicleRevenue>("Percent Of Total", t => t.PercentOfDepotTotal_Formatted)); CsvExport.Export <VehicleRevenue>(vehicles, "RevenuePerVehicleReport.csv", mappings); }