private void ConfigureDisplay()
        {
            int jobId, instructionId = 0;

            if (JobId == -1 && !string.IsNullOrEmpty(Request.QueryString["jId"]))
            {
                if (int.TryParse(Request.QueryString["jId"], out jobId))
                {
                    JobId = jobId;
                }
            }

            if (InstructionId == -1 && !string.IsNullOrEmpty(Request.QueryString["iId"]))
            {
                if (int.TryParse(Request.QueryString["iId"], out instructionId))
                {
                    InstructionId = instructionId;
                }
            }

            // Bind the options for redelivery reasons, collection options only.
            cboRedeliveryReason.DataSource = EF.DataContext.Current.RedeliveryReasonSet.Where(rr => rr.IsEnabled == true && rr.IsCollection == true).OrderBy(rr => rr.Description);
            cboRedeliveryReason.DataBind();

            // Bind the extra types (remove any invalid options).
            Facade.ExtraType facExtraType        = new Facade.ExtraType();
            bool?            getActiveExtraTypes = true;

            List <Entities.ExtraType> extraTypes = facExtraType.GetForIsEnabled(getActiveExtraTypes);

            extraTypes.RemoveAll(o => (eExtraType)(o.ExtraTypeId) == eExtraType.Custom ||
                                 (eExtraType)(o.ExtraTypeId) == eExtraType.Demurrage ||
                                 (eExtraType)(o.ExtraTypeId) == eExtraType.DemurrageExtra);

            cboExtraType.DataSource     = extraTypes;
            cboExtraType.DataValueField = "ExtraTypeId";
            cboExtraType.DataTextField  = "Description";
            cboExtraType.DataBind();

            // Bind the extra states (remove any invalid options).
            List <string> extraStates = new List <string>(Utilities.UnCamelCase(Enum.GetNames(typeof(eExtraState))));

            extraStates.Remove(Utilities.UnCamelCase(Enum.GetName(typeof(eExtraState), eExtraState.Invoiced)));
            cboExtraState.DataSource = extraStates;
            cboExtraState.DataBind();

            // Get Instruction Details
            Facade.IInstruction facIns   = new Facade.Instruction();
            Facade.IPoint       facPoint = new Facade.Point();

            Entities.Instruction currentIns = facIns.GetInstruction(InstructionId);
            Entities.Point       loadPoint  = facPoint.GetPointForPointId(currentIns.PointID);

            txtExtraCustomReason.Text = string.Format("Attempted Collection from {0}", loadPoint.Description);
        }
Esempio n. 2
0
        private bool ApplyFuelSurcharge()
        {
            Facade.IOrder facadeOrder = new Facade.Order();
            var           order       = facadeOrder.GetForOrderID(this.OrderID);

            Facade.Organisation facOrg = new Facade.Organisation();
            var defaults = facOrg.GetDefaultsForIdentityId(order.CustomerIdentityID);

            Facade.ExtraType facExtraType = new Facade.ExtraType();
            var extraType = facExtraType.GetForExtraTypeID(int.Parse(cboExtraType.SelectedValue));

            m_fuelSurchargePercentage = order.FuelSurchargePercentage;
            bool fuelSurchargeAppliesToExtras = bool.Parse(defaults.Tables[0].Rows[0]["FuelSurchargeOnExtras"].ToString());

            return(fuelSurchargeAppliesToExtras && extraType.FuelSurchargeApplies);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Security.Authorise.EnforceAuthorisation(eSystemPortion.AddEditOrder);
            _exportOrderEnabled = bool.Parse(ConfigurationManager.AppSettings["ExportOrderEnabled"].ToLower());

            if (!IsPostBack)
            {
                // Show/hide the "Export to Palletforce" button depending on whether a module id is present in the config.
                btnExportOrder.Visible = _exportOrderEnabled;

                btnCreateDelivery.PostBackUrl = "DeliveryJob.aspx?" + this.CookieSessionID;

                rblDateFiltering.Items.Clear();

                // amended to remove the var so that I can deploy a hot fix
                foreach (eDateFilterType item in Enum.GetValues(typeof(eDateFilterType)))
                {
                    rblDateFiltering.Items.Add(new ListItem(Enum.GetName(typeof(eDateFilterType), item).Replace("_", " "), ((int)item).ToString()));
                }

                rblDateFiltering.Items.Add(new ListItem("Trunk Date", "3"));

                ListItem defaultDateFiltering = rblDateFiltering.Items.FindByValue(((int)C_DEFAULT_DATE_FILTERING).ToString());
                if (defaultDateFiltering != null)
                {
                    defaultDateFiltering.Selected = true;
                }
                if (rblDateFiltering.Items.Count > 0 && rblDateFiltering.SelectedItem == null)
                {
                    rblDateFiltering.Items[0].Selected = true;
                }

                Facade.ITrafficArea facTrafficArea = new Facade.Traffic();
                cblTrafficAreas.DataSource = facTrafficArea.GetAll();
                cblTrafficAreas.DataBind();

                Facade.IBusinessType facBusinessType = new Facade.BusinessType();
                DataSet dsBusinessTypes = facBusinessType.GetAll();

                cblBusinessTypes.DataSource = dsBusinessTypes;
                cblBusinessTypes.DataBind();

                foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
                {
                    RadMenuItem rmi = new RadMenuItem();
                    rmi.Text  = row["Description"].ToString();
                    rmi.Value = row["BusinessTypeID"].ToString();
                    RadMenu1.Items.Add(rmi);
                }

                Facade.IOrderServiceLevel facOrderServiceLevel = new Facade.Order();
                cblServiceLevel.DataSource = facOrderServiceLevel.GetAll();
                cblServiceLevel.DataBind();

                Facade.ExtraType facExtraType = new Facade.ExtraType();
                cblSurcharges.DataSource = facExtraType.GetAllForFiltering();
                cblSurcharges.DataBind();

                PreSelectItems(cblServiceLevel, C_SELECTED_SERVICE_LEVELS);
                PreSelectItems(cblSurcharges, C_SELECTED_SURCHARGES);

                GetDates();
            }
        }
