private void GetDefaultParameters()
        {
            tbFromDate.Text = DateTime.Now.ToShortDateString();
            tbToDate.Text   = DateTime.Now.ToShortDateString();
            using (var dataAccess = new ParamaterListItemGenerator())
            {
                ddlTopics.Items.AddRange(dataAccess.GenerateAvailabilityTopicList().ToArray());
            }

            using (var dataAccess = new BaseDataAccess())
            {
                lbFleet.Items.AddRange(dataAccess.GetFleetTypesList(ModuleType.Availability).ToArray());
                var daysOfWeek = dataAccess.GetDayOfWeeks();
                daysOfWeek.Insert(0, new ListItem("All", string.Empty));
                ddlDayOfWeek.Items.AddRange(daysOfWeek.ToArray());
                lbMovementType.Items.AddRange(dataAccess.GetMovementTypesList().ToArray());
                lbOperationalStatus.Items.AddRange(dataAccess.GetOperationalStatusList().ToArray());
            }
            AddPredicamentDropDownValues();

            if (SessionStoredAvailabilityParameters != null)
            {
                ExtractParametersFromSession();
            }
            else
            {
                rblPercentOrValues.Items[2].Selected = true;
                rblDayGrouping.Items[0].Selected     = true;
                rblShowValuesAs.Items[0].Selected    = true;
            }
        }
Пример #2
0
        private void UpdateFromQuickLocation(bool outLocation)
        {
            var locationWwd = outLocation ? tbQuickCheckOutLocation.Text : tbQuickCheckInLocation.Text;
            var parameters  = BuildParameterDictionary();

            using (var generator = new ParamaterListItemGenerator())
            {
                var country = generator.GetCountry(locationWwd);
                if (country == string.Empty)
                {
                    if (outLocation)
                    {
                        tbQuickCheckOutLocation.Text = string.Empty;
                    }
                    else
                    {
                        tbQuickCheckInLocation.Text = string.Empty;
                    }

                    return;
                }

                var poolId          = generator.GetLocationBranchId(ParameterType.Pool, locationWwd);
                var locationGroupId = generator.GetLocationBranchId(ParameterType.LocationGroup, locationWwd);
                var areaId          = generator.GetLocationBranchId(ParameterType.Area, locationWwd);
                var regionId        = generator.GetLocationBranchId(ParameterType.Region, locationWwd);
                var locationId      = generator.GetLocationBranchId(ParameterType.Location, locationWwd);
                if (outLocation)
                {
                    parameters[DictionaryParameter.OwningCountry]         = country;
                    parameters[DictionaryParameter.CheckOutCountry]       = country;
                    parameters[DictionaryParameter.CheckOutPool]          = poolId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.CheckOutLocationGroup] = locationGroupId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.CheckOutArea]          = areaId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.CheckOutRegion]        = regionId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.CheckOutLocation]      = locationId.ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    parameters[DictionaryParameter.LocationCountry] = country;
                    parameters[DictionaryParameter.Pool]            = poolId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.LocationGroup]   = locationGroupId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.Area]            = areaId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.Region]          = regionId.ToString(CultureInfo.InvariantCulture);
                    parameters[DictionaryParameter.Location]        = locationId.ToString(CultureInfo.InvariantCulture);
                }
            }

            FillDropDowns(!outLocation, 0, parameters, false, false, true);
            SelectAutoCompleteParameters(parameters, outLocation);
            if (outLocation)
            {
                tbQuickCheckOutLocation.Text = string.Empty;
            }
            else
            {
                tbQuickCheckInLocation.Text = string.Empty;
            }
            SetSessionDropdownLists();
        }
