/// <summary> /// Populate PCV /// </summary> private void populatePCV() { if (ViewState["pcv"] == null) { pcv = new Entities.PCV(); } else { pcv = (Entities.PCV)ViewState["pcv"]; } pcv.PCVId = Convert.ToInt32(txtJobPCVId.Text); pcv.VoucherNo = Convert.ToInt32(txtVoucherNo.Text); pcv.NoOfPalletsReceived = Convert.ToInt32(txtNoOfPallets.Text); pcv.DateOfIssue = dteDateOfIssue.SelectedDate.Value; pcv.PCVStatusId = (ePCVStatus)Enum.Parse(typeof(ePCVStatus), (cboPCVStatus.Items[cboPCVStatus.SelectedIndex].Value)); pcv.PCVRedemptionStatusId = (ePCVRedemptionStatus)Enum.Parse(typeof(ePCVRedemptionStatus), (cboPCVRedemptionStatus.Items[cboPCVRedemptionStatus.SelectedIndex].Value)); pcv.DeliverPointId = FindSelectedPoint(); pcv.DepotId = Convert.ToInt32(txtDepotId.Text); pcv.NoOfSignings = Convert.ToInt32(txtSignings.Text); // Deleted checked not required until the PCV's are allowed to be deleted // if (chkDelete.Checked) // pcv.PCVStatus = ePCVStatus.NotApplicable; // else // pcv.PCVStatus = ePCVStatus.Received; }
private Entities.PCV LoadPCV() { Entities.PCV newPCV = new Entities.PCV(); int clientID = -1, palletTypeID = -1; int.TryParse(rcbClient.SelectedValue, out clientID); int.TryParse(rcbPalletType.SelectedValue, out palletTypeID); //Add PCV here newPCV.ClientID = clientID; newPCV.DateOfIssue = rdiDate.SelectedDate.Value; newPCV.DeliverPointId = ucIssuedPoint.PointID; newPCV.FormTypeId = eFormTypeId.PCV; newPCV.NoOfPallets = (int)rntNoOfPallets.Value; newPCV.NoOfPalletsReceived = 0; newPCV.NoOfPalletsReturned = 0; newPCV.NoOfSignings = int.Parse(rcbNoOfSignings.SelectedValue); newPCV.PalletTypeID = palletTypeID; newPCV.PCVIssued = true; newPCV.PCVReasonForIssuingId = (ePCVReasonForIssuing)int.Parse(rcbReasonForIssue.SelectedValue); newPCV.PCVRedemptionStatusId = ePCVRedemptionStatus.ToBeRedeemed; newPCV.PCVStatusId = ePCVStatus.Received; newPCV.VoucherNo = (int)rntVoucherNo.Value; newPCV.RequiresScan = true; return(newPCV); }
void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { Button currentButton = sender as Button; Facade.IPCV facPCV = new Facade.PCV(); Facade.ITrafficArea facTrafficArea = new Facade.Traffic(); Entities.PCV newPCV = LoadPCV(); int pcvID = facPCV.Create(newPCV, ((Entities.CustomPrincipal)Page.User).UserName); //Do reset if specified switch (currentButton.CommandArgument.ToLower()) { case "add_reset": ConfigureDisplay(); break; } //Popup PCV Details if (pcvID > 0) { ShowConfirmationWindow(newPCV.ScannedFormId, pcvID); } LoadPCVList(); } }
private Entities.FacadeResult CreateInstructionActual(Entities.InstructionActual instructionActual, string userId) { Entities.FacadeResult result = new Orchestrator.Entities.FacadeResult(false); Entities.PCV m_PCV = null; try { using (Facade.IInstructionActual facInstructionActual = new Facade.Instruction()) { DateTime startedAt = DateTime.UtcNow; result = facInstructionActual.Create(m_job, instructionActual, m_PCV, userId); DateTime endedAt = DateTime.UtcNow; instructionActual.InstructionActualId = result.ObjectId; } } catch { } return(result); }
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."; } }
/// <summary> /// Load PCV /// </summary> private void LoadPCV() { // May be required to be shown if PCV's are allowed to be deleted once created //chkDelete.Visible = true; //pnlPCVDeleted.Visible = true; if (ViewState["pcv"] == null) { Facade.IPCV facPCV = new Facade.PCV(); pcv = facPCV.GetForPCVId(m_PCVId); ViewState["pcv"] = pcv; } else { pcv = (Entities.PCV)ViewState["pcv"]; } if (m_isUpdate) { txtJobPCVId.Text = pcv.PCVId.ToString(); } else { txtJobPCVId.Text = m_jobId.ToString(); } txtVoucherNo.Text = pcv.VoucherNo.ToString(); txtNoOfPallets.Text = pcv.NoOfPalletsReceived.ToString(); dteDateOfIssue.SelectedDate = pcv.DateOfIssue; txtDepotId.Text = pcv.DepotId.ToString(); cboPCVStatus.Items.FindByValue(pcv.PCVStatusId.ToString()).Selected = true; cboPCVRedemptionStatus.Items.FindByValue(pcv.PCVRedemptionStatusId.ToString()).Selected = true; // Load dgDeliveryPoints with the relevant fields and markers int deliveryPointId = pcv.DeliverPointId; // Get point and mark it checked in the grid Facade.IPoint facPoint = new Facade.Point(); DataSet ds = facPoint.GetPointForPointId(deliveryPointId, "DataSet"); dgDeliveryPoint.DataSource = ds; dgDeliveryPoint.DataBind(); foreach (DataGridItem dgItem in dgDeliveryPoint.Items) { // Get RdoBtnGrouper object RdoBtnGrouper selectRadioButton = dgItem.FindControl("selectRadioButton") as RdoBtnGrouper; // Make the row highlight the radiobutton selectRadioButton.Checked = true; } txtSignings.Text = pcv.NoOfSignings.ToString(); //if (pcv.PCVStatus == ePCVStatus.NotApplicable) // chkDelete.Checked = true; Header1.Title = "Update PCV"; Header1.subTitle = "Please make any changes neccessary."; btnAdd.Text = "Update"; }