Esempio n. 1
0
        private void PopulateStaticControls()
        {
            // Bind the control areas
            using (Facade.IControlArea facControlArea = new Facade.Traffic())
                cboControlArea.DataSource = facControlArea.GetAll();
            cboControlArea.DataBind();
            cboControlArea.Items.Insert(0, new ListItem("All", "0"));

            // Pre-populate fields if qs elements present
            if (Request.QueryString["prepop"] == "true")
            {
                m_popupJobId = Request.QueryString["jid"];

                cboControlArea.SelectedIndex = Convert.ToInt32(Request.QueryString["ca"]);
                if (Request.QueryString["oi"] != string.Empty)
                {
                    using (Facade.IOrganisation facOrganisation = new Facade.Organisation())
                    {
                        Entities.Organisation client = facOrganisation.GetForIdentityId(Convert.ToInt32(Request.QueryString["oi"]));
                        cboClient.Text          = client.OrganisationName;
                        cboClient.SelectedValue = client.IdentityId.ToString();
                    }
                }
            }
        }
Esempio n. 2
0
        private void LoadOrganisation()
        {
            // Retrieve the organisation and place it in viewstate
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            m_organisation               = facOrganisation.GetForIdentityId(m_identityId);
            m_organisationName           = m_organisation.OrganisationName;
            ViewState[C_ORGANISATION_VS] = m_organisation;

            txtOrganisationName.Text = m_organisation.OrganisationName;

            ddStatuses.SelectedValue          = ((int)m_organisation.IdentityStatus).ToString();
            m_originalStatus                  = m_organisation.IdentityStatus;
            ViewState[C_ORIGINALSTATUS_ID_VS] = m_originalStatus;

            // Set the update buttons and labels
            btnAddLocation.Enabled = true;
            btnAdd.Text            = "Update";

            PopulateLocations();

            Repositories.DTOs.GeofenceNotificationSettings settings = facOrganisation.GetSettings(m_identityId);
            if (settings != null)
            {
                cbNotifyWhen_ItemsRequested(cbNotifyWhen, null);

                chkBoxEnableNotification.Checked = settings.Enabled;
                cbNotificationType.SelectedValue = settings.NotificationType.ToString();
                cbNotifyWhen.SelectedValue       = settings.NotifyWhen.ToString();
                txtContactDetail.Text            = settings.Recipient;
            }
        }
Esempio n. 3
0
        private void PopulateType(bool useClientDefaults)
        {
            eJobType       jobType       = eJobType.Normal;
            eJobChargeType jobChargeType = eJobChargeType.Job;
            decimal        chargeAmount  = 0;

            if (useClientDefaults)
            {
                Facade.IOrganisation  facOrganisation = new Facade.Organisation();
                Entities.Organisation client          = facOrganisation.GetForIdentityId(m_job.IdentityId);

                if (client.Defaults != null && client.Defaults.Count > 0)
                {
                    jobType = (eJobType)client.Defaults[0].JobTypeId;
                }
            }
            else
            {
                // Get the values from the Job object
                jobType       = m_job.JobType;
                jobChargeType = m_job.Charge.JobChargeType;
                chargeAmount  = m_job.Charge.JobChargeAmount;
            }

            cboChargeType.ClearSelection();
            cboChargeType.Items.FindByValue(Utilities.UnCamelCase(Enum.GetName(typeof(eJobChargeType), jobChargeType))).Selected = true;

            ConfigureChargeAmount(jobChargeType);

            txtChargeAmount.Text = chargeAmount.ToString("F2");

            chkIsStockMovement.Checked = m_job.IsStockMovement;
        }
Esempio n. 4
0
        private void PrepareOrders()
        {
            if (!IsPostBack)
            {
                OrdersCSV = PreviousPage.Orders;
            }

            Facade.IOrder facOrder = new Facade.Order();
            DataSet       dsOrders = facOrder.GetOrdersForList(OrdersCSV, true, false);

            Facade.IOrganisation  facOrg   = new Facade.Organisation();
            Entities.Organisation org      = facOrg.GetForIdentityId(Globals.Configuration.IdentityId);
            Facade.IPoint         facPoint = new Facade.Point();
            Entities.Point        deliveryRunCollectionPoint = null;
            if (org.Defaults[0].GroupageDeliveryRunCollectionPoint > 0)
            {
                deliveryRunCollectionPoint = facPoint.GetPointForPointId(org.Defaults[0].GroupageDeliveryRunCollectionPoint);
            }

            dsOrders.Tables[0].Columns.Add("CollectFromPointID", typeof(int));
            dsOrders.Tables[0].Columns.Add("CollectFromPoint", typeof(string));
            dsOrders.Tables[0].Columns.Add("CollectAtDateTime", typeof(DateTime));
            dsOrders.Tables[0].Columns.Add("CollectAtAnyTime", typeof(bool));
            dsOrders.Tables[0].Columns.Add("LoadOrder", typeof(string));
            dsOrders.Tables[0].Columns.Add("DeliveryOrder", typeof(int));

            int loadOrder = 1;

            foreach (DataRow row in dsOrders.Tables[0].Rows)
            {
                row["CollectFromPointID"] = (int)row["DeliveryRunCollectionPointID"];
                row["CollectFromPoint"]   = row["DeliveryRunCollectionPointDescription"].ToString();
                row["CollectAtDateTime"]  = (DateTime)row["DeliveryRunCollectionDateTime"];
                row["CollectAtAnyTime"]   = (bool)row["DeliveryRunCollectionIsAnyTime"];
                if (loadOrder == dsOrders.Tables[0].Rows.Count)
                {
                    row["LoadOrder"] = "L";
                }
                else
                {
                    row["LoadOrder"] = loadOrder.ToString();
                }
                loadOrder++;

                // Set the default collection point to that specified by the organisation settings
                if (row["LastPlannedOrderActionID"] == DBNull.Value)
                {
                    if (deliveryRunCollectionPoint != null)
                    {
                        row["CollectFromPointID"] = deliveryRunCollectionPoint.PointId;
                        row["CollectFromPoint"]   = deliveryRunCollectionPoint.Description;
                    }
                }
            }

            dsOrders.AcceptChanges();
            OrderData = dsOrders;
            grdOrders.Rebind();
        }
        private void PopulateJobInformation()
        {
            // Populate the Job fieldset.
            lblJobId.Text = m_jobId.ToString();
            ucJobStateIndicator.JobState = m_job.JobState;
            lblJobType.Text = Utilities.UnCamelCase(m_job.JobType.ToString());
            if (m_job.CurrentTrafficArea == null)
            {
                lblCurrentTrafficArea.Text = "Unknown";
            }
            else
            {
                lblCurrentTrafficArea.Text = m_job.CurrentTrafficArea.TrafficAreaName;
            }

            // Populate the Job Details fieldset.
            Facade.IOrganisation  facOrganisation = new Facade.Organisation();
            Entities.Organisation client          = facOrganisation.GetForIdentityId(m_job.IdentityId);
            lblLoadNumber.Text     = m_job.LoadNumber;
            lblLoadNumberText.Text = client.LoadNumberText;
            if (m_job.JobType == eJobType.Return)
            {
                lblReturnReferenceNumber.Text = m_job.ReturnReceiptNumber;
            }
            else
            {
                lblReturnReferenceNumber.Text = "N/A";
            }
            int numberOfPallets = 0;

            foreach (Entities.Instruction instruction in m_job.Instructions)
            {
                if (instruction.InstructionTypeId == (int)eInstructionType.Load)
                {
                    numberOfPallets = numberOfPallets + instruction.TotalPallets;
                }
            }

            lblNumberOfPallets.Text = numberOfPallets.ToString();
            if (m_job.ForCancellation)
            {
                lblMarkedForCancellation.Text = "Yes - " + m_job.ForCancellationReason;
            }
            else
            {
                lblMarkedForCancellation.Text = "No";
            }

            if (m_job.PCVs.Count > 0)
            {
                lblTakingPCVs.Text = "YES - INFORM DRIVER";
            }
            else
            {
                lblTakingPCVs.Text = "No";
            }
        }
Esempio n. 6
0
        protected void LoadInvoicePreparationProgress()
        {
            Facade.IInvoice facProgress = new Facade.Invoice();

            string userName = ((Entities.CustomPrincipal)Page.User).UserName;

            ClearFields();

            m_InvoicePreparation = facProgress.LoadInvoicePreparationProgress(userName);

            // Load Params If Entity Is Populated
            if (m_InvoicePreparation != null)
            {
                lblSaveProgressNotification.Visible   = true;
                lblSaveProgressNotification.ForeColor = Color.SeaGreen;
                lblSaveProgressNotification.Text      = "The progress of your last search has been loaded.  You can turn this off using the 'Clear Filter' button.";

                cboClient.SelectedValue = m_InvoicePreparation.ClientId.ToString();
                m_IdentityId            = Convert.ToInt32(m_InvoicePreparation.ClientId.ToString());
                Facade.IOrganisation facOrganisation = new Facade.Organisation();
                cboClient.Text = facOrganisation.GetForIdentityId(m_InvoicePreparation.ClientId).OrganisationName;

                dteStartDate.SelectedDate = m_InvoicePreparation.StartDate;
                dteEndDate.SelectedDate   = m_InvoicePreparation.EndDate;

                // Load Array List To Grid After Loaded
                jobIdCSV = m_InvoicePreparation.JobIdCSV; // ie: '234,234,233'

                hidSelectedJobs.Value = "," + jobIdCSV;

                if (jobIdCSV != null && jobIdCSV.Length > 0)
                {
                    m_selectedJobs.Clear();

                    string[] jobIds = jobIdCSV.Split(',');

                    foreach (string jobId in jobIds)
                    {
                        m_selectedJobs.Add(jobId);
                    }

                    LoadGrid();

                    btnSaveFilter.Visible = true;
                }
            }
            else
            {
                lblSaveProgressNotification.Visible   = true;
                lblSaveProgressNotification.ForeColor = Color.Red;
                lblSaveProgressNotification.Text      = "No filter progress found.";
                btnLoadFilter.Visible = false;
            }
        }
