public ActionResult Resend(Guid id) { DailyLeaveManager dlm = new DailyLeaveManager(UOW); var dailyLeave = dlm.GetByID(id); dlm.Resend(dailyLeave); UOW.SaveChanges(); return(RedirectToAction("ShowDenied", new { ac = "Resend" })); }
public ActionResult DenyConfirmed(Guid id) { DailyLeaveManager dlm = new DailyLeaveManager(UOW); var result = dlm.GetByID(id); dlm.Deny(result); UOW.SaveChanges(); return(RedirectToAction("ApproveIndex", new { ac = "Deny" })); }
public ActionResult ApproveConfirmed(Guid id) { DailyLeaveManager dlm = new DailyLeaveManager(UOW); var result = dlm.GetByID(id); var currentUser = new UserHelper().GetCurrent(); dlm.Approve(result); UOW.SaveChanges(); return(RedirectToAction("ApproveIndex", new { ac = "Approve" })); }
// GET: DailyLeaves/Details/5 public ActionResult Details(Guid id) { if (id == Guid.Empty) { return(this.StatusCode(statusCode: (int)System.Net.HttpStatusCode.BadRequest, "آی دی مرخصی ارسال نشده است")); } DailyLeaveManager dlm = new DailyLeaveManager(UOW); DailyLeave dailyLeave = dlm.GetByID(id); if (dailyLeave == null) { return(this.StatusCode(statusCode: (int)System.Net.HttpStatusCode.NotFound, "مرخصی با آی دی ارسال شده یافت نشد")); } return(View(new DailyLeaveAssembles().ToJson(dailyLeave))); }
// GET: DailyLeaves/Details/5 public ActionResult Details(Guid id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DailyLeaveManager dlm = new DailyLeaveManager(UOW); DailyLeave dailyLeave = dlm.GetByID(id); if (dailyLeave == null) { return(HttpNotFound()); } return(View(new DailyLeaveAssembles().ToJson(dailyLeave))); }
// POST: DailyLeaves/Approve/5 public ActionResult Deny(Guid id) { DailyLeaveManager dlm = new DailyLeaveManager(UOW); ProjectManager pm = new ProjectManager(UOW); UserManager um = new UserManager(UOW); var currentUser = new UserHelper().GetCurrent(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DailyLeave dailyLeave = dlm.GetByID(id); if (dailyLeave == null) { return(HttpNotFound()); } return(View(new DailyLeaveAssembles().ToJson(dailyLeave))); }
// GET: DailyLeaves/Edit/5 public ActionResult Edit(Guid id) { DailyLeaveManager dlm = new DailyLeaveManager(UOW); ProjectManager pm = new ProjectManager(UOW); UserManager um = new UserManager(UOW); if (id == Guid.Empty) { return(this.StatusCode(statusCode: (int)System.Net.HttpStatusCode.BadRequest, "آی دی مرخصی ارسال نشده است")); } DailyLeave dailyLeave = dlm.GetByID(id); if (dailyLeave == null) { return(this.StatusCode(statusCode: (int)System.Net.HttpStatusCode.NotFound, "مرخصی با آی دی ارسال شده یافت نشد")); } ViewBag.ProjectID = new SelectList(pm.GetByUser(this.CurrentUser), "ID", "Title"); ViewBag.SuccessorID = new SelectList(um.GetAll(), "ID", "UserTitle"); return(View(dailyLeave)); }
// GET: DailyLeaves/Edit/5 public ActionResult Edit(Guid id) { DailyLeaveManager dlm = new DailyLeaveManager(UOW); ProjectManager pm = new ProjectManager(UOW); UserManager um = new UserManager(UOW); var currentUser = new UserHelper().GetCurrent(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DailyLeave dailyLeave = dlm.GetByID(id); if (dailyLeave == null) { return(HttpNotFound()); } ViewBag.ProjectID = new SelectList(pm.GetByUser(currentUser), "ID", "Title"); ViewBag.SuccessorID = new SelectList(um.GetAll(), "ID", "UserTitle"); return(View(dailyLeave)); }
public IActionResult approveDeny(vmApproveDenyRequest request) { try { if (!this.MainChecks(request.ver, out string error)) { throw new Exception(error); } if (request.approveIds.Count == 0 && request.denyIds.Count == 0) { throw new Exception("موردی برای تایید یا رد مشخص نشده است"); } var currentUser = new UserHelper().GetCurrent(this._uow, this.UserName); TimeSheetManager timeSheetManager = new TimeSheetManager(this._uow); if (request.type == 10) { //workhour foreach (var itemForApprove in request.approveIds) { var item = timeSheetManager.GetByID(itemForApprove.id); approveDenyWorkhour(true, currentUser, timeSheetManager, item, itemForApprove.description); } foreach (var itemForDeny in request.denyIds) { var item = timeSheetManager.GetByID(itemForDeny.id); approveDenyWorkhour(false, currentUser, timeSheetManager, item, itemForDeny.description); } } if (request.type == 1) { //ماموریت ساعتی HourlyMissionManager dlm = new HourlyMissionManager(this._uow); foreach (var itemForApprove in request.approveIds) { var dailyLeave = dlm.GetByID(itemForApprove.id); approveDenyHourlyMission(true, currentUser, timeSheetManager, dlm, dailyLeave, itemForApprove.description); } foreach (var itemForDeny in request.denyIds) { var dailyLeave = dlm.GetByID(itemForDeny.id); approveDenyHourlyMission(false, currentUser, timeSheetManager, dlm, dailyLeave, itemForDeny.description); } this._uow.SaveChanges(); } if (request.type == 2) { //مرخصی ساعتی HourlyLeaveManager dlm = new HourlyLeaveManager(this._uow); foreach (var itemForApprove in request.approveIds) { var dailyLeave = dlm.GetByID(itemForApprove.id); approveDenyHourlyLeave(true, currentUser, timeSheetManager, dlm, dailyLeave, itemForApprove.description); } foreach (var itemForDeny in request.denyIds) { var dailyLeave = dlm.GetByID(itemForDeny.id); approveDenyHourlyLeave(false, currentUser, timeSheetManager, dlm, dailyLeave, itemForDeny.description); } this._uow.SaveChanges(); } if (request.type == 3) { //مرخصی روزانه DailyLeaveManager dlm = new DailyLeaveManager(this._uow); foreach (var itemForApprove in request.approveIds) { var dailyLeave = dlm.GetByID(itemForApprove.id); approveDenyDailyLeave(true, currentUser, timeSheetManager, dlm, dailyLeave, itemForApprove.description); } foreach (var itemForDeny in request.denyIds) { var dailyLeave = dlm.GetByID(itemForDeny.id); approveDenyDailyLeave(false, currentUser, timeSheetManager, dlm, dailyLeave, itemForDeny.description); } this._uow.SaveChanges(); } return(Ok(new { message = "عملیات تایید با موفقیت انجام گردید" })); } catch (Exception ex) { return(this.ReturnError(ex, "خطا در ذخیره تایید و رد ها")); } }