Ejemplo n.º 1
0
        private string GetAssignedResource(Entities.Job job, Entities.Instruction instruction, Entities.Order order)
        {
            if (instruction.Driver != null)
            {
                return(instruction.Driver.Individual.FullName);
            }
            else
            {
                // May be sub-contracted.
                var jobSubContracts = job.SubContractors.Cast <Entities.JobSubContractor>();
                var facOrganisation = new Facade.Organisation();

                if (jobSubContracts.Any(jsc => jsc.SubContractWholeJob))
                {
                    // Whole job sub-contracted out.
                    return(facOrganisation.GetNameForIdentityId(jobSubContracts.First(jsc => jsc.SubContractWholeJob).ContractorIdentityId));
                }
                else if (jobSubContracts.Any(jsc => jsc.JobSubContractID == instruction.JobSubContractID))
                {
                    // Per-instruction sub-contracted out.
                    return(facOrganisation.GetNameForIdentityId(jobSubContracts.First(jsc => jsc.JobSubContractID == instruction.JobSubContractID).ContractorIdentityId));
                }
                else if (instruction.InstructionTypeId == (int)eInstructionType.Drop && jobSubContracts.Any(jsc => jsc.JobSubContractID == order.JobSubContractID))
                {
                    // Sub-contracted for delivery.
                    return(facOrganisation.GetNameForIdentityId(jobSubContracts.First(jsc => jsc.JobSubContractID == order.JobSubContractID).ContractorIdentityId));
                }
            }

            // No resource assigned.
            return(String.Empty);
        }
Ejemplo n.º 2
0
        private void PopulateStaticControls()
        {
            Facade.ExtraType facExtraType = new Orchestrator.Facade.ExtraType();

            //cboExtraType.DataSource = facExtraType.GetForIsEnabled(getActiveExtraTypes); // Enum.GetNames(typeof(eExtraType));

            //Get all Extras that apply to Subbies AND Pallet Networks
            //At present this will only be the Hub Charge and at some point the Network and Subby Extras
            //may need to be dealt with seperately
            cboExtraType.DataSource = facExtraType.GetForAppliesTo(new List <eExtraAppliesTo>
            {
                eExtraAppliesTo.SubContractor, eExtraAppliesTo.Network
            });

            cboExtraType.DataValueField = "ExtraTypeId";
            cboExtraType.DataTextField  = "Description";
            cboExtraType.DataBind();
            cboExtraType.Items.Insert(0, "");

            cboSelectExtraState.DataSource = Enum.GetNames(typeof(eExtraState));
            cboSelectExtraState.DataBind();
            cboSelectExtraState.Items.RemoveAt((int)eExtraState.Invoiced - 1);
            cboSelectExtraState.Items.Insert(0, "");

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboSubContractor.SelectedValue = m_IdentityId.ToString();
                cboSubContractor.Text          = name;
            }
        }
        //TODO: Change to work with Credit Notes.
        /// <summary>
        /// Prepares the page for viewing.
        /// </summary>
        private void ConfigureDisplay()
        {
            // Populate master page information
            //this.Master.WizardTitle = "Find Orders to Associate";

            // Bind the order states
            List <string> orderStateNames = new List <string>(Enum.GetNames(typeof(eOrderStatus)));

            orderStateNames.Remove(eOrderStatus.Invoiced.ToString());
            orderStateNames.Remove(eOrderStatus.Cancelled.ToString());
            cblOrderStatus.DataSource = orderStateNames;
            cblOrderStatus.DataBind();

            // Mark approved as being the only item checked.
            cblOrderStatus.Items.FindByValue(eOrderStatus.Approved.ToString()).Selected = true;

            // Default date range.
            dteStartDate.SelectedDate = DateTime.Today;
            dteEndDate.SelectedDate   = DateTime.Today.AddDays(2);

            // Set the client to match that of the orders in the group.
            Facade.IOrderGroup  facOrderGroup = new Facade.Order();
            Entities.OrderGroup orderGroup    = facOrderGroup.Get(_creditNoteID);
            if (orderGroup != null && orderGroup.Orders.Count > 0)
            {
                Facade.IOrganisation facOrganisation = new Facade.Organisation();
                int orderGroupCustomerIdentityID     = orderGroup.Orders[0].CustomerIdentityID;
                cboClient.Enabled       = false;
                cboClient.Text          = facOrganisation.GetNameForIdentityId(orderGroupCustomerIdentityID);
                cboClient.SelectedValue = orderGroupCustomerIdentityID.ToString();
            }
        }
        private void PopulateStaticControls()
        {
            Facade.ExtraType facExtraType        = new Orchestrator.Facade.ExtraType();
            bool?            getActiveExtraTypes = true;

            cboExtraType.DataSource     = facExtraType.GetForIsEnabled(getActiveExtraTypes); // Enum.GetNames(typeof(eExtraType));
            cboExtraType.DataValueField = "ExtraTypeId";
            cboExtraType.DataTextField  = "Description";
            cboExtraType.DataBind();
            cboExtraType.Items.Insert(0, "");

            cboSelectExtraState.DataSource = Enum.GetNames(typeof(eExtraState));
            cboSelectExtraState.DataBind();
            cboSelectExtraState.Items.RemoveAt((int)eExtraState.Invoiced - 1);
            cboSelectExtraState.Items.Insert(0, "");

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;
            }
        }
