Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BusinessHandler businessHandler = new BusinessHandler();
            Business business = businessHandler.GetBusinessDetails();

            int depositPercent = business.DepositPercent;
            lblDeposit.Text = depositPercent.ToString();

            lblOwed.Text = (100 - depositPercent).ToString();
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BusinessHandler businessHandler = new BusinessHandler();
            Business business = new Business();

            business = businessHandler.GetBusinessDetails();

            lblBusinessName.Text = business.Name;
            /*lblEmail.Text = business.Email;
            lblAddress1.Text = business.AddressLine1;
            lblAddress2.Text = business.AddressLine2;*/
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BusinessHandler businessHandler = new BusinessHandler();
            Business business = new Business();
            business = businessHandler.GetBusinessDetails();

            lblName.Text = business.Name;
            lblPhoneNo.Text = business.PhoneNo;
            lblEmail.Text = business.Email;
            lblServer.Text = business.EmailServer;
            lblPort.Text = Convert.ToString(business.EmailPort);
            lblAddressLine1.Text = business.AddressLine1;
            lblAddressLine2.Text = business.AddressLine2;
            lblPercentage.Text = Convert.ToString(business.DepositPercent);
            lblBankName.Text = business.BankName;
            lblAccountNo.Text = business.AccountNo;
            lblBranchCode.Text = business.BranchCode;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //get dynamic page info
            BusinessHandler businessHandler = new BusinessHandler();
            Business business = new Business();

            business = businessHandler.GetBusinessDetails();
            lblBusinessEmail.Text = business.Email;
            lblDepositPercent.Text = business.DepositPercent.ToString();
        }
        protected void btnRecoverPassword_Click(object sender, EventArgs e)
        {
            LecturerHandler lecturerHandler = new LecturerHandler();
            Lecturer lecturer = null;
            BusinessHandler businessHandler = null;
            Business business = null;

            string destinationEmail = txtEmail.Value;

            //check email exists
            if (lecturerHandler.ValidateEmail(destinationEmail) == false)
            {
                //email doesn't exist in DB
                litAlert.Text = "<div class='alert alert-danger'>Invalid Email Address</div>";
            }

            else
            {
                //get business email and password
                string name, email, password, emailServer, newPassword;
                int port;

                businessHandler = new BusinessHandler();
                business = new Business();
                business = businessHandler.GetBusinessDetails();

                name = business.Name;
                email = business.Email;
                password = business.EmailPassword;
                emailServer = business.EmailServer;
                port = business.EmailPort;

                //generate new password
                newPassword = Membership.GeneratePassword(7, 0);

                //update database
                lecturer = new Lecturer();
                lecturer.Email = destinationEmail;
                lecturer.Password = newPassword;

                //send email
                try
                {
                    MailMessage mail = new MailMessage();
                    SmtpClient smtpClient = new SmtpClient(emailServer);
                    mail.From = new MailAddress(email);
                    mail.To.Add(destinationEmail);
                    mail.Subject = name + " Password Reset";
                    mail.Body = "Your password has been reset. Please use the following phrase as your new password when you log in: " + newPassword;

                    //code to include an attatchment
                    //System.Net.Mail.Attachment attachment;
                    //attachment = new System.Net.Mail.Attachment("attatchment.jpg");
                    //mail.Attachments.Add(attachment);

                    smtpClient.Port = port;
                    smtpClient.Credentials = new NetworkCredential(email, password);
                    smtpClient.EnableSsl = true;

                    smtpClient.Send(mail);
                    lecturerHandler.UpdateLecturerPassword(lecturer);

                    litAlert.Text = "<div class='alert alert-success'>An email was sent, check you email for your new password.</div>";

                    //delay redirect to alert user of page change
                    /*lblRedirect.Text = "Redirecting to log in, in 5 seconds.";
                    Response.Write("<script type=\"text/javascript\">setTimeout(function () { window.location.href = \"Login.aspx\"; }, 5000);</script>");*/
                }
                catch (Exception)
                {
                    litAlert.Text = "<div class='alert alert-warning'>Failed to send an email</div>";
                }
            }
        }
        protected void SendMail(int bookingID, bool confirmed)
        {
            //get member who created the booking
            BookingHandler bookingHandler = new BookingHandler();
            int memberID = bookingHandler.GetBookingOwner(bookingID);

            //the get members email
            MemberHandler memberHandler = new MemberHandler();
            Member member = new Member();
            member = memberHandler.GetMemberDetails(memberID);

            BusinessHandler businessHandler = null;
            Business business = null;

            //get business email and password
            string businessName, businessEmail, businessPassword, emailServer;
            int port;

            businessHandler = new BusinessHandler();
            business = new Business();
            business = businessHandler.GetBusinessDetails();

            businessName = business.Name;
            businessEmail = business.Email;
            businessPassword = business.EmailPassword;
            emailServer = business.EmailServer;
            port = business.EmailPort;

            //send email
            MailMessage mail = new MailMessage();
            SmtpClient smtpClient = new SmtpClient(emailServer);
            mail.From = new MailAddress(businessEmail);
            mail.To.Add(member.Email);

            if (confirmed)
            {
                mail.Subject = businessName + " Booking Confirmed";
                mail.Body = "We are pleased to inform you, your booking at " + businessName + " has been confirmed. Please supply the following booking referance number when checking in: " + bookingID.ToString();
            }
            else
            {
                mail.Subject = businessName + " Booking Declined";
                mail.Body = "We are sad to inform you, your booking at " + businessName + " has been declined. If you have any queries please contact us for assistance.";
            }

            smtpClient.Port = port;
            smtpClient.Credentials = new NetworkCredential(businessEmail, businessPassword);
            smtpClient.EnableSsl = true;

            smtpClient.Send(mail);
            memberHandler.UpdateMemberPassword(member);

                /*
                lblProgress.CssClass = "label label-success";
                lblProgress.Text = "An email was sent, check you email for your new password.";

                //delay redirect to alert user of page change
                lblRedirect.Text = "Redirecting to log in, in 5 seconds.";
                Response.Write("<script type=\"text/javascript\">setTimeout(function () { window.location.href = \"Login.aspx\"; }, 5000);</script>");
            */
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int invoiceID = 0;
            bool intTest = false;
            intTest = int.TryParse(Request.QueryString["id"], out invoiceID);

            if (invoiceID == 0)
                Response.Redirect("Default.aspx");

            litInvoiceNo.Text = invoiceID.ToString();

            BusinessHandler businessHandler = new BusinessHandler();
            Business business = businessHandler.GetBusinessDetails();

            lblCompanyName.Text = business.Name;
            lblAddressLine1.Text = business.AddressLine1;
            lblAddressLine2.Text = business.AddressLine2;
            lblPhoneNo.Text = business.PhoneNo;
            lblEmail.Text = business.Email;
            lblBankName.Text = business.BankName;
            lblBankAccountNo.Text = business.AccountNo;
            lblBranchCode.Text = business.BranchCode;

            InvoiceHandler invoiceHandler = new InvoiceHandler();
            DAL.Invoice invoice = invoiceHandler.GetInvoiceDetails(invoiceID);
            int bookingID = 0;
            try
            {
                bookingID = invoice.BookingID;
            }
            catch (NullReferenceException)
            {
                Response.Redirect("Default.aspx");
            }

            BookingHandler bookingHandler = new BookingHandler();
            ProvisionalBooking provisionalBooking = bookingHandler.GetProvisionalBookingDetails(bookingID);
            lblArriveDate.Text = provisionalBooking.ArriveDate.Year + "-" + provisionalBooking.ArriveDate.Month + "-" + provisionalBooking.ArriveDate.Day;
            lblDepartDate.Text = provisionalBooking.DepartDate.Year + "-" + provisionalBooking.DepartDate.Month + "-" + provisionalBooking.DepartDate.Day;

            //Get all rooms in booking
            double totalPrice = 0;
            DateTime startDate = new DateTime();
            DateTime endDate = new DateTime();
            startDate = provisionalBooking.ArriveDate;
            endDate = provisionalBooking.DepartDate;
            double noOfDays = (endDate - startDate).TotalDays;
            string htmlOutput = "";
            string[] rooms = invoice.Rooms.Split(',');
            int roomCount = rooms.Count();
            RoomAndType roomAndType = null;
            AvailabilityHandler availabilityHandler = new AvailabilityHandler();
            for (int i = 0; i < roomCount - 1; i++)
            {
                roomAndType = availabilityHandler.GetAvailableRoomDetails(Convert.ToInt32(rooms[i]));
                totalPrice = totalPrice + (roomAndType.Rate * noOfDays);
                htmlOutput += "<tr><td>" + roomAndType.RoomNo + "</td><td>" + roomAndType.Name + "</td><td>R " + roomAndType.Rate + "</td><td>R " + (roomAndType.Rate * noOfDays).ToString() + "</td></tr>";
            }
            //end get all rooms in booking

            litSelectedRooms.Text = htmlOutput;
            double depositAmount = invoiceHandler.GetDepositAmount(bookingID);
            double totalAmount = invoiceHandler.GetTotalAmount(bookingID);
            lblDeposit.Text = depositAmount.ToString();
            lblTotalAmount.Text = totalAmount.ToString();
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            double totalPrice = 0;
            string selectedRooms = null;
            DateTime startDate = new DateTime();
            DateTime endDate = new DateTime();
            try
            {
                selectedRooms = (string)Session["SelectedRooms"];
                startDate = (DateTime)Session["StartDate"];
                endDate = (DateTime)Session["EndDate"];
            }
            catch (NullReferenceException)
            {
                Response.Redirect("Availability.aspx");
            }

            double noOfDays = (endDate - startDate).TotalDays;
            string htmlOutput = "";
            string[] rooms = null;
            try
            {
                rooms = selectedRooms.Split(',');
            }
            catch (NullReferenceException)
            {
                Response.Redirect("Availability.aspx");
            }

            int roomCount = rooms.Count();
            RoomAndType roomAndType = null;
            AvailabilityHandler availabilityHandler = new AvailabilityHandler();
            for (int i = 0; i < roomCount -1; i++)
            {
                roomAndType = availabilityHandler.GetAvailableRoomDetails(Convert.ToInt32(rooms[i]));
                totalPrice = totalPrice + (roomAndType.Rate * noOfDays);
                htmlOutput += "<tr><td>" + roomAndType.RoomNo + "</td><td>" + roomAndType.Name + "</td><td>" + roomAndType.MaxCapacity + "</td><td>R " + roomAndType.Rate + "</td><td>R " + (roomAndType.Rate * noOfDays).ToString() +"</td></tr>";
            }

            litAvailableRooms.Text = htmlOutput;

            BusinessHandler businessHandler = new BusinessHandler();
            Business business = businessHandler.GetBusinessDetails();

            double depositPercent = business.DepositPercent;
            depositPercent = depositPercent / 100;
            lblDeposit.Text = (totalPrice * depositPercent).ToString();
            lblTotalCost.Text = totalPrice.ToString();

            litDates.Text = startDate.Year + "-" + startDate.Month + "-" + startDate.Day + " to " + endDate.Year + "-" + endDate.Month + "-" + endDate.Day;
        }