Esempio n. 7
0
        private void ConfigureDisplay()
        {
            if (!string.IsNullOrEmpty(Request.QueryString[c_customerID_QS]))
            {
                int id = int.Parse(Request.QueryString[c_customerID_QS]);
                Facade.IOrganisation facOrganisation = new Facade.Organisation();

                organisation = facOrganisation.GetForIdentityId(id);

                RadComboBoxItem listItem = new RadComboBoxItem(organisation.OrganisationDisplayName, organisation.IdentityId.ToString());
                cboClient.Items.Add(listItem);
                cboClient.SelectedValue = organisation.IdentityId.ToString();

                hidSelectedClientsValues.Value = organisation.IdentityId.ToString() + ",";
                hidSelectedClientsText.Value   = organisation.OrganisationDisplayName + ",";
            }

            DateTime startDate = DateTime.Today.AddMonths(-1);

            System.Globalization.GregorianCalendar cal = new System.Globalization.GregorianCalendar();


            if (!string.IsNullOrEmpty(Request.QueryString[c_startDate_QS]))
            {
                this.rdiStartDate.SelectedDate = DateTime.Parse(Request.QueryString[c_startDate_QS], null, System.Globalization.DateTimeStyles.RoundtripKind);
            }
            else
            {
                this.rdiStartDate.SelectedDate = new DateTime(startDate.Year, startDate.Month, 01);
            }

            if (!string.IsNullOrEmpty(Request.QueryString[c_endDate_QS]))
            {
                this.rdiEndDate.SelectedDate = DateTime.Parse(Request.QueryString[c_endDate_QS], null, System.Globalization.DateTimeStyles.RoundtripKind);
            }
            else
            {
                this.rdiEndDate.SelectedDate = new DateTime(startDate.Year, startDate.Month, cal.GetDaysInMonth(startDate.Year, startDate.Month));
            }


            lblMode.Text = IsClient ? "Client" : "Sub-Contractor";

            if (!string.IsNullOrEmpty(cboClient.SelectedValue) &&
                !string.IsNullOrEmpty(Request.QueryString[c_startDate_QS]) &&
                !string.IsNullOrEmpty(Request.QueryString[c_endDate_QS]))
            {
                Refresh();
            }

            this.rfvCboClient.Enabled = !IsClient;

            seSelectedClients.Visible = lblSelectedClients.Visible = btnRemoveSelectedClients.Visible = btnAddCboClient.Visible = IsClient;
        }
        void cboClient_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            // Get the Account Codes(s) for the Customer
            Facade.IOrganisation  facOrg = new Facade.Organisation();
            Entities.Organisation org    = facOrg.GetForIdentityId(int.Parse(cboClient.SelectedValue));

            lblAccountCode.Text = org.AccountCode;

            CultureInfo culture = new CultureInfo(org.LCID);

            this.txtNETAmount.Culture = culture;
        }
Esempio n. 9
0
        private void LoadClientAuditTrail()
        {
            pnlClient.Visible = true;

            Facade.IOrganisation  facOrganisation = new Facade.Organisation();
            Entities.Organisation currentOrg      = facOrganisation.GetForIdentityId(currentID);

            lblPalletBalanceType.Text = "Client Pallet Audit Trail : " + currentOrg.OrganisationName;

            Facade.IPalletBalance facPalletBalance = new Facade.Pallet();
            lvClientAudit.DataSource = facPalletBalance.GetClientAuditTrail(currentID, int.Parse(rcbPalletType.SelectedValue), rdiStartDate.SelectedDate.Value, rdiEndDate.SelectedDate.Value);
            lvClientAudit.DataBind();
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int identityId = Convert.ToInt32(Request.QueryString["IdentityId"]);

            // Telephone Number
            // Fax Number
            // Primary Contact Email
            // Head Office Address

            Entities.Organisation organisation = null;

            if (identityId > 0)
            {
                string cacheName = "_organisation" + identityId.ToString();

                if (Cache[cacheName] == null)
                {
                    Facade.IOrganisation facOrganisation = new Facade.Organisation();
                    organisation = facOrganisation.GetForIdentityId(identityId);
                    Cache.Add(cacheName, organisation, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 20, 0), System.Web.Caching.CacheItemPriority.Normal, null);
                }
                else
                {
                    organisation = (Entities.Organisation)Cache[cacheName];
                }
            }

            if (organisation != null)
            {
                // An organisation has been selected for viewing so display it.
                XslCompiledTransform transformer = new XslCompiledTransform();
                transformer.Load(Server.MapPath(@"..\xsl\organisationContactDetails.xsl"));

                XmlUrlResolver resolver  = new XmlUrlResolver();
                XPathNavigator navigator = organisation.ToXml().CreateNavigator();

                // Populate the Organisation Contact Details.
                StringWriter sw = new StringWriter();
                transformer.Transform(navigator, null, sw);
                Response.Write(sw.GetStringBuilder().ToString());

                if (Response.IsClientConnected)
                {
                    Response.Flush();
                    Response.End();
                }
                return;
            }
        }
Esempio n. 11
0
        private void PopulateClient()
        {
            // Get the organisation
            Facade.IOrganisation facOrganisation = new Facade.Organisation();

            // Configure the DbCombo box
            cboClient.Text          = facOrganisation.GetForIdentityId(m_job.IdentityId).OrganisationName;
            cboClient.SelectedValue = m_job.IdentityId.ToString();

            // Can't change the client for a job once it is created.
            if (m_isUpdate)
            {
                cboClient.Enabled = false;
            }
        }
Esempio n. 12
0
        private int GetDecimalPlaces(OrderGroup orderGroup)
        {
            int decimalPlaces = 2;

            if (orderGroup != null && orderGroup.Orders.Count > 0)
            {
                Facade.IOrganisation facOrg = new Facade.Organisation();
                Entities.OrganisationDefaultCollection defaults = facOrg.GetForIdentityId(orderGroup.Orders[0].CustomerIdentityID).Defaults;
                if (defaults != null && defaults.Count > 0)
                {
                    decimalPlaces = defaults[0].RateDecimalPlaces;
                }
            }

            return(decimalPlaces);
        }
Esempio n. 13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            m_jobId = Convert.ToInt32(Request.QueryString["jobId"]);

            if (m_jobId > 0)
            {
                m_isUpdate = true;
            }

            // Retrieve the job from the session variable
            m_job = (Entities.Job)Session[wizard.C_JOB];

            if (Session[wizard.C_INSTRUCTION_INDEX] != null)
            {
                m_instructionIndex = (int)Session[wizard.C_INSTRUCTION_INDEX];

                if (!m_isUpdate && m_instructionIndex != m_job.Instructions.Count)
                {
                    m_isAmendment = true;
                }
            }

            if (Session[wizard.C_INSTRUCTION] != null)
            {
                m_instruction = (Entities.Instruction)Session[wizard.C_INSTRUCTION];
            }

            if (!IsPostBack)
            {
                // Set the company
                Facade.IOrganisation facOrganisation = new Facade.Organisation();
                m_company = facOrganisation.GetForIdentityId((int)Session[wizard.C_POINT_FOR]).OrganisationName;

                // Set the town
                Facade.IPostTown facPostTown = new Facade.Point();
                m_town = facPostTown.GetPostTownForTownId((int)Session[wizard.C_TOWN_ID]).TownName;

                // Set the description
                m_description = Session[wizard.C_POINT_NAME].ToString();

                m_instruction = (Entities.Instruction)Session[wizard.C_INSTRUCTION];

                btnNext.Attributes.Add("onClick", "javascript:HidePage();");
                btnCancel.Attributes.Add("onClick", wizard.C_CONFIRM_MESSAGE);
            }
        }
