예제 #1
0
        public static bool confirmBorrow(int idBorrow)
        {
            bool res = LenderData.confirmBorrow(idBorrow);

            if (res == true)
            {
                LendsTable lendTable = LenderData.getLendsByIdBorrow(idBorrow);
                //השואל
                UsersTable borrow = UserData.getUserById(lendTable.borrowerId);
                BooksTable bt     = BooksData.getBookById(lendTable.bookId);
                //המשאיל
                UsersTable ut       = UserData.getUserById(bt.lenderId);
                string     bookName = LookupBL.getLookupByCode(Constants.BooksNameTableName, bt.nameId).Desc;
                string     message  = "הספר " + bookName + " שביקשת אושר על ידי בעל הספר   : ";
                message += " פרטי בעל הספר ליצירת קשר  : ";
                message += ut.firstName + " " + ut.lastName + ", ";
                message += "טלפון: " + ut.phone + " מייל " + ut.email;
                message += "<br/>  מיקום הספר: רחוב " + ut.address + " " + ut.houseNumber + " " + ut.neighborhood + " " +
                           LookupBL.getLookupByCode(Constants.CitiesTableName, ut.cityCode).Desc;
                //פניה לפונקציה ששולחת מייל על אישור השאלת הספר
                sendEmailFunc.sendEmailAsync(borrow.email, borrow.firstName +
                                             " " + borrow.lastName, message, "אישור השאלת ספר " + bookName);
            }
            return(false);
        }
예제 #2
0
        public static bool rejectBorrow(int idBorrow)
        {
            bool res = LenderData.rejectBorrow(idBorrow);

            if (res == true)
            {
                LendsTable lendTable = LenderData.getLendsByIdBorrow(idBorrow);
                //השואל
                UsersTable borrow = UserData.getUserById(lendTable.borrowerId);
                BooksTable bt     = BooksData.getBookById(lendTable.bookId);
                //המשאיל
                //   UsersTable ut = bt.UsersTable;
                string bookName = LookupBL.getLookupByCode(Constants.BooksNameTableName, bt.nameId).Desc;
                string message  = "מצטערים הספר " + bookName + " שביקשת  לא אושר על ידי בעל הספר באפשרותך לחפש ספר אחר במאגר הספרים שלנו  : ";
                //הצליח לשנות לאשר


                sendEmailFunc.sendEmailAsync(borrow.email, borrow.firstName + " " + borrow.lastName, message, "הודעה בדבר בקשה להשאלת ספר");
            }
            return(false);
        }
예제 #3
0
        //mv 05-03-2019
        public static bool returnBook(int idLender)
        {
            bool res = LenderData.returnBook(idLender);

            if (res == true)
            {
                LendsTable lending = LenderData.getLendsByIdBorrow(idLender);
                List <waitingForAbookTable> listWaiting = new List <waitingForAbookTable>();
                listWaiting = LenderData.GetAllWaitingForBook(lending.bookId);
                if (listWaiting.Count > 0)
                {
                    foreach (var item in listWaiting)
                    {
                        try
                        {
                            UsersTable u = UserData.getUserById(item.userCode);
                            if (u != null)
                            {
                                string messageTo = "";

                                string bookNameToMail = LookupBL.getLookupByCode(Constants.BooksNameTableName, BooksData.getBookById(lending.bookId).nameId).Desc;
                                messageTo += " הספר " + bookNameToMail + " הפך להיות זמין במערכת הנך יכול להיכנס לאתר ולשאול את הספר ";
                                sendEmailFunc.sendEmailAsync(u.email, u.firstName + " " + u.lastName, messageTo, "הודעת מערכת");
                                LenderData.removeWaitingToBookByIdWaiting(item);
                            }
                        }
                        catch (Exception)
                        {
                            return(false);
                        }
                    }
                }


                /*
                 * LendsTable lendTable = LenderData.getLendsByIdBorrow(lending.bookId);
                 * //השואל
                 * UsersTable borrow = UserData.getUserById(lendTable.borrowerId);//השואל
                 * BooksTable bt = BooksData.getBookById(lendTable.bookId);
                 * //המשאיל
                 * UsersTable ut = UserData.getUserById(bt.lenderId);// המשאיל
                 * string bookName = LookupBL.getLookupByCode(Constants.BooksNameTableName, bt.nameId).Desc;
                 * string message = "התקבלה בקשה להחזרת הספר " + bookName;
                 * message += " פרטי בעל הספר ליצירת קשר  : ";
                 * message += ut.firstName + " " + ut.lastName + ", ";
                 * message += "טלפון: " + ut.phone + " מייל " + ut.email;
                 * //הצליח לשנות לאשר
                 * //לשוח מייל לשואל עם הפרטים
                 * // sendEmailFunc.sendEmailAsync(borrow.email, borrow.firstName + " " + borrow.lastName, message, "אישור החזרת ספר " + bookName);
                 *
                 * //שליחת מייל לבעלי הספר שרוצים להחזיר את הספר שלו
                 * message = "התקבלה בקשה להחזרת הספר " + bookName;
                 * message += " פרטי השואל ליצירת קשר  : ";
                 * message += borrow.firstName + " " + borrow.lastName + ", ";
                 * message += "טלפון: " + borrow.phone + " מייל " + borrow.email;
                 *
                 * //   sendEmailFunc.sendEmailAsync(ut.email, ut.firstName + " " + ut.lastName, message, "אישור החזרת ספר " + bookName);
                 */
            }
            return(res);
        }