Beispiel #1
0
        private void LoadNominalCode(int nominalCodeID)
        {
            Orchestrator.Facade.INominalCode  facNominalCode = new Orchestrator.Facade.NominalCode();
            Orchestrator.Entities.NominalCode nc             = facNominalCode.GetForNominalCodeID(nominalCodeID);
            this.Code = nc;

            string jobType = "0";

            if (nc.JobType > 0)
            {
                jobType = nc.JobType.ToString();
            }
            cboJobType.ClearSelection();
            cboJobType.FindItemByValue(jobType).Selected = true;
            txtNominalCode.Text = nc.ShortCode;
            txtDescription.Text = nc.Description;
            chkIsActive.Checked = nc.IsActive;

            lblBusinessTypesMapped.Text = nc.BusinessTypeMaps.ToString();
            lblExtraTypesMapped.Text    = nc.ExtraTypeMaps.ToString();
            lblOrganisationsMapped.Text = nc.OrganisationMaps.ToString();
            lblVehiclesMapped.Text      = nc.VehicleMaps.ToString();

            trAssignments.Visible   = trAssignmentNote.Visible = btnUnassign.Visible = nc.BusinessTypeMaps + nc.ExtraTypeMaps + nc.OrganisationMaps + nc.VehicleMaps > 0;
            chkIsActive.Enabled     = !trAssignmentNote.Visible;
            trBusinessTypes.Visible = nc.BusinessTypeMaps > 0;
            trExtraTypes.Visible    = nc.ExtraTypeMaps > 0;
            trOrganisations.Visible = nc.OrganisationMaps > 0;
            trVehicles.Visible      = nc.VehicleMaps > 0;
        }
Beispiel #2
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();
        }