Ejemplo n.º 1
0
    private void LoadJob()
    {
        int jobID = int.Parse(Request.QueryString["jID"]);

        Orchestrator.Entities.Job job    = null;
        Orchestrator.Facade.IJob  facJob = new Orchestrator.Facade.Job();
        job = facJob.GetJob(jobID);

        if (job.NominalCode != null)
        {
            lblNominalCode.Text = job.NominalCode.ShortCode;
        }
        else
        {
            lblNominalCode.Text = "No Nominal Code Set";
        }

        Orchestrator.Facade.INominalCode facNominalCode = new Orchestrator.Facade.NominalCode();
        DataSet dsCodes = facNominalCode.GetAllActive();

        cboNominalCode.DataSource     = dsCodes;
        cboNominalCode.DataTextField  = "NominalCode";
        cboNominalCode.DataValueField = "NominalCodeID";
        cboNominalCode.DataBind();

        if (job.NominalCode != null)
        {
            cboNominalCode.FindItemByValue(job.NominalCode.NominalCodeID.ToString()).Selected = true;
            this.CurrentNominalCodeID = job.NominalCode.NominalCodeID;
        }
    }
Ejemplo n.º 2
0
        private void LoadJob()
        {
            int jobID = int.Parse(Request.QueryString["jID"]);

            Orchestrator.Entities.Job job    = null;
            Orchestrator.Facade.IJob  facJob = new Orchestrator.Facade.Job();
            job = facJob.GetJob(jobID);

            Facade.IBusinessType  facBusinessType = new Facade.BusinessType();
            Entities.BusinessType businessType    = facBusinessType.GetForBusinessTypeID(job.BusinessTypeID);

            if (businessType != null)
            {
                lblBusinessType.Text = businessType.Description;
            }
            else
            {
                lblBusinessType.Text = "No Business Type Set";
            }

            DataSet dsTypes = facBusinessType.GetAll();

            cboBusinessType.DataSource     = dsTypes;
            cboBusinessType.DataTextField  = "Description";
            cboBusinessType.DataValueField = "BusinessTypeID";
            cboBusinessType.DataBind();

            if (businessType != null)
            {
                cboBusinessType.FindItemByValue(businessType.BusinessTypeID.ToString()).Selected = true;
                this.CurrentBusinessTypeID = businessType.BusinessTypeID;
            }
        }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int instructionID = int.Parse(Request.QueryString["iID"]);
        int jobID         = int.Parse(Request.QueryString["jID"]);

        Orchestrator.Facade.IJobSubContractor facJS = new Orchestrator.Facade.Job();
        facJS.UncontractInstruction(jobID, instructionID, this.Page.User.Identity.Name);
        Response.Redirect(Request.QueryString["returnURL"]);
    }
        public bool GetForResource(int resourceID, int jobID, DateTime fromDate, DateTime toDate)
        {
            return(ServiceCallHandler(() =>
            {
                DateTime startOfDay = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 0, 0, 0);
                DateTime endOfDay = new DateTime(toDate.Year, toDate.Month, toDate.Day, 23, 59, 59);

                Orchestrator.Facade.Job fac = new Orchestrator.Facade.Job();
                return fac.IsAvailableInstuction(resourceID, startOfDay, endOfDay);
            }));
        }
Ejemplo n.º 5
0
 void btnOK_Click(object sender, EventArgs e)
 {
     if (cboNominalCode.SelectedValue != this.CurrentNominalCodeID.ToString())
     {
         int jobID = int.Parse(Request.QueryString["jID"]);
         Orchestrator.Facade.IJob facJob = new Orchestrator.Facade.Job();
         bool retVal = facJob.UpdateNominalCode(jobID, int.Parse(cboNominalCode.SelectedValue), this.Page.User.Identity.Name);
         if (retVal)
         {
             InjectScript.Text = @"<script>RefreshParentPage()</script>";
         }
     }
 }
