protected void Page_Load(object sender, EventArgs e)
        {
            lblErrorMessage.Visible = false;
            lblProcessMessage.Text  = string.Empty;
            if (!IsPostBack)
            {
                hfLoggedOnUser.Value          = ApplicationAuthentication.GetGlobalId();
                ucDgcProgress.CurrentProgress = DemandGapCalculationStep.NotStarted;
                PopulateScenarios();
                PopulateMinAndMaxSpreadDates();
                pnlGapFill.Visible = false;
            }

            if (ucDgcProgress.CurrentProgress == DemandGapCalculationStep.Complete ||
                ucDgcProgress.CurrentProgress == DemandGapCalculationStep.Error)
            {
                hfLoading.Value      = string.Empty;
                btnCaluclate.Enabled = true;
                pnlGapFill.Visible   = true;
                tbSummary.Text       = ucDgcProgress.CurrentProgress == DemandGapCalculationStep.Complete
                    ? SummaryText : string.Empty;
                ucDgcProgress.CurrentProgress = DemandGapCalculationStep.NotStarted;
            }

            ucDemanGapStageOneGrid.GridItemType           = typeof(WeeklyMaxMinValues);
            ucDemanGapStageOneGrid.SessionNameForGridData = DemandGapDisplaySession;
            ucDemanGapStageOneGrid.ColumnHeaders          = WeeklyMaxMinValues.HeaderRows;
            ucDemanGapStageOneGrid.ColumnFormats          = WeeklyMaxMinValues.Formats;

            ucResult.GridItemType           = typeof(AdditionEntity);
            ucResult.SessionNameForGridData = AdditionPlanSessionHolder;
            ucResult.ColumnHeaders          = AdditionEntity.HeaderRows;
            ucResult.ColumnFormats          = AdditionEntity.Formats;
        }
Пример #2
0
        public void UpdateMinCommercialSegments(double newMinCommSegPercent)
        {
            var comSegData  = CommercialSegmentQueryable.GetCommercialCarSemgents(DataContext, Parameters);
            var locations   = LocationQueryable.GetLocations(DataContext, Parameters);
            var carSegments = CarSegmentQueryable.GetCarSegments(DataContext, Parameters);

            var fullComSeg = from ccs in comSegData
                             from l in locations
                             from cs in carSegments
                             select new
            {
                LocationId   = l.dim_Location_id,
                CarSegmentId = cs.car_segment_id,
                ccs.CommercialCarSegmentId
            };

            var minCommIdsToUpdate = from fullCs in fullComSeg
                                     join mcs in DataContext.MinCommercialSegments on
                                     new { fullCs.LocationId, fullCs.CarSegmentId, fullCs.CommercialCarSegmentId }
            equals new { mcs.LocationId, mcs.CarSegmentId, mcs.CommercialCarSegmentId }
            select mcs;

            minCommIdsToUpdate.ForEach(d => d.Percentage = newMinCommSegPercent);
            minCommIdsToUpdate.ForEach(d => d.UpdatedBy  = ApplicationAuthentication.GetGlobalId());
            minCommIdsToUpdate.ForEach(d => d.UpdatedOn  = DateTime.Now);

            var entriesToCreate = from fullCs in fullComSeg
                                  join mcs in DataContext.MinCommercialSegments on
                                  new { fullCs.LocationId, fullCs.CarSegmentId, fullCs.CommercialCarSegmentId }
            equals new { mcs.LocationId, mcs.CarSegmentId, mcs.CommercialCarSegmentId }
            into joinedComSeg
            from comSegFigures in joinedComSeg.DefaultIfEmpty()
            where comSegFigures == null
                select new
            {
                LocationId             = fullCs.LocationId,
                CarSegmentId           = fullCs.CarSegmentId,
                CommercialCarSegmentId = fullCs.CommercialCarSegmentId,
                Percentage             = newMinCommSegPercent,
                LastChangedOn          = DateTime.Now,
                LastChangedBy          = ApplicationAuthentication.GetGlobalId()
            };
            var localEntities = from etc in entriesToCreate.AsEnumerable()
                                select new MinCommercialSegment
            {
                LocationId             = etc.LocationId,
                CarSegmentId           = etc.CarSegmentId,
                CommercialCarSegmentId = etc.CommercialCarSegmentId,
                Percentage             = newMinCommSegPercent,
                UpdatedOn = DateTime.Now,
                UpdatedBy = ApplicationAuthentication.GetGlobalId()
            };

            DataContext.MinCommercialSegments.InsertAllOnSubmit(localEntities);
            DataContext.SubmitChanges();
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                UserActivity.LogPageAccess(ApplicationAuthentication.GetGlobalId(), Request.Url.AbsolutePath, ApplicationAuthentication.GetUserName());
            }
            //Check session timeout
            base.CheckSessionTimeout();

            this.ControlPanelRibbon.UserLoggedIn = @"User Logged In: " + ApplicationAuthentication.GetUserName();
            this.ControlPanelRibbon.ControlTitle = @"Application Home";

            this.ChangeMenuStyles();
        }
