Exemplo n.º 1
0
 public void BanEmail(bool?isPermBan, tb_CSUStudent banStu, bool isTest = false)
 {
     mailMessage.To.Clear();
     mailMessage.From = new MailAddress("*****@*****.**");
     mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : banStu.EMAIL_ADDRESS);
     // add subject
     mailMessage.Subject = isPermBan == true
         ? "Notice of Permanent Ban from UTRC Checkout"
         : "Notice of Temporary Ban from UTRC Checkout";
     // add body
     text = isPermBan == true
         ? banStu.FIRST_NAME + ",  </br></br>" +
            "Our records indicate that you either failed to return the item(s) you checked out from the" +
            " Undeclared Technology Resource Center (UTRC) within the six hour checkout limit or the item(s) you" +
            " returned was damaged. Due to either the severity of the broken item(s) or the length of time you had" +
            " the item(s) you have been permanently banned from future use of our services. If you feel this is" +
            " an error and wish to contest the ban you can set up a time to meet with one of our managers" +
            " to discuss the issue further. If you would like to contest please respond back to this email" +
            " and we will reply to setup a time to meet with you." +
            " </br></br> -UTRC Management </br> http://utrc.casa.colostate.edu/"
         : banStu.FIRST_NAME + ", </br></br>" +
            "Our records indicate that you either failed to return the item(s) you checkout from the" +
            " Undeclared Technology Resource Center (UTRC) within the six hour checkout limit or the item(s) you" +
            " returned was damaged. Due to not complying with the terms of our agreement you have been temporarily" +
            " banned from our system. To lift the ban you may come to the checkout location and talk to one of" +
            " our staff members. We will lift the ban for you and you can utilize our services in the" +
            " future." +
            " </br></br> -UTRC Management </br> http://utrc.casa.colostate.edu/";
     SendMailHtml(mailMessage, text);
 }
Exemplo n.º 2
0
 public void CheckinEmail(bool?isLate, bool?isfined, tb_CSUStudent student, tb_CSUCheckoutCheckin checkout, bool isTest = false)
 {
     mailMessage.To.Clear();
     mailMessage.From = new MailAddress("*****@*****.**");
     mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
     // add subject
     mailMessage.Subject =
         checkout.ItemUPCFK + " Check-in at UTRC Checkout";
     // add body
     if (isLate == true && isfined != true)
     {
         text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                "Thank you for returning " + checkout.ItemUPCFK + ". Unfortunately, this item was returned late." +
                "</br></br> -UTRC Management </br> http://utrc.casa.colostate.edu/";
     }
     if (isfined == true)
     {
         text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br></br>" +
                "Thank you for returning " + checkout.ItemUPCFK +
                ". Unfortunately, this item was returned late and a fine will be assessed to your student account. " +
                "Fines are applied on the 15th of each month, and will appear on your account the following month." +
                " </br></br> -UTRC Management </br> http://utrc.casa.colostate.edu/";
     }
     if (isfined != true && isLate != true)
     {
         text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br></br>" +
                "Thank you for returning " + checkout.ItemUPCFK + " on time. " +
                "</br></br> -UTRC Management </br> http://utrc.casa.colostate.edu/";
     }
     // now send it
     SendMailHtml(mailMessage, text);
 }
        public bool?WaiverCheck(tb_CSUStudent tbs)
        {
            var v = db.tb_CSUStudent.FirstOrDefault(s => s.CSU_ID == tbs.CSU_ID);

            if (v.SIGNEDWAIVER == true)
            {
                return(v.SIGNEDWAIVER);
            }
            else
            {
                // ping SmartWaiver API to verify signed waiver before continuing
                var sw = smartwaiver.GetSignedWaivers(tbs.LAST_NAME);
                foreach (var s in sw)
                {
                    // check tags in each returned waiver for match with student id
                    foreach (var t in s.tags)
                    {
                        if (t == v.CSU_ID)
                        {
                            // grab first photo in s.photos and cache in db
                            if (s.photos.Count() > 0)
                            {
                                v.PHOTO = s.photos.ElementAt(0).photo;
                            }
                            v.SIGNEDWAIVER = true;
                            //email.WaiverEmail(v);
                            db.Entry(v).State = EntityState.Modified;
                            db.SaveChanges();
                        }
                    }
                }
                return(v.SIGNEDWAIVER);
            }
        }
