Exemple #1
0
        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.";
            }
        }
Exemple #2
0
        ///	<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";
        }