public Operation SaveApprovalComment(CmnApprovalComment obj) { Operation objOperation = new Operation { Success = true }; long Id = _ICmnApprovalCommentRepository.AddEntity(obj); objOperation.OperationId = Id; try { _UnitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }
public ActionResult SaveApprovalComment(VoucherViewModel comment, int userId, int companyId) { int processId = 0; int levelId = 0; string urlData = Request.UrlReferrer.Query; string[] array = urlData.Split('='); if (array.Length > 0) { processId = Convert.ToInt32(array[1]); levelId = Convert.ToInt32(array[2]); } Operation objOperation = new Operation(); Int64 ret = 0; CmnApproval apr = _ICmnApprovalService.GetApproval(comment.Id, processId, levelId); if (apr != null) { apr.Value = true; apr.DoneBy = userId; apr.DoneDateTime = DateTime.Now; //apr.CmnApprovalComments = comment; objOperation = _ICmnApprovalService.UpdatewithComment(apr); if (objOperation.Success) { CmnApprovalComment obj = new CmnApprovalComment(); obj.CmnApprovalId = Convert.ToInt32(objOperation.OperationId); obj.Comments = comment.Naration; obj.Commentator = userId; obj.CommentDate = DateTime.Now; objOperation = _ICmnApprovalCommentService.SaveApprovalComment(obj); } int i = Convert.ToInt32(objOperation.OperationId); if (i > 0) { //This means all is checked so make the PStatus=true if (array[3] == "Approve") { AnFVoucher vr = _IAnFVoucherService.GetAnfVoucherById(comment.Id); if (vr != null) { vr.IsPosted = true; _IAnFVoucherService.UpdateVoucher(vr); } } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }
public ActionResult Reject(VoucherViewModel comment, int userId, int companyId) { int processId = 0; int levelId = 0; string urlData = Request.UrlReferrer.Query; string[] array = urlData.Split('='); if (array.Length > 0) { processId = Convert.ToInt32(array[1]); levelId = Convert.ToInt32(array[2]); } Operation objOperation = new Operation(); CmnApproval apr = _ICmnApprovalService.GetApproval(comment.Id, processId, levelId); if (apr != null) { apr.Value = false; apr.DoneBy = userId; apr.DoneDateTime = DateTime.Now; //apr.Comment = comment.Naration; //Int64 i = 0; objOperation = _ICmnApprovalService.UpdatewithComment(apr); if (objOperation.Success) { CmnApprovalComment obj = new CmnApprovalComment(); obj.CmnApprovalId = Convert.ToInt32(objOperation.OperationId); obj.Comments = comment.Naration; obj.Commentator = userId; obj.CommentDate = DateTime.Now; objOperation = _ICmnApprovalCommentService.SaveApprovalComment(obj); } } return Json(objOperation, JsonRequestBehavior.DenyGet); }