public ActionResult RevertUser(int Id) { object result = ""; try { B_Personels bPersonel = new B_Personels(); var personel = bPersonel.GetPersonelById(Id); personel.IsDeleted = false; bPersonel.Edit(personel); result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult Modify(int Id) { ViewBag.Route = new List <MFRoute> { new MFRoute { ActionName = "Index", ControllerName = "Personels", Title = "لیست کارکنان", Priority = 1 } }; B_Personels bRole = new B_Personels(); var personel = bRole.GetPersonelById(Id); if (personel == null || personel.Id == CurrentUser.Id) { return(RedirectToAction("Index")); } B_PersonelRoles bRoleVal = new B_PersonelRoles(); ViewBag.Roles = bRoleVal.GetPersonelRoles(); ViewBag.VehicleType = new B_PublicCategory().GetPublicCategory(E_PublicCategory.PUBLIC_CATEGORY_PARENT.CAR_TYPE); ViewBag.PlaqColor = new B_PublicCategory().GetPublicCategory(E_PublicCategory.PUBLIC_CATEGORY_PARENT.TAG_COLOR); ViewBag.Booth = new B_Booth().GetBoothByPersonelId(personel.Id); ViewBag.Car = new B_CarInfo().GetCarInfoByPersonelId(personel.Id); return(View(personel)); }
public ActionResult Modify(M_Personels Personel, M_CarInfo CareInfo, M_BoothInfo BoothInfo) { object result = ""; try { B_Personels bPersonel = new B_Personels(); var oldPersonel = bPersonel.GetPersonelById(Personel.Id); if (oldPersonel.ImageName.ToLower() != "default.jpg" && oldPersonel.ImageName.ToLower() != Personel.ImageName) { System.IO.File.Delete(Server.MapPath("~/Areas/Admin/Images/Profile") + "/" + oldPersonel.ImageName); } bPersonel.Edit(Personel); if (CareInfo != null) { if (CareInfo.Id == 0) { CareInfo.PersonelId = Personel.Id; new B_CarInfo().Add(CareInfo); } else { new B_CarInfo().Edit(CareInfo); } } if (BoothInfo != null) { if (BoothInfo.Id == 0) { BoothInfo.PersonelId = Personel.Id; new B_Booth().Add(BoothInfo); } else { new B_Booth().Edit(BoothInfo); } } result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }