Пример #1
0
        public JsonResult sendMail(string strOrderID)
        {
            List <FPT_CIR_HOLDING_GET_ALL_Result> list = le.FPT_CIR_HOLDING_GET_ALL().ToList();

            strOrderID = strOrderID.Trim();
            strOrderID = strOrderID.Substring(0, strOrderID.LastIndexOf(','));
            string[] orderArr = strOrderID.Split(',');
            foreach (string item in orderArr)
            {
                CIR_HOLDING order    = le.CIR_HOLDING.Where(a => a.ID.ToString() == item).First();
                string      date     = Convert.ToDateTime(order.TimeOutDate).ToString("dd/MM/yyyy");
                CIR_PATRON  patron   = le.CIR_PATRON.Where(a => a.Code == order.PatronCode).First();
                string      name     = patron.FirstName + " " + patron.MiddleName + " " + patron.LastName;
                DateTime    dateTime = DateTime.Now.AddDays(7);
                le.ExcuteSQL("update CIR_HOLDING set CheckMail=1, InTurn=1, TimeOutDate='" + dateTime.ToString() + "' where id =" + item);
                string bookname = "";
                foreach (FPT_CIR_HOLDING_GET_ALL_Result temp in list)
                {
                    if (temp.ID.ToString().Equals(item))
                    {
                        bookname = temp.BOOKNAME;
                        bookname = format.getContent(bookname.Split('$'), "a");
                        break;
                    }
                }
                sendmail(patron.Email, name, date, bookname);
            }

            return(Json("", JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetLockPatronInfo()
        {
            CIR_PATRON patron      = db.CIR_PATRON.Where(a => a.Code == sessionpcode).First();
            string     LPatronName = patron.FirstName + " " + patron.MiddleName + " " + patron.LastName;
            string     LPatronCode = sessionpcode;

            ViewBag.blackstartdate = db.CIR_PATRON_LOCK.Where(a => a.PatronCode == LPatronCode).First().StartedDate;
            string Lblackstartdate = db.CIR_PATRON_LOCK.Where(a => a.PatronCode == LPatronCode).First().StartedDate.ToString("dd/MM/yyyy");
            string Lblackenddate   = ViewBag.blackstartdate.AddDays(db.CIR_PATRON_LOCK.Where(a => a.PatronCode == LPatronCode).First().LockedDays).ToString("dd/MM/yyyy");
            string LlockedDay      = db.CIR_PATRON_LOCK.Where(a => a.PatronCode == LPatronCode).First().LockedDays.ToString();
            string LblackNote      = db.CIR_PATRON_LOCK.Where(a => a.PatronCode == LPatronCode).First().Note;

            string[] PatronLockInfo = { LPatronName, LPatronCode, Lblackstartdate, Lblackenddate, LlockedDay, LblackNote };
            return(Json(PatronLockInfo, JsonRequestBehavior.AllowGet));
        }
 public void Getpatrondetail(string strPatronCode)
 {
     if (db.SP_GET_PATRON_INFOR("", strPatronCode, DateTime.Now.ToString("MM/dd/yyyy")).Count() == 0)
     {
         ViewBag.message      = "Số thẻ không tồn tại";
         ViewBag.PatronDetail = null;
     }
     else
     {
         ViewBag.message = "";
         SP_GET_PATRON_INFOR_Result patroninfo =
             db.SP_GET_PATRON_INFOR("", strPatronCode, DateTime.Now.ToString("MM/dd/yyyy")).First();
         CIR_PATRON patron = db.CIR_PATRON.Where(a => a.Code == strPatronCode).First();
         ViewBag.loanquota    = patron.CIR_PATRON_GROUP.LoanQuota;
         ViewBag.message      = "";
         ViewBag.PatronDetail = new DetailPatron
         {
             ID                = patron.ID,
             strCode           = patron.Code,
             Name              = patron.FirstName + " " + patron.MiddleName + " " + patron.LastName,
             strDOB            = Convert.ToDateTime(patron.DOB).ToString("dd/MM/yyyy"),
             strValidDate      = Convert.ToDateTime(patroninfo.ValidDate).ToString("dd/MM/yyyy"),
             strExpiredDate    = Convert.ToDateTime(patron.ExpiredDate).ToString("dd/MM/yyyy"),
             Sex               = patron.Sex == "1" ? "Nam" : "Nữ",
             intEthnicID       = db.CIR_DIC_ETHNIC.Where(a => a.ID == patron.EthnicID).Count() == 0 ? "" : db.CIR_DIC_ETHNIC.Where(a => a.ID == patron.EthnicID).First().Ethnic,
             intCollegeID      = (patron.CIR_PATRON_UNIVERSITY == null || patron.CIR_PATRON_UNIVERSITY.CIR_DIC_COLLEGE == null) ? "" : patron.CIR_PATRON_UNIVERSITY.CIR_DIC_COLLEGE.College,
             intFacultyID      = (patron.CIR_PATRON_UNIVERSITY == null || patron.CIR_PATRON_UNIVERSITY.CIR_DIC_FACULTY == null) ? "" : patron.CIR_PATRON_UNIVERSITY.CIR_DIC_FACULTY.Faculty,
             strEducationlevel = patron.CIR_DIC_EDUCATION == null ? null : patron.CIR_DIC_EDUCATION.EducationLevel,
             strWorkPlace      = patroninfo.WorkPlace,
             strGrade          = patron.CIR_PATRON_UNIVERSITY == null ? "" : patron.CIR_PATRON_UNIVERSITY.Grade,
             strClass          = patron.CIR_PATRON_UNIVERSITY == null ? "" : patron.CIR_PATRON_UNIVERSITY.Class,
             strAddress        = patron.CIR_PATRON_OTHER_ADDR.Count == 0 ? "" : patron.CIR_PATRON_OTHER_ADDR.First().Address,
             strTelephone      = patron.Telephone,
             strMobile         = patron.Mobile,
             strEmail          = patron.Email,
             strNote           = patron.Note,
             intOccupationID   = patron.CIR_DIC_OCCUPATION == null ? "" : patron.CIR_DIC_OCCUPATION.Occupation,
             intPatronGroupID  = patron.CIR_PATRON_GROUP == null ? "" : patron.CIR_PATRON_GROUP.Name,
             strPortrait       = patron.Portrait
         };
         int id2 = ViewBag.PatronDetail.ID;
         Getonloandetail(id2);
     }
 }
Пример #4
0
        public PartialViewResult CheckInByDKCB(
            int intType,
            int intAutoPaid,
            string strCopyNumbers,
            string strCheckInDate,
            string strPatronCode
            )
        {
            string CopyNumber = strCopyNumbers.Trim();
            int    success    = -1;

            if (!sessionpcode.Equals(""))
            {
                Getpatrondetail(sessionpcode);
            }
            else
            {
                ViewBag.PatronDetail = null;
            }
            if (db.HOLDINGs.Where(a => a.CopyNumber == CopyNumber).Count() == 0)
            {
                ViewBag.message = "ĐKCB không đúng";
            }
            else if (db.CIR_LOAN.Where(a => a.CopyNumber == CopyNumber).Count() == 0)
            {
                ViewBag.message = "ĐKCB chưa được ghi mượn";
            }
            else
            {
                string patroncode = db.CIR_LOAN.Where(a => a.CopyNumber == CopyNumber).First().CIR_PATRON.Code;
                success = db.SP_CHECKIN((int)Session["UserID"], intType, intAutoPaid, CopyNumber, strCheckInDate,
                                        new ObjectParameter("strTransIDs", typeof(string)),
                                        new ObjectParameter("strPatronCode", typeof(string)),
                                        new ObjectParameter("intError", typeof(int)));
                if (success == -1)
                {
                    ViewBag.CurrentCheckin = null;
                    ViewBag.message        = "Ghi trả thất bại";
                }
                else
                {
                    int    lastid    = db.CIR_LOAN_HISTORY.Max(a => a.ID);
                    int    id        = db.CIR_LOAN_HISTORY.Where(b => b.ID == lastid).First().ItemID;
                    String fieldcode = "245";
                    ViewBag.message        = "";
                    ViewBag.CurrentCheckin = new CurrentCheckIn
                    {
                        Title        = f.OnFormatHoldingTitle(db.FIELD200S.Where(a => a.ItemID == id).Where(a => a.FieldCode == fieldcode).First().Content),
                        Copynumber   = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().CopyNumber,
                        CheckOutDate = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().CheckOutdate.ToString("dd/MM/yyyy"),
                        CheckInDate  = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().CheckInDate.ToString("dd/MM/yyyy"),
                        OverdueFine  = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().OverdueFine.ToString()
                    };
                    sessionpcode = patroncode;
                }
                Getpatrondetail(patroncode);
                HOLDING holding = db.HOLDINGs.Where(a => a.CopyNumber == CopyNumber).First();


                if (db.CIR_HOLDING.Where(a => a.ItemID == holding.ItemID).Count() != 0)
                {
                    if (db.CIR_HOLDING.Where(a => (a.ItemID == holding.ItemID) && (a.InTurn == false) && (a.CheckMail == false)).Count() != 0)
                    {
                        CIR_HOLDING cIR_HOLDING = db.CIR_HOLDING.Where(a => (a.ItemID == holding.ItemID) && (a.InTurn == false) && (a.CheckMail == false)).OrderByDescending(x => x.CreatedDate).First();
                        CIR_PATRON  cIR_PATRON  = db.CIR_PATRON.Where(a => a.Code == cIR_HOLDING.PatronCode).First();
                        ViewBag.message = "Bạn đọc " + cIR_PATRON.FirstName + " " + cIR_PATRON.MiddleName + " " + cIR_PATRON.LastName + " .Mã SV:" + cIR_PATRON.Code + " đang đợi mượn cuốn này!";
                    }
                }
                if (db.CIR_PATRON_LOCK.Where(a => a.PatronCode == patroncode).Count() == 0)
                {
                    ViewBag.active = 1;
                }
                else
                {
                    ViewBag.active = 0;
                }
            }
            if (db.CIR_PATRON_LOCK.Where(a => a.PatronCode == strPatronCode).Count() == 0)
            {
                ViewBag.active = 1;
            }
            else
            {
                ViewBag.active = 0;
            }

            return(PartialView("_checkinByDKCB"));
        }
Пример #5
0
        public PartialViewResult CheckInByDKCBs(
            string strPatronCode,
            int intType,
            int intAutoPaid,
            string[] strCopyNumbers,
            string strCheckInDate
            )
        {
            string pcode   = strPatronCode.Trim();
            int    success = -1;

            if (strCopyNumbers != null)
            {
                foreach (string CopyNumber in strCopyNumbers)
                {
                    success = db.SP_CHECKIN((int)Session["UserID"], intType, intAutoPaid, CopyNumber, strCheckInDate,
                                            new ObjectParameter("strTransIDs", typeof(string)),
                                            new ObjectParameter("strPatronCode", typeof(string)),
                                            new ObjectParameter("intError", typeof(int)));
                }
            }
            Getpatrondetail(sessionpcode);
            //FPT_SP_UNLOCK_PATRON_CARD_LIST("'" + strPatronCode + "'");
            if (db.CIR_PATRON_LOCK.Where(a => a.PatronCode == strPatronCode).Count() == 0)
            {
                ViewBag.active = 1;
            }
            else
            {
                ViewBag.active = 0;
            }
            if (success == -1)
            {
                ViewBag.message        = "Ghi trả thất bại";
                ViewBag.CurrentCheckin = null;
            }
            else
            {
                int    lastid    = db.CIR_LOAN_HISTORY.Max(a => a.ID);
                int    id        = db.CIR_LOAN_HISTORY.Where(b => b.ID == lastid).First().ItemID;
                String fieldcode = "245";
                ViewBag.message        = "";
                ViewBag.CurrentCheckin = new CurrentCheckIn
                {
                    Title        = f.OnFormatHoldingTitle(db.FIELD200S.Where(a => a.ItemID == id).Where(a => a.FieldCode == fieldcode).First().Content),
                    Copynumber   = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().CopyNumber,
                    CheckOutDate = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().CheckOutdate.ToString("dd/MM/yyyy"),
                    CheckInDate  = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().CheckInDate.ToString("dd/MM/yyyy"),
                    OverdueFine  = db.CIR_LOAN_HISTORY.Where(a => a.ID == lastid).First().OverdueFine.ToString()
                };
                string messageOrder = "";
                foreach (string item in strCopyNumbers)
                {
                    HOLDING holding = db.HOLDINGs.Where(a => a.CopyNumber == item).First();
                    //check this book is on exist in table order
                    if (db.CIR_HOLDING.Where(a => a.ItemID == holding.ItemID).Count() != 0)
                    {
                        if (db.CIR_HOLDING.Where(a => (a.ItemID == holding.ItemID) && (a.InTurn == false) && (a.CheckMail == false)).Count() != 0)
                        {
                            CIR_HOLDING cIR_HOLDING = db.CIR_HOLDING.Where(a => (a.ItemID == holding.ItemID) && (a.InTurn == false) && (a.CheckMail == false)).OrderByDescending(x => x.CreatedDate).First();
                            CIR_PATRON  cIR_PATRON  = db.CIR_PATRON.Where(a => a.Code == cIR_HOLDING.PatronCode).First();
                            ITEM        temp        = db.ITEMs.Where(a => a.ID == cIR_HOLDING.ItemID).First();
                            messageOrder = messageOrder + "Mã SV:" + cIR_PATRON.Code + " đang đợi mượn tài liệu " + temp.Code + "\n";
                        }
                    }
                }
                ViewBag.message = messageOrder;
            }
            return(PartialView("_checkinByDKCB"));
        }