Exemplo n.º 4
0
        public void testWaiverEmail()
        {
            tb_CSUStudent student = new tb_CSUStudent();

            student.FIRST_NAME = SessionVariables.CurrentUser.First_Name;
            student.LAST_NAME  = SessionVariables.CurrentUser.Last_Name;
            WaiverEmail(student, true);
        }
Exemplo n.º 5
0
        public void testBanEmailPerm()
        {
            tb_CSUStudent student = new tb_CSUStudent();

            student.FIRST_NAME    = SessionVariables.CurrentUser.First_Name;
            student.LAST_NAME     = SessionVariables.CurrentUser.Last_Name;
            student.EMAIL_ADDRESS = SessionVariables.CurrentUser.EMAIL;
            BanEmail(true, student, true);
        }
Exemplo n.º 6
0
        public void testCheckinEmailLateFine()
        {
            tb_CSUStudent student = new tb_CSUStudent();

            student.FIRST_NAME = SessionVariables.CurrentUser.First_Name;
            student.LAST_NAME  = SessionVariables.CurrentUser.Last_Name;
            tb_CSUCheckoutCheckin checkout = new tb_CSUCheckoutCheckin();

            checkout.ItemUPCFK = "Test Item";
            CheckinEmail(true, true, student, checkout, true);
        }
Exemplo n.º 7
0
        public void testLateEmail()
        {
            tb_CSUStudent student = new tb_CSUStudent();

            student.FIRST_NAME = SessionVariables.CurrentUser.First_Name;
            student.LAST_NAME  = SessionVariables.CurrentUser.Last_Name;
            tb_CSUCheckoutCheckin checkout = new tb_CSUCheckoutCheckin();

            checkout.ItemUPCFK = "Test Item";
            checkout.DueDate   = DateTime.Now;
            LateEmail(student, checkout, true);
        }
