public ActionResult ShiftMstrEdit(ShiftMaster shiftMaster, GridCommand command, ShiftDetailSearchModel searchModel)
 {
     if (ModelState.IsValid)
     {
         this.genericMgr.UpdateWithTrim(shiftMaster);
         SaveSuccessMessage(Resources.MD.WorkingCalendar.ShiftMaster_Updated);
     }
     SearchCacheModel searchCacheModel = ProcessSearchModel(command, searchModel);
     SearchStatementModel searchStatementModel = this.ShiftDetailPrepareSearchStatement(command, (ShiftDetailSearchModel)searchCacheModel.SearchObject, shiftMaster.Code);
     ViewBag.shiftDetList = GetPageData<ShiftDetail>(searchStatementModel, command);
     return PartialView(shiftMaster);
 }
        public ActionResult ShiftMstrNew(ShiftAll shiftAll, ShiftMaster shiftMaster, ShiftDetail shiftDetail)
        {
            if (ModelState.IsValid)
            {
                if (this.genericMgr.FindAll<long>(shiftMstrDuiplicateVerifyStatement, new object[] { shiftMaster.Code })[0] > 0)
                {
                    SaveErrorMessage(Resources.SYS.ErrorMessage.Errors_Existing_Code, shiftMaster.Code.ToString());
                }
                else
                {
                    if (shiftAll.EndDate != null & shiftAll.StartDate != null)
                    {
                        if (System.DateTime.Compare((System.DateTime)shiftAll.EndDate, (System.DateTime)shiftAll.StartDate) < 1)
                        {
                            SaveErrorMessage(Resources.MD.WorkingCalendar.Errors_StartDateGreaterThanEndDate);
                            return PartialView(shiftAll);
                        }
                    }

                    shiftDetail.Shift = shiftAll.Code;
                    WorkingCalendarMgr.CreateShiftMasterAndShiftDetail(shiftMaster, shiftDetail);
                    SaveSuccessMessage(Resources.MD.WorkingCalendar.ShiftMaster_Added);
                    return RedirectToAction("ShiftMstrEdit/" + shiftAll.Code);
                }
            }

            return PartialView(shiftAll);
        }
 public ActionResult _Edit(ShiftMaster shiftMaster)
 {
     if (ModelState.IsValid)
     {
         var shiftMstr = base.genericMgr.FindById<ShiftMaster>(shiftMaster.Code);
         shiftMstr.Name = shiftMaster.Name;
         base.genericMgr.Update(shiftMstr);
         SaveSuccessMessage(Resources.PRD.ShiftMaster.ShiftMaster_Updated);
     }
     return PartialView(shiftMaster);
 }
示例#4
0
        public ActionResult _ShiftMasterDropDownList(string controlName, string controlId, string groupNo, bool? includeBlankOption, string blankOptionDescription, string blankOptionValue, string selectedValue, bool? enable)
        {
            ViewBag.ControlName = controlName;
            ViewBag.ControlId = controlId;
            ViewBag.Enable = enable;
            IList<ShiftMaster> shiftMasters = base.genericMgr.FindAll<ShiftMaster>(selectShiftMastersStatement, new object[] { });
            if (shiftMasters == null)
            {
                shiftMasters = new List<ShiftMaster>();
            }

            if (includeBlankOption.HasValue && includeBlankOption.Value)
            {
                ShiftMaster shiftMaster = new ShiftMaster();
                shiftMaster.Code = blankOptionValue;
                shiftMaster.Code = blankOptionDescription;

                shiftMasters.Insert(0, shiftMaster);
            }

            return PartialView(new SelectList(shiftMasters, "Code", "Code", selectedValue));
        }
        public ActionResult New(ShiftMaster shiftMaster)
        {
            if (ModelState.IsValid)
            {
                if (base.genericMgr.FindAll<long>(duiplicateVerifyStatement, new object[] { shiftMaster.Code })[0] > 0)
                {
                    SaveErrorMessage(Resources.ErrorMessage.Errors_Existing_Code, shiftMaster.Code);
                }
                else
                {
                    base.genericMgr.Create(shiftMaster);
                    SaveSuccessMessage(Resources.PRD.ShiftMaster.ShiftMaster_Added);
                    return RedirectToAction("Edit/" + shiftMaster.Code);
                }
            }

            return View(shiftMaster);
        }