Beispiel #1
0
        private long _insertClient(BookingEmail bookingEmail, string password)
        {
            long clientId = 0;

            try
            {
                DateTime?dt     = null;
                Client   client = new Client();
                client.BirthDate   = dt;
                client.ClientPhoto = "";
                client.Country     = "";
                client.CreatedBy   = bookingEmail.Email.Trim();
                client.CreatedDate = DateTime.Now;
                client.Email       = bookingEmail.Email.Trim();
                client.FirstName   = "";
                client.LastName    = "";
                client.MobileNo    = bookingEmail.MobileNo;
                client.Password    = password;

                clientId = ClientManager.InsertClient(client);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }

            return(clientId);
        }
Beispiel #2
0
        private long _insertBooking(BookingEmail bookingEmail, long clientId, long propertyId, string bookingNo)
        {
            long bookingId = 0;

            try
            {
                Booking data = new Booking();
                data.FromDate      = Convert.ToDateTime(bookingEmail.FromDate);
                data.FromHour      = bookingEmail.FromHour;
                data.MaximumPerson = bookingEmail.MaximumPerson;
                data.PropertyId    = Convert.ToInt32(propertyId);
                data.ToDate        = Convert.ToDateTime(bookingEmail.ToDate);
                data.ToHour        = bookingEmail.ToHour;
                data.ClientId      = clientId;
                data.CreatedBy     = bookingEmail.Email.Trim();
                data.CreatedDate   = DateTime.Now;
                data.UpdateBy      = bookingEmail.Email.Trim();
                data.UpdateDate    = DateTime.Now;
                data.BookingNo     = bookingNo;
                bookingId          = BookingManager.InsertBooking(data);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }


            return(bookingId);
        }
Beispiel #3
0
        public ActionResult OfficeDetails(BookingEmail bookingEmail, PropertyView propertyView, string address, string area, string city, string zipCode)
        {
            long bookingId  = 0;
            long propertyId = propertyView.PropertyId;

            try
            {
                if (!ModelState.IsValid)
                {
                    string password = string.Empty;
                    long   clientId = _checkExclient(bookingEmail.Email.Trim());
                    if (clientId == 0)
                    {
                        password = UtilityManager.RandomString(5);
                        clientId = _insertClient(bookingEmail, password);
                    }

                    string bookingNo = "SS" + UtilityManager.RandomString(5);
                    bookingId = _insertBooking(bookingEmail, clientId, propertyId, bookingNo);
                    //_sendEmail(bookingEmail, propertyId, bookingNo, address, area, city, zipCode, password);
                }
            }
            catch (Exception ex)
            {
                if (Request.UrlReferrer != null)
                {
                    return(Redirect(Request.UrlReferrer.PathAndQuery));
                }
            }

            // return RedirectToAction("BookingConfirmed");
            return(RedirectToAction("BookingConfirmed", new
            {
                PropertyId = propertyId,
                BookingId = bookingId
            }));
        }
Beispiel #4
0
        private void _sendEmail(BookingEmail bookingEmail, string propertyId, string bookingNo, string address, string area, string city, string zipCode, string password)
        {
            try
            {
                var data = PropertyManager.GetPropertyById(Convert.ToInt64(propertyId));


                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<div style=\"background:#F6F6F6;width:600px;margin:10px auto;overflow: hidden; padding-bottom:40px; box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.10), 0 3px 3px 0 rgba(0, 0, 0, 0.10); font-family:Roboto, Helvetica, Arial;\">");
                sb.AppendFormat("<div style=\"padding-top:20px; text-align:center; background:#333333;\">");
                sb.AppendFormat("<img src=\"http://ss.byteheart.com/images/Share_space.png\" alt=\"Sharespace\">");
                sb.AppendFormat("<p style=\"font-size:38px; color:#ffff;font-weight:800;text-align:center;\">Thank You</p>");
                sb.AppendFormat("<p style=\"font-size:24px; color:#ffff;font-weight:600;text-align:center;\">Confirmation No. #{0}</p>", bookingNo);
                sb.AppendFormat("<img src=\"http://ss.byteheart.com/images/mail_middle.png\" alt='' style=\"display:block; border: 0; outline: none; text-decoration:none; -ms-interpolation-mode:bicubic; width: 600px; \" >");
                sb.AppendFormat("</div>");
                sb.AppendFormat("<h2 style=\"padding-left:10px; line-height:26px; mso-line-height-rule:exactly; font-size:22px; font-style:normal; font-weight:normal; font-weight: 800; \">Booking Details</h2>");
                sb.AppendFormat("<div style=\"width: 600px; \">");
                sb.AppendFormat("<div style=\"width: 328px; float:left;padding-left: 10px; \">");
                sb.AppendFormat(
                    "<img  src=\"http://ss.byteheart.com/{0}\" alt='sharespace' style=\"display: block; border: 0; outline: none; text-decoration:none; -ms-interpolation-mode:bicubic; \" width=\"330\">", data.FeatureImage);
                sb.AppendFormat("</div>");
                sb.AppendFormat("<div style=\"width: 260px; float:right; \">");
                sb.AppendFormat("<div style=\"width: 245px; margin: auto; font-size:14px; \">");
                sb.AppendFormat("<p><span style=\"font-weight: 600; \">Check In:</span> {0} {1}</p>", bookingEmail.FromDate, bookingEmail.FromHour);
                sb.AppendFormat(" <p><span style=\"font-weight: 600; \">Check Out:</span> {0} {1}</p>", bookingEmail.ToDate, bookingEmail.ToHour);
                sb.AppendFormat("<p><span style=\"font-weight: 600; \">Persons:</span> {0}</p>", bookingEmail.MaximumPerson);
                sb.AppendFormat("<p><span style=\"font-weight: 600; \">Office Type:</span> {0}</p>", data.ShareType);
                sb.AppendFormat("<p><span style=\"font-weight: 600; \">Your Address:</span></p>");
                sb.AppendFormat("<p style=\"line-height:21px; \"> {0}, {1}, {2}</p>", area, city, zipCode);
                sb.AppendFormat("</div> </div></div> ");
                sb.AppendFormat("<div style=\"width: 600px; text-align:center; clear: both; padding-top: 40px; font-size:14px;\">");
                sb.AppendFormat(
                    "You can see details from <a href='http://ss.byteheart.com/Auth/Login' target='_blank'> your panel </a>");
                if (!string.IsNullOrEmpty(password))
                {
                    sb.AppendFormat("\n <br/> Your username: {0} and Password: {1}", bookingEmail.Email.Trim(), password);
                }
                sb.AppendFormat("</div></div>");


                SmtpClient client = new SmtpClient("smtp.office365.com", 587);
                client.EnableSsl   = true;
                client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "SlimGuy@12");
                MailAddress from    = new MailAddress("*****@*****.**", "Sharespace", System.Text.Encoding.UTF8);
                MailAddress to      = new MailAddress(bookingEmail.Email.Trim());
                MailMessage message = new MailMessage(from, to);
                MailAddress bcc     = new MailAddress("*****@*****.**");
                message.Bcc.Add(bcc);
                MailAddress bcc2 = new MailAddress("*****@*****.**");
                message.Bcc.Add(bcc2);
                message.Body            = sb.ToString();
                message.BodyEncoding    = System.Text.Encoding.UTF8;
                message.IsBodyHtml      = true;
                message.Subject         = "Sharespace Booking Confirmation";
                message.SubjectEncoding = System.Text.Encoding.UTF8;
                client.Send(message);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }