public ActionResult Create() { var model = new ComplaintCategoryItem(); model.MainMenu = _mainMenu; model.CurrentLogin = CurrentUser; var RoleTypeList = new Dictionary <string, string> { { "HR", "HR" }, { "FLEET", "FLEET" } }; model.RoleTypeList = new SelectList(RoleTypeList, "Key", "Value"); return(View(model)); }
public ActionResult Detail(int MstComplaintId) { var data = _complaintCategoryBLL.GetByID(MstComplaintId); var model = new ComplaintCategoryItem(); model = Mapper.Map <ComplaintCategoryItem>(data); model.MainMenu = _mainMenu; model.CurrentLogin = CurrentUser; var RoleTypeList = new Dictionary <string, string> { { "HR", "HR" }, { "FLEET", "FLEET" } }; model.RoleTypeList = new SelectList(RoleTypeList, "Key", "Value"); model.ChangesLogs = GetChangesHistory((int)Enums.MenuList.MasterComplaintCategory, MstComplaintId); return(View(model)); }
public ActionResult Edit(ComplaintCategoryItem model) { if (ModelState.IsValid) { try { var Exist = _complaintCategoryBLL.GetComplaints().Where(x => (x.CategoryName == null ? "" : x.CategoryName.ToUpper()) == (model.CategoryName == null ? "" : model.CategoryName.ToUpper()) && (x.RoleType == null ? "" : x.RoleType.ToUpper()) == (model.RoleType == null ? "" : model.RoleType.ToUpper()) && x.IsActive && x.MstComplaintCategoryId != model.MstComplaintCategoryId).FirstOrDefault(); if (Exist != null) { model.ErrorMessage = "Data Already Exist in Master Complaint Category"; model.MainMenu = _mainMenu; model.CurrentLogin = CurrentUser; var RoleTypeList = new Dictionary <string, string> { { "HR", "HR" }, { "FLEET", "FLEET" } }; model.RoleTypeList = new SelectList(RoleTypeList, "Key", "Value"); return(View(model)); } var data = Mapper.Map <ComplaintDto>(model); data.ModifiedDate = DateTime.Now; data.ModifiedBy = CurrentUser.USER_ID; _complaintCategoryBLL.Save(data, CurrentUser); _complaintCategoryBLL.SaveChanges(); AddMessageInfo(Constans.SubmitMessage.Saved, Enums.MessageInfoType.Success); } catch (Exception exception) { model.ErrorMessage = exception.Message; model.MainMenu = _mainMenu; model.CurrentLogin = CurrentUser; var RoleTypeList = new Dictionary <string, string> { { "HR", "HR" }, { "FLEET", "FLEET" } }; model.RoleTypeList = new SelectList(RoleTypeList, "Key", "Value"); return(View(model)); } } return(RedirectToAction("Index", "MstComplaint")); }
public JsonResult UploadFile(HttpPostedFileBase upload) { var data = (new ExcelReader()).ReadExcel(upload); var model = new List <ComplaintCategoryItem>(); if (data != null) { foreach (var dataRow in data.DataRows) { if (dataRow[0] == "") { continue; } var item = new ComplaintCategoryItem(); item.ErrorMessage = ""; item.CategoryName = dataRow[0].ToString(); if (item.CategoryName == "") { item.ErrorMessage = "Category Name Can't be Empty"; } item.RoleType = (dataRow[1] == null ? "" :dataRow[1].ToUpper()); if (item.RoleType == "") { item.ErrorMessage = "Role Type Can't be Empty"; } else { if (item.RoleType != "HR" && item.RoleType != "FLEET") { item.ErrorMessage = "Role Type is not Valid"; } } model.Add(item); } } return(Json(model)); }