Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string  search = Request.QueryString["search"];
        DataSet d      = new PaymentDAO().getEarn(search);

        if (d != null)
        {
            if (d.Tables[0].Rows.Count != 0)
            {
                Earn.DataSource = d;
                Earn.DataBind();
            }
            else
            {
                Earn.DataSource = null;
                Earn.DataBind();
            }
        }
        int a = 0;

        for (int i = 0; i < d.Tables[0].Rows.Count; i++)
        {
            a = a + Convert.ToInt32(d.Tables[0].Rows[i]["cost"]);
        }
        Total.Text = a.ToString();
    }
Пример #2
0
        public ActionResult SubscribeReceive(User editUser)
        {
            var search = PaymentDAO.GetPaymentByUsername(Session["username"].ToString().ToLower());

            if (search != null)
            {
                if (search.IsActive)
                {
                    var searchUser = UserDAO.GetUser(search.UserId);
                    if (searchUser != null)
                    {
                        searchUser.IsSubcribeReceive = true;
                        if (UserDAO.UpdateSubscribeReceive(searchUser))
                        {
                            Alert("Subscribe Daily Receive New Card Successfully", NotificationType.success);
                            return(RedirectToAction("Index", "Home"));
                        }
                    }
                    Alert("Not found Username", NotificationType.error);
                    return(RedirectToAction("SubscribeReceive"));
                }
                Alert("Your Payment is not activated. Please contact Administrator by send feedback.", NotificationType.error);
                return(RedirectToAction("FeedbackIndex"));
            }
            Alert("Sorry You not register Payment Information. Please register first!", NotificationType.error);
            return(RedirectToAction("Payment"));
        }
Пример #3
0
        public async Task <IActionResult> Create(int RoomID, DateTime CheckInDate, DateTime CheckOutDate, Guest guest, Payment payment, int Amount)
        {
            int guestid   = GuestDAO.InsertGuest(guest);
            int paymentid = PaymentDAO.InsertPayment(payment);
            int bookingid = BookingDAO.InsertBooking(new Booking()
            {
                RoomID       = RoomID,
                CheckInDate  = CheckInDate.AddHours(14),
                CheckOutDate = CheckOutDate.AddHours(12).AddMinutes(5),
                GuestID      = guestid,
                Amount       = (int)(CheckOutDate - CheckInDate).TotalDays * RoomsDAO.GetRoomModel(RoomID).RoomType.Price,
                PaymentID    = paymentid,
            });

            var    model = BookingDAO.GetBookingModel(bookingid);
            string body  = await Utlities.RenderViewToStringAsync <BookingModel>(this, "~/Areas/Guests/Views/Partial/_ConfirmEmail.cshtml", model);

            MailMessage mail = new MailMessage();

            mail.From = new MailAddress("*****@*****.**");
            mail.To.Add(guest.Email);
            mail.Subject    = "Congratulations on your successful booking";
            mail.Body       = body;
            mail.IsBodyHtml = true;

            Utlities.SendEmail(mail);

            return(View());
        }
Пример #4
0
        public ActionResult Payment(PaymentInfo addPayment)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //addPayment.DateCreated = DateTime.Now;
                    if (addPayment.DateExpire > DateTime.Now)
                    {
                        if (PaymentDAO.CreatePayment(addPayment))
                        {
                            Alert("Register payment account successfully. Please wait until we activate your payment. Thank you! ", NotificationType.success);
                            return(RedirectToAction("Index", "Home"));
                        }
                    }
                    Alert("Expire Date must be date in future", NotificationType.error);
                }
                return(View());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(View());

                throw;
            }
        }
Пример #5
0
        //==================================================== Subscribes ===========================================================================

        //GET: //User/SubscribeSend
        public ActionResult SubscribeSend()
        {
            if (IsLoggedIn())
            {
                var username      = Session["username"].ToString();
                var searchPayment = PaymentDAO.GetPaymentByUsername(username);
                if (searchPayment == null)
                {
                    Alert("You must register Payment Info to use this feature.", NotificationType.error);
                    return(RedirectToAction("Payment", "User"));
                }
                var search = UserDAO.GetUserByUsername(username);
                if (search.IsSubcribeSend)
                {
                    return(RedirectToAction("ChangeSubscribeSend"));
                }
                if (!searchPayment.IsActive)
                {
                    Alert("You Payment Not Activate. Please Contact Administrator. Thank you.", NotificationType.error);
                    return(RedirectToAction("FeedbackIndex", "User"));
                }
                return(View());
            }
            Alert("You need Log in to access this page!", NotificationType.warning);
            return(RedirectToAction("Login", "Home"));
        }
