public static bool CheckRoleMenu(string keyRole) { //if (DefineFuntion.UserName() == "Admin") return true; var objKey = keyRole.Split(','); var roler = new SharedFuntionController().GetRolesUserMenu(); var obj = roler.Intersect(objKey); return(obj.Count() > 0 ? true : false); }
public ActionResult Create(ServiceOther ServiceOther, string typeName) { var shared = new SharedFuntionController(); int ms = 0; try { var dat = DateTime.Now.ToString("MM'/'dd'/'yyyy HH:mm:ss"); ServiceOther.CreateBy = @User.Identity.GetUserName(); ServiceOther.CreateDay = DateTime.Parse(dat); db.ServiceOthers.Add(ServiceOther); db.SaveChanges(); ms = 1; //1-them, 2- sua, 3-xoa, 4- khac shared.CreateHistory(new History() { Name = "Thêm Dịch Vụ", Contens = "", ItemId = ServiceOther.ServiceOtherId, Type = (int)DefineFuntion.TypeHistory.ServiceOther, }); } catch (Exception) { ms = 2; } if (ms != 2) { if (typeName == "savenew" || typeName == "") { return(RedirectToAction("Create", new { mess = ms })); } else { return(RedirectToAction("Edit", new { id = DefineFuntion.Encrypt(ServiceOther.ServiceOtherId), mess = ms })); } } ViewBag.Status = new SelectList(DefineFuntion.ListStatus, "Value", "Text", ServiceOther.Status); return(View("Create", "ServiceOther")); }
public ActionResult Create(Regency rengency, string typeName) { var shared = new SharedFuntionController(); int ms = 0; try { if (ModelState.IsValid) { db.Regencies.Add(rengency); db.SaveChanges(); ms = 1; //1-them, 2- sua, 3-xoa, 4- khac shared.CreateHistory(new History() { Name = "Thêm Chức Vụ", Contens = "", ItemId = rengency.RegencyId, Type = (int)DefineFuntion.TypeHistory.Regency, }); } } catch (Exception) { ms = 2; } if (ms != 2) { if (typeName == "savenew" || typeName == "") { return(RedirectToAction("Create", new { mess = ms })); } else { return(RedirectToAction("Edit", new { id = DefineFuntion.Encrypt(rengency.RegencyId), mess = ms })); } } ViewBag.Status = new SelectList(DefineFuntion.ListStatus, "Value", "Text", rengency.Status); return(View()); }
public ActionResult Create(LandGroup landGroup, string typeName) { var shared = new SharedFuntionController(); int ms = 0; try { db.LandGroups.Add(landGroup); db.SaveChanges(); ms = 1; //1-them, 2- sua, 3-xoa, 4- khac shared.CreateHistory(new History() { Name = "Thêm LandGroup", Contens = "", ItemId = landGroup.LandGroupId, Type = (int)DefineFuntion.TypeHistory.LandGroup, }); } catch (Exception ex) { ms = 2; ViewBag.Err = ex.InnerException; } if (ms != 2) { if (typeName == "savenew" || typeName == "") { return(RedirectToAction("Create", new { mess = ms })); } else { return(RedirectToAction("Edit", new { id = DefineFuntion.Encrypt(landGroup.LandGroupId), mess = ms })); } } ViewBag.Status = new SelectList(DefineFuntion.ListStatus, "Value", "Text", landGroup.Status); return(View()); }
public ActionResult Create(ServiceOtherPrice ServiceOtherPrice, string typeName) { var shared = new SharedFuntionController(); int ms = 0; try { db.ServiceOtherPrices.Add(ServiceOtherPrice); db.SaveChanges(); ms = 1; //1-them, 2- sua, 3-xoa, 4- khac shared.CreateHistory(new History() { Name = "Thêm Giá Dịch Vụ", Contens = "", ItemId = ServiceOtherPrice.ServiceOtherPriceId, Type = (int)DefineFuntion.TypeHistory.ServiceOther, }); } catch (Exception) { ms = 2; } if (ms != 2) { if (typeName == "savenew" || typeName == "") { return(RedirectToAction("Create", new { mess = ms })); } else { return(RedirectToAction("Edit", new { id = DefineFuntion.Encrypt(ServiceOtherPrice.ServiceOtherPriceId), mess = ms })); } } ViewBag.Status = new SelectList(DefineFuntion.ListStatus, "Value", "Text", ServiceOtherPrice.Status); return(View("Create", "ServiceOtherPrice")); }