Пример #3
0
        private void UpdateFromQuickCarGroup()
        {
            var carGroup   = tbQuickCarGroup.Text;
            var country    = GetJoinedSelectedListBoxItems(lbCheckOutCountry);
            var parameters = BuildParameterDictionary();

            if (carGroup.Contains("-"))
            {
                country  = carGroup.Substring(0, 2);
                carGroup = carGroup.Substring(3, carGroup.Length - 3);
            }

            using (var generator = new ParamaterListItemGenerator())
            {
                var carSegmentId = generator.GetCarBranchId(ParameterType.CarSegment, carGroup, country);
                var carClassId   = generator.GetCarBranchId(ParameterType.CarClass, carGroup, country);
                var carGroupId   = generator.GetCarBranchId(ParameterType.CarGroup, carGroup, country);

                parameters[DictionaryParameter.OwningCountry] = AddAutoCompleteToCountry(parameters[DictionaryParameter.OwningCountry], country);
                parameters[DictionaryParameter.CarSegment]    = AddAutoCompleteToGenericId(parameters[DictionaryParameter.CarSegment], carSegmentId);
                parameters[DictionaryParameter.CarClass]      = AddAutoCompleteToGenericId(parameters[DictionaryParameter.CarClass], carClassId);
                parameters[DictionaryParameter.CarGroup]      = AddAutoCompleteToGenericId(parameters[DictionaryParameter.CarGroup], carGroupId);
            }
            FillDropDowns(false, 0, parameters);
            SelectAutoCompleteParameters(parameters, true);
            tbQuickCarGroup.Text = string.Empty;
            SetSessionDropdownLists();
        }
Пример #4
0
        private void UpdateFromQuickCarGroup()
        {
            var carGroup   = tbQuickCarGroup.Text;
            var country    = ddlCheckOutCountry.SelectedValue;
            var parameters = BuildParameterDictionary();


            using (var generator = new ParamaterListItemGenerator())
            {
                if (!generator.DoesCarGroupExistForCountry(country, carGroup))
                {
                    tbQuickCarGroup.Text = string.Empty;
                    return;
                }

                var carSegment = generator.GetCarBranchId(ParameterType.CarSegment, carGroup, country);
                var carClass   = generator.GetCarBranchId(ParameterType.CarClass, carGroup, country);
                var carGroupId = generator.GetCarBranchId(ParameterType.CarGroup, carGroup, country);

                parameters[DictionaryParameter.CarSegment] = carSegment.ToString(CultureInfo.InvariantCulture);
                parameters[DictionaryParameter.CarClass]   = carClass.ToString(CultureInfo.InvariantCulture);
                parameters[DictionaryParameter.CarGroup]   = carGroupId.ToString(CultureInfo.InvariantCulture);
            }
            FillDropDowns(false, 1, parameters);
            SelectAutoCompleteParameters(parameters, true);
            tbQuickCarGroup.Text = string.Empty;
            SetSessionDropdownLists();
        }
 private void GenerateNewDropdowns()
 {
     using (var generator = new ParamaterListItemGenerator())
     {
         var owningCountries   = generator.GenerateList(ParameterType.OwningCountry, null).ToArray();
         var locationCountries = generator.GenerateList(ParameterType.LocationCountry, null).ToArray();
         var emptyList         = generator.GenerateEmptyList().ToArray();
         ddlOwningCountry.Items.AddRange(owningCountries);
         ddlOwningCountry.SelectedIndex = 0;
         ddlLocationCountry.Items.AddRange(locationCountries);
         ddlLocationCountry.SelectedIndex = 0;
         ddlCarSegment.Items.AddRange(emptyList);
         ddlCarSegment.SelectedIndex = 0;
         ddlCarClass.Items.AddRange(emptyList);
         ddlCarClass.SelectedIndex = 0;
         ddlCarGroup.Items.AddRange(emptyList);
         ddlCarGroup.SelectedIndex = 0;
         ddlPool.Items.AddRange(emptyList);
         ddlPool.SelectedIndex = 0;
         ddlRegion.Items.AddRange(emptyList);
         ddlRegion.SelectedIndex = 0;
         ddlArea.Items.AddRange(emptyList);
         ddlArea.SelectedIndex = 0;
         ddlLocationGroup.Items.AddRange(emptyList);
         ddlLocationGroup.SelectedIndex = 0;
         ddlLocation.Items.AddRange(emptyList);
         ddlLocation.SelectedIndex = 0;
     }
 }
