Beispiel #1
0
        public ActionResult Detail(int MstEpafId)
        {
            var data  = _epafBLL.GetEpafById(MstEpafId);
            var model = new EpafItem();

            model              = Mapper.Map <EpafItem>(data);
            model.MainMenu     = _mainMenu;
            model.CurrentLogin = CurrentUser;
            return(View(model));
        }
Beispiel #2
0
        public ActionResult Create(long?epafId)
        {
            var model = new TraCrfItemViewModel();

            model.MainMenu     = _mainMenu;
            model.CurrentLogin = CurrentUser;
            try
            {
                model.MainMenu     = _mainMenu;
                model.CurrentLogin = CurrentUser;
                model = InitialModel(model);
                if (epafId.HasValue && epafId.Value > 0)
                {
                    var dataEpaf     = _epafBLL.GetEpafById(epafId);
                    var dataFromEpaf = Mapper.Map <TraCrfItemDetails>(dataEpaf);
                    model.Detail = dataFromEpaf;
                }
                model.Detail.CreatedBy   = CurrentUser.USER_ID;
                model.Detail.CreatedDate = DateTime.Now;
                var list = _employeeBLL.GetEmployee().Where(x => x.IS_ACTIVE && x.GROUP_LEVEL > 0).Select(x => new { x.EMPLOYEE_ID, x.FORMAL_NAME }).ToList().OrderBy(x => x.FORMAL_NAME);
                if (CurrentUser.UserRole == Enums.UserRole.HR)
                {
                    model.Detail.VehicleType = "BENEFIT";
                }
                else if (CurrentUser.UserRole == Enums.UserRole.Fleet)
                {
                    list = _employeeBLL.GetEmployee().Where(x => x.IS_ACTIVE).Select(x => new { x.EMPLOYEE_ID, x.FORMAL_NAME }).ToList().OrderBy(x => x.FORMAL_NAME);
                    model.Detail.VehicleType = "WTC";
                }
                model.EmployeeList          = new SelectList(list, "EMPLOYEE_ID", "FORMAL_NAME");
                model.LocationNewList       = new SelectList(new List <SelectListItem>());
                model.Detail.DocumentStatus = (int)Enums.DocumentStatus.Draft;
                return(View(model));
            }
            catch (Exception ex)
            {
                AddMessageInfo(ex.Message, Enums.MessageInfoType.Error);
                model = InitialModel(model);
                model.ErrorMessage    = ex.Message;
                model.LocationNewList = new SelectList(new List <SelectListItem>());
                return(View(model));
            }
        }