Esempio n. 4
0
        void grdExtraTypes_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DropDownList     cboNominalCodes         = (DropDownList)e.Item.FindControl("cboNominalCodes");
            HtmlInputControl txtDescription          = (HtmlInputControl)e.Item.FindControl("txtDescription");
            HtmlInputControl txtShortDescription     = (HtmlInputControl)e.Item.FindControl("txtShortDescription");
            CheckBox         chkFuelSurchargeApplies = (CheckBox)e.Item.FindControl("chkFuelSurchargeApplies");
            CheckBox         chkIsEnabled            = (CheckBox)e.Item.FindControl("chkIsEnabled");

            CheckBox chkIsAcceptanceRequired        = (CheckBox)e.Item.FindControl("chkIsAcceptanceRequired");
            CheckBox chkIsDisplayedOnAddUpdateOrder = (CheckBox)e.Item.FindControl("chkIsDisplayedOnAddUpdateOrder");

            CheckBox      chkIsTimeBased = (CheckBox)e.Item.FindControl("chkIsTimeBased");
            RadTimePicker rdiStartTime   = (RadTimePicker)e.Item.FindControl("rdiStartTime");
            RadTimePicker rdiEndTime     = (RadTimePicker)e.Item.FindControl("rdiEndTime");

            CheckBox chkIsDayBased = (CheckBox)e.Item.FindControl("chkIsDayBased");
            CheckBox chkMonday     = (CheckBox)e.Item.FindControl("chkMonday");
            CheckBox chkTuesday    = (CheckBox)e.Item.FindControl("chkTuesday");
            CheckBox chkWednesday  = (CheckBox)e.Item.FindControl("chkWednesday");
            CheckBox chkThursday   = (CheckBox)e.Item.FindControl("chkThursday");
            CheckBox chkFriday     = (CheckBox)e.Item.FindControl("chkFriday");
            CheckBox chkSaturday   = (CheckBox)e.Item.FindControl("chkSaturday");
            CheckBox chkSunday     = (CheckBox)e.Item.FindControl("chkSunday");

            Facade.ExtraType   facExtraType = new Facade.ExtraType();
            Entities.ExtraType extraType    = new Entities.ExtraType();

            int?startTime = null;
            int?endTime   = null;

            if (chkIsTimeBased.Checked)
            {
                startTime = (int?)rdiStartTime.SelectedTime.Value.TotalMinutes;
                endTime   = (int?)rdiEndTime.SelectedTime.Value.TotalMinutes;
            }

            if (!string.IsNullOrEmpty(cboNominalCodes.SelectedValue) && Convert.ToInt32(cboNominalCodes.SelectedValue) > 0)
            {
                Facade.INominalCode  facNominal  = new Facade.NominalCode();
                Entities.NominalCode nominalCode = facNominal.GetForNominalCodeID(Convert.ToInt32(cboNominalCodes.SelectedValue));
                extraType.NominalCode = nominalCode;
            }

            extraType.Description                 = txtDescription.Value;
            extraType.FuelSurchargeApplies        = chkFuelSurchargeApplies.Checked;
            extraType.IsEnabled                   = chkIsEnabled.Checked;
            extraType.IsDisplayedOnAddUpdateOrder = chkIsDisplayedOnAddUpdateOrder.Checked;
            extraType.IsAcceptanceRequired        = chkIsAcceptanceRequired.Checked;
            extraType.IsTimeBased                 = chkIsTimeBased.Checked;
            extraType.ExtraTypeStartTime          = startTime;
            extraType.ExtraTypeEndTime            = endTime;
            extraType.IsDayBased                  = chkIsDayBased.Checked;
            extraType.Monday    = chkMonday.Checked;
            extraType.Tuesday   = chkTuesday.Checked;
            extraType.Wednesday = chkWednesday.Checked;
            extraType.Thursday  = chkThursday.Checked;
            extraType.Friday    = chkFriday.Checked;
            extraType.Saturday  = chkSaturday.Checked;
            extraType.Sunday    = chkSunday.Checked;

            extraType.ShortDescription = txtShortDescription.Value;

            facExtraType.Create(extraType, ((Orchestrator.Entities.CustomPrincipal)Page.User).UserName.ToString());

            grdExtraTypes.Rebind();
        }