Пример #6
0
        private void FillDropdowns()
        {
            var t = DateTime.Now;

            ipMonthSelected.Value = string.Format("{0} {1}", t.ToString("MMMM"), t.Year);;
            using (var dataAccess = new ApprovalDataAccess(null))
            {
                lbOperationalStatus.Items.AddRange(dataAccess.GetOperationalStatusList().ToArray());
                lbFleet.Items.AddRange(dataAccess.GetFleetTypesList(ModuleType.NonRev).ToArray());
            }

            using (var generator = new ParamaterListItemGenerator())
            {
                var owningCountries   = generator.GenerateList(ParameterType.OwningCountry, null);
                var locationCountries = generator.GenerateList(ParameterType.LocationCountry, null);
                ddlOwningCountry.Items.AddRange(owningCountries.ToArray());
                ddlLocationCountry.Items.AddRange(locationCountries.ToArray());
                ddlApprovedOwningCountry.Items.AddRange(owningCountries.ToArray());
                ddlApprovedLocationCountry.Items.AddRange(locationCountries.ToArray());
                ddlApprovedLocationCountry.SelectedIndex = 0;
                ddlApprovedOwningCountry.SelectedIndex   = 0;
                ddlOwningCountry.SelectedIndex           = 0;
                ddlLocationCountry.SelectedIndex         = 0;
            }
        }
Пример #7
0
        private void GenerateNewDropdowns()
        {
            using (var generator = new ParamaterListItemGenerator())
            {
                var owningCountries   = generator.GenerateList(ParameterType.OwningCountry, null, false).ToArray();
                var locationCountries = generator.GenerateList(ParameterType.LocationCountry, null, false).ToArray();

                lbCheckOutCountry.Items.AddRange(owningCountries);
                lbCheckInCountry.Items.AddRange(locationCountries);
            }
        }
