Пример #1
0
        private Entities.Job GetJobEntityFromCache()
        {
            Entities.Job job = (Entities.Job)Cache.Get("JobEntityForJobId" + m_jobID);

            if (job == null)
            {
                Facade.IJob facJob = new Facade.Job();
                Facade.IPCV facPCV = new Facade.PCV();
                Facade.IJobSubContractor facJobSubContractor = new Facade.Job();

                job                = facJob.GetJob(m_jobID, true, true);
                job.Charge         = ((Facade.IJobCharge)facJob).GetForJobId(m_jobID);
                job.Extras         = facJob.GetExtras(m_jobID, true);
                job.PCVs           = facPCV.GetForJobId(m_jobID);
                job.References     = ((Facade.IJobReference)facJob).GetJobReferences(m_jobID);
                job.SubContractors = facJobSubContractor.GetSubContractorForJobId(m_jobID);

                AddJobEntityToCache(job);
            }

            return(job);
        }
Пример #2
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();
        }