public ActionResult CreateEdit(user user, FormCollection frm, HttpPostedFileBase user_photo) { try { string rol_id = frm["rol_id"]; string hdnUserPhoto = frm["hdnUserPhoto"]; if (user_photo != null) { string AWSProfileName = STUtil.GetWebConfigValue("AWSProfileName"); string GenFileName = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + SessionUtil.GetCompanyID().ToString() + "_" + Path.GetFileName(user_photo.FileName).Replace(" ", "_"); String companyFolderName = STUtil.GetSessionValue(UserInfo.CompanyFolderName.ToString()).ToString().Replace("/", ""); user.user_photo = GenFileName; } else { user.user_photo = hdnUserPhoto != null ? (hdnUserPhoto != "" ? hdnUserPhoto : user.gender + ".JPG") : user.gender + ".JPG"; } result = userUtil.PostCreateEdit(user, frm); ViewBag.Title = user == null ? "User Create" : "User Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); switch (result.MessageType) { case MessageType.Success: return(RedirectToAction("Index", "User", new { id = rol_id, Result = result.Message, MessageType = result.MessageType })); default: return(RedirectToAction("CreateEdit", "User", new { id = user.user_id, Result = result.Message, MessageType = result.MessageType })); } return(View(user)); } catch (Exception ex) { return(View(user)); } }
public ActionResult MenuRoleAction(int id) { ViewBag.Title = "Role Action"; int menuID = id; int company_id = SessionUtil.GetCompanyID(); IList <ControllerAction> list = new List <ControllerAction>(); var listController = STUtil.GetListController(); //Nedd to check data in respwct of ViewBag.action_name = new List <SelectListItem>(); ViewBag.menu_id = menuID; foreach (var c in listController) { string controllerName = c.Value; var listAllAction = STUtil.GetListAllActionByController(controllerName); var listAssignedAction = (from r in db.menu_access_controller_action where r.menu_id == menuID && r.controller_name == controllerName orderby r.action_name select new SelectListItem { Value = r.action_name, Text = r.action_name, }).ToList(); foreach (var aa in listAllAction) { ControllerAction ca = new ControllerAction(); ca.ControllerName = controllerName; ca.ActionName = aa.Text; ca.IsAssigned = listAssignedAction.Where(a => a.Text == aa.Text).Count() > 0 ? true : false; list.Add(ca); } } return(PartialView("_MenuRoleAction", list)); }
public ActionResult CompanyRoleAction(int id, string companyId = "") { ViewBag.Title = "Role Action"; int roleID = id; int company_id = Convert.ToInt32(companyId); IList <ControllerAction> list = new List <ControllerAction>(); var listController = STUtil.GetListController(); //Nedd to check data in respwct of ViewBag.action_name = new List <SelectListItem>(); ViewBag.role_id = id; ViewBag.RoleName = db.roles.Where(r => r.role_id == id && r.company_id == company_id).FirstOrDefault().role_name; foreach (var c in listController) { string controllerName = c.Value; var listAllAction = STUtil.GetListAllActionByController(controllerName); var listAssignedAction = STUtil.GetListActionAssignedByRoleAndController(roleID, controllerName); foreach (var aa in listAllAction) { ControllerAction ca = new ControllerAction(); ca.ControllerName = controllerName; ca.ActionName = aa.Text; ca.IsAssigned = listAssignedAction.Where(a => a.Text == aa.Text).Count() > 0 ? true : false; list.Add(ca); } } return(PartialView("_CompanyRoleAction", list)); }
public ActionResult CurrencyCreateEdit(currency currency) { result = currencyUtil.CreateEditCurrency(currency); ViewBag.Title = currency == null ? "Currency Create" : "Currency Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult GetActionNameByController(string id) { string controllerName = string.Format("{0}Controller", id); var list = STUtil.GetListAllActionByController(controllerName); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult PaperSubTypeCreateEdit(paper_sub_type paper_sub_type) { result = paperSubTypeUtill.PaperSubTypeCreateEdit(paper_sub_type); ViewBag.Title = paper_sub_type == null ? "Paper Sub Type Create" : "Paper Sub Type Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult LeminationTypeCreateEdit(lemination_type lemination_type) { result = leminationTypeUtill.LeminationTypeCreateEdit(lemination_type); ViewBag.Title = lemination_type == null ? "LeminationType Create" : "LeminationType Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult IndustryCreateEdit(industry_type industry_type) { result = industryUtil.CreateEditIndustryType(industry_type); ViewBag.Title = industry_type == null ? "Country Create" : "Country Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult PaymentModeCreateEdit(payment_mode paymentmode) { result = paymentModeUtil.CreateEditPaymentMode(paymentmode); ViewBag.Title = paymentmode == null ? "Payment Mode Create" : "Payment Mode Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult ReligionCreateEdit(religion religion) { result = religionUtil.CreateEditReligion(religion); ViewBag.Title = religion == null ? "Religion Create" : "Religion Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult NationalityCreateEdit(nationality nationality) { result = nationalityUtil.CreateEditNationality(nationality); ViewBag.Title = nationality == null ? "Nationality Create" : "Nationality Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult LanguageCreateEdit(language language) { result = languageUtil.CreateEditLanguage(language); ViewBag.Title = language == null ? "Language Create" : "Language Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult DocumentTypeCreateEdit(document_type document_type) { result = documentTypeUtil.CreateEditDocumentType(document_type); ViewBag.Title = document_type == null ? "DocumentType Create" : "DocumentType Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult TimeFormatCreateEdit(time_format time_format) { result = timeFormatUtil.CreateEditTimeFormat(time_format); ViewBag.Title = time_format == null ? "TimeFormat Create" : "TimeFormat Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult JobTypeCreateEdit(job_type job_type) { result = jobTypeUtill.JobTypeCreateEdit(job_type); ViewBag.Title = job_type == null ? "Job Create" : "Job Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult DurationDaysCreateEdit(duration_days duration_days) { result = durationDaysUtil.CreateEditDurationDays(duration_days); ViewBag.Title = duration_days == null ? "Duration Days Create" : "Duration Days Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult JobStatusCreateEdit(job_status job_status) { result = jobStatusUtill.JobStatusCreateEdit(job_status); ViewBag.Title = job_status == null ? "Job Status Create" : "Job Status Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult PaymentStatusCreateEdit(payment_status payment_status) { result = paymentStatusUtill.PaymentStatusCreateEdit(payment_status); ViewBag.Title = payment_status == null ? "Payment Status Create" : "Payment Status Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult CountryCreateEdit(country country) { result = countryUtil.CreateEditCountry(country); ViewBag.Title = country == null ? "Country Create" : "Country Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult CreateEdit(Int32 Id = 0) { menu menu = Id > 0 ? db.menus.Find(Id) : new menu(); ViewBag.Title = menu == null ? "Menu Create" : "Menu Edit"; ViewBag.controller_name = new SelectList(menuUtil.GetController(), "Value", "Text", menu != null ? menu.controller_name : ""); ViewBag.menu_parent_id = new SelectList(menuUtil.GetMenu(true), "Value", "Text", menu != null ? menu.menu_parent_id : 0); ViewBag.action_name = new SelectList(STUtil.GetListAllActionByController(menu != null ? menu.controller_name : ""), "Value", "Text", menu != null ? menu.action_name : ""); ViewBag.SelectedMenuAction = menu != null ? menu.action_name : ""; return(View(menu)); }
public ActionResult PostAssignViewAction(string id, int companyID) { result = new Result(); try { string[] str = id.Split(','); //Chk_CityController_Create_False, for (int i = 0; i < str.Length; i++) { if (!String.IsNullOrEmpty(str[i])) { string[] info = str[i].Split('_'); if (!String.IsNullOrEmpty(info[1])) { string roleName = info[1]; string controllerName = info[2]; bool isAssigned = Convert.ToBoolean(info[3]); var roleID = db.roles.AsEnumerable().Where(x => x.role_name == roleName && x.company_id == companyID).Select(x => x.role_id).FirstOrDefault(); var listAllAction = STUtil.GetListAllActionByController(controllerName); //var listController = STUtil.GetListController(); var roleaction = db.role_action.Where(ra => ra.controller_name == controllerName && ra.role_id == roleID).ToList(); if (roleaction.Count == 0) // new { foreach (var item in listAllAction) { role_action roleAction = new role_action(); roleAction.role_id = roleID; roleAction.controller_name = controllerName; roleAction.action_name = item.Value; db.role_action.Add(roleAction); } } else { db.role_action.RemoveRange(roleaction); } db.SaveChanges(); Thread.Sleep(4000); } } } } catch (Exception ex) { result.MessageType = MessageType.Error; result.Message = ex.Message; } return(RedirectToAction("Index", result)); }
public ActionResult CreateEdit(menu menu) { result = menuUtil.PostMenuCreate(menu); ViewBag.Title = menu == null ? "Menu Create" : "Menu Edit"; ViewBag.controller_name = menuUtil.GetController(); ViewBag.menu_parent_id = menuUtil.GetMenu(true); ViewBag.menu_ddl_id = menuUtil.GetMenu(true); ViewBag.action_name = STUtil.GetListAllActionByController(""); switch (result.MessageType) { case MessageType.Success: return(RedirectToAction("Index", "Menu", new { result = result.Message, MessageType = result.MessageType })); default: return(RedirectToAction("CreateEdit", "Menu", new { result = result.Message, MessageType = result.MessageType })); } return(View(menu)); }
public ActionResult EditProfile(user user, HttpPostedFileBase user_photo) { try { if (user_photo != null) { string AWSProfileName = STUtil.GetWebConfigValue("AWSProfileName"); string GenFileName = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + SessionUtil.GetCompanyID().ToString() + "_" + Path.GetFileName(user_photo.FileName).Replace(" ", "_"); String companyFolderName = STUtil.GetSessionValue(UserInfo.CompanyFolderName.ToString()).ToString().Replace("/", ""); UploadFile(SessionUtil.GetCompanyFolderName().ToString(), user_photo); user.user_photo = GenFileName; } else { } result = userUtil.PostProfileEdit(user); ViewBag.action_name = STUtil.GetListAllActionByController(""); switch (result.MessageType) { case MessageType.Success: STUtil.SetSessionValue(UserInfo.FullName.ToString(), Convert.ToString(user.user_name)); STUtil.SetSessionValue(UserInfo.Mobile.ToString(), Convert.ToString(user.mobile)); STUtil.SetSessionValue(UserInfo.UserPhoto.ToString(), Convert.ToString(user.user_photo)); STUtil.SetSessionValue(UserInfo.Gender.ToString(), Convert.ToString(user.gender)); return(RedirectToAction("MyProfile", "MyProfile", new { Result = result.Message, MessageType = result.MessageType })); default: return(RedirectToAction("MyProfile", "MyProfile", new { Result = result.Message, MessageType = result.MessageType })); } return(View(user)); } catch { return(View(user)); } }