Пример #8
0
        /// <summary>
        /// Fills Drop down lists from database
        /// </summary>
        /// <param name="locationBranch">Clears everything below depth for this branch</param>
        /// <param name="depth">Clears everything below this depth</param>
        /// <param name="parameters"></param>
        private void FillDropDowns(bool locationBranch, int depth, Dictionary <DictionaryParameter, string> parameters
                                   , bool clearCms = false, bool clearOps = false, bool owningLocationOnly = false)
        {
            bool locationSelectedOnCms = CmsLogicSelected && (depth == 3);
            bool locationSelectedOnOps = !CmsLogicSelected && (depth == 3);

            using (var generator = new ParamaterListItemGenerator())
            {
                if (locationBranch)
                {
                    SetInvlisibleCmsOpsFields(parameters, depth, generator, false);

                    var locationGroups = generator.GenerateList(ParameterType.LocationGroup, parameters, false).ToArray();
                    var locations      = generator.GenerateList(ParameterType.Location, parameters, false).ToArray();
                    var areas          = generator.GenerateList(ParameterType.Area, parameters, false).ToArray();
                    var pools          = generator.GenerateList(ParameterType.Pool, parameters, false).ToArray();
                    var regions        = generator.GenerateList(ParameterType.Region, parameters, false).ToArray();

                    ClearAndPopulateLb(lbCheckInPool, pools, depth == 0 || clearCms || locationSelectedOnOps);
                    ClearAndPopulateLb(lbCheckInRegion, regions, depth == 0 || clearOps || locationSelectedOnCms);
                    ClearAndPopulateLb(lbCheckInLocationGroup, locationGroups, depth <= 1 || clearCms || locationSelectedOnOps);
                    ClearAndPopulateLb(lbCheckInArea, areas, depth <= 1 || clearOps || locationSelectedOnCms);
                    ClearAndPopulateLb(lbCheckInLocation, locations, depth <= 2);
                }
                else
                {
                    SetInvlisibleCmsOpsFields(parameters, depth, generator, true);

                    var carSegments = generator.GenerateList(ParameterType.CarSegment, parameters, false).ToArray();
                    var carClass    = generator.GenerateList(ParameterType.CarClass, parameters, false).ToArray();
                    var carGroup    = generator.GenerateList(ParameterType.CarGroup, parameters, false).ToArray();

                    ClearAndPopulateLb(lbCarSegment, carSegments, depth == 0);
                    ClearAndPopulateLb(lbCarClass, carClass, (depth <= 1 && !owningLocationOnly) || depth == 0);
                    ClearAndPopulateLb(lbCarGroup, carGroup, (depth <= 2 && !owningLocationOnly) || depth == 0);

                    var poolsOut          = generator.GenerateList(ParameterType.Pool, parameters, false, true).ToArray();
                    var regionsOut        = generator.GenerateList(ParameterType.Region, parameters, false, true).ToArray();
                    var locationGroupsOut = generator.GenerateList(ParameterType.LocationGroup, parameters, false, true).ToArray();
                    var areasOut          = generator.GenerateList(ParameterType.Area, parameters, false, true).ToArray();
                    var locationsOut      = generator.GenerateList(ParameterType.Location, parameters, false, true).ToArray();

                    ClearAndPopulateLb(lbCheckOutPool, poolsOut, depth == 0 || clearCms || locationSelectedOnOps);
                    ClearAndPopulateLb(lbCheckOutRegion, regionsOut, depth == 0 || clearOps || locationSelectedOnCms);
                    ClearAndPopulateLb(lbCheckOutLocationGroup, locationGroupsOut,
                                       ((depth <= 1 || clearCms || locationSelectedOnOps) && owningLocationOnly) || depth == 0);
                    ClearAndPopulateLb(lbCheckOutArea, areasOut,
                                       ((depth <= 1 || clearOps || locationSelectedOnCms) && owningLocationOnly) || depth == 0);

                    ClearAndPopulateLb(lbCheckOutLocation, locationsOut, ((depth <= 2 && owningLocationOnly) || depth == 0));
                }
            }
        }
        private void UpdateFromQuickLocation()
        {
            var locationWwd = tbQuickLocation.Text;

            if (locationWwd == string.Empty)
            {
                return;
            }
            var parameters = BuildParameterDictionary();

            using (var generator = new ParamaterListItemGenerator())
            {
                var country = generator.GetCountry(locationWwd);
                if (country == string.Empty)
                {
                    tbQuickLocation.Text = string.Empty;
                    return;
                }

                var poolId          = generator.GetLocationBranchId(ParameterType.Pool, locationWwd);
                var locationGroupId = generator.GetLocationBranchId(ParameterType.LocationGroup, locationWwd);
                var areaId          = generator.GetLocationBranchId(ParameterType.Area, locationWwd);
                var regionId        = generator.GetLocationBranchId(ParameterType.Region, locationWwd);
                var locationId      = generator.GetLocationBranchId(ParameterType.Location, locationWwd);


                parameters[DictionaryParameter.LocationCountry] = AddAutoCompleteToCountry(parameters[DictionaryParameter.LocationCountry], country);
                parameters[DictionaryParameter.Pool]            = AddAutoCompleteToGenericId(parameters[DictionaryParameter.Pool], poolId);
                parameters[DictionaryParameter.LocationGroup]   = AddAutoCompleteToGenericId(parameters[DictionaryParameter.LocationGroup], locationGroupId);
                parameters[DictionaryParameter.Area]            = AddAutoCompleteToGenericId(parameters[DictionaryParameter.Area], areaId);
                parameters[DictionaryParameter.Region]          = AddAutoCompleteToGenericId(parameters[DictionaryParameter.Region], regionId);
                parameters[DictionaryParameter.Location]        = AddAutoCompleteToGenericId(parameters[DictionaryParameter.Location], locationId);
            }

            FillDropDowns(true, 0, parameters);
            SelectAutoCompleteParameters(parameters);
            tbQuickLocation.Text = string.Empty;
            SetSessionDropdownLists();
        }
        public void UpdateFromQuickLocation()
        {
            var locationWwd = tbQuickLocation.Text;

            if (locationWwd == string.Empty)
            {
                return;
            }
            var parameters = BuildParameterDictionary();

            using (var generator = new ParamaterListItemGenerator())
            {
                var country = generator.GetCountry(locationWwd);
                if (country == string.Empty)
                {
                    tbQuickLocation.Text = string.Empty;
                    return;
                }

                var poolId          = generator.GetLocationBranchId(ParameterType.Pool, locationWwd);
                var locationGroupId = generator.GetLocationBranchId(ParameterType.LocationGroup, locationWwd);
                var areaId          = generator.GetLocationBranchId(ParameterType.Area, locationWwd);
                var regionId        = generator.GetLocationBranchId(ParameterType.Region, locationWwd);
                var locationId      = generator.GetLocationBranchId(ParameterType.Location, locationWwd);
                parameters[DictionaryParameter.LocationCountry] = country;
                parameters[DictionaryParameter.Pool]            = poolId.ToString(CultureInfo.InvariantCulture);
                parameters[DictionaryParameter.LocationGroup]   = locationGroupId.ToString(CultureInfo.InvariantCulture);
                parameters[DictionaryParameter.Area]            = areaId.ToString(CultureInfo.InvariantCulture);
                parameters[DictionaryParameter.Region]          = regionId.ToString(CultureInfo.InvariantCulture);
                parameters[DictionaryParameter.Location]        = locationId.ToString(CultureInfo.InvariantCulture);
            }

            FillDropDowns(true, 0, parameters);
            SelectAutoCompleteParameters(parameters);
            tbQuickLocation.Text = string.Empty;
            SetSessionDropdownLists();
        }