Пример #6
0
 public ActionResult EditPaymentInfo(PaymentInfo edit)
 {
     if (ModelState.IsValid)
     {
         if (PaymentDAO.EditPaymentInfo(edit))
         {
             Alert("Edited successfully!!", NotificationType.success);
             var search = PaymentDAO.GetPayment(edit.PayId);
             if (search != null)
             {
                 return(View(search));
             }
             return(RedirectToAction("Index"));
         }
         else
         {
             Alert("Edited failed!!", NotificationType.error);
             return(View());
         }
     }
     else
     {
         Alert("Edited failed!!", NotificationType.error);
         return(View());
     }
 }
Пример #7
0
        public ActionResult EditPayment(int id, string IsActive)
        {
            if (PaymentDAO.ChangeStatusActivation(id, Boolean.Parse(IsActive)))
            {
                var searchPayment = PaymentDAO.GetPayment(id);
                if (searchPayment != null)
                {
                    var searchUser = UserDAO.GetUser(searchPayment.UserId);
                    if (searchUser != null)
                    {
                        if (Boolean.Parse(IsActive))
                        {
                            searchUser.IsVIP = true;
                        }
                        else
                        {
                            searchUser.IsVIP = false;
                        }

                        if (UserDAO.UpdateIsVIP(searchUser))
                        {
                            Alert("Change status activation successfully", NotificationType.success);
                            return(RedirectToAction("ManagePaymentInfo"));
                        }
                    }
                    Alert("Cannot found User.", NotificationType.error);
                    return(View());
                }
                Alert("Cannot found Payment.", NotificationType.error);
                return(View());
            }
            Alert("Change status activation failed.", NotificationType.error);
            return(View());
        }
