Example #1
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;
        }
Example #2
0
        private void btnAddJob_Click(object sender, EventArgs e)
        {
            eJobType jobType = (eJobType)Convert.ToInt32(cboJobType.SelectedValue);

            switch (jobType)
            {
            case eJobType.Normal:
                cboJobType.Enabled    = false;
                pnlOpenWizard.Visible = true;
                break;

            case eJobType.PalletReturn:
                Response.Redirect("addupdatepalletreturnjob.aspx");
                break;

            case eJobType.Return:
                Response.Redirect("addupdategoodsreturnjob.aspx");
                break;
            }
        }
Example #3
0
        private bool AddGoodsRefused()
        {
            Facade.IGoodsRefusal facGoods = new Facade.GoodsRefusal();
            bool   retVal   = false;
            string userName = ((Entities.CustomPrincipal)Page.User).UserName;

            eJobType jobType = eJobType.Normal;

            using (Facade.IInstruction facInstruction = new Facade.Instruction())
            {
                Entities.Instruction instruction = facInstruction.GetInstruction(_instructionId);

                using (Facade.IJob facJob = new Facade.Job())
                {
                    Entities.Job job = facJob.GetJob(instruction.JobId);
                    jobType = job.JobType;
                }
            }

            retVal = facGoods.Create(_goodsRefused, jobType, _instructionId, userName);

            if (!retVal)
            {
                lblConfirmation.Text      = "There was an error adding the Goods Refused, please try again.";
                lblConfirmation.Visible   = true;
                lblConfirmation.ForeColor = Color.Red;
                retVal = false;
            }
            else
            {
                btnAdd.Text      = "Update Goods Refused";
                this.ReturnValue = "Refresh_Redeliveries_And_Refusals";
                this.Close();
            }

            return(retVal);
        }