Ejemplo n.º 5
0
        private void PopulateStaticControls()
        {
            cboJobState.DataSource = Enum.GetNames(typeof(eJobState));
            cboJobState.DataBind();
            cboJobState.SelectedValue = eJobState.ReadyToInvoice.ToString();

            // Invoice Sort Type
            rdoSortType.DataSource = Enum.GetNames(typeof(eInvoiceSortType));
            rdoSortType.DataBind();
            rdoSortType.Items[0].Selected = true;

            // Invoice Type
            rdoInvoiceType.Items.Add(new ListItem("Normal Invoice/Self Bill"));
            rdoInvoiceType.Items.Add(new ListItem("Sub Contractor"));
            //rdoInvoiceType.Items[0].Selected = true;

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;

                // Add client specific references to sort collection
                Facade.IOrganisationReference            facOrgRef = new Facade.Organisation();
                Entities.OrganisationReferenceCollection eOrf      = facOrgRef.GetReferencesForOrganisationIdentityId(m_IdentityId, true);

                foreach (Entities.OrganisationReference ocr in eOrf)
                {
                    rdoSortType.Items.Add(new ListItem(ocr.Description));
                }
            }
        }
Ejemplo n.º 6
0
 private void ConfigureClientDbCombo(bool isUpdate)
 {
     Facade.IOrganisation facOrganisation = new Facade.Organisation();
     cboClient.SelectedValue = m_identityId.ToString();
     cboClient.Text          = facOrganisation.GetNameForIdentityId(m_clientIdentityId);
     cboClient.Enabled       = !isUpdate;
 }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage);

            m_reportType = Convert.ToString(Request.QueryString["reportType"]);
            m_pcvId      = Convert.ToInt32(Request.QueryString["PCVId"]);

            btnGenerateReport.Attributes.Add("onclick", "ClearQueryString()");

            switch (m_reportType)
            {
            case "beingRedeemed":
                h1Text.Text = "PCVs Being Redeemed.";
                h2Text.Text = "A list of PCVs being taken for redemption on runs during the specified period is displayed below.";
                break;

            case "outstanding":
                h1Text.Text = "PCVs Awaiting Redemption";
                h2Text.Text = "A list of PCVs which have not been Redeemed or Posted to B&M For Dehire is displayed below";
                break;
            }

            if (!IsPostBack && m_reportType != null)
            {
                // If a different report type, clear the session variables used for sorting.
                if (Convert.ToString(Session["ReportType"]) != m_reportType)
                {
                    ClearSessionVariables();
                }

                if (Session["ClientId"] != null || (Session["DateFrom"] != null && Session["DateTo"] != null))
                {
                    if (Session["ClientId"] != null)
                    {
                        string clientId = Convert.ToString(Session["ClientId"]);
                        Facade.IOrganisation facOrganisation = new Facade.Organisation();
                        string clientName = facOrganisation.GetNameForIdentityId(int.Parse(clientId));
                        cboClient.SelectedValue = clientId;
                        cboClient.Text          = clientName;
                    }
                    dteDateFrom.SelectedDate = Session["DateFrom"] != null ? (DateTime?)Session["DateFrom"] : (DateTime?)null;
                    dteDateTo.SelectedDate   = Session["DateTo"] != null ? (DateTime?)Session["DateTo"] : (DateTime?)null;
                    LoadReport();
                }
                else
                {
                    // Default period from yesterday to today
                    dteDateFrom.SelectedDate = DateTime.Today - new TimeSpan(1, 0, 0, 0);
                    dteDateTo.SelectedDate   = DateTime.Today;
                }
                if (Session["Sort"] != null)
                {
                    // Load the report without user intervention, since sorting a current
                    // report.
                    LoadReport();
                }
            }
        }
        private void PopulateStaticControls()
        {
            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboSubContractor.SelectedValue = m_IdentityId.ToString();
                cboSubContractor.Text          = name;

                pnlFilter.Visible = true;
            }
        }
