Example #1
0
        public ActionResult RecordBorrowReturn(string borrowId)
        {
            //var result = BorrowHistoryService.ReturnBorrowFile(borrowId);
            var recordList = ApplyBorrowFileListService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).ToList();
            var apply      = ApplyBorrowService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).First();

            apply.ApplyState = 4;
            ApplyBorrowService.UpdateModel(apply);
            //if(result)
            //{
            foreach (var item in recordList)
            {
                var operate = new OperateLog()
                {
                    RecordId      = item.RecordID,
                    OperatePeople = Operator.RealName,
                    OperateTime   = DateTime.Now,
                    OperateType   = "借阅档案归还确认",
                    OperateInfo   = $"外借档案借阅归还 档案号:{item.RecordID}"
                };
                var record = recordService.GetByWhere(" where RecordID=@RecordID", new { RecordID = item.RecordID })
                             .First();
                record.RecordStatus = 2;
                recordService.UpdateModel(record);
                OperateLogService.CreateModel(operate);
            }
            return(Json(SuccessTip("外借档案归还成功!")));
            //}
            //else
            //{
            //return Json(ErrorTip("外借档案归还失败,请重试!"));
            //}
        }
Example #2
0
        public ActionResult ReApplyBorrow(string borrowId)
        {
            try
            {
                var result           = ApplyBorrowService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).First();
                var borrowRecordList = ApplyBorrowFileListService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).ToList();
                if (result.ApplyState == 3)
                {
                    result.ApplyState = 1;
                    var sign = ApplyBorrowService.UpdateModel(result);

                    if (sign)
                    {
                        foreach (var item in borrowRecordList)
                        {
                            var operate = new OperateLog()
                            {
                                OperatePeople = Operator.RealName,
                                OperateTime   = DateTime.Now,
                                OperateType   = "重新申请借阅",
                                RecordId      = item.RecordID,
                                OperateInfo   = $"重新申请借阅 借阅编号:{result.BorrowID},档案编号:{item.RecordID}"
                            };
                            OperateLogService.CreateModel(operate);
                        }
                        return(Json(SuccessTip("重新申请借阅成功!")));
                    }
                    else
                    {
                        return(Json(ErrorTip("重新申请借阅失败!")));
                    }
                }
                else
                {
                    return(Json(ErrorTip("当前申请状态不允许重新申请!")));
                }
            }
            catch (InvalidOperationException ex)
            {
                Log.WriteFatal(ex);
                return(Json(ErrorTip("重新申请借阅失败,当前借阅编号不存在!")));
            }
        }
Example #3
0
        public ActionResult ApplyBorrowAgree(string borrowId)
        {
            try
            {
                var applyBorrow = ApplyBorrowService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId })
                                  .First();
                applyBorrow.ApplyState = 2;
                var result     = ApplyBorrowService.UpdateModel(applyBorrow);
                var editResult = ApplyBorrowService.ApplyBorrowAgree(borrowId);

                if (result && editResult)
                {
                    var applyRecordList = ApplyBorrowFileListService
                                          .GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).ToList();

                    foreach (var record in applyRecordList)
                    {
                        var operate = new OperateLog()
                        {
                            OperateTime   = DateTime.Now,
                            OperateType   = "审批借阅",
                            OperatePeople = Operator.RealName,
                            RecordId      = record.RecordID
                        };
                        operate.OperateInfo += $"档案编号:{record.RecordID} 申请借阅审核通过";
                        OperateLogService.CreateModel(operate);
                    }

                    return(Json(SuccessTip("申请借阅审核成功!")));
                }
                else
                {
                    return(Json(ErrorTip("申请借阅审核失败!")));
                }
            }
            catch (InvalidOperationException ex)
            {
                Log.WriteFatal(ex);
                return(Json(ErrorTip("获取不到申请借阅记录,出现数据一致性错误!")));
            }
        }