Example #4
0
        void dgJobs_ItemContentCreated(object sender, ComponentArt.Web.UI.GridItemContentCreatedEventArgs e)
        {
            if (m_dsJobsData != null)
            {
                int        jobId          = Convert.ToInt32(e.Item["JobId"]);
                eJobType   jobType        = (eJobType)Enum.Parse(typeof(eJobType), ((string)e.Item["JobType"]).Replace(" ", ""));
                HtmlAnchor lnkManageJob   = (HtmlAnchor)e.Content.FindControl("lnkManageJob");
                Table      tblCollections = (Table)e.Content.FindControl("tblCollections");
                Table      tblDeliveries  = (Table)e.Content.FindControl("tblDeliveries");

                if (lnkManageJob != null)
                {
                    HtmlImage imgRequiresCallIn        = (HtmlImage)e.Content.FindControl("imgRequiresCallIn");
                    HtmlImage imgHasRequests           = (HtmlImage)e.Content.FindControl("imgHasRequests");
                    HtmlImage imgHasNewPCVs            = (HtmlImage)e.Content.FindControl("imgHasNewPCVs");
                    HtmlImage imgHasExtras             = (HtmlImage)e.Content.FindControl("imgHasExtras");
                    HtmlImage imgMarkedForCancellation = (HtmlImage)e.Content.FindControl("imgMarkedForCancellation");
                    HtmlImage imgHasPCVAttached        = (HtmlImage)e.Content.FindControl("imgHasPCVAttached");
                    HtmlImage imgHasDehireReceipt      = (HtmlImage)e.Content.FindControl("imgHasDehireReceipt");

                    // Set the manage job link.
                    if (Orchestrator.Globals.Configuration.UseJobManagementLink)
                    {
                        lnkManageJob.HRef = "javascript:OpenJob(" + jobId.ToString() + ");";
                    }
                    else
                    {
                        lnkManageJob.HRef = "javascript:OpenJobDetails(" + jobId.ToString() + ");";
                    }

                    lnkManageJob.InnerText = jobId.ToString();

                    // Display the Requires Call In icon if required.
                    imgRequiresCallIn.Visible = Convert.ToBoolean(e.Item["RequiresCallIn"]);

                    // Display the Has Request icon if required.
                    if (Convert.ToInt32(e.Item["Requests"]) == 0)
                    {
                        imgHasRequests.Visible = false;
                    }
                    else
                    {
                        imgHasRequests.Visible = true;
                        imgHasRequests.Attributes.Add("onClick", "javascript:ShowPlannerRequests('" + jobId.ToString() + "');");
                    }

                    // Display the Has New PCVs icon if required.
                    if (Convert.ToInt32(e.Item["IssuedPCVs"]) == 0)
                    {
                        imgHasNewPCVs.Visible = false;
                    }
                    else
                    {
                        imgHasNewPCVs.Visible = true;
                    }

                    imgHasExtras.Visible        = ((bool)e.Item["ExtraId"]);
                    imgHasPCVAttached.Visible   = ((int)e.Item["HasPCVAttached"]) > 0 ? true : false;
                    imgHasDehireReceipt.Visible = ((int)e.Item["HasDehireReceipt"]) > 0 ? true : false;

                    // Display the Marked for Cancellation if required.
                    if ((bool)(e.Item["ForCancellation"]))
                    {
                        imgMarkedForCancellation.Visible = true;
                        imgMarkedForCancellation.Alt     = "Marked for cancellation: " + (string)e.Item["ForCancellationReason"];
                    }
                    else
                    {
                        imgMarkedForCancellation.Visible = false;
                    }
                }

                if (tblCollections != null)
                {
                    DataView dvCollections = new DataView(m_dsJobsData.Tables[1]);
                    foreach (DataRow collection in dvCollections.Table.Rows)
                    {
                        if ((int)collection["JobId"] == jobId && ((int)collection["InstructionTypeID"] != (int)eInstructionType.Trunk || jobType == eJobType.Groupage))
                        {
                            // This is a collection for the current job
                            ArrayList rows = CreateTableRows(jobType, collection);
                            foreach (TableRow row in rows)
                            {
                                tblCollections.Rows.Add(row);
                            }
                        }
                    }
                }

                if (tblDeliveries != null)
                {
                    DataView dvDeliveries = new DataView(m_dsJobsData.Tables[2]);
                    foreach (DataRow delivery in dvDeliveries.Table.Rows)
                    {
                        if ((int)delivery["JobId"] == jobId && ((int)delivery["InstructionTypeID"] != (int)eInstructionType.Trunk || jobType == eJobType.Groupage))
                        {
                            // This is a delivery for the current job
                            ArrayList rows = CreateTableRows(jobType, delivery);
                            foreach (TableRow row in rows)
                            {
                                tblDeliveries.Rows.Add(row);
                            }
                        }
                    }
                }
            }
        }