Ejemplo n.º 9
0
        private void ConfigureDisplay()
        {
            string MinDate = System.DateTime.Today.ToString();

            if (!string.IsNullOrEmpty(Request.QueryString["IdentityId"]))
            {
                int IdentityID = 0;
                int.TryParse(Request.QueryString["IdentityID"].ToString(), out IdentityID);
                m_IdentityId = IdentityID;
                IsFromDash   = true;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["MinDate"]))
            {
                MinDate    = Request.QueryString["MinDate"];
                IsFromDash = true;
            }

            if (IsFromDash)
            {
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;

                DateTime startDate = new DateTime();
                DateTime endDate   = System.DateTime.Today;
                DateTime.TryParse(MinDate, out startDate);

                rdiStartDate.SelectedDate = startDate;
                rdiEndDate.SelectedDate   = endDate;

                //Unselect NORM and select BOTH
                rdoListInvoiceType.Items[0].Selected = false;
                rdoListInvoiceType.Items[2].Selected = true;
            }

            // This has been removed re TFS Issue : #22431
            //else
            //{
            //    DateTime startDate = DateTime.Today.AddMonths(-1);
            //    System.Globalization.GregorianCalendar cal = new System.Globalization.GregorianCalendar();

            //    this.rdiStartDate.SelectedDate = new DateTime(startDate.Year, startDate.Month, 01);
            //    this.rdiEndDate.SelectedDate = new DateTime(startDate.Year, startDate.Month, cal.GetDaysInMonth(startDate.Year, startDate.Month));
            //}
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var customerIdentityID = Utilities.ParseNullable <int>(Request.QueryString["ciid"]);

                if (customerIdentityID.HasValue)
                {
                    Facade.IOrganisation facOrganisation = new Facade.Organisation();
                    this.clientCombo.Text          = facOrganisation.GetNameForIdentityId(customerIdentityID.Value);
                    this.clientCombo.SelectedValue = customerIdentityID.Value.ToString();
                }

                this.startDate.SelectedDate = this.endDate.SelectedDate = DateTime.Today.AddDays(-1);
            }
        }
Ejemplo n.º 11
0
        private string GetInvoiceClient()
        {
            if (m_isUpdate)
            {
                Facade.IInvoiceExtra facInvoiceExtra = new Facade.Invoice();
                DataSet dsClient = facInvoiceExtra.GetClientForInvoiceExtraId(Convert.ToInt32(ViewState["InvoiceId"]));

                m_identityId            = Convert.ToInt32(dsClient.Tables[0].Rows[0]["IdentityId"]);
                ViewState["IdentityId"] = m_identityId;

                return(dsClient.Tables[0].Rows[0]["OrganisationName"].ToString());
            }
            else
            {
                Facade.IOrganisation facOrganisation = new Facade.Organisation();
                return(facOrganisation.GetNameForIdentityId(m_identityId));
            }
        }
        private void PopulateStaticControls()
        {
            // Invoice Sort Type
            rdoSortType.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eInvoiceSortType)));
            rdoSortType.DataBind();
            rdoSortType.Items[0].Selected = true;

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;

                pnlFilter.Visible = true;
            }
        }