Пример #4
0
        public List <ListItem> GetFleetTypesList(ModuleType modType)
        {
            var returned = NonRevParameterDataAccess.GetFleetTypes(DataContext);

            switch (modType)
            {
            case ModuleType.Availability:
                returned.ForEach(d => d.Selected =
                                     d.Text.ToLower() != "licensee" &&
                                     d.Text.ToLower() != "inactive" &&
                                     d.Text.ToLower() != "undefined" &&
                                     d.Text.ToLower() != "firefly" &&
                                     d.Text.ToLower() != "hertz on demand" &&
                                     d.Text.ToLower() != "sold");
                break;

            case ModuleType.NonRev:
                returned.ForEach(d => d.Selected =
                                     d.Text.ToLower() != "licensee" &&
                                     d.Text.ToLower() != "inactive" &&
                                     d.Text.ToLower() != "sold");
                break;

            default:
                throw new ArgumentOutOfRangeException("modType");
            }
            var loggedOnEmployee = ApplicationAuthentication.GetEmployeeId();

            if (loggedOnEmployee == string.Empty) //Special case for Itdemo
            {
                loggedOnEmployee = ApplicationAuthentication.GetGlobalId();
            }

            var marsUserEntity = DataContext.MarsUsers.FirstOrDefault(d => d.EmployeeId == loggedOnEmployee);

            if (marsUserEntity != null)
            {
                if (marsUserEntity.CompanyType.CompanyTypeName == CompanyTypeEnum.Licensee.ToString())
                {
                    var item = returned.SingleOrDefault(d => d.Text.ToLower() == "licensee");
                    if (item != null)
                    {
                        item.Selected = true;
                    }
                }
            }

            return(returned);
        }
Пример #5
0
        public void UpdateMaxFleetFactors(double?nonRevPercent, double?utilizationPercent)
        {
            if (!Parameters.ContainsValueAndIsntEmpty(DictionaryParameter.DayOfWeek))
            {
                return;
            }

            var splitDaysOfWeek =
                Parameters[DictionaryParameter.DayOfWeek].Split(VehicleFieldRestrictions.Separator.ToCharArray())
                .Select(int.Parse)
                .ToList();

            var locations = LocationQueryable.GetLocations(DataContext, Parameters);
            var carGroups = CarGroupQueryable.GetCarGroups(DataContext, Parameters);
            var weekDays  = from wd in DataContext.WeekDays
                            where splitDaysOfWeek.Contains(wd.DayOfWeekId)
                            select wd.DayOfWeekId;

            var locationsAndGroups = from l in locations
                                     from cg in carGroups
                                     from wd in weekDays
                                     select new
            {
                LocationId  = l.dim_Location_id,
                CarGroupId  = cg.car_group_id,
                DayOfWeekId = wd
            };


            var entriesToUpdate = from lag in locationsAndGroups
                                  join mff in DataContext.MaxFleetFactors on
                                  new { lag.CarGroupId, lag.LocationId, lag.DayOfWeekId } equals
            new { mff.CarGroupId, mff.LocationId, mff.DayOfWeekId }
            select mff;



            if (nonRevPercent.HasValue)
            {
                entriesToUpdate.ForEach(d => d.NonRevPercentage = nonRevPercent.Value);
            }

            if (utilizationPercent.HasValue)
            {
                entriesToUpdate.ForEach(d => d.UtilizationPercentage = utilizationPercent.Value);
            }

            entriesToUpdate.ForEach(d => d.UpdatedBy = ApplicationAuthentication.GetGlobalId());
            entriesToUpdate.ForEach(d => d.UpdatedOn = DateTime.Now);


            var entriesToCreate = from fullCs in locationsAndGroups
                                  join mff in DataContext.MaxFleetFactors on
                                  new { fullCs.LocationId, fullCs.CarGroupId, fullCs.DayOfWeekId }
            equals new { mff.LocationId, mff.CarGroupId, mff.DayOfWeekId }
            into joinedFleetFactors
            from fleetFactors in joinedFleetFactors.DefaultIfEmpty()
            where fleetFactors == null
                select new
            {
                LocationId    = fullCs.LocationId,
                CarGroupId    = fullCs.CarGroupId,
                DayOfWeekId   = fullCs.DayOfWeekId,
                NonRev        = nonRevPercent,
                Utilization   = utilizationPercent,
                LastChangedOn = DateTime.Now,
                LastChangedBy = ApplicationAuthentication.GetGlobalId()
            };
            var localEntities = from etc in entriesToCreate.AsEnumerable()
                                select new MaxFleetFactor
            {
                LocationId            = etc.LocationId,
                CarGroupId            = etc.CarGroupId,
                DayOfWeekId           = etc.DayOfWeekId,
                NonRevPercentage      = etc.NonRev,
                UtilizationPercentage = etc.Utilization,
                UpdatedOn             = DateTime.Now,
                UpdatedBy             = ApplicationAuthentication.GetGlobalId()
            };

            DataContext.MaxFleetFactors.InsertAllOnSubmit(localEntities);
            DataContext.SubmitChanges();
        }