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();
            }
        }
Exemple #2
0
        ///	<summary>
        /// Add PCV
        ///	</summary>
        private bool AddPCV()
        {
            int PCVId = 0;

            Facade.IPCV facPCV          = new Facade.PCV();
            bool        retVal          = false;
            string      userName        = ((Entities.CustomPrincipal)Page.User).UserName;
            int         deliveryPointId = FindSelectedPoint();

            if (deliveryPointId == 0)
            {
                lblConfirmation.Text      = "Please select a Delivery Point and then try again, please.";
                lblConfirmation.Visible   = true;
                lblConfirmation.ForeColor = Color.Red;
                return(retVal);
            }
            else
            {
                pcv.DeliverPointId = deliveryPointId;
                PCVId = facPCV.Create(pcv, m_jobId, userName);
            }

            if (PCVId == 0)
            {
                lblConfirmation.Text      = "There was an error adding the PCV, please try again.";
                lblConfirmation.Visible   = true;
                lblConfirmation.ForeColor = Color.Red;
                retVal = false;
            }
            else
            {
                lblJobPCV.Text = "PCV Id";
            }
            txtJobPCVId.Text = PCVId.ToString();
            btnAdd.Text      = "Update PCV";
            retVal           = true;

            return(retVal);
        }