Пример #8
0
 public bool Add(Payment p)
 {
     try
     {
         PaymentDAO.Add(p);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #9
0
 public ActionResult <InvoiceModel> GetInvoice(int jobId)
 {
     try
     {
         int?         userId     = Helpers.ClaimHelper.GetIdFromClaimIdentity((ClaimsIdentity)this.ControllerContext.HttpContext.User.Identity);
         PaymentDAO   paymentDAO = new PaymentDAO(_connection);
         InvoiceModel invoice    = _mapper.Map <InvoiceModel>(paymentDAO.GetInvoiceByID((int)userId, jobId));
         return(Ok(invoice));
     }
     catch (Exception ex)
     {
         return(UnprocessableEntity(new ErrorMessageModel(ex.Message)));
     }
 }
Пример #10
0
 public ActionResult ConfirmPayment(int jobId)
 {
     try
     {
         int?       mateId     = Helpers.ClaimHelper.GetIdFromClaimIdentity((ClaimsIdentity)this.ControllerContext.HttpContext.User.Identity);
         PaymentDAO paymentDAO = new PaymentDAO(_connection);
         bool       result     = paymentDAO.confirmPayment(jobId, (int)mateId);
         return(Ok(new SuccessMessageModel("Resultado: " + result)));
     }
     catch (Exception ex)
     {
         return(UnprocessableEntity(new ErrorMessageModel(ex.Message)));
     }
 }
Пример #11
0
        // Phuc Check Payment Expire
        private void CheckActive(User user)
        {
            PaymentInfo item = PaymentDAO.GetPaymentByUsername(user.UserName);

            if (item != null && item.DateCreated != null)
            {
                if ((item.DateCreated).Value.AddMonths(1) < DateTime.Now || item.DateExpire < DateTime.Now)
                {
                    Alert("Your Payment Info was expired. Please register again. Thank you.", NotificationType.warning);
                    item.IsActive = false;
                    PaymentDAO.EditPayment(item);
                }
            }
        }
Пример #12
0
 public ActionResult <InvoiceModel> MakePayment(int jobId, [FromBody] InvoiceModel payment)
 {
     try
     {
         int?         employerId   = Helpers.ClaimHelper.GetIdFromClaimIdentity((ClaimsIdentity)this.ControllerContext.HttpContext.User.Identity);
         PaymentDAO   paymentDAO   = new PaymentDAO(_connection);
         Invoice      invoice      = _mapper.Map <Invoice>(payment);
         InvoiceModel invoiceModel = _mapper.Map <InvoiceModel>(paymentDAO.makePayment(invoice, jobId, (int)employerId));
         return(Ok(invoiceModel));
     }
     catch (Exception ex)
     {
         return(UnprocessableEntity(new ErrorMessageModel(ex.Message)));
     }
 }
Пример #13
0
 //Phuc
 public ActionResult EditPaymentInfo()
 {
     if (IsLoggedIn())
     {
         var findPaymentInfo = PaymentDAO.GetPaymentByUsername(Session["username"].ToString());
         if (findPaymentInfo == null)
         {
             Alert("Your Payment Info are not registered!!", NotificationType.warning);
             return(RedirectToAction("Index"));
         }
         return(View(findPaymentInfo));
     }
     Alert("You need Log in to access this page", NotificationType.warning);
     return(RedirectToAction("Login", "Home"));
 }
Пример #14
0
 //GET: User/CreateTrans
 public ActionResult CreateTrans(int id)
 {
     if (IsLoggedIn())
     {
         var Username      = Session["username"].ToString();
         var searchUser    = UserDAO.GetUserByUsername(Username);
         var searchPayment = PaymentDAO.GetPaymentByUsername(Username);
         if (searchPayment != null)
         {
             if (searchUser == null)
             {
                 Alert("You not Register Email List", NotificationType.error);
                 return(RedirectToAction("SubscribeSend"));
             }
             if (!searchPayment.IsActive)
             {
                 Alert("Your Info Payment is not activated. Please contact Administrator by send feedback.", NotificationType.error);
                 return(RedirectToAction("FeedbackIndex"));
             }
             else
             {
                 var searchCard      = CardDAO.GetCard(id);
                 var searchEmailList = EmailListDAO.GetEmailListByUsername(searchUser.UserName);
                 if (searchEmailList == null)
                 {
                     Alert("You not register email list to send Card. Please click Subscribe Send Card to register email list.", NotificationType.error);
                     return(RedirectToAction("Index"));
                 }
                 if (searchCard != null)
                 {
                     var model = new Transaction
                     {
                         NameCard       = searchCard.NameCard,
                         Username       = Session["username"].ToString(),
                         ImageNameTrans = searchCard.ImageName,
                         Receiver       = searchEmailList.ListEmail
                     };
                     return(View(model));
                 }
                 return(RedirectToAction("Index"));
             }
         }
         Alert("Please purchase to use this feature. Thanks", NotificationType.info);
         return(RedirectToAction("DescriptionPayment"));
     }
     Alert("You need Log in to access this page", NotificationType.warning);
     return(RedirectToAction("Login", "Home"));
 }
Пример #15
0
        //Dewi
        public Order GetOrderById(int orderID)
        {
            try
            {
                PaymentDAO paymentDAO = new PaymentDAO();

                Order order = paymentDAO.GetOrderById(orderID);
                order.Table = paymentDAO.GetTableByOrderID(order.Table.tableId);

                return(order);
            }
            catch (Exception)
            {
                ErrorHandler error = new ErrorHandler("Couldn't read from the Database!");
                return(null);
            }
        }
Пример #16
0
        public JsonResult CreateBooking(int RoomID, DateTime CheckInDate, DateTime CheckOutDate, Guest guest, Payment payment)
        {
            int guestid   = GuestDAO.InsertGuest(guest);
            int paymentid = PaymentDAO.InsertPayment(payment);

            Booking booking = new Booking();

            booking.RoomID       = RoomID;
            booking.GuestID      = guestid;
            booking.PaymentID    = paymentid;
            booking.CheckInDate  = CheckInDate;
            booking.CheckOutDate = CheckOutDate;

            int bookingid = BookingDAO.InsertBooking(booking);

            return(Json(new
            {
                data = booking
            }));
        }
Пример #17
0
        public ActionResult AddFund(FormCollection f)
        {
            string   username = (string)Session["username"];
            double   amount   = Convert.ToDouble(f["amount"]);
            string   type     = f["type"];
            DateTime date     = Convert.ToDateTime(f["date"]);
            Payment  p        = new Payment(amount, username, date, type);

            if (PaymentDAO.InsertPayment(p) > 0)
            {
                Borrower b          = BorrowerDAO.GetBorrowerByUsername(username);
                double   NewDeposit = amount + b.Deposit;
                BorrowerDAO.UpdateDeposit(username, NewDeposit);
                ViewBag.message = "Payment Successfully !";
            }
            else
            {
                ViewBag.message = "Failed !!";
            }
            return(View());
        }
Пример #18
0
        //public ActionResult ReScheduleTest(long id)
        //{
        //    return Content(ReScheduleDAO.GetSearchParamByOrder(id));
        //}

        public ActionResult ReSchedule(long?id)
        {
            if (id != null)
            {
                // Check if user is logged in or not
                if (!isLoggedIn())
                {
                    Session["GotoPayment"] = "/ars/reschedule?id=" + id;
                    return(RedirectToAction("Login"));
                }

                var   orderid = Convert.ToInt64(id);
                Order order   = PaymentDAO.GetOrder(orderid);
                if (order != null && order.UserID == Session["user"].ToString())
                {
                    ViewBag.OrderID = orderid;
                    return(View(order));
                }
                ViewBag.Message = "You cannot re-schedule this order.";
            }
            return(RedirectToAction("Index"));
        }
Пример #19
0
        public ActionResult DeletePayment(int id)
        {
            try
            {
                if (PaymentDAO.DeletePayment(id))
                {
                    //Alert("Delete Payment Successfully .", NotificationType.success);
                    return(RedirectToAction("ManagePaymentInfo"));
                }
                else
                {
                    Alert("Delete error, cannot find this User!!!", NotificationType.error);
                    return(RedirectToAction("ManagePaymentInfo"));
                }
            }
            catch (Exception e)
            {
                Alert(e.Message, NotificationType.error);
                return(RedirectToAction("ManagePaymentInfo"));

                throw;
            }
        }