Exemplo n.º 1
0
        public ActionResult WorkOrderMessage(string phoneNumber, int UnitId)
        {
            string messageText = $"A maintenance report has been submitted for unit number: {UnitId}";

            TwilioNotification.TwilioMessage(phoneNumber, messageText);
            return(View());
        }
Exemplo n.º 2
0
        public void NotifyTenantOrderComplete(MaintenanceOrder order)
        {
            var    tenant  = GetTenantFromUnitId(order.UnitId);
            string message = $"Dear, {tenant.FirstName} {tenant.LastName} your work order titled: {order.Name} has been completed";

            TwilioNotification.TwilioMessage(tenant.PhoneNumber, message);
        }
        //VERY MVP, NEEDS A LOT MORE USER INPUT OPTIONS. WANT TO ADD PARTIAL VIEW
        public ActionResult LateRentMessage(string phoneNumber, int balance)
        {
            string messageText = $"Your past due rent balance is: {balance}. Please remit payment at your earliest convenience";

            TwilioNotification.TwilioMessage(phoneNumber, messageText);
            return(View());
        }
Exemplo n.º 4
0
        public ActionResult FileReport([Bind(Include = "OrderId,UnitId,Name,Description,DueDate")] MaintenanceOrder maintenanceOrder)
        {
            if (ModelState.IsValid)
            {
                db.MaintenanceOrders.Add(maintenanceOrder);
                db.SaveChanges();
                var manangerNumber = TwilioNotification.GetManagerNumber();
                WorkOrderMessage(manangerNumber, maintenanceOrder.UnitId);
                return(RedirectToAction("TicketComplete"));
            }

            ViewBag.UnitId = new SelectList(db.HousingUnits, "UnitId", "UnitId", maintenanceOrder.UnitId);
            return(View(maintenanceOrder));
        }
        public ActionResult AssignWorkOrder([Bind(Include = "OrderId,WorkerId")] MaintenanceOrder order)
        {
            if (ModelState.IsValid)
            {
                int OrderFixedId = order.OrderId;

                var workOrder = db.MaintenanceOrders.Where(ord => ord.OrderId == OrderFixedId).Single();

                workOrder.WorkerId = order.WorkerId;

                db.Entry(workOrder).State = EntityState.Modified;
                db.SaveChanges();
                TwilioNotification.NotifyWorkerOfReport();
                return(RedirectToAction("WorkOrders"));
            }

            return(View(order));
        }
Exemplo n.º 6
0
        public ActionResult CheckIfRentDueDate(int?id)
        {
            var tenant       = db.Tenants.Find(id);
            int dueDate      = 5; //TEMP!! NEED TO GRAB THIS FROM TENANT.DUEDATE
            int reminderDate = 1;

            if (DateTime.Now.Day == reminderDate)
            {
                string message = $"Dear, {tenant.FirstName} {tenant.LastName} your rent payment of {tenant.HousingUnit.MonthlyRent} is due on the 5th. Thank you";
                TwilioNotification.TwilioMessage(message, tenant.PhoneNumber);
            }

            else if (dueDate == DateTime.Now.Day)
            {
                ChargeRentBalance(tenant);
            }

            return(RedirectToAction(""));
        }
 public ActionResult NotifyTenantOfUpcomingRent()
 {
     TwilioNotification.NotifyTenantOfUpcomingRent();
     return(RedirectToAction("Tenants"));
 }