Ejemplo n.º 13
0
        private void PopulateStaticControls()
        {
            cboJobState.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eJobState)));
            cboJobState.DataBind();
            cboJobState.SelectedValue = Utilities.UnCamelCase(eJobState.ReadyToInvoice.ToString());

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;

                chkMarkAll.Visible    = true;
                btnSaveFilter.Visible = true;
            }
        }
Ejemplo n.º 14
0
        private void LoadJob()
        {
            chkIsPriced.Enabled = true;

            Facade.IJob         facJob         = new Facade.Job();
            Facade.IInstruction facInstruction = new Facade.Instruction();

            m_job = facJob.GetJob(m_jobId);

            // The m_job pricing can only be viewed if it is complete.
            if (m_job.JobState == eJobState.Booked || m_job.JobState == eJobState.Planned || m_job.JobState == eJobState.InProgress)
            {
                Response.Redirect("../jobManagement.aspx?jobId=" + m_jobId.ToString() + "&csid=" + this.CookieSessionID);
            }

            if (m_job.JobState == eJobState.Cancelled)
            {
                Response.Redirect("../../Job/job.aspx?jobId=" + m_job.JobId.ToString() + "&csid=" + this.CookieSessionID);
            }

            m_job.Charge       = ((Facade.IJobCharge)facJob).GetForJobId(m_job.JobId);
            m_job.Instructions = facInstruction.GetForJobId(m_job.JobId);
            m_job.Extras       = facJob.GetExtras(m_job.JobId, true);
            Facade.IJobRate facJobRate = new Facade.Job();
            m_job.Rate = facJobRate.GetRateForJobId(m_job.JobId);

            GetChargeableLegs();
            CountChargeableLegs();

            // Store the m_job in the ViewState
            ViewState[C_JOB_VS] = m_job;

            // The job can not be altered if it has been invoiced.
            if (m_job.JobState == eJobState.Invoiced)
            {
                txtRate.Enabled     = false;
                btnUpdate.Enabled   = false;
                chkIsPriced.Checked = true;
                chkIsPriced.Enabled = false;
            }

            #region Populate the Job Information

            lblJobId.Text = m_jobId.ToString();

            // Display the client this m_job is for
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            lblCustomer.Text = facOrganisation.GetNameForIdentityId(m_job.IdentityId);

            // Select the appropriate m_job type
            lblJobType.Text = Utilities.UnCamelCase(Enum.GetName(typeof(eJobChargeType), m_job.Charge.JobChargeType));

            // Display the m_job rate
            txtRate.Text = m_job.Charge.JobChargeAmount.ToString("C");

            // Set if the m_job is priced or not
            chkIsPriced.Checked = m_job.IsPriced;

            #endregion

            //Get the Extras for the Job
            pnlExtra.Visible    = true;
            dgExtras.DataSource = GetExtras();
            dgExtras.DataBind();
            if (((Entities.ExtraCollection)dgExtras.DataSource).Count > 0)
            {
                dgExtras.Visible    = true;
                lblNoExtras.Visible = false;
            }
            else
            {
                dgExtras.Visible    = false;
                lblNoExtras.Visible = true;
            }
            btnAddExtra.Visible = m_job.JobType != eJobType.Groupage;

            // Display the legs with their associated costs and charges
            gvLegs.DataSource = new Facade.Instruction().GetLegPlan(m_job.Instructions, false).Legs();
            gvLegs.DataBind();

            if (m_job.JobType == eJobType.Return)
            {
                gvRefusals.DataBind();
            }
            else
            {
                fsRefusals.Visible = false;
            }

            checkRoundingIssue();
        }