Esempio n. 14
0
        private void BindTrunkInstruction(Entities.Instruction instruction)
        {
            // The instruction to convert is currently a trunk instruction so will
            // either be converted to a drop instruction or the point will be changed
            // so that the orders involved will be taken to a different location.
            // In the case when instruction will be converted to a drop instruction,
            // this is only possible for the orders that have not already been planned
            // for delivery.
            // In the case of changing the trunk location, this can only be done for the
            // end of the collection run, otherwise the order's collection chain will be broken.

            mvConvertInstruction.SetActiveView(vwConvertTrunk);

            var facJob          = new Facade.Job();
            var facOrganisation = new Facade.Organisation();

            var job = facJob.GetJob(instruction.JobId, true, true);

            grdOrdersOnTrunk.DataSource                   = from o in instruction.CollectDrops.Cast <Entities.CollectDrop>().Select(cd => cd.Order)
                                                   let ci = (from i in job.Instructions where i.InstructionTypeId == (int)eInstructionType.Load && i.CollectDrops.Cast <Entities.CollectDrop>().FirstOrDefault(cd => cd.OrderID == o.OrderID) != null select i).Single()
                                                            let client = facOrganisation.GetForIdentityId(o.CustomerIdentityID)
                                                                         select new ConvertInstructionOrderData()
            {
                OrderID = o.OrderID,
                CustomerOrganisationName = client.OrganisationName,
                BusinessTypeDescription  = GetBusinessTypeDescription(o.BusinessTypeID),
                OrderServiceLevel        = o.OrderServiceLevel,
                CustomerOrderNumber      = o.CustomerOrderNumber,
                DeliveryOrderNumber      = o.DeliveryOrderNumber,
                Message                    = GetTrunkConversionMessage(ci, instruction, o),
                CollectionPointID          = ci.PointID,
                CollectionPointDescription = ci.Point.Description,
                CollectionDateTime         = ci.BookedDateTime,
                CollectionIsAnyTime        = ci.IsAnyTime,
                DeliveryPointID            = instruction.PointID,
                DeliveryPointDescription   = instruction.Point.Description,
                DeliveryDateTime           = instruction.BookedDateTime,
                DeliveryIsAnyTime          = instruction.IsAnyTime,
                DeliveringResource         = GetAssignedResource(job, instruction, o),
                LCID        = o.LCID,
                ForeignRate = o.ForeignRate
            };

            grdOrdersOnDrop.DataBind();
        }
Esempio n. 15
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage);

            if (!IsPostBack)
            {
                int identityId = Convert.ToInt32(Request.QueryString["identityId"]);

                if (identityId > 0)
                {
                    cboClient.SelectedValue = identityId.ToString();

                    Facade.IOrganisation facOrganisation = new Facade.Organisation();
                    cboClient.Text = facOrganisation.GetForIdentityId(identityId).OrganisationName;

                    PopulatePoints();
                }
            }
        }
Esempio n. 16
0
        private void BindRepeater()
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            DataSet dsBusinessType;

            int identityID;

            int.TryParse(cboClient.SelectedValue, out identityID);

            organisation = facOrganisation.GetForIdentityId(identityID);

            dsBusinessType = facBusinessType.GetAll();

            repBusinessType.DataSource = dsBusinessType;
            repBusinessType.DataBind();
            grdNormal.Rebind();
            grdSummary.Rebind();
        }
Esempio n. 17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!this.IsPostBack)
            {
                Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage, eSystemPortion.SearchForPODs);

                //Get the user's Identity row
                Facade.IUser  facUser = new Facade.User();
                SqlDataReader reader  = facUser.GetRelatedIdentity(((Entities.CustomPrincipal)Page.User).UserName);
                reader.Read();
                //Is the User a Client User
                if ((eRelationshipType)reader["RelationshipTypeId"] == eRelationshipType.IsClient)
                {
                    //Set the Client combo yo the Client of the User and diable it
                    int clientID = (int)reader["RelatedIdentityId"];
                    UserClientID            = clientID;
                    cboClient.SelectedValue = Convert.ToString(clientID);
                    Facade.IOrganisation  facOrganisation = new Facade.Organisation();
                    Entities.Organisation organisation    = facOrganisation.GetForIdentityId(clientID);
                    cboClient.Text    = organisation.OrganisationName;
                    cboClient.Enabled = false;
                }
                reader.Close();
            }

            if (UserClientID.HasValue)
            {
                ConfigureClientUI(); //Tweak the grid headings etc. so that the are relevant for a Client user
            }
            if (!dteDateOfDeliveryFrom.SelectedDate.HasValue)
            {
                dteDateOfDeliveryFrom.SelectedDate = DateTime.Today.AddMonths(-5);
            }

            if (!dteDateOfDeliveryTo.SelectedDate.HasValue)
            {
                dteDateOfDeliveryTo.SelectedDate = DateTime.Today.AddMonths(1);
            }

            // retrive the dataset from viewstate
            dsPODList = (DataSet)ViewState[C_PODDATA_VS];
        }
Esempio n. 18
0
        private void BindDropInstruction(Entities.Instruction instruction)
        {
            // The instruction to convert is currently a drop instruction so will be
            // converted to a trunk instruction (most likely for cross-docking).
            // Performing this action is only permissable if the new movement represented
            // by each order's involvement on the run can sensibly be attached to end of the
            // collection run for the order.  This is so that the chain for each order is maintained.

            mvConvertInstruction.SetActiveView(vwConvertDrop);

            var facJob          = new Facade.Job();
            var facOrganisation = new Facade.Organisation();

            var job = facJob.GetJob(instruction.JobId, true, true);

            grdOrdersOnDrop.DataSource                   = from o in instruction.CollectDrops.Cast <Entities.CollectDrop>().Select(cd => cd.Order)
                                                  let ci = (from i in job.Instructions where i.InstructionTypeId == (int)eInstructionType.Load && i.CollectDrops.Cast <Entities.CollectDrop>().FirstOrDefault(cd => cd.OrderID == o.OrderID) != null select i).Single()
                                                           let client = facOrganisation.GetForIdentityId(o.CustomerIdentityID)
                                                                        select new ConvertInstructionOrderData()
            {
                OrderID = o.OrderID,
                CustomerOrganisationName = client.OrganisationName,
                BusinessTypeDescription  = GetBusinessTypeDescription(o.BusinessTypeID),
                OrderServiceLevel        = o.OrderServiceLevel,
                CustomerOrderNumber      = o.CustomerOrderNumber,
                DeliveryOrderNumber      = o.DeliveryOrderNumber,
                Message                    = GetDropConversionMessage(ci, instruction, o),
                CollectionPointID          = ci.PointID,
                CollectionPointDescription = ci.Point.Description,
                CollectionDateTime         = ci.BookedDateTime,
                CollectionIsAnyTime        = ci.IsAnyTime,
                DeliveryPointID            = instruction.PointID,
                DeliveryPointDescription   = instruction.Point.Description,
                DeliveryDateTime           = instruction.BookedDateTime,
                DeliveryIsAnyTime          = instruction.IsAnyTime,
                DeliveringResource         = GetAssignedResource(job, instruction, o),
                LCID        = o.LCID,
                ForeignRate = o.ForeignRate
            };

            grdOrdersOnDrop.DataBind();
        }
Esempio n. 19
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage);

            Facade.IUser  facUser = new Facade.User();
            SqlDataReader reader  = facUser.GetRelatedIdentity(((Entities.CustomPrincipal)Page.User).UserName);

            reader.Read();

            if ((eRelationshipType)reader["RelationshipTypeId"] == eRelationshipType.IsClient)
            {
                cboClient.SelectedValue = Convert.ToString((int)reader["RelatedIdentityId"]);
                Facade.IOrganisation  facOrganisation = new Facade.Organisation();
                Entities.Organisation organisation    = facOrganisation.GetForIdentityId((int)reader["RelatedIdentityId"]);
                cboClient.Text    = organisation.OrganisationName;
                cboClient.Enabled = false;
            }

            // Put user code to initialize the page here
        }