Exemplo n.º 8
0
        public void WaitlistRemoveEmail(tb_CSUStudent student, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = "Removed From Waitlist for Longterm Checkout";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "You were removed from the waitlist for longterm checkout at " + DateTime.Now + ". " +
                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 9
0
        public void WaitlistRemoveAfter48HoursEmail(tb_CSUStudent student, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = "Removed From Waitlist for Longterm Checkout";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "You were previously notified that a longterm checkout laptop was available for you and that you had 48 hours " +
                   "to pick it up. Since you did not, you were removed from the waitlist at " + DateTime.Now + ". " +
                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 10
0
        public void WaitlistAddEmail(tb_CSUStudent student, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = "Added to Waitlist for Longterm Checkout";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "You were added to the waitlist for a longterm checkout at " + DateTime.Now + ". You will be" +
                   " notified by email when your item is ready, at which point you will have 48 hours to check it out. " +
                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 11
0
        public void WaiverEmail(tb_CSUStudent student, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = "UTRC Waiver Agreement";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "Thank you for joining the UTRC checkout system! [email protected] is the official email of the program, " +
                   "and will be sending you emails regarding your check-outs. You'll recieve an email shortly with the terms and conditions of the checkout program, " +
                   "and information about your first checkout. A digital copy of the waiver you signed will be provided in an email by SmartWaiver, and the waiver may be found here: " +
                   "http://utrc.casa.colostate.edu/waiver/" + "." +
                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 12
0
        public void LateEmail(tb_CSUStudent student, tb_CSUCheckoutCheckin checkout, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = checkout.ItemUPCFK + " NOT RETURNED!!!";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "Our records indicate you have not returned " + checkout.ItemUPCFK + " by " + checkout.DueDate + " and our checkout desk staff has closed for the day. " +
                   "Be advised, you will be assesed a late fee on the item in accordance with the Laptop Agreement found here: " +
                   "http://utrc.casa.colostate.edu/waiver/" + "." +

                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 13
0
        public void LongtermDue(tb_CSUStudent student, tb_CSUCheckoutCheckin checkout, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = checkout.ItemUPCFK + " Due Back Soon!";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "Our records indicate you have had " + checkout.ItemUPCFK + " on longterm checkout since " + checkout.CheckoutDate + " and the due date for the item is " + checkout.DueDate +
                   ". Please return the item before the due date or" +
                   " you will be assesed a late fee on the item in accordance with the Laptop Agreement found here: " +
                   "http://utrc.casa.colostate.edu/waiver/" + "." +

                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
        private tb_CSUStudent GetOrMigrateStudent(string csuId)
        {
            var findStudent = db.tb_CSUStudent.FirstOrDefault(s => s.CSU_ID == csuId);

            if (findStudent != null)
            {
                return(findStudent);
            }

            //The student hasn't checked out before, attempt to gather info from CSU Main Database
            try
            {
                var dbHera             = new HeraStudents_Entities();
                var noDupesForCheckout =
                    dbHera.v_CSUG_DIRECTORY_ALL_LOCAL_No_Dupes_forCheckinCheckout
                    .FirstOrDefault(s => s.CSU_ID == csuId);

                if (noDupesForCheckout != null)
                {
                    //creates student record if its found
                    var csuStudent = new tb_CSUStudent
                    {
                        CSU_ID        = noDupesForCheckout.CSU_ID,
                        EMAIL_ADDRESS = noDupesForCheckout.EMAIL_ADDRESS,
                        ENAME         = noDupesForCheckout.ENAME,
                        FIRST_NAME    = noDupesForCheckout.FIRST_NAME,
                        LAST_NAME     = noDupesForCheckout.LAST_NAME,
                        PHONE         = noDupesForCheckout.LAST_NAME,
                        SIGNEDWAIVER  = null
                    };
                    db.tb_CSUStudent.Add(csuStudent);
                    db.SaveChanges();
                    findStudent = csuStudent;
                }
                //the student wasn't found in our view of the CSU Directory. What happend?
                email.ErrorEmail(csuId);
                ViewBag.Message = "Student ID # not found in the system, please create a manual entry";
            }
            catch (Exception e)
            {
                string error = e.ToString();
                email.ErrorEmail(error);
            }
            return(findStudent);
        }
Exemplo n.º 15
0
        public ActionResult EmailLateStudents()
        {
            var checkoutRecords = db.tb_CSUCheckoutCheckin.Where(m => m.CheckinDate == null && m.isLongterm != true);

            foreach (var rec in checkoutRecords)
            {
                CsuStudent = db.tb_CSUStudent.FirstOrDefault(m => m.CSU_ID == rec.CSU_IDFK);
                if (CsuStudent == null)
                {
                    continue;
                }
                if (rec.CheckoutLocationFK != "TLT")
                {
                    email.LateEmail(CsuStudent, rec);
                }
            }
            ViewBag.Message = "Email Sent!";
            return(View());
        }
Exemplo n.º 16
0
        public void WaitlistReservationProblemEmail(tb_CSUStudent student, tb_CSULabInventoryItems item, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = "Your waitlist reservation had a problem";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "There was an issue with the available laptop and unfortunately it is no longer available for you to checkout. You are at the " +
                   "top of the waitlist and will be notified as soon as an item becomes available. If you have " +
                   "any questions, please feel free to contact a manager at the BSB checkout desk during the following times:" +
                   "</br></br><strong>MONDAY: </strong>1:00pm-3:00pm" +
                   "</br><strong>TUESDAY: </strong>1:00pm-4:00pm" +
                   "</br><strong>THURSDAY: </strong>2:00pm-6:00pm" +
                   "</br><strong>FRIDAY: </strong>2:00pm-5:00pm" +
                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 17
0
        public ActionResult EmailLongtermDueStudents()
        {
            var longtermRecords = db.tb_CSUCheckoutCheckin.Where(m => m.CheckinDate == null && m.isLongterm == true);

            foreach (var rec in longtermRecords)
            {
                CsuStudent = db.tb_CSUStudent.FirstOrDefault(m => m.CSU_ID == rec.CSU_IDFK);
                if (CsuStudent == null)
                {
                    continue;
                }

                if (rec.DueDate < DateTime.Now.AddDays(5))
                {
                    email.LongtermDue(CsuStudent, rec);
                }
            }
            ViewBag.Message = "Email Sent!";
            return(View());
        }
Exemplo n.º 18
0
        public void WaitlistItemReadyEmail(tb_CSUStudent student, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject = "Your item is ready for Longterm Checkout";
            text = student.FIRST_NAME + " " + student.LAST_NAME + ", </br> </br>" +
                   "A laptop is ready for you to checkout longterm. You have 48 hours to check it out, after which " +
                   "you will be able to keep the computer for 2 weeks. You can pick it up from the UTRC checkout desk in the BSB during the " +
                   "following times:" +
                   "</br></br><strong>MONDAY: </strong>1:00pm-3:00pm" +
                   "</br><strong>TUESDAY: </strong>1:00pm-4:00pm" +
                   "</br><strong>THURSDAY: </strong>2:00pm-6:00pm" +
                   "</br><strong>FRIDAY: </strong>2:00pm-5:00pm" +
                   "</br></br>If you do not check it out within 48 hours, the item will go to the next person and you " +
                   "will be removed from the waitlist." +
                   "</br></br> -UTRC Management";

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 19
0
        private void LateCheck(tb_CSUCheckoutCheckin checkin, out tb_CSUCheckoutCheckin checkIn, out tb_CSUStudent stuRec)
        {
            // assigns records
            checkIn = checkin;
            stuRec  = db.tb_CSUStudent.FirstOrDefault(m => m.CSU_ID == checkin.CSU_IDFK);
            if (checkIn == null)
            {
                return;
            }
            if (stuRec == null)
            {
                return;
            }


            //checks for a late checkin by 6 hours.
            var fullStudentName = stuRec.FIRST_NAME + " " + stuRec.LAST_NAME;

            var lateCheck = checkIn.CheckinDate < checkIn.DueDate;

            if (lateCheck || checkIn.isLongterm == true)
            {
                return;
            }

            checkIn.isLate  = true;
            ViewBag.Message = checkIn.ItemUPCFK + " is late, a warning will be issued to " + fullStudentName;

            Debug.Assert(checkIn.DueDate != null, "checkIn.DueDate != null");

            DateTime overdueCheck = checkIn.DueDate.Value.AddHours(18);
            var      fineCheck    = checkIn.CheckinDate < overdueCheck;

            if (fineCheck)
            {
                return;
            }
            checkIn.isFined = true;
            ViewBag.Message = checkIn.ItemUPCFK + " is late, a fine will be issued to " + fullStudentName;
        }
Exemplo n.º 20
0
        public void OverdueItemEmail(tb_CSUStudent student, tb_CSUCheckoutCheckin checkout, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject =
                "Notice of OverDue Checkout from UTRC Checkout";
            // add body
            text =
                student.FIRST_NAME + " " + student.LAST_NAME + "," + "</br> </br>" +
                "Our records indicate that you checked out " + checkout.ItemUPCFK + " on " + checkout.CheckoutDate.Value.ToString("M") + " at " + checkout.CheckoutDate.Value.ToString("HH:mm tt") + "</br>"
                + checkout.ItemUPCFK + " was due back at " + checkout.DueDate.Value.ToString("f") + ". Late charges will be issued if the item is not reutrned within 24 hours of checkout time." + "</br>"
                + "</br>This includes a NON-REFUNDABLE fine of $5 per day, upto a maximum  of $25.00. Failure to return the item without all internal and external components intact, will be billed at its replacement charge plus a billing fee of $5.00."
                + "Replacement charges are assessed in addition to the maximum overdue fine. Replacement charges are: Laptops = $1,800, each accessory = $95.00." + "</br>"
                + "</br>If damage occurs to any laptop components or accessories, damage charges will be imposed as appropriate." + "</br>"
                + "To avoid further charges on your student account  please return the item to the  checkout desk." + "</br></br>"
                + " -UTRC Management";

            // now send it

            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 21
0
        public void CheckoutEmail(tb_CSUStudent student, tb_CSUCheckoutCheckin checkout, bool isTest = false)
        {
            mailMessage.To.Clear();
            mailMessage.From = new MailAddress("*****@*****.**");
            mailMessage.To.Add(isTest ? SessionVariables.CurrentUser.EMAIL : student.EMAIL_ADDRESS);
            // add subject
            mailMessage.Subject =
                checkout.ItemUPCFK + " Checked-out from UTRC Checkout";
            // add body
            text =
                student.FIRST_NAME + " " + student.LAST_NAME + "," + "</br> </br>" +
                "Our records indicate that you checked out " + checkout.ItemUPCFK + " on " + checkout.CheckoutDate.Value.ToString("M") + " at " + checkout.CheckoutDate.Value.ToString("h:mm:ss tt") + "</br>"
                + "<h3>" + checkout.ItemUPCFK + " is due back at " + checkout.DueDate.Value.ToString("dddd, MMMM dd, yyyy h:mm tt") + ".</h3> Late charges will be issued if the item is not reutrned on time."
                + "This includes a NON-REFUNDABLE fine of $5 per day, up to a maximum  of $25.00. Failure to return " + checkout.ItemUPCFK + " within 6 days, or returning the item without all internal and external components intact,"
                + "will cause your student account to be billed for the cost of " + checkout.ItemUPCFK + "'s replacement plus a non-refundable billing fee of $5.00."
                + "Replacement charges are assessed in addition to the maximum overdue fine. Replacement charges can be upto: Laptops = $1,800, Accessory = $95.00."
                + "If damage occurs to any laptop components or accessories, damage charges will be imposed as appropriate." + "</br> </br>"

                + " -UTRC Management </br> http://utrc.casa.colostate.edu/";

            // now send it
            SendMailHtml(mailMessage, text);
        }
Exemplo n.º 22
0
        // Email end of day report to management
        public ActionResult EmailEndOfDayReport(bool isTest = false)
        {
            Sb.Clear();

            // pull the day's reports and compile into one report
            var todaysReports = db.tb_Reports.Where(m => System.Data.Entity.DbFunctions.TruncateTime(m.TimeSubmitted) == System.Data.Entity.DbFunctions.TruncateTime(DateTime.Now));

            foreach (var rec in todaysReports)
            {
                // add each tech report
                var rep = rec.Report;
                Sb.Append(rep + "<br/>");
            }

            //collect records
            var lscCheckouts = db.tb_CSUCheckoutCheckin.Where(m => m.CheckoutDate.Value.Day == DateTime.Now.Day && m.CheckoutLocationFK == "LSC");
            var bsbCheckouts = db.tb_CSUCheckoutCheckin.Where(m => m.CheckoutDate.Value.Day == DateTime.Now.Day && m.CheckoutLocationFK == "BSB");
            //var tltCheckouts = db.tb_CSUCheckoutCheckin.Where(m => m.CheckoutDate.Value.Day == DateTime.Now.Day && m.CheckoutLocationFK == "TLT");
            var checkoutRecords = db.tb_CSUCheckoutCheckin.Where(m => m.CheckinDate == null && m.isLongterm != true);
            var longtermRecords = db.tb_CSUCheckoutCheckin.Where(m => m.CheckinDate == null && m.isLongterm == true);

            var lscUniqueIds = new List <string>();

            foreach (var rec in lscCheckouts)
            {
                if (!lscUniqueIds.Contains(rec.CSU_IDFK))
                {
                    lscUniqueIds.Add(rec.CSU_IDFK);
                }
            }
            var bsbUniqueIds = new List <string>();

            foreach (var rec in bsbCheckouts)
            {
                if (!bsbUniqueIds.Contains(rec.CSU_IDFK))
                {
                    bsbUniqueIds.Add(rec.CSU_IDFK);
                }
            }

            Sb.Append("</div><div><h3> # of Checkouts </h3>" +
                      "<li>LSC Total Checkouts: " + lscCheckouts.Count() + " (" + lscUniqueIds.Count() + " unique students)</li>" +
                      "<li>BSB Total Checkouts: " + bsbCheckouts.Count() + " (" + bsbUniqueIds.Count() + " unique students)</li>");

            // create html table of items not checked in when report is run, filter by location and longterm
            Sb.Append("<h1>LSC Items not returned </h1><table border='1px' WIDTH='50%'   CELLPADDING='4' CELLSPACING='3' bordercolor='red'> <thead> <tr> <th>First Name</th>" + "<th>Last Name</th>" + "<th>CSU ID</th>" + "<th>Item</th>" + "<th>Checkout Date</th><th>Due Date</th> </tr> </thead> <tbody>");
            foreach (var rec in checkoutRecords.Where(m => m.CheckoutLocationFK == "LSC"))
            {
                CsuStudent = db.tb_CSUStudent.FirstOrDefault(m => m.CSU_ID == rec.CSU_IDFK);

                if (CsuStudent == null)
                {
                    continue;
                }

                var name = "<tr><td>" + CsuStudent.FIRST_NAME + " </td><td> " + CsuStudent.LAST_NAME + "</td><td>" + rec.CSU_IDFK + " </td><td> " + rec.ItemUPCFK + "</td><td>" + rec.CheckoutDate + "</td><td>" + rec.DueDate + " </td></tr> ";
                Sb.Append(name);
            }
            Sb.Append("<tr> <tbody> </table>");
            Sb.Append("<h1>BSB Items not returned </h1><table border='1px' WIDTH='50%'   CELLPADDING='4' CELLSPACING='3' bordercolor='red'> <thead> <tr> <th>First Name</th>" + "<th>Last Name</th>" + "<th>CSU ID</th>" + "<th>Item</th>" + "<th>Checkout Date</th><th>Due Date</th> </tr> </thead> <tbody>");
            foreach (var rec in checkoutRecords.Where(m => m.CheckoutLocationFK == "BSB"))
            {
                CsuStudent = db.tb_CSUStudent.FirstOrDefault(m => m.CSU_ID == rec.CSU_IDFK);

                if (CsuStudent == null)
                {
                    continue;
                }

                var name = "<tr><td>" + CsuStudent.FIRST_NAME + " </td><td> " + CsuStudent.LAST_NAME + "</td><td>" + rec.CSU_IDFK + " </td><td> " + rec.ItemUPCFK + "</td><td>" + rec.CheckoutDate + "</td><td>" + rec.DueDate + " </td></tr> ";

                Sb.Append(name);
            }
            Sb.Append("<tr> <tbody> </table>");

            Sb.Append("<h1> Items in Longterm </h1><table border='1px' WIDTH='50%' CELLPADDING='4' CELLSPACING='3'> <thead> <tr> <th>First Name</th>" + "<th>Last Name</th>" +
                      "<th>CSU ID</th>" + "<th>Item</th>" + "<th>Checkout Date</th> <th>Due Date</th> </tr> </thead> <tbody> ");

            foreach (var rec in longtermRecords)
            {
                CsuStudent = db.tb_CSUStudent.FirstOrDefault(m => m.CSU_ID == rec.CSU_IDFK);

                if (CsuStudent == null)
                {
                    continue;
                }
                var name = "<tr><td>" + CsuStudent.FIRST_NAME + " </td><td> " + CsuStudent.LAST_NAME + "</td><td>" + rec.CSU_IDFK + " </td><td> " + rec.ItemUPCFK + "</td><td>" + rec.CheckoutDate + "</td><td>" + rec.DueDate + " </td></tr> ";
                Sb.Append(name);
            }
            Sb.Append("<tr> <tbody> </table>");

            // retrieve open repairs and recently completed repairs
            Trello             t                     = new Trello();
            var                cards                 = t.GetCards("notset");
            List <Trello.Card> openRepairs           = new List <Trello.Card>();
            List <Trello.Card> recentlyClosedRepairs = new List <Trello.Card>();

            foreach (var card in cards)
            {
                if (card.dueComplete == false && card.due != null && !card.name.StartsWith("test"))
                {
                    openRepairs.Add(card);
                }
                else if (card.dueComplete == true && (DateTime.Now < Convert.ToDateTime(card.dateLastActivity).AddHours(24)) && !card.name.StartsWith("test"))
                {
                    recentlyClosedRepairs.Add(card);
                }
            }

            // add open repairs to report
            Sb.Append("<h1> Open Repairs </h1><table border='1px' WIDTH='50%' CELLPADDING='4' CELLSPACING='3'> <thead> <tr> <th>Item UPC</th>" + "<th>Repair Request Date</th>" +
                      "<th>Issue</th>" + "<th>Location</th>" + " <th>Due Date</th> </tr> </thead> <tbody> ");
            foreach (var repair in openRepairs)
            {
                var    requestDate = t.GetChecklists(repair.id).First().name;
                var    comments    = t.GetCardComments(repair.id);
                string issue       = "";
                foreach (var comment in comments)
                {
                    if (Convert.ToDateTime(requestDate) <= Convert.ToDateTime(comment.date))
                    {
                        issue += "<p>" + comment.text + "</p>";
                    }
                }
                var location = t.GetBoards().Where(m => m.id == repair.idBoard).FirstOrDefault().name;
                var due      = Convert.ToDateTime(repair.due).Date;
                var row      = "<tr><td>" + repair.name + " </td><td> " + requestDate + "</td><td>" + issue + " </td><td> " + location + "</td><td>" + due.ToString() + "</td></tr> ";
                Sb.Append(row);
            }
            Sb.Append("<tr> <tbody> </table>");
            if (openRepairs.Count() == 0)
            {
                Sb.Append("<p>There are no open repairs.</p>");
            }

            // add recently closed repairs to report
            Sb.Append("<h1> Completed Repairs </h1><table border='1px' WIDTH='50%' CELLPADDING='4' CELLSPACING='3'> <thead> <tr> <th>Item UPC</th>" + "<th>Repair Request Date</th>" +
                      "<th>Issue</th>" + "<th>Location</th>" + "</tr> </thead> <tbody> ");
            foreach (var repair in recentlyClosedRepairs)
            {
                var    requestDate = t.GetChecklists(repair.id).First().name;
                var    comments    = t.GetCardComments(repair.id);
                string issue       = "";
                foreach (var comment in comments)
                {
                    if (Convert.ToDateTime(requestDate) <= Convert.ToDateTime(comment.date))
                    {
                        issue += "<p>" + comment.text + "</p>";
                    }
                }
                var location = t.GetBoards().Where(m => m.id == repair.idBoard).FirstOrDefault().name;
                var row      = "<tr><td>" + repair.name + " </td><td> " + requestDate + "</td><td>" + issue + " </td><td> " + location + "</td></tr> ";
                Sb.Append(row);
            }
            Sb.Append("<tr> <tbody> </table>");
            if (recentlyClosedRepairs.Count() == 0)
            {
                Sb.Append("<p>There were no repairs closed today.</p>");
            }

            // convert StringBuilder to string
            var compiledReport = Sb.ToString();

            // email compiled report to management (note: will be routed to current user's email if isTest==true)
            email.EndOfDayReport(compiledReport, isTest);

            ViewBag.Message = "Email Sent!";
            return(View());
        }