protected void Page_Load(object sender, System.EventArgs e) { // Retrieve the job we're working on try { if (Request.QueryString["pointID"] != null) { int.TryParse(Request.QueryString["pointID"], out m_PointId); } m_jobId = Convert.ToInt32(ViewState[C_JOB_ID_VS]); m_deliveryPointId = Convert.ToInt32(ViewState[C_DELIVERY_POINT_ID_VS]); Facade.IJob facJob = new Facade.Job(); m_job = facJob.GetJob(m_jobId); Facade.IPCV facPCV = new Facade.PCV(); m_job.PCVs = facPCV.GetForJobId(m_jobId, m_deliveryPointId); } catch {} if (!IsPostBack) { PopulateStaticControls(); LoadJobs(); } }
private void LoadJob() { Facade.IJob facJob = new Facade.Job(); m_job = facJob.GetJob(m_jobId); if (m_job != null) { if (m_job.JobState == eJobState.Cancelled) { Response.Redirect("../../Job/job.aspx?wiz=true&jobId=" + m_job.JobId.ToString() + "&csid=" + this.CookieSessionID); } Facade.IPCV facPCV = new Facade.PCV(); m_job.PCVs = facPCV.GetForJobId(m_jobId); if (m_job.JobState == eJobState.Booked) { Response.Redirect("../jobManagement.aspx?jobId=" + m_jobId + "&csid=" + this.CookieSessionID); } // Load the various parts of the job. Facade.IInstruction facInstruction = new Facade.Instruction(); m_job.Instructions = facInstruction.GetForJobId(m_jobId); PopulateJobInformation(); } ViewState[C_JOB_VS] = m_job; }
private void dgJobs_ItemCommand(object source, DataGridCommandEventArgs e) { switch (e.CommandName) { case "AttachPCVs": m_jobId = Convert.ToInt32(e.Item.Cells[0].Text); m_deliveryPointId = Convert.ToInt32(e.Item.Cells[5].Text); ViewState[C_JOB_ID_VS] = m_jobId; ViewState[C_DELIVERY_POINT_ID_VS] = m_deliveryPointId; Facade.IJob facJob = new Facade.Job(); m_job = facJob.GetJob(m_jobId); Facade.IPCV facPCV = new Facade.PCV(); m_job.PCVs = facPCV.GetForJobId(m_jobId, m_deliveryPointId); LoadJobs(); LoadPCVs(m_jobId); break; } }
private Entities.Job GetJobEntityFromCache() { Entities.Job job = (Entities.Job)Cache.Get("JobEntityForJobId" + m_jobID); if (job == null) { Facade.IJob facJob = new Facade.Job(); Facade.IPCV facPCV = new Facade.PCV(); Facade.IJobSubContractor facJobSubContractor = new Facade.Job(); job = facJob.GetJob(m_jobID, true, true); job.Charge = ((Facade.IJobCharge)facJob).GetForJobId(m_jobID); job.Extras = facJob.GetExtras(m_jobID, true); job.PCVs = facPCV.GetForJobId(m_jobID); job.References = ((Facade.IJobReference)facJob).GetJobReferences(m_jobID); job.SubContractors = facJobSubContractor.GetSubContractorForJobId(m_jobID); AddJobEntityToCache(job); } return(job); }
private void btnTakeOnJob_Click(object sender, EventArgs e) { reportViewer.Visible = false; Facade.IPCV facPCV = new Facade.PCV(); Entities.PCVCollection pcvs = new Entities.PCVCollection(); List <int> updatePCVIDs = new List <int>(); int pcvId; DateTime AgreedDateTime; string ClientContact = string.Empty; m_palletCount = 0; foreach (DataGridItem item in dgPCVs.Items) { CheckBox takePCV = (CheckBox)item.FindControl("chkTakePCV"); CheckBox updatePCV = item.FindControl("chkUpdatePCV") as CheckBox; if (takePCV.Checked) { pcvId = Convert.ToInt32(item.Cells[0].Text); m_palletCount += Convert.ToInt32(item.Cells[4].Text); Entities.PCV pcv = facPCV.GetForPCVId(pcvId); pcvs.Add(pcv); } if (updatePCV.Checked) { updatePCVIDs.Add(int.Parse(item.Cells[0].Text)); } } lblPalletCount.Text = m_palletCount.ToString(); if (rdiSlotDate.SelectedDate.HasValue && rdiSlotTime.SelectedDate.HasValue) { AgreedDateTime = new DateTime(rdiSlotDate.SelectedDate.Value.Year, rdiSlotDate.SelectedDate.Value.Month, rdiSlotDate.SelectedDate.Value.Day, rdiSlotTime.SelectedDate.Value.Hour, rdiSlotTime.SelectedDate.Value.Minute, 0); } else { AgreedDateTime = DateTime.Today; } // If the client contact is empty, the agreed redemption details will not be added. ClientContact = txtClientContact.Text; Facade.IJob facJob = new Facade.Job(); bool success = facJob.TakePCVs(m_jobId, m_deliveryPointId, pcvs, updatePCVIDs, AgreedDateTime, ClientContact, ((Entities.CustomPrincipal)Page.User).Name); if (success) { LoadPCVAgreements(m_jobId); m_job.PCVs = facPCV.GetForJobId(m_jobId, m_deliveryPointId); LoadPCVs(m_jobId); if (m_job.PCVs.Count > 0) { LoadReport(m_jobId); } else { reportViewer.Visible = false; } } else { lblConfirmation.Visible = true; lblConfirmation.Text = "The specified PCVs will not be taken on the specified job as an error occurred, please try again."; } }