Esempio n. 20
0
        protected void btnApproveOrganisation_Click(object sender, EventArgs e)
        {
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            int organisationID = Convert.ToInt32(Request.QueryString["OrganisationID"].ToString());

            this.Organisation = facOrganisation.GetForIdentityId(organisationID);
            this.Organisation.IdentityStatus = eIdentityStatus.Active;

            Entities.FacadeResult result = null;
            result = facOrganisation.Update(this.Organisation, this.Page.User.Identity.Name);

            if (result.Success)
            {
                this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ApprovePoint", "window.opener.__doPostBack('','Refresh');window.close();", true);
            }
            else
            {
                idErrors.Infringements = result.Infringements;
                idErrors.DisplayInfringments();
                idErrors.Visible = true;
            }
        }
        private void LoadGrid()
        {
            int       clientId  = 0;
            DateTime  startDate = DateTime.MinValue;
            DateTime  endDate   = DateTime.MinValue;
            eJobState jobState  = new eJobState();

            Facade.IOrganisation  facOrg = new Facade.Organisation();
            Entities.Organisation enOrg  = new Entities.Organisation();

            // Client
            if (cboClient.Text != "")
            {
                clientId          = Convert.ToInt32(cboClient.SelectedValue);
                pnlFilter.Visible = true;
            }

            if (cboClient.SelectedValue != "")
            {
                clientId          = Convert.ToInt32(cboClient.SelectedValue);
                enOrg             = facOrg.GetForIdentityId(Convert.ToInt32(cboClient.SelectedValue));
                cboClient.Text    = enOrg.OrganisationName;
                pnlFilter.Visible = true;
            }
            //else
            //    pnlFilter.Visible = false;

            // Date Range
            if (dteStartDate.SelectedDate != DateTime.MinValue)
            {
                startDate = dteStartDate.SelectedDate.Value;
                startDate = startDate.Subtract(startDate.TimeOfDay);
            }

            if (dteEndDate.SelectedDate != DateTime.MinValue)
            {
                endDate = dteEndDate.SelectedDate.Value;
                endDate = endDate.Subtract(endDate.TimeOfDay);
                endDate = endDate.Add(new TimeSpan(23, 59, 59));
            }

            // Get Jobs to Invoice
            Facade.IInvoice facInvoice = new Facade.Invoice();
            DataSet         dsInvoicing;

            bool posted = false;

            if (startDate != DateTime.MinValue || endDate != DateTime.MinValue)
            {
                dsInvoicing = facInvoice.GetJobsToInvoiceWithParamsAndDate(clientId, jobState, posted, startDate, endDate);
            }
            else
            {
                if (clientId == 0)
                {
                    dsInvoicing = facInvoice.GetAllJobsToInvoice();
                }
                else
                {
                    dsInvoicing = facInvoice.GetJobsToInvoiceWithParams(clientId, jobState, posted);
                }
            }

            // Check whether account is on hold
            if (dsInvoicing.Tables[0].Rows.Count > 0)
            {
                if (Convert.ToInt32(dsInvoicing.Tables[0].Rows[0]["OnHold"]) == 1)
                {
                    dlJob.Enabled = false;

                    if (string.IsNullOrEmpty(cboClient.Text))
                    {
                        lblOnHold.Visible = true;
                        lblOnHold.Text    = "Client accounts are on hold, please update their on-hold status in order to raise invoices.</A>";
                    }
                    else
                    {
                        lblOnHold.Visible = true;
                        lblOnHold.Text    = cboClient.Text + "'s account has been put on hold, please go to <A HREF=../Organisation/addupdateorganisation.aspx?IdentityId=" + Convert.ToInt32(cboClient.SelectedValue) + ">" + cboClient.Text + "'s details to change.</A>";
                    }
                }
                else
                {
                    lblOnHold.Visible = false;
                }

                dlJob.Visible = true;
            }
            else
            {
                lblOnHold.Visible = true;
                lblOnHold.Text    = "With the given parameters no jobs have been found.";
                dlJob.Visible     = false;
            }

            DataView dvInvoice = new DataView(dsInvoicing.Tables[0]);

            // Sort By
            foreach (ListItem sortField in rdoSortType.Items)
            {
                if (sortField.Selected)
                {
                    dvInvoice.Sort = sortField.Text.Replace(" ", "");
                }
            }

            // Load List
            dlJob.DataSource = dvInvoice;

            dlJob.DataBind();

            lblJobCount.Text = "There are " + dlJob.Items.Count.ToString() + " jobs ready to invoice.";

            pnlNormalJob.Visible = true;
            btnFilter.Visible    = true;
            btnFilter1.Visible   = true;
            btnClear.Visible     = true;
            btnClear1.Visible    = true;
            pnlSort.Visible      = true;
            lblJobCount.Visible  = true;
        }
Esempio n. 22
0
        private void BindJob()
        {
            using (Facade.IJob facJob = new Facade.Job())
            {
                LoadJob();

                using (Facade.IOrganisation facOrganisation = new Facade.Organisation())
                    m_organisation = facOrganisation.GetForIdentityId(m_job.IdentityId);

                XmlDocument          jobDocument = m_job.ToXml();
                XslCompiledTransform transformer = new XslCompiledTransform();
                transformer.Load(Server.MapPath(@"..\..\..\xsl\instructions.xsl"));
                XmlUrlResolver resolver  = new XmlUrlResolver();
                XPathNavigator navigator = jobDocument.CreateNavigator();

                // Populate the Collections.
                XsltArgumentList collectionArgs = new XsltArgumentList();
                if (m_job.JobType == eJobType.PalletReturn)
                {
                    collectionArgs.AddParam("InstructionTypeId", "", "5");
                }
                else
                {
                    collectionArgs.AddParam("InstructionTypeId", "", "1");
                }
                collectionArgs.AddParam("DocketText", "", m_organisation.DocketNumberText);
                collectionArgs.AddParam("webserver", "", Orchestrator.Globals.Configuration.WebServer);
                StringWriter sw = new StringWriter();
                transformer.Transform(navigator, collectionArgs, sw);
                lblCollections.Text = sw.GetStringBuilder().ToString();

                // Populate the Deliveries.
                sw = new StringWriter();
                XsltArgumentList deliveryArgs = new XsltArgumentList();
                deliveryArgs.AddParam("InstructionTypeId", "", "2,6,7");
                deliveryArgs.AddParam("DocketText", "", m_organisation.DocketNumberText);
                deliveryArgs.AddParam("webserver", "", Orchestrator.Globals.Configuration.WebServer);
                transformer.Transform(navigator, deliveryArgs, sw);
                lblDeliveries.Text = sw.GetStringBuilder().ToString();

                // Populate the Pallet Handling.
                sw = new StringWriter();
                XsltArgumentList leavePalletArgs = new XsltArgumentList();
                leavePalletArgs.AddParam("InstructionTypeId", "", "3");
                leavePalletArgs.AddParam("DocketText", "", m_organisation.DocketNumberText);
                leavePalletArgs.AddParam("webserver", "", Orchestrator.Globals.Configuration.WebServer);
                transformer.Transform(navigator, leavePalletArgs, sw);
                lblLeavePallets.Text = sw.GetStringBuilder().ToString();
                sw = new StringWriter();
                XsltArgumentList dehirePalletArgs = new XsltArgumentList();
                dehirePalletArgs.AddParam("InstructionTypeId", "", "4");
                dehirePalletArgs.AddParam("DocketText", "", m_organisation.DocketNumberText);
                dehirePalletArgs.AddParam("webserver", "", Orchestrator.Globals.Configuration.WebServer);
                transformer.Transform(navigator, dehirePalletArgs, sw);
                lblDeHirePallets.Text = sw.GetStringBuilder().ToString();

                if (lblLeavePallets.Text == lblDeHirePallets.Text)
                {
                    lblLeavePallets.Text  = "No Pallet Handling has been configured for this job.";
                    lblDeHirePallets.Text = String.Empty;
                }
            }

            LoadEmptyPallets();
        }
        /// <summary>
        /// Populates the location object with the new information.
        /// </summary>
        private void PopulateLocation()
        {
            Entities.Point thisPoint;

            if (m_location == null)
            {
                // adding a new location, configure identity and a new address
                m_location            = new Orchestrator.Entities.OrganisationLocation();
                m_location.IdentityId = m_identityId;
                thisPoint             = new Entities.Point();
                m_location.Point      = thisPoint;
            }
            else
            {
                thisPoint = m_location.Point;
            }

            if (_individual == null)
            {
                _individual = new Orchestrator.Entities.Individual();
                _individual.IndividualType = eIndividualType.Contact;
            }

            //Set the indiviudal details;
            _individual.FirstNames = txtFirstNames.Text;
            _individual.LastName   = txtLastName.Text;
            _individual.Title      = (eTitle)Enum.Parse(typeof(eTitle), cboTitle.SelectedValue);
            if (_individual.Contacts == null)
            {
                _individual.Contacts = new Orchestrator.Entities.ContactCollection();
            }

            _individual.Contacts.Add(new Orchestrator.Entities.Contact(eContactType.Email, txtEmailAddress.Text));
            _individual.Contacts.Add(new Orchestrator.Entities.Contact(eContactType.Telephone, txtTelephone.Text));
            _individual.Contacts.Add(new Orchestrator.Entities.Contact(eContactType.Fax, txtFax.Text));


            // Update the location based on it's settings.
            // location information
            m_location.OrganisationLocationName = txtLocationName.Text;
            m_location.OrganisationLocationType = (eOrganisationLocationType)Enum.Parse(typeof(eOrganisationLocationType), cboType.SelectedValue.Replace(" ", ""), true);
            m_location.TelephoneNumber          = txtTelephone.Text;
            m_location.FaxNumber = txtFax.Text;

            // address information
            thisPoint.Description = m_organisationName + " - " + txtPostTown.Text;
            Facade.IPostTown facPostTown = new Facade.Point();
            thisPoint.PostTown = facPostTown.GetPostTownForTownId(Convert.ToInt32(cboClosestTown.SelectedValue));
            if (thisPoint.Address == null)
            {
                thisPoint.Address = new Entities.Address();
            }
            thisPoint.Address.AddressType  = eAddressType.Correspondence;
            thisPoint.Address.AddressLine1 = txtAddressLine1.Text;
            thisPoint.Address.AddressLine2 = txtAddressLine2.Text;
            thisPoint.Address.AddressLine3 = txtAddressLine3.Text;
            thisPoint.Address.PostTown     = txtPostTown.Text;
            thisPoint.Address.County       = txtCounty.Text;
            thisPoint.Address.PostCode     = txtPostCode.Text;
            thisPoint.Address.Longitude    = Decimal.Parse(txtLongitude.Text);
            thisPoint.Address.Latitude     = Decimal.Parse(txtLatitude.Text);
            if (thisPoint.Address.TrafficArea == null)
            {
                thisPoint.Address.TrafficArea = new Entities.TrafficArea();
            }

            thisPoint.Address.CountryDescription        = cboCountry.SelectedItem.Text;
            thisPoint.Address.CountryId                 = Convert.ToInt32(cboCountry.SelectedValue);
            thisPoint.Address.TrafficArea.TrafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue);
            thisPoint.IdentityId       = m_identityId;
            thisPoint.Latitude         = thisPoint.Address.Latitude;
            thisPoint.Longitude        = thisPoint.Address.Longitude;
            thisPoint.OrganisationName = m_organisationName;

            Facade.IOrganisation facOrganisation            = new Facade.Organisation();
            Orchestrator.Entities.Organisation organisation = facOrganisation.GetForIdentityId(thisPoint.IdentityId);

            // set the radius if the address was changed by addressLookup
            // if the org has a default, use it, if not, use the system default.
            if (!String.IsNullOrEmpty(this.hdnSetPointRadius.Value))
            {
                if (organisation.Defaults[0].DefaultGeofenceRadius == null)
                {
                    thisPoint.Radius = Globals.Configuration.GPSDefaultGeofenceRadius;
                }
                else
                {
                    thisPoint.Radius = organisation.Defaults[0].DefaultGeofenceRadius;
                }
            }
        }
        private void BindPalletHandling(Entities.PalletDelivery palletDelivery)
        {
            btnGenerate.Text = "Update";

            m_isUpdateable = palletDelivery.PalletOrder.OrderStatus == eOrderStatus.Approved;

            rcbPalletHandlingAction.FindItemByValue(((int)palletDelivery.PalletAction).ToString()).Selected = true;

            if (palletDelivery.PalletAction == eInstructionType.DeHirePallets)
            {
                // Set the Customer Identity
                Facade.IOrganisation  facOrg = new Facade.Organisation();
                Entities.Organisation org    = facOrg.GetForIdentityId(palletDelivery.PalletOrder.CustomerIdentityID);

                rcbDeHireOrganisation.Text          = org.OrganisationName;
                rcbDeHireOrganisation.SelectedValue = org.IdentityId.ToString();

                deHireRow.Style.Remove("display");
            }

            Facade.IPoint facPoint = new Facade.Point();
            ucDeliveryPoint.SelectedPoint = facPoint.GetPointForPointId(palletDelivery.PalletOrder.DeliveryPointID);

            #region Delivery Date Time

            //Delivery Date
            dteDeliveryFromDate.SelectedDate = palletDelivery.PalletOrder.DeliveryFromDateTime;
            dteDeliveryByDate.SelectedDate   = palletDelivery.PalletOrder.DeliveryDateTime;
            dteDeliveryByTime.SelectedDate   = palletDelivery.PalletOrder.DeliveryDateTime;
            dteDeliveryFromTime.SelectedDate = palletDelivery.PalletOrder.DeliveryFromDateTime;

            if (palletDelivery.PalletOrder.DeliveryIsAnytime)
            {
                // Anytime
                rdDeliveryIsAnytime.Checked     = true;
                rdDeliveryTimedBooking.Checked  = false;
                rdDeliveryBookingWindow.Checked = false;

                dteDeliveryFromTime.Enabled   = false;
                hidDeliveryTimingMethod.Value = "anytime";
            }
            else if (palletDelivery.PalletOrder.DeliveryFromDateTime == palletDelivery.PalletOrder.DeliveryDateTime)
            {
                // Timed booking
                rdDeliveryIsAnytime.Checked     = false;
                rdDeliveryTimedBooking.Checked  = true;
                rdDeliveryBookingWindow.Checked = false;

                hidDeliveryTimingMethod.Value = "timed";
            }
            else
            {
                // Booking window
                rdDeliveryIsAnytime.Checked     = false;
                rdDeliveryTimedBooking.Checked  = false;
                rdDeliveryBookingWindow.Checked = true;

                hidDeliveryTimingMethod.Value = "window";
            }

            #endregion

            rntPalletDeliveryCharge.Value   = (double)palletDelivery.PalletOrder.ForeignRate;
            rntPalletDeliveryCharge.Culture = new CultureInfo(palletDelivery.PalletOrder.LCID);

            //Set Updateable flags.

            rcbPalletHandlingAction.Enabled = m_isUpdateable;
            rcbDeHireOrganisation.Enabled   = m_isUpdateable;

            ucDeliveryPoint.CanUpdatePoint = m_isUpdateable;

            dteDeliveryFromDate.Enabled = m_isUpdateable;
            dteDeliveryByDate.Enabled   = m_isUpdateable;
            dteDeliveryByTime.Enabled   = m_isUpdateable;
            dteDeliveryFromTime.Enabled = m_isUpdateable;

            rdDeliveryIsAnytime.Disabled     = !m_isUpdateable;
            rdDeliveryTimedBooking.Disabled  = !m_isUpdateable;
            rdDeliveryBookingWindow.Disabled = !m_isUpdateable;

            rntPalletDeliveryCharge.Enabled = m_isUpdateable;
        }