Ejemplo n.º 6
0
        public List <RunLeg> GetLegsForRun(int runID, bool includeDataPoints)
        {
            List <RunLeg> runLegs = new List <RunLeg>();

            try
            {
                Orchestrator.Facade.IJob                    facJob         = new Orchestrator.Facade.Job();
                Orchestrator.Facade.IInstruction            facInstruction = new Orchestrator.Facade.Instruction();
                Orchestrator.Facade.IGPS                    facGPS         = new Orchestrator.Facade.GPS();
                Orchestrator.Entities.InstructionCollection instructions   = facInstruction.GetForJobId(runID);
                Orchestrator.Entities.LegPlan               lp             = new Orchestrator.Facade.Instruction().GetLegPlan(instructions, true);

                DataTable ds = facGPS.GetLegTable(lp);
                runLegs = (from v in ds.AsEnumerable()
                           select new RunLeg()
                {
                    JobID = v.Field <int>("JobID"),
                    StartInstructionID = v.Field <int>("StartInstructionID"),
                    EndInstructionID = v.Field <int>("EndInstructionID"),
                    ActualDistance = (v.IsNull("ActualDistance")) ? 0 : v.Field <int>("ActualDistance"),
                    ActualDuration = (v.IsNull("ActualDuration")) ? 0 : v.Field <int>("ActualDuration"),
                    EstimatedDistance = (v.IsNull("EstimatedDistance")) ? 0 : v.Field <int>("EstimatedDistance"),
                    EstimatedDuration = (v.IsNull("EstimatedDuration")) ? 0 : v.Field <int>("EstimatedDuration"),

                    PlannedStartDate = v.Field <DateTime>("PlannedStartDateTime"),
                    StartActualArrivalDate = v.IsNull("StartActualArrivalDateTime") ? new DateTime?() : v.Field <DateTime>("StartActualArrivalDateTime"),
                    StartActualDepartureDate = v.IsNull("StartActualDepartureDateTime") ? new DateTime?() : v.Field <DateTime>("StartActualDepartureDateTime"),
                    StartPointID = v.Field <int>("StartPointID"),
                    StartPointDescription = v.Field <string>("StartPointDisplay"),
                    StartPointLatitude = Convert.ToDouble(v.Field <decimal>("StartLatitude")),
                    StartPointLongitude = Convert.ToDouble(v.Field <decimal>("StartLongitude")),

                    PlannedEndDate = v.Field <DateTime>("PlannedEndDateTime"),
                    EndActualArrivalDate = v.IsNull("EndActualArrivalDateTime") ? new DateTime?() : v.Field <DateTime>("EndActualArrivalDateTime"),
                    EndActualDepartureDate = v.IsNull("EndActualDepartureDateTime") ? new DateTime?() : v.Field <DateTime>("EndActualDepartureDateTime"),
                    EndPointID = v.Field <int>("EndPointID"),
                    EndPointDescription = v.Field <string>("EndPointDisplay"),
                    EndPointLatitude = Convert.ToDouble(v.Field <decimal>("EndLatitude")),
                    EndPointLongitude = Convert.ToDouble(v.Field <decimal>("EndLongitude")),

                    RegNo = v.Field <string>("RegNo"),
                    VehicleResourceID = v.Field <int>("VehicleResourceID"),
                    DriverName = v.Field <string>("FullName"),
                    TrailerRef = v.Field <string>("TrailerRef"),
                    JobSubContractID = v.Field <int>("JobSubContractID"),
                    SubContractorIdentityID = v.Field <int>("SubContractor"),
                    SubContractorName = v.Field <string>("DrivingDisplayName"),
                    ETA = String.Empty,
                    InstructionStateID = v.Field <int>("InstructionStateId"),
                }).ToList();

                if (includeDataPoints)
                {
                    foreach (RunLeg runLeg in runLegs)
                    {
                        runLeg.DataPoints = GetPositionHistoryForRunLeg(runLeg);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(runLegs);
        }
Ejemplo n.º 7
0
        void dgJobs_ItemCommand(object sender, ComponentArt.Web.UI.GridItemCommandEventArgs e)
        {
            Facade.Job facJob = new Orchestrator.Facade.Job();

            string userId = ((Entities.CustomPrincipal)Page.User).UserName;
            int    jobId;
            bool   success = false;

            switch (((Button)e.Control).CommandName.ToLower())
            {
            case "reinstate":
                jobId   = Convert.ToInt32(e.Item["JobId"]);
                success = facJob.UpdateForCancellation(jobId, false, "", userId);

                if (success == true)
                {
                    pnlConfirmation.Visible = true;
                    imgIcon.ImageUrl        = "~/images/ico_info.gif";
                    lblNote.Text            = "The Job " + jobId + " has been reinstated successfully.";
                }
                else
                {
                    pnlConfirmation.Visible = true;
                    imgIcon.ImageUrl        = "~/images/ico_critical.gif";
                    lblNote.Text            = "The application failed while reinstating the job, please try again.";
                }

                break;

            case "cancel":
                jobId = Convert.ToInt32(e.Item["JobId"]);

                Facade.IInstruction            facInstruction = new Facade.Instruction();
                Entities.InstructionCollection insCol         = facInstruction.GetForJobId(jobId);

                if (insCol.Count == 0 || insCol[0].InstructionActuals == null || insCol[0].InstructionActuals.Count == 0)
                {
                    success =
                        facJob.UpdateState(jobId, eJobState.Cancelled,
                                           ((Entities.CustomPrincipal)Page.User).UserName);

                    if (success)
                    {
                        pnlConfirmation.Visible = true;
                        imgIcon.ImageUrl        = "../images/ico_info.gif";
                        lblNote.Text            = "The Job " + jobId + " has been cancelled successfully.";
                    }
                    else
                    {
                        pnlConfirmation.Visible = true;
                        imgIcon.ImageUrl        = "../images/ico_critical.gif";
                        lblNote.Text            = "The application failed while cancelling the job, please try again.";
                    }
                }
                else
                {
                    pnlConfirmation.Visible = true;
                    imgIcon.ImageUrl        = "../images/ico_critical.gif";
                    lblNote.Text            = "This job can not be cancelled at this time as it has at least one call-in.";
                }

                break;
            }

            ApplyFilter();
        }