Example #5
0
        private ArrayList CreateTableRows(eJobType jobType, DataRow data)
        {
            ArrayList rows = new ArrayList();

            #region Top row (Location, Timings, Resources, Pallets, Weight)

            TableRow row = new TableRow();

            rows.Add(row);

            // Location
            TableCell location = new TableCell();
            if (data["InstructionActualId"] != DBNull.Value)
            {
                location.Text = "<img src=\"..\\images\\tick.gif\" alt=\"Completed\" style=\"VERTICAL-ALIGN: -3px;\">&nbsp;";
            }
            Uri pointAddressUri = new Uri(Request.Url, "../Point/GetPointAddressHtml.aspx");
            location.Text += "<span onMouseOver=\"ShowPoint('" + pointAddressUri.ToString() + "', '" + ((int)data["PointId"]).ToString() + "')\" onMouseOut=\"HidePoint()\">";
            location.Text += (string)data["Location"];
            location.Text += "</span>";
            location.Width = new Unit("100px");
            row.Cells.Add(location);

            // Timing
            TableCell timing = new TableCell();
            if ((bool)data["Anytime"])
            {
                timing.Text = ((DateTime)data["By"]).ToString("dd/MM/yy") + " Anytime";
            }
            else
            {
                timing.Text = ((DateTime)data["By"]).ToString("dd/MM/yy HH:mm");
            }
            timing.Width = new Unit("100px");
            row.Cells.Add(timing);

            // Resources
            TableCell resources = new TableCell();
            if (data["FullName"] != DBNull.Value)
            {
                resources.Text = "<b>" + (string)data["FullName"] + "</b><br>";
            }
            if (data["RegNo"] != DBNull.Value)
            {
                resources.Text += "<b>" + (string)data["RegNo"] + "</b><br>";
            }
            if (data["TrailerRef"] != DBNull.Value)
            {
                resources.Text += "<b>" + (string)data["TrailerRef"] + "</b><br>";
            }
            if (resources.Text.Length == 0)
            {
                resources.Text = "&nbsp;";
            }
            resources.Width = new Unit("150px");
            row.Cells.Add(resources);

            foreach (TableCell cell in row.Cells)
            {
                cell.VerticalAlign   = VerticalAlign.Top;
                cell.HorizontalAlign = HorizontalAlign.Left;
            }

            // Pallets (delivery only)
            if (data.Table.Columns.Contains("Pallets"))
            {
                TableCell pallets = new TableCell();
                if (data["Pallets"] != DBNull.Value)
                {
                    pallets.Text = ((int)data["Pallets"]).ToString("F0");
                }
                else
                {
                    pallets.Text = "0";
                }
                pallets.Width           = new Unit("30px");
                pallets.VerticalAlign   = VerticalAlign.Top;
                pallets.HorizontalAlign = HorizontalAlign.Right;
                row.Cells.Add(pallets);
            }

            // Weight (delivery only)
            if (data.Table.Columns.Contains("Weight"))
            {
                TableCell weight = new TableCell();
                if (data["Weight"] != DBNull.Value)
                {
                    weight.Text = ((decimal)data["Weight"]).ToString("F0");
                }
                else
                {
                    weight.Text = "0";
                }
                weight.Width           = new Unit("30px");
                weight.VerticalAlign   = VerticalAlign.Top;
                weight.HorizontalAlign = HorizontalAlign.Right;
                row.Cells.Add(weight);
            }

            #endregion

            #region Dockets

            // Dockets row
            TableRow dockets = new TableRow();
            rows.Add(dockets);

            TableCell docketsCell = new TableCell();
            docketsCell.ColumnSpan = row.Cells.Count;
            dockets.Cells.Add(docketsCell);

            if (jobType == eJobType.Return)
            {
                // return jobs need better information than just the docket information.
                docketsCell.Attributes.Add("onMouseOver", "javascript:ReturnsForInstructionId(true, " + ((int)data["InstructionId"]).ToString() + ");");
                docketsCell.Attributes.Add("onMouseOut", "javascript:ReturnsForInstructionId(false, 0);");
                docketsCell.Text            = "Mouseover for returns information";
                docketsCell.Style["cursor"] = "hand";
            }
            else
            {
                docketsCell.Text = "<b>" + (string)data["Dockets"] + "</b>";
            }

            #endregion

            #region Notes

            if (data["Note"] != DBNull.Value && ((string)data["Note"]).Length > 0)
            {
                TableRow notes = new TableRow();
                rows.Add(notes);

                // Note
                TableCell space = new TableCell();
                space.Text = "&nbsp;";
                notes.Cells.Add(space);
                TableCell note = new TableCell();
                note.Text       = (string)data["Note"];
                note.ColumnSpan = row.Cells.Count - 1;
                notes.Cells.Add(note);
            }

            #endregion

            return(rows);
        }