Ejemplo n.º 15
0
        private void ConfigureDisplay()
        {
            System.Globalization.GregorianCalendar cal = new System.Globalization.GregorianCalendar();

            Facade.BusinessType       facBusinessType      = new Facade.BusinessType();
            Facade.IOrderServiceLevel facOrderServiceLevel = new Facade.Order();

            cblBusinessType.DataSource = facBusinessType.GetAll();
            cblBusinessType.DataBind();

            foreach (ListItem li in cblBusinessType.Items)
            {
                li.Selected = true;
            }

            cblServiceLevel.DataSource = facOrderServiceLevel.GetAll();
            cblServiceLevel.DataBind();

            foreach (ListItem li in cblServiceLevel.Items)
            {
                li.Selected = true;
            }

            string referencesSortExpression = Globals.Configuration.FlagForInvoicingReferencesSortExpression;

            if (!string.IsNullOrEmpty(referencesSortExpression))
            {
                grdOrders.Columns.FindByUniqueName("References").SortExpression = referencesSortExpression;
            }

            int IdentityID = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["identityid"]))
            {
                int.TryParse(Request.QueryString["identityid"].ToString(), out IdentityID);
            }

            string MinDate = string.Empty;

            if (!string.IsNullOrEmpty(Request.QueryString["MinDate"]))
            {
                MinDate = Request.QueryString["MinDate"];
            }

            if (IdentityID > 0 && MinDate.Length > 0)
            {
                m_isFromDash = true;
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(IdentityID);

                cboClient.SelectedValue = IdentityID.ToString();
                cboClient.Text          = name;

                DateTime startDate = new DateTime();
                DateTime.TryParse(MinDate, out startDate);

                rdiStartDate.SelectedDate = startDate;
                rdiEndDate.SelectedDate   = System.DateTime.Today;

                if (startDate >= System.DateTime.Today)
                {
                    rdiEndDate.SelectedDate = startDate.AddDays(1);
                }

                rdoListInvoiceType.Items[0].Selected = false;
                rdoListInvoiceType.Items[2].Selected = true;

                grdOrders.Rebind();
            }
        }
Ejemplo n.º 16
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;
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Label PageTitle = ((System.Web.UI.UserControl)(Page.Master)).FindControl("lblWizardTitle") as Label;

            if (PageTitle != null)
            {
                PageTitle.Text = "Sub Contract";
            }

            m_jobId    = int.Parse(Request.QueryString["jobId"]);
            m_isUpdate = (Request.QueryString["isUpdate"] != null && Request.QueryString["isUpdate"].ToString() == "true");

            if (!IsPostBack && Request.QueryString["rcbId"] == null)
            {
                // You can only sub-contract per order if the job is a groupage job.
                if (Job.JobType != eJobType.Groupage)
                {
                    rdoSubContractMethod.Items.RemoveAt(2);
                }

                // If any of the legs have been completed then the sub contract whole job should be disabled (how can you sub the whole
                // job to someone when part of the job has already been completed.
                ReadOnlyCollection <Entities.Instruction> completedInstructions = Job.Instructions.FindAll(new Predicate <Orchestrator.Entities.Instruction>(FindAllCompletedInstructions));
                if (completedInstructions != null && completedInstructions.Count > 0)
                {
                    // disable the whole job radio button.
                    rdoSubContractMethod.Items[0].Selected = false;
                    rdoSubContractMethod.Items[0].Enabled  = false;
                }

                if (!m_isUpdate)
                {
                    grdLegs.Visible = false;
                }
                else
                if (Request.QueryString["rcbId"] == null)
                {
                    // Populate with the correct settings.
                    Facade.IJobSubContractor  facJobSubContractor = new Facade.Job();
                    Facade.IOrganisation      facOrganisation     = new Facade.Organisation();
                    Entities.JobSubContractor jobSubContractor    = facJobSubContractor.GetSubContractorForJobId(m_jobId)[0];
                    rntSubContractRate.Culture = new CultureInfo(jobSubContractor.LCID);

                    cboSubContractor.SelectedValue     = jobSubContractor.ContractorIdentityId.ToString();
                    cboSubContractor.Text              = facOrganisation.GetNameForIdentityId(jobSubContractor.ContractorIdentityId);
                    chkUseSubContractorTrailer.Checked = jobSubContractor.UseSubContractorTrailer;
                    rntSubContractRate.Text            = jobSubContractor.ForeignRate.ToString();

                    cboSubContractor.Enabled           = false;
                    chkUseSubContractorTrailer.Enabled = false;
                    pnlTrailer.Visible = true;
                }

                if (Globals.Configuration.SubContractorCommunicationsRequired)
                {
                    lblShowAsCommunicated.Visible = true;
                    chkShowAsCommunicated.Visible = true;
                }
            }

            InjectScript.Text = string.Empty;
        }