Esempio n. 25
0
        /// <summary>
        /// Load Report Depending On Invoice Type
        /// </summary>
        private ReportBase LoadReport()
        {
            // Configure the Session variables used to pass data to the report
            NameValueCollection reportParams = new NameValueCollection();

            //-------------------------------------------------------------------------------------
            //						Job/Collect-Drops/References/Demurrages Section
            //-------------------------------------------------------------------------------------
            Facade.IInvoice facInv = new Facade.Invoice();

            DataSet dsInv = null;

            if (m_isUpdate)
            {
                dsInv = facInv.GetJobsForInvoiceId(Convert.ToInt32(lblInvoiceNo.Text));
            }
            else
            {
                dsInv = facInv.GetJobsToInvoice(m_jobIdCSV);
            }

            reportParams.Add("JobIds", m_jobIdCSV);

            reportParams.Add("ExtraIds", m_extraIdCSV);

            //-------------------------------------------------------------------------------------
            //									Param Section
            //-------------------------------------------------------------------------------------
            // Fuel Type & Rate
            eInvoiceDisplayMethod fuelType;
            decimal newRate = 0;

            if (chkIncludeFuelSurcharge.Checked)
            {
                reportParams.Add("Fuel", "Include");

                // Pass The New Rate To Report if so...
                newRate = Convert.ToDecimal(txtFuelSurchargeRate.Text);
                reportParams.Add("FuelRate", newRate.ToString());

                // Pass FuelSurchargeType
                fuelType = (eInvoiceDisplayMethod)Enum.Parse(typeof(eInvoiceDisplayMethod), rdoFuelSurchargeType.SelectedValue);
                reportParams.Add("FuelType", fuelType.ToString());
            }

            // Override
            if (chkOverride.Checked)
            {
                reportParams.Add("Override", "Include");
                reportParams.Add("OverrideVAT", txtOverrideVAT.Text);
                reportParams.Add("OverrideNET", txtOverrideNetAmount.Text);
                reportParams.Add("OverrideGross", txtOverrideGrossAmount.Text);
                reportParams.Add("OverrideReason", txtOverrideReason.Text);
            }

            // PODs
            if (chkIncludePODs.Checked)
            {
                reportParams.Add("PODs", "Include");
            }

            // References
            if (chkIncludeReferences.Checked)
            {
                reportParams.Add("References", "Include");
            }

            // Job
            if (chkJobDetails.Checked)
            {
                reportParams.Add("JobDetails", "Include");

                // Demuragge
                if (chkIncludeDemurrage.Checked)
                {
                    reportParams.Add("Demurrage", "Include");

                    // Demurrage Type
                    try
                    {
                        eInvoiceDisplayMethod demurrageType = (eInvoiceDisplayMethod)Enum.Parse(typeof(eInvoiceDisplayMethod), rdoDemurrageType.SelectedValue);
                        reportParams.Add("DemurrageType", demurrageType.ToString());
                    }
                    catch (Exception) { }
                }
            }

            if (pnlExtras.Visible)
            {
                reportParams.Add("ExtraIds", Convert.ToString(ViewState["ExtraIdCSV"]));
                reportParams.Add("Extras", "Include");
            }

            // Extra details
            if (chkExtraDetails.Visible && chkExtraDetails.Checked)
            {
                reportParams.Add("ExtraDetail", "include");
            }

            // Self Bill Invoice Number
            if ((eInvoiceType)Enum.Parse(typeof(eInvoiceType), lblInvoiceType.Text) == eInvoiceType.SelfBill)
            {
                reportParams.Add("InvoiceType", "SelfBill");
                reportParams.Add("SelfBillInvoiceNumber", txtClientSelfBillInvoiceNumber.Text);
            }
            else
            {
                reportParams.Add("InvoiceType", "Normal");
            }

            // Client Name & Id
            if (m_isUpdate)
            {
                Facade.IInvoice facClient = new Facade.Invoice();

                DataSet ds = facClient.GetClientForInvoiceId(Convert.ToInt32(lblInvoiceNo.Text));

                try
                {
                    reportParams.Add("Client", Convert.ToString(ds.Tables[0].Rows[0]["Client"]));
                    reportParams.Add("ClientId", Convert.ToString(ds.Tables[0].Rows[0]["ClientId"]));

                    m_clientId = int.Parse(ds.Tables[0].Rows[0]["ClientId"].ToString());

                    if (!chkPostToExchequer.Checked)
                    {
                        btnSendToAccounts.Visible = true;
                        pnlInvoiceDeleted.Visible = true;
                    }
                }
                catch
                {
                }
            }
            else
            {
                if (Convert.ToString(Session["ClientName"]) != "")
                {
                    reportParams.Add("Client", Convert.ToString(Session["ClientName"]));
                }

                if (Convert.ToString(Session["ClientId"]) != "")
                {
                    reportParams.Add("ClientId", Convert.ToString(Session["ClientId"]));
                }

                if (m_clientId == 0)
                {
                    m_clientId = int.Parse(Session["ClientId"].ToString());
                }
                else
                {
                    Facade.IOrganisation  facOrg = new Facade.Organisation();
                    Entities.Organisation enOrg  = new Entities.Organisation();
                    enOrg = facOrg.GetForIdentityId(m_clientId);
                    reportParams.Add("Client", enOrg.OrganisationName.ToString());
                    reportParams.Add("ClientId", m_clientId.ToString());
                }
            }

            // Date Range
            if (Convert.ToDateTime(Session["StartDate"]).Date != DateTime.MinValue)
            {
                reportParams.Add("startDate", Convert.ToDateTime(Session["StartDate"]).ToString("dd/MM/yy"));
            }

            if (Convert.ToDateTime(Session["EndDate"]).Date != DateTime.MinValue)
            {
                reportParams.Add("endDate", Convert.ToDateTime(Session["EndDate"]).ToString("dd/MM/yy"));
            }

            // Invoice Id
            if (lblInvoiceNo.Text != "To Be Issued ... (This invoice has not yet been saved, add invoice to allocate Invoice No.)")
            {
                reportParams.Add("invoiceId", lblInvoiceNo.Text);
            }
            else
            {
                reportParams.Add("invoiceId", "0");
            }

            // Posted To Accounts
            if (chkPostToExchequer.Checked)
            {
                reportParams.Add("Accounts", "true");
            }

            int     vatNo   = 0;
            decimal vatRate = 0.00M;

            // VAT Rate
            facInv.GetVatRateForVatType(eVATType.Standard, dteInvoiceDate.SelectedDate.Value, out vatNo, out vatRate);
            reportParams.Add("VATrate", vatRate.ToString());

            // Invoice Date
            reportParams.Add("InvoiceDate", dteInvoiceDate.SelectedDate.Value.ToShortDateString());

            //-------------------------------------------------------------------------------------
            //									Load Report Section
            //-------------------------------------------------------------------------------------
            Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable]       = eReportType.Invoice;
            Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable]  = dsInv;
            Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable]   = rdoSortType.SelectedItem.Text.Replace(" ", "");
            Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table";
            Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable]     = reportParams;

            Orchestrator.Reports.ReportBase activeReport = null;
            eReportType reportType = 0;

            reportType = (eReportType)Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable];
            try
            {
                activeReport = new Orchestrator.Reports.Invoicing.rptInvoice();
            }
            catch (NullReferenceException e)
            {
                Response.Write(e.Message);
                Response.Flush();
                return(null);
            }

            if (activeReport != null)
            {
                try
                {
                    ApplicationLog.WriteTrace("Getting Data From Session Variable");
                    DataView view = null;
                    DataSet  ds   = (DataSet)Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable];

                    string sortExpression = (string)Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable];
                    ApplicationLog.WriteTrace("sortExpression ::" + sortExpression);
                    try
                    {
                        if (sortExpression.Length > 0)
                        {
                            view      = new DataView(ds.Tables[0]);
                            view.Sort = sortExpression;
                            activeReport.DataSource = view;
                        }
                        else
                        {
                            activeReport.DataSource = ds;
                        }

                        activeReport.DataMember = (string)Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable];
                    }
                    catch (Exception eX)
                    {
                        this.Trace.Write("Err1:" + eX.Message);
                        ApplicationLog.WriteTrace("GetReport :: Err1:" + eX.Message);
                    }
                    activeReport.Document.Printer.PrinterName = string.Empty;
                    activeReport.Document.Printer.PaperKind   = System.Drawing.Printing.PaperKind.A4;
                    //activeReport.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;
                    //activeReport.PrintWidth = activeReport.PageSettings.PaperWidth - (activeReport.PageSettings.Margins.Right + activeReport.PageSettings.Margins.Left);
                    activeReport.Run(false);
                }
                catch (Exception e)
                {
                    Response.Write(e.Message);
                    Response.Flush();
                    return(null);
                }
            }

            Session[Orchestrator.Globals.Constants.ReportSessionVariable] = activeReport;

            return(activeReport);
        }