Пример #11
0
        private void SetInvlisibleCmsOpsFields(Dictionary <DictionaryParameter, string> parameters, int depth, ParamaterListItemGenerator generator
                                               , bool checkOutLogic)

        {
            bool locationSelectedOnCms = CmsLogicSelected && depth == 3;
            bool locationSelectedOnOps = !CmsLogicSelected && depth == 3;

            if (locationSelectedOnCms)
            {
                string areaId   = string.Empty;
                string regionId = string.Empty;
                if (!string.IsNullOrEmpty(parameters[DictionaryParameter.Location]))
                {
                    var locationWwd = generator.GetWwdFromLocationId(int.Parse(parameters[DictionaryParameter.Location]));
                    areaId = generator.GetLocationBranchId(ParameterType.Area,
                                                           locationWwd).ToString();
                    regionId = generator.GetLocationBranchId(ParameterType.Region,
                                                             locationWwd).ToString();
                }


                parameters[DictionaryParameter.Area]   = areaId;
                parameters[DictionaryParameter.Region] = regionId;
            }
            if (locationSelectedOnOps)
            {
                string poolId          = string.Empty;
                string locationGroupId = string.Empty;

                if (!string.IsNullOrEmpty(parameters[DictionaryParameter.Location]))
                {
                    var locationWwd =
                        generator.GetWwdFromLocationId(int.Parse(parameters[DictionaryParameter.Location]));
                    poolId = generator.GetLocationBranchId(ParameterType.Pool,
                                                           locationWwd).ToString();
                    locationGroupId = generator.GetLocationBranchId(ParameterType.LocationGroup,
                                                                    locationWwd).ToString();
                }
                parameters[DictionaryParameter.Pool]          = poolId;
                parameters[DictionaryParameter.LocationGroup] = locationGroupId;
            }
        }
        /// <summary>
        /// Fills Drop down lists from database
        /// </summary>
        /// <param name="locationBranch">Clears everything below depth for this branch</param>
        /// <param name="depth">Clears everything below this depth</param>
        /// <param name="parameters"></param>
        private void FillDropDowns(bool locationBranch, int depth, Dictionary <DictionaryParameter, string> parameters, bool clearCms = false, bool clearOps = false)
        {
            using (var generator = new ParamaterListItemGenerator())
            {
                if (locationBranch)
                {
                    bool locationSelectedOnCms = CmsLogicSelected && depth == 3;
                    bool locationSelectedOnOps = !CmsLogicSelected && depth == 3;

                    if (locationSelectedOnCms)
                    {
                        string areaId   = string.Empty;
                        string regionId = string.Empty;
                        if (!string.IsNullOrEmpty(parameters[DictionaryParameter.Location]))
                        {
                            var locationWwd = generator.GetWwdFromLocationId(int.Parse(parameters[DictionaryParameter.Location]));
                            areaId = generator.GetLocationBranchId(ParameterType.Area,
                                                                   locationWwd).ToString();
                            regionId = generator.GetLocationBranchId(ParameterType.Region,
                                                                     locationWwd).ToString();
                        }


                        parameters[DictionaryParameter.Area]   = areaId;
                        parameters[DictionaryParameter.Region] = regionId;
                    }
                    if (locationSelectedOnOps)
                    {
                        string poolId          = string.Empty;
                        string locationGroupId = string.Empty;

                        if (!string.IsNullOrEmpty(parameters[DictionaryParameter.Location]))
                        {
                            var locationWwd =
                                generator.GetWwdFromLocationId(int.Parse(parameters[DictionaryParameter.Location]));
                            poolId = generator.GetLocationBranchId(ParameterType.Pool,
                                                                   locationWwd).ToString();
                            locationGroupId = generator.GetLocationBranchId(ParameterType.LocationGroup,
                                                                            locationWwd).ToString();
                        }
                        parameters[DictionaryParameter.Pool]          = poolId;
                        parameters[DictionaryParameter.LocationGroup] = locationGroupId;
                    }


                    var pools          = generator.GenerateList(ParameterType.Pool, parameters, false).ToArray();
                    var locationGroups = generator.GenerateList(ParameterType.LocationGroup, parameters, false).ToArray();
                    var locations      = generator.GenerateList(ParameterType.Location, parameters, false).ToArray();
                    var regions        = generator.GenerateList(ParameterType.Region, parameters, false).ToArray();
                    var areas          = generator.GenerateList(ParameterType.Area, parameters, false).ToArray();



                    ClearAndPopulateLb(lbPool, pools, depth <= 0 || clearCms || locationSelectedOnOps);
                    ClearAndPopulateLb(lbRegion, regions, depth <= 0 || clearOps || locationSelectedOnCms);
                    ClearAndPopulateLb(lbLocationGroup, locationGroups, depth <= 1 || clearCms || locationSelectedOnOps);
                    ClearAndPopulateLb(lbArea, areas, depth <= 1 || clearOps || locationSelectedOnCms);
                    ClearAndPopulateLb(lbLocation, locations, depth <= 2);
                    if (locationSelectedOnCms)
                    {
                        SetDropdownListMultiple(lbRegion, parameters[DictionaryParameter.Region]);
                        SetDropdownListMultiple(lbArea, parameters[DictionaryParameter.Area]);
                    }
                    if (locationSelectedOnOps)
                    {
                        SetDropdownListMultiple(lbRegion, parameters[DictionaryParameter.Pool]);
                        SetDropdownListMultiple(lbLocationGroup, parameters[DictionaryParameter.LocationGroup]);
                    }
                }
                else
                {
                    var carSegments = generator.GenerateList(ParameterType.CarSegment, parameters, false).ToArray();
                    var carClass    = generator.GenerateList(ParameterType.CarClass, parameters, false).ToArray();
                    var carGroup    = generator.GenerateList(ParameterType.CarGroup, parameters, false).ToArray();

                    ClearAndPopulateLb(lbCarSegment, carSegments, depth <= 0);
                    ClearAndPopulateLb(lbCarClass, carClass, depth <= 1);
                    ClearAndPopulateLb(lbCarGroup, carGroup, depth <= 2);
                }
            }
        }