Example #6
0
        private void dgJobsToBookIn_ItemContentCreated(object sender, GridItemContentCreatedEventArgs e)
        {
            try
            {
                int jobId = Convert.ToInt32(((HtmlInputHidden)e.Content.FindControl("hidJobId")).Value);

                if (jobId > 0)
                {
                    DataView dvJobRow = new DataView(m_dsJobsData.Tables[0]);
                    dvJobRow.RowFilter = "JobId = " + jobId.ToString();
                    eJobState jobState = (eJobState)Enum.Parse(typeof(eJobState), ((string)dvJobRow.Table.Rows[0]["JobState"]).Replace(" ", ""), true);

                    HtmlInputHidden hidJobState = (HtmlInputHidden)e.Content.FindControl("hidJobState");
                    HtmlInputHidden hidJobType  = (HtmlInputHidden)e.Content.FindControl("hidJobType");

                    if (hidJobState != null && hidJobType != null)
                    {
                        eJobType jobType = (eJobType)Enum.Parse(typeof(eJobType), ((string)dvJobRow.Table.Rows[0]["JobType"]).Replace(" ", ""), true);

                        GridServerTemplateContainer container = (GridServerTemplateContainer)e.Content;

                        if (jobState == eJobState.Booked || jobState == eJobState.Planned || jobState == eJobState.InProgress)
                        {
                            Facade.IJob facJob = new Facade.Job();
                            ((HtmlImage)e.Content.FindControl("imgRequiresCallIn")).Visible = facJob.RequiresCallIn(jobId);
                        }
                        else
                        {
                            ((HtmlImage)e.Content.FindControl("imgRequiresCallIn")).Visible = false;
                        }

                        HtmlImage imgHasRequests = (HtmlImage)e.Content.FindControl("imgHasRequests");
                        if (((int)dvJobRow[0]["Requests"]) == 0)
                        {
                            imgHasRequests.Visible = false;
                        }
                        else
                        {
                            imgHasRequests.Visible = true;
                            imgHasRequests.Attributes.Add("onClick", "javascript:ShowPlannerRequests('" + jobId.ToString() + "');");
                        }

                        HtmlAnchor lnkEditJob = (HtmlAnchor)e.Content.FindControl("lnkEditJob");
                        switch (jobType)
                        {
                        case eJobType.Normal:
                            lnkEditJob.HRef = "javascript:openResizableDialogWithScrollbars('../job/wizard/wizard.aspx?jobId=" + jobId.ToString() + "', '623', '508');";
                            break;

                        case eJobType.PalletReturn:
                            lnkEditJob.HRef = "../job/addupdatepalletreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        case eJobType.Return:
                            lnkEditJob.HRef = "../job/addupdategoodsreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        default:
                            lnkEditJob.Visible = false;
                            break;
                        }
                    }

                    Table tblCollections = (Table)e.Content.FindControl("tblCollections");
                    if (tblCollections != null)
                    {
                        tblCollections.BackColor = Utilities.GetJobStateColour(jobState);
                        DataView dvCollections = new DataView(m_dsJobsData.Tables[1]);
                        foreach (DataRow collection in dvCollections.Table.Rows)
                        {
                            if ((int)collection["JobId"] == jobId)
                            {
                                // This is a collection for the current job
                                ArrayList rows = CreateTableRows(collection);
                                foreach (TableRow row in rows)
                                {
                                    tblCollections.Rows.Add(row);
                                }
                            }
                        }
                    }

                    Table tblDeliveries = (Table)e.Content.FindControl("tblDeliveries");
                    if (tblDeliveries != null)
                    {
                        tblDeliveries.BackColor = Utilities.GetJobStateColour(jobState);
                        DataView dvDeliveries = new DataView(m_dsJobsData.Tables[2]);
                        foreach (DataRow delivery in dvDeliveries.Table.Rows)
                        {
                            if ((int)delivery["JobId"] == jobId)
                            {
                                // This is a delivery for the current job
                                ArrayList rows = CreateTableRows(delivery);
                                foreach (TableRow row in rows)
                                {
                                    tblDeliveries.Rows.Add(row);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                string error = exc.Message;
            }
        }
Example #7
0
        private void dgJobs_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            ListItemType itemType = e.Item.ItemType;

            if (itemType == ListItemType.Item || itemType == ListItemType.AlternatingItem || itemType == ListItemType.SelectedItem)
            {
                string jobIdText = ((HtmlInputHidden)e.Item.FindControl("hidJobId")).Value;

                try
                {
                    int jobId = Convert.ToInt32(jobIdText);

                    if (jobId > 0)
                    {
                        DataRowView dataItem = (DataRowView)e.Item.DataItem;
                        eJobState   jobState = (eJobState)Enum.Parse(typeof(eJobState), e.Item.Cells[2].Text.Replace(" ", ""), true);
                        eJobType    jobType  = (eJobType)Enum.Parse(typeof(eJobType), e.Item.Cells[3].Text.Replace(", ", ""), true);

                        e.Item.BackColor = Utilities.GetJobStateColour(jobState);

                        if (jobState == eJobState.Booked || jobState == eJobState.Planned || jobState == eJobState.InProgress)
                        {
                            Facade.IJob facJob = new Facade.Job();
                            ((HtmlImage)e.Item.FindControl("imgRequiresCallIn")).Visible = facJob.RequiresCallIn(jobId);
                        }
                        else
                        {
                            ((HtmlImage)e.Item.FindControl("imgRequiresCallIn")).Visible = false;
                        }

                        HtmlAnchor lnkEditJob = (HtmlAnchor)e.Item.FindControl("lnkEditJob");
                        switch (jobType)
                        {
                        case eJobType.Normal:
                            lnkEditJob.HRef = "javascript:openResizableDialogWithScrollbars('../job/wizard/wizard.aspx?jobId=" + jobId.ToString() + "', '623', '508');";
                            break;

                        case eJobType.PalletReturn:
                            lnkEditJob.HRef = "../job/addupdatepalletreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        case eJobType.Return:
                            lnkEditJob.HRef = "../job/addupdategoodsreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        default:
                            lnkEditJob.Visible = false;
                            break;
                        }

                        // Configure the toggle ownership button
                        CheckBox chkOwnership = (CheckBox)e.Item.FindControl("chkOwnership");
                        bool     isMyJob      = ((int)dataItem.Row["DoesOwn"] == 1);
                        chkOwnership.Checked = isMyJob;

                        HtmlImage imgHasRequests = (HtmlImage)e.Item.FindControl("imgHasRequests");
                        if (((int)dataItem.Row["Requests"]) == 0)
                        {
                            imgHasRequests.Visible = false;
                        }
                        else
                        {
                            imgHasRequests.Visible = true;
                            imgHasRequests.Attributes.Add("onClick", "javascript:ShowPlannerRequests('" + jobId.ToString() + "');");
                        }

                        Table tblCollections = (Table)e.Item.FindControl("tblCollections");

                        DataView dvCollections = new DataView(m_dsJobsData.Tables[1]);
                        foreach (DataRow collection in dvCollections.Table.Rows)
                        {
                            if ((int)collection["JobId"] == jobId)
                            {
                                // This is a collection for the current job
                                ArrayList rows = CreateTableRows(collection);
                                foreach (TableRow row in rows)
                                {
                                    tblCollections.Rows.Add(row);
                                }
                            }
                        }

                        Table tblDeliveries = (Table)e.Item.FindControl("tblDeliveries");

                        DataView dvDeliveries = new DataView(m_dsJobsData.Tables[2]);
                        foreach (DataRow delivery in dvDeliveries.Table.Rows)
                        {
                            if ((int)delivery["JobId"] == jobId)
                            {
                                // This is a collection for the current job
                                ArrayList rows = CreateTableRows(delivery);
                                foreach (TableRow row in rows)
                                {
                                    tblDeliveries.Rows.Add(row);
                                }
                            }
                        }
                    }
                }
                catch (Exception exc)
                {
                    string error = exc.Message;
                }
            }
        }