Esempio n. 26
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            m_jobId = Convert.ToInt32(Request.QueryString["jobId"]);

            if (m_jobId > 0)
            {
                m_isUpdate = true;
            }

            // Retrieve the job from the session variable
            m_job = (Entities.Job)Session[wizard.C_JOB];

            if (Session[wizard.C_INSTRUCTION_INDEX] != null)
            {
                m_instructionIndex = (int)Session[wizard.C_INSTRUCTION_INDEX];

                if (!m_isUpdate && m_instructionIndex != m_job.Instructions.Count)
                {
                    m_isAmendment = true;
                }
            }

            if (!IsPostBack)
            {
                Facade.IOrganisation facOrganisation = new Facade.Organisation();
                btnCancel.Attributes.Add("onClick", wizard.C_CONFIRM_MESSAGE);

                if (Session[wizard.C_INSTRUCTION] != null)
                {
                    m_instruction = (Entities.Instruction)Session[wizard.C_INSTRUCTION];

                    switch ((eInstructionType)m_instruction.InstructionTypeId)
                    {
                    case eInstructionType.Load:
                        // Allow the user to collect from any location if this is a stock movement job.
                        if (m_job.IsStockMovement)
                        {
                            m_identityId = 0;
                        }
                        else
                        {
                            m_identityId = m_job.IdentityId;
                        }
                        lblCollection.Visible  = true;
                        lblCollectFrom.Visible = true;
                        lblDelivery.Visible    = false;
                        lblDeliverTo.Visible   = false;
                        lblCollectDrop.Text    = "Collection Details";
                        break;

                    case eInstructionType.Drop:
                        m_identityId           = m_instruction.ClientsCustomerIdentityID;
                        lblCollection.Visible  = false;
                        lblCollectFrom.Visible = false;
                        lblDelivery.Visible    = true;
                        lblDeliverTo.Visible   = true;
                        lblCollectDrop.Text    = "Delivery Details";

                        m_owner                = facOrganisation.GetNameForIdentityId(m_identityId);
                        cboOwner.Text          = m_owner;
                        cboOwner.SelectedValue = m_identityId.ToString();
                        cboOwner.Visible       = false;
                        lblOwner.Visible       = true;
                        lblOwner.Text          = m_owner;
                        break;
                    }
                }
                else
                {
                    m_instruction       = new Entities.Instruction();
                    m_instruction.JobId = m_jobId;

                    if (m_job.Instructions == null)
                    {
                        m_job.Instructions = new Entities.InstructionCollection();
                    }

                    switch ((ePointType)Session[wizard.C_POINT_TYPE])
                    {
                    case ePointType.Collect:
                        // Allow the user to collect from any location if this is a stock movement job.
                        if (m_job.IsStockMovement)
                        {
                            m_identityId = 0;
                        }
                        else
                        {
                            m_identityId = m_job.IdentityId;
                        }

                        m_owner                = facOrganisation.GetNameForIdentityId(m_job.IdentityId);
                        cboOwner.Text          = m_owner;
                        cboOwner.SelectedValue = m_identityId.ToString();

                        m_instruction.InstructionTypeId = (int)eInstructionType.Load;
                        lblCollection.Visible           = true;
                        lblCollectFrom.Visible          = true;
                        lblDelivery.Visible             = false;
                        lblDeliverTo.Visible            = false;
                        lblCollectDrop.Text             = "Collection Details";

                        #region Load the Default Collection Point

                        try
                        {
                            Entities.Organisation client       = facOrganisation.GetForIdentityId(m_job.IdentityId);
                            Facade.IPoint         facPoint     = new Facade.Point();
                            Entities.Point        defaultPoint = facPoint.GetPointForPointId(client.Defaults[0].DefaultCollectionPointId);
                            cboTown.SelectedValue  = defaultPoint.PostTown.TownId.ToString();
                            cboTown.Text           = defaultPoint.PostTown.TownName;
                            cboPoint.SelectedValue = defaultPoint.PointId.ToString();
                            cboPoint.Text          = defaultPoint.Description;

                            m_identityId = defaultPoint.IdentityId;
                            m_owner      = defaultPoint.OrganisationName;
                            m_pointId    = defaultPoint.PointId;
                            m_point      = defaultPoint.Description;
                            m_townId     = defaultPoint.PostTown.TownId;
                            m_town       = defaultPoint.PostTown.TownName;

                            cboOwner.Text          = m_owner;
                            cboOwner.SelectedValue = m_identityId.ToString();
                        }
                        catch { }

                        #endregion
                        break;
                    }

                    Session[wizard.C_INSTRUCTION] = m_instruction;

                    if (!m_isUpdate)
                    {
                        Session[wizard.C_INSTRUCTION_INDEX] = m_job.Instructions.Count;
                    }
                }

                if (m_instruction != null && m_instruction.Point != null)
                {
                    cboOwner.SelectedValue = m_instruction.Point.IdentityId.ToString();
                    cboOwner.Text          = m_instruction.Point.OrganisationName;

                    cboPoint.SelectedValue = m_instruction.PointID.ToString();
                    cboPoint.Text          = m_instruction.Point.Description;

                    cboTown.SelectedValue = m_instruction.Point.PostTown.TownId.ToString();
                    cboTown.Text          = m_instruction.Point.PostTown.TownName;
                }
            }
            else
            {
                m_instruction = (Entities.Instruction)Session[wizard.C_INSTRUCTION];
            }

            pnlCreateNewPoint.Visible = false;
        }
