Esempio n. 1
0
        public ActionResult TrueIsRotating(int workPatternId)
        {
            List <WorkPatternListViewModel> model = new List <WorkPatternListViewModel>();

            if (workPatternId > 0)
            {
            }
            else
            {
                WorkPatternListViewModel oneModel = new WorkPatternListViewModel();
                oneModel.WorkPatternID = workPatternId;
                oneModel.Id            = 0;
                model.Add(oneModel);
            }
            return(PartialView("_partialTrueIsRotating", model));
        }
Esempio n. 2
0
        public WorkPatternViewModel returnModel(int Id)
        {
            WorkPatternViewModel returnModel = new WorkPatternViewModel();
            var data = getWorkPatternById(Id);

            returnModel.Id         = Id;
            returnModel.Name       = data.Name;
            returnModel.IsRotating = data.IsRotating;
            if (data.IsRotating)
            {
                foreach (var item in workPatternDetaiiById(Id))
                {
                    WorkPatternListViewModel detailData = new WorkPatternListViewModel();
                    detailData.Id                  = item.Id;
                    detailData.Name                = item.Name;
                    detailData.WorkPatternID       = item.WorkPatternID;
                    detailData.MondayHours         = item.MondayHours;
                    detailData.MondayDays          = item.MondayDays;
                    detailData.MondayStart         = String.Format("{0:HH:mm}", item.MondayStart);
                    detailData.MondayEnd           = String.Format("{0:HH:mm}", item.MondayEnd);
                    detailData.MondayBreakMins     = item.MondayBreakMins;
                    detailData.TuesdayHours        = item.TuesdayHours;
                    detailData.TuesdayDays         = item.TuesdayDays;
                    detailData.TuesdayStart        = String.Format("{0:HH:mm}", item.TuesdayStart);
                    detailData.TuesdayEnd          = String.Format("{0:HH:mm}", item.TuesdayEnd);
                    detailData.TuesdayBreakMins    = item.TuesdayBreakMins;
                    detailData.WednessdayHours     = item.WednessdayHours;
                    detailData.WednessdayDays      = item.WednessdayDays;
                    detailData.WednessdayStart     = String.Format("{0:HH:mm}", item.WednessdayStart);
                    detailData.WednessdayEnd       = String.Format("{0:HH:mm}", item.WednessdayEnd);
                    detailData.WednessdayBreakMins = item.WednessdayBreakMins;
                    detailData.ThursdayHours       = item.ThursdayHours;
                    detailData.ThursdayDays        = item.ThursdayDays;
                    detailData.ThursdayStart       = String.Format("{0:HH:mm}", item.ThursdayStart);
                    detailData.ThursdayEnd         = String.Format("{0:HH:mm}", item.ThursdayEnd);
                    detailData.ThursdayBreakMins   = item.ThursdayBreakMins;
                    detailData.FridayHours         = item.FridayHours;
                    detailData.FridayDays          = item.FridayDays;
                    detailData.FridayStart         = String.Format("{0:HH:mm}", item.FridayStart);
                    detailData.FridayEnd           = String.Format("{0:HH:mm}", item.FridayEnd);
                    detailData.FridayBreakMins     = item.FridayBreakMins;
                    detailData.SaturdayHours       = item.SaturdayHours;
                    detailData.SaturdayDays        = item.SaturdayDays;
                    detailData.SaturdayStart       = String.Format("{0:HH:mm}", item.SaturdayStart);
                    detailData.SaturdayEnd         = String.Format("{0:HH:mm}", item.SaturdayEnd);
                    detailData.SaturdayBreakMins   = item.SaturdayBreakMins;
                    detailData.SundayHours         = item.SundayHours;
                    detailData.SundayDays          = item.SundayDays;
                    detailData.SundayStart         = String.Format("{0:HH:mm}", item.SundayStart);
                    detailData.SundayEnd           = String.Format("{0:HH:mm}", item.SundayEnd);
                    detailData.SundayBreakMins     = item.SundayBreakMins;
                    detailData.TotalHours          = Convert.ToDecimal((item.MondayHours == null ? 0 : item.MondayHours) + (item.TuesdayHours == null ? 0 : item.TuesdayHours) + (item.WednessdayHours == null ? 0 : item.WednessdayHours) + (item.ThursdayHours == null ? 0 : item.ThursdayHours) + (item.FridayHours == null ? 0 : item.FridayHours) + (item.SaturdayHours == null ? 0 : item.SaturdayHours) + (item.SundayHours == null ? 0 : item.SundayHours));

                    returnModel.WorkPatternList.Add(detailData);
                }
            }
            else
            {
                returnModel.MondayHours         = data.MondayHours;
                returnModel.MondayDays          = data.MondayDays;
                returnModel.MondayStart         = Convert.ToDecimal(data.MondayStart);
                returnModel.MondayEnd           = Convert.ToDecimal(data.MondayEnd);
                returnModel.MondayBreakMins     = data.MondayBreakMins;
                returnModel.TuesdayHours        = data.TuesdayHours;
                returnModel.TuesdayDays         = data.TuesdayDays;
                returnModel.TuesdayStart        = Convert.ToDecimal(data.TuesdayStart);
                returnModel.TuesdayEnd          = Convert.ToDecimal(data.TuesdayEnd);
                returnModel.TuesdayBreakMins    = data.TuesdayBreakMins;
                returnModel.WednessdayHours     = data.WednessdayHours;
                returnModel.WednessdayDays      = data.WednessdayDays;
                returnModel.WednessdayStart     = Convert.ToDecimal(data.WednessdayStart);
                returnModel.WednessdayEnd       = Convert.ToDecimal(data.WednessdayEnd);
                returnModel.WednessdayBreakMins = data.WednessdayBreakMins;
                returnModel.ThursdayHours       = data.ThursdayHours;
                returnModel.ThursdayDays        = data.ThursdayDays;
                returnModel.ThursdayStart       = Convert.ToDecimal(data.ThursdayStart);
                returnModel.ThursdayEnd         = Convert.ToDecimal(data.ThursdayEnd);
                returnModel.ThursdayBreakMins   = data.ThursdayBreakMins;
                returnModel.FridayHours         = data.FridayHours;
                returnModel.FridayDays          = data.FridayDays;
                returnModel.FridayStart         = Convert.ToDecimal(data.FridayStart);
                returnModel.FridayEnd           = Convert.ToDecimal(data.FridayEnd);
                returnModel.FridayBreakMins     = data.FridayBreakMins;
                returnModel.SaturdayHours       = data.SaturdayHours;
                returnModel.SaturdayDays        = data.SaturdayDays;
                returnModel.SaturdayStart       = Convert.ToDecimal(data.SaturdayStart);
                returnModel.SaturdayEnd         = Convert.ToDecimal(data.SaturdayEnd);
                returnModel.SaturdayBreakMins   = data.SaturdayBreakMins;
                returnModel.SundayHours         = data.SundayHours;
                returnModel.SundayDays          = data.SundayDays;
                returnModel.SundayStart         = Convert.ToDecimal(data.SundayStart);
                returnModel.SundayEnd           = Convert.ToDecimal(data.SundayEnd);
                returnModel.SundayBreakMins     = data.SundayBreakMins;
                returnModel.TotalHours          = Convert.ToDecimal((data.MondayHours == null ? 0 : data.MondayHours) + (data.TuesdayHours == null ? 0 : data.TuesdayHours) + (data.WednessdayHours == null ? 0 : data.WednessdayHours) + (data.ThursdayHours == null ? 0 : data.ThursdayHours) + (data.FridayHours == null ? 0 : data.FridayHours) + (data.SaturdayHours == null ? 0 : data.SaturdayHours) + (data.SundayHours == null ? 0 : data.SundayHours));
            }

            return(returnModel);
        }