示例#1
0
        public JsonResult StartFollowUp(int?LoanId)
        {
            if (LoanId == null || DmlObj.GetLoanById(LoanId) == null)
            {
                return(Json(new { Id = 0, Message = "عملیات به دلیل خطا در دریافت اطلاعات تسهیلات انجام نشد" }, JsonRequestBehavior.AllowGet));
            }

            var Loan = DmlObj.GetLoanById(LoanId);

            int UserId = 0;

            Int32.TryParse(User.GetAmUser(), out UserId);
            AMUser CurrentUser = DmlObj.GetAmUserById(UserId);

            if (CurrentUser == null)
            {
                return(Json(new { Id = 0, Message = "اطلاعات کاربری شما یافت نشد. لطفا دوباره به سیستم وارد شوید." }, JsonRequestBehavior.AllowGet));
            }



            bool            op = false;
            AMUpdateLoanLog UpdateLoanLogObj = DmlObj.AddStartFollowUpLoanLog(new AMUpdateLoanLog {
                LoanId = Loan.Id, UpdateTime = DateTime.Now, UserId = CurrentUser.Id, Status = Enum.UpdateLoanStatus.UnderProcess
            }, out op);

            if (op)
            {
                return(Json(new { Id = UpdateLoanLogObj.Id, FirstName = UpdateLoanLogObj.User.FirstName, LastName = UpdateLoanLogObj.User.Lastname, ElapsedTime = DisplayExtension.ElapsedTime(UpdateLoanLogObj.UpdateTime), Message = "در حال بررسی" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { Id = 0, Message = "خطا در ذخیره سازی در پایگاه داده ها اتفاق افتاده است٬ لطفا مجددا تلاش نمایید." }, JsonRequestBehavior.AllowGet));
            }
        }