Esempio n. 27
0
        void btnAlterPoint_Click(object sender, EventArgs e)
        {
            Page.Validate("AlterPoint");

            if (Page.IsValid)
            {
                int ownerID = 0;

                #region Validate that the Point Name is Unique for this Organisation
                bool foundPointName = false;
                lblError.Visible = false;
                Orchestrator.Facade.IPoint facPoint = new Orchestrator.Facade.Point();
                Entities.Point             point    = facPoint.GetPointForPointId(PointID);

                ownerID = new Facade.Organisation().GetForName(cboNewPointOwner.Text).IdentityId;

                DataSet pointNames = facPoint.GetAllForOrganisation(ownerID, ePointType.Any, txtDescription.Text);
                foreach (DataRow row in pointNames.Tables[0].Rows)
                {
                    if (((string)row["Description"]) == txtDescription.Text && point.PointId != (int)row["PointId"])
                    {
                        foundPointName = true;
                    }
                }
                #endregion

                if (foundPointName)
                {
                    lblError.Text          = "The Description must be unique for this organisation.";
                    lblError.ForeColor     = Color.Red;
                    lblError.Visible       = true;
                    pnlPoint.Visible       = false;
                    pnlNewPoint.Visible    = true;
                    pnlFullAddress.Visible = false;
                }
                else
                {
                    Orchestrator.Facade.IPostTown  facPostTown = new Orchestrator.Facade.Point();
                    Orchestrator.Entities.PostTown town        = facPostTown.GetPostTownForTownId(int.Parse(cboClosestTown.SelectedValue));

                    // Set the point owner and description
                    point.OrganisationName = cboPoint.Text;
                    point.IdentityId       = ownerID;
                    point.Description      = txtDescription.Text;
                    point.PointCode        = this.txtPointCode.Text;

                    // Get the point type
                    switch (this.PointType)
                    {
                    case ePointType.Collect:
                        point.Collect = true;
                        break;

                    case ePointType.Deliver:
                        point.Deliver = true;
                        break;

                    case ePointType.Any:
                        point.Collect = true;
                        point.Deliver = true;
                        break;
                    }

                    // set the address
                    Orchestrator.Entities.Address address = new Orchestrator.Entities.Address();
                    address.AddressLine1       = txtAddressLine1.Text;
                    address.AddressLine2       = txtAddressLine2.Text;
                    address.AddressLine3       = txtAddressLine3.Text;
                    address.AddressType        = eAddressType.Point;
                    address.County             = txtCounty.Text;
                    address.CountryDescription = this.cboCountry.Text;
                    address.CountryId          = Convert.ToInt32(this.cboCountry.SelectedValue);
                    address.IdentityId         = ownerID;
                    decimal latitude = 0;
                    if (decimal.TryParse(hidLat.Value, out latitude))
                    {
                        address.Latitude = latitude;
                    }
                    decimal longitude = 0;
                    if (decimal.TryParse(hidLon.Value, out longitude))
                    {
                        address.Longitude = longitude;
                    }
                    address.PostCode = txtPostCode.Text.ToUpper();
                    address.PostTown = txtPostTown.Text;
                    if (address.TrafficArea == null)
                    {
                        address.TrafficArea = new Orchestrator.Entities.TrafficArea();
                    }

                    Facade.IOrganisation facOrganisation            = new Facade.Organisation();
                    Orchestrator.Entities.Organisation organisation = facOrganisation.GetForIdentityId(point.IdentityId);

                    // set the radius if the address was changed by addressLookup
                    // if the org has a default, use it, if not, use the system default.
                    if (!String.IsNullOrEmpty(this.hdnSetPointRadius.Value))
                    {
                        if (organisation.Defaults != null)
                        {
                            if (organisation.Defaults.Count > 0 && organisation.Defaults[0].DefaultGeofenceRadius.HasValue)
                            {
                                point.Radius = organisation.Defaults[0].DefaultGeofenceRadius;
                            }
                            else
                            {
                                point.Radius = Globals.Configuration.GPSDefaultGeofenceRadius;
                            }
                        }
                        else
                        {
                            point.Radius = Globals.Configuration.GPSDefaultGeofenceRadius;
                        }
                    }

                    // Get the Traffic Area for this Point
                    address.TrafficArea.TrafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue);

                    point.Address   = address;
                    point.Longitude = address.Longitude;
                    point.Latitude  = address.Latitude;
                    point.PostTown  = town;

                    point.PointNotes = txtPointNotes.Text;

                    if (ClientUserOrganisationIdentityID > 0)
                    {
                        point.PointStateId = ePointState.Unapproved;
                    }
                    else
                    {
                        point.PointStateId = ePointState.Approved;
                    }

                    point.PhoneNumber = txtPhoneNumber.Text;

                    string userId = ((Orchestrator.Entities.CustomPrincipal)Page.User).UserName;

                    // Create the new point
                    Entities.FacadeResult result = facPoint.Update(point, userId);

                    if (result.Success)
                    {
                        // get the Point with all parts populated.
                        this.SelectedPoint     = point;
                        cboPoint.Text          = point.Description;
                        cboPoint.SelectedValue = point.IdentityId.ToString() + "," + point.PointId.ToString();

                        pnlNewPoint.Visible             = false;
                        pnlPoint.Visible                = true;
                        inpCreateNewPointSelected.Value = string.Empty;
                    }
                    else
                    {
                        for (int i = 0; i < result.Infringements.Count; i++)
                        {
                            lblError.Text += result.Infringements[i].Description + Environment.NewLine;
                        }

                        lblError.ForeColor     = Color.Red;
                        lblError.Visible       = true;
                        pnlPoint.Visible       = false;
                        pnlNewPoint.Visible    = true;
                        pnlFullAddress.Visible = false;
                    }
                }
            }
        }
