public PartialViewResult AddItem() { AssignUserRoleService service = new AssignUserRoleService(); AssignUserRoleItemViewModel assignUserViewModel = service.InitialItem(); return(PartialView("~/Views/Authorization/AssignUserRole/AssignUserRoleItem.cshtml", assignUserViewModel)); }
public ActionResult GetValueHelpStatus(int roleID) { AssignUserRoleService service = new AssignUserRoleService(); AssignUserRoleItemViewModel model = new AssignUserRoleItemViewModel(); model.StatusText = service.InitialGetRoleStatus(roleID); return(Json(model, JsonRequestBehavior.AllowGet)); }
public string InitialGetRoleStatus(int roleID) { AssignUserRoleItemViewModel roleItem = new AssignUserRoleItemViewModel(); var context = new PYMFEEEntities(); var appComposite = context.AppCompositeRoles.Where(m => m.ID == roleID).OrderBy(m => m.Name).FirstOrDefault(); var valueStatus = ValueHelpService.GetValueHelpText("CONFIGSTATUS", appComposite.Status); if (valueStatus != null) { roleItem.StatusText = valueStatus.ValueText; } return(roleItem.StatusText); }
public AssignUserRoleItemViewModel InitialItem() { AssignUserRoleItemViewModel assignUserRoleItemViewModel = new AssignUserRoleItemViewModel(); List <AssignUserRoleItemViewModel> assignUserRoleItemList = new List <AssignUserRoleItemViewModel>(); try { var context = new PYMFEEEntities(); //var appComposite = context.AppCompositeRoles.Where(m => m.Status == ConstantVariableService.ConfigStatusActive).OrderBy(m => m.Name).ToList(); var appComposite = context.AppCompositeRoles.OrderBy(m => m.Name).ToList(); assignUserRoleItemViewModel.CompositeRoleList = appComposite; } catch (Exception ex) { } return(assignUserRoleItemViewModel); }
public AssignUserRoleViewModel GetDetail(int recordKey, string formState, string assignUserRoleCode, string assignUserType) { AssignUserRoleViewModel assignUserRole = NewFormData(); assignUserRole.FormState = formState; assignUserRole.FormAction = formState; var userInfo = UserService.GetSessionUserInfo(); try { using (var context = new PYMFEEEntities()) { var assignUserRoleList = GetAssignUserRoleList(assignUserRoleCode).FirstOrDefault(); assignUserRole.AssignUserCode = assignUserRoleList.AssignUserCode; assignUserRole.AssignUserName = assignUserRoleList.AssignUserName; assignUserRole.UserName = assignUserRoleList.UserName; assignUserRole.AssignUserType = assignUserType; assignUserRole.CREATE_BY = userInfo.UserCode; assignUserRole.CREATE_DATE = DateTime.Now; //Get line item List <UserRole> assignUserRoleItemList = (from m in context.UserRoles where m.USERID == assignUserRoleCode select m).OrderBy(m => m.CompositeRoleID).ToList(); //var appComposite = context.AppCompositeRoles.Where(m => m.Status == ConstantVariableService.ConfigStatusActive).OrderBy(m => m.Name).ToList(); var appComposite = context.AppCompositeRoles.OrderBy(m => m.Name).ToList(); foreach (var item in assignUserRoleItemList) { AssignUserRoleItemViewModel assignUserRoleItem = new AssignUserRoleItemViewModel(); MVMMappingService.MoveData(item, assignUserRoleItem); assignUserRoleItem.CompositeRoleID = item.CompositeRoleID; assignUserRoleItem.CompositeRoleList = appComposite; assignUserRoleItem.StatusText = ValueHelpService.GetValueHelpText("CONFIGSTATUS", appComposite.SingleOrDefault(m => m.ID == item.CompositeRoleID).Status).ValueText; assignUserRole.AssignUserRoleItemList.Add(assignUserRoleItem); //Get line item } ////Setting Signature //var UserSignal = context.UserSignatures.Where(m => m.Username == assignUserRole.UserName).FirstOrDefault(); ////Photo //if (UserSignal != null ) //{ // string documentPath = AttachmentService.GetDocumentFilePath(AssignUserRoleViewModel.ProcessCode); // //Check file is existing // string filePath = System.Web.HttpContext.Current.Server.MapPath(documentPath); // string file = Path.Combine(filePath, UserSignal.SignatureFileName); // if (System.IO.File.Exists(file)) // { // assignUserRole.Photo.PreviewPhoto = VirtualPathUtility.ToAbsolute(documentPath + "/" + UserSignal.SignatureFileName); // } //} } } catch (Exception ex) { } return(assignUserRole); }