Esempio n. 28
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                #region Create the new point

                Entities.Point newPoint = new Entities.Point();

                Facade.IPostTown  facPostTown = new Facade.Point();
                Entities.PostTown town        = facPostTown.GetPostTownForTownId((int)Session[wizard.C_TOWN_ID]);

                // Set the point owner and description
                newPoint.IdentityId  = (int)Session[wizard.C_POINT_FOR];
                newPoint.Description = Session[wizard.C_POINT_NAME].ToString();

                // Get the point type
                switch ((ePointType)Session[wizard.C_POINT_TYPE])
                {
                case ePointType.Collect:
                    newPoint.Collect = true;
                    break;

                case ePointType.Deliver:
                    newPoint.Deliver = true;
                    break;

                case ePointType.Any:
                    newPoint.Collect = true;
                    newPoint.Deliver = true;
                    break;
                }

                // set the address
                Entities.Address address = new Entities.Address();
                address.AddressLine1 = txtAddressLine1.Text;
                address.AddressLine2 = txtAddressLine2.Text;
                address.AddressLine3 = txtAddressLine3.Text;
                address.AddressType  = eAddressType.Point;
                address.County       = txtCounty.Text;
                address.IdentityId   = newPoint.IdentityId;
                address.Latitude     = Decimal.Parse(txtLatitude.Text);
                address.Longitude    = Decimal.Parse(txtLongitude.Text);
                address.PostCode     = txtPostCode.Text;
                address.PostTown     = txtPostTown.Text;
                if (address.TrafficArea == null)
                {
                    address.TrafficArea = new Orchestrator.Entities.TrafficArea();
                }

                address.TrafficArea.TrafficAreaId = Convert.ToInt32(hidTrafficArea.Value);
                newPoint.Address   = address;
                newPoint.Longitude = address.Longitude;
                newPoint.Latitude  = address.Latitude;

                Facade.IOrganisation facOrganisation            = new Facade.Organisation();
                Orchestrator.Entities.Organisation organisation = facOrganisation.GetForIdentityId(newPoint.IdentityId);

                // set the radius if the address was changed by addressLookup
                // if the org has a default, use it, if not, use the system default.
                if (!String.IsNullOrEmpty(this.hdnSetPointRadius.Value))
                {
                    if (organisation.Defaults[0].DefaultGeofenceRadius == null)
                    {
                        newPoint.Radius = Globals.Configuration.GPSDefaultGeofenceRadius;
                    }
                    else
                    {
                        newPoint.Radius = organisation.Defaults[0].DefaultGeofenceRadius;
                    }
                }

                newPoint.PostTown   = town;
                newPoint.PointNotes = txtPointNotes.Text;

                string userId = ((Entities.CustomPrincipal)Page.User).UserName;

                // Create the new point
                Facade.IPoint         facPoint = new Facade.Point();
                Entities.FacadeResult result   = facPoint.Create(newPoint, userId);

                int pointId = facPoint.Create(newPoint, userId).ObjectId;

                #endregion

                if (pointId == 0)
                {
                    // This customer already has a point with this name
                    // Try to locate the point
                    Entities.PointCollection points = facPoint.GetClientPointsForName(newPoint.IdentityId, newPoint.Description);
                    if (points.Count == 1)
                    {
                        // The point id has been found!
                        pointId = points[0].PointId;
                    }
                    else
                    {
                        // Clear the session variables used to help add the new point
                        Session[wizard.C_POINT_TYPE] = null;
                        Session[wizard.C_POINT_FOR]  = null;
                        Session[wizard.C_POINT_NAME] = null;
                        Session[wizard.C_TOWN_ID]    = null;

                        GoToStep("P");
                    }
                }

                if (pointId > 0)
                {
                    // Reload the point to ensure we have all the ancillary entities
                    Entities.Point createdPoint = facPoint.GetPointForPointId(pointId);

                    if (m_isUpdate)
                    {
                        // Add the collect drop point information
                        if (m_instruction == null)
                        {
                            m_instruction = new Entities.Instruction();

                            m_instruction.JobId = m_jobId;
                            switch ((ePointType)(int)Session[wizard.C_POINT_TYPE])
                            {
                            case ePointType.Collect:
                                m_instruction.InstructionTypeId = (int)eInstructionType.Load;
                                break;

                            case ePointType.Deliver:
                                m_instruction.InstructionTypeId = (int)eInstructionType.Drop;
                                break;
                            }
                        }

                        m_instruction.Point         = createdPoint;
                        m_instruction.PointID       = createdPoint.PointId;
                        m_instruction.InstructionID = m_instruction.InstructionID;

                        if (m_instruction.InstructionTypeId == (int)eInstructionType.Drop)
                        {
                            m_instruction.ClientsCustomerIdentityID = createdPoint.IdentityId;
                        }

                        // Cause the first docket to be displayed.
                        if (m_instruction.CollectDrops.Count > 0)
                        {
                            Session[wizard.C_COLLECT_DROP]       = m_instruction.CollectDrops[0];
                            Session[wizard.C_COLLECT_DROP_INDEX] = 0;
                        }

                        Session[wizard.C_INSTRUCTION] = m_instruction;
                    }
                    else
                    {
                        if (m_isAmendment)
                        {
                            if (pointId != m_instruction.PointID)
                            {
                                m_instruction.Point   = createdPoint;
                                m_instruction.PointID = createdPoint.PointId;
                            }

                            // Cause the first docket to be displayed.
                            if (m_instruction.CollectDrops.Count > 0)
                            {
                                Session[wizard.C_COLLECT_DROP]       = m_instruction.CollectDrops[0];
                                Session[wizard.C_COLLECT_DROP_INDEX] = 0;
                            }

                            Session[wizard.C_INSTRUCTION] = m_instruction;
                        }
                        else
                        {
                            // Add the collect drop point information
                            if (m_instruction == null)
                            {
                                m_instruction = new Entities.Instruction();

                                m_instruction.JobId = m_jobId;
                                switch ((ePointType)(int)Session[wizard.C_POINT_TYPE])
                                {
                                case ePointType.Collect:
                                    m_instruction.InstructionTypeId = (int)eInstructionType.Load;
                                    break;

                                case ePointType.Deliver:
                                    m_instruction.InstructionTypeId = (int)eInstructionType.Drop;
                                    break;
                                }
                            }

                            m_instruction.Point         = createdPoint;
                            m_instruction.PointID       = createdPoint.PointId;
                            m_instruction.InstructionID = m_instruction.InstructionID;

                            if (m_instruction.InstructionTypeId == (int)eInstructionType.Drop)
                            {
                                m_instruction.ClientsCustomerIdentityID = createdPoint.IdentityId;
                            }

                            Session[wizard.C_INSTRUCTION] = m_instruction;
                        }
                    }

                    GoToStep("PD");
                }
            }
        }
Esempio n. 29
0
        private void ImportOrganisationValues()
        {
            cboEmail.Text              = String.Empty;
            cboEmail.SelectedValue     = String.Empty;
            cboEmail.DataSource        = null;
            cboFaxNumber.SelectedValue = String.Empty;
            cboFaxNumber.Text          = String.Empty;
            cboFaxNumber.DataSource    = null;
            txtFaxNumber.Text          = String.Empty;
            txtEmail.Text              = String.Empty;

            if (m_identityId > 0)
            {
                Facade.IOrganisation  facOrganisation = new Facade.Organisation();
                Entities.Organisation organisation    = facOrganisation.GetForIdentityId(m_identityId);

                //RJD: changed to use IndividualContacts instead of PrimaryContact STILL NEEDS WORK
                if (organisation != null && (organisation.IndividualContacts != null && organisation.IndividualContacts.Count > 0))
                {
                    DataSet emailDataSet = this.GetContactDataSet(organisation.IndividualContacts, eContactType.Email);

                    cboEmail.DataSource     = emailDataSet;
                    cboEmail.DataMember     = "contactTable";
                    cboEmail.DataValueField = "ContactDetail";
                    cboEmail.DataTextField  = "ContactDisplay";
                    cboEmail.DataBind();

                    if (this.cboEmail.Items.Count > 0)
                    {
                        this.txtEmail.Text = this.cboEmail.Items[0].Value;
                    }

                    DataSet faxDataSet = this.GetContactDataSet(organisation.IndividualContacts, eContactType.Fax);

                    if (organisation != null && organisation.Locations != null)
                    {
                        Entities.OrganisationLocation headOffice = organisation.Locations.GetHeadOffice();

                        if (!String.IsNullOrEmpty(headOffice.FaxNumber))
                        {
                            DataRow dr = faxDataSet.Tables[0].NewRow();
                            dr["ContactName"]    = "Head Office";
                            dr["ContactDetail"]  = headOffice.FaxNumber;
                            dr["ContactDisplay"] = String.Format("{0} - {1}", dr["ContactName"], headOffice.FaxNumber);
                            faxDataSet.Tables[0].Rows.InsertAt(dr, 0);
                        }
                    }

                    cboFaxNumber.DataSource     = faxDataSet;
                    cboFaxNumber.DataMember     = "contactTable";
                    cboFaxNumber.DataValueField = "ContactDetail";
                    cboFaxNumber.DataTextField  = "ContactDisplay";
                    cboFaxNumber.DataBind();

                    if (this.cboFaxNumber.Items.Count > 0)
                    {
                        this.txtFaxNumber.Text = this.cboFaxNumber.Items[0].Value;
                    }
                }
            }
            else
            {
                cboFaxNumber.Text = txtFaxNumber.Text = String.Empty;
            }
        }
Esempio n. 30
0
        private void PopulatePoint()
        {
            if (ViewState["point"] == null)
            {
                point         = new Entities.Point();
                point.Address = new Entities.Address();
            }
            else
            {
                point = (Entities.Point)ViewState["point"];
            }

            point.Description = txtDescription.Text;
            point.PointCode   = this.txtPointCode.Text;

            //Always make a Point both Collection and Delivery
            point.Collect = true;
            point.Deliver = true;

            point.IdentityId = int.Parse(cboClient.SelectedValue);

            // Get the town object for the town
            point.PostTown = new Entities.PostTown();
            Facade.IPostTown facPostTown = new Facade.Point();
            point.PostTown = facPostTown.GetPostTownForTownId(Convert.ToInt32(cboTown.SelectedValue));

            point.Address.AddressLine1       = txtAddressLine1.Text;
            point.Address.AddressLine2       = txtAddressLine2.Text;
            point.Address.AddressLine3       = txtAddressLine3.Text;
            point.Address.AddressType        = eAddressType.Point;
            point.Address.PostTown           = txtPostTown.Text;
            point.Address.County             = txtCounty.Text;
            point.Address.PostCode           = txtPostCode.Text;
            point.Address.CountryDescription = this.cboCountry.Text;
            point.Address.CountryId          = Convert.ToInt32(this.cboCountry.SelectedValue);

            if (txtLongitude.Text.Length > 0 && txtLatitude.Text.Length > 0)
            {
                point.Longitude = point.Address.Longitude = Decimal.Parse(txtLongitude.Text);
                point.Latitude  = point.Address.Latitude = Decimal.Parse(txtLatitude.Text);
            }

            Facade.IOrganisation facOrganisation            = new Facade.Organisation();
            Orchestrator.Entities.Organisation organisation = facOrganisation.GetForIdentityId(point.IdentityId);

            // set the radius if the address was changed by addressLookup
            // if the org has a default, use it, if not, use the system default.
            if (!String.IsNullOrEmpty(this.hdnSetPointRadius.Value))
            {
                if (organisation.Defaults.Count == 0 || organisation.Defaults[0].DefaultGeofenceRadius == null)
                {
                    point.Radius = Globals.Configuration.GPSDefaultGeofenceRadius;
                }
                else
                {
                    point.Radius = organisation.Defaults[0].DefaultGeofenceRadius;
                }
            }

            if (point.Address.TrafficArea == null)
            {
                point.Address.TrafficArea = new Entities.TrafficArea();
            }

            if (m_isUpdate)
            {
                point.Address.TrafficArea.TrafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue);
            }
            else
            {
                point.Address.TrafficArea.TrafficAreaId = 0; //Convert.ToInt32(hidTrafficArea.Value);
            }
            point.PointNotes = txtPointNotes.Text;

            // get the delivery point for saving
            point.DeliveryMatrix = Convert.ToInt32(this.cboDeliveryPeriod.SelectedValue);
        }