protected void Page_Load(object sender, EventArgs e) { NameValueCollection nvc = Request.Form; // string userName, password; if (!string.IsNullOrEmpty(Request["resp_number"])) { respid = Convert.ToInt32(Request["resp_number"]); resp_id.Value = respid.ToString(); } else if (resp_id.Value != null && resp_id.Value != "") { respid = Convert.ToInt32(resp_id.Value); } else { Response.Redirect("/Error.aspx?error=Wrong Request for booking"); }; //Not post or Wrong respid //Get the inquiry info. email_resp = BookResponseEmail.getResponseInfo(respid); if (email_resp.ID == 0) { Response.Redirect("/Error.aspx?error=Wrong Response number or not valid"); } inquiryinfo = BookDBProvider.getQuoteInfo(email_resp.QuoteID); owner_info = BookDBProvider.getUserInfo(inquiryinfo.PropertyOwnerID); prop_info = AjaxProvider.getPropertyDetailInfo(inquiryinfo.PropertyID); // _total_sum = email_resp.NightRate * inquiryinfo.Nights; _total_sum = email_resp.NightRate; _lodgingval = _total_sum * email_resp.LoadingTax / 100; _balance = _lodgingval + email_resp.CleaningFee + email_resp.SecurityDeposit; _total = _total_sum + _balance; }
public bool SendMail(InquiryInfo inquiry) { MailAddress fromAddr = new MailAddress("*****@*****.**", "stesha.com.au"); MailAddress toAddr = new MailAddress(inquiry.RecepientAddress, inquiry.RecepientName); MailMessage message = new MailMessage(fromAddr, toAddr); message.Body = inquiry.FullMessage; message.Subject = inquiry.Subject; //create an smtp client(necessary to send an email.) using (SmtpClient smtpCl = new SmtpClient()) { try { smtpCl.Host = "smtp.gmail.com"; smtpCl.Port = 587; smtpCl.EnableSsl = true; NetworkCredential cred = new NetworkCredential("*****@*****.**", "10868774", ""); smtpCl.Credentials = cred; //send the message smtpCl.Send(message); //Response.Redirect("Contact.aspx"); return(true); } catch (SmtpException) { return(false); } } }
protected void Page_Load(object sender, EventArgs e) { bool vaild_session = true; string session; session = Request.QueryString["session"]; List <SqlParameter> sparams = new List <SqlParameter>(); sparams.Add(new SqlParameter("@session", session)); DataSet ds_session = BookDBProvider.getDataSet("uspGetEmailQuoteSession", sparams); //Get quote id from the url Int32.TryParse(Request.QueryString["quoteid"], out quoteid); if (ds_session.Tables.Count == 0 || ds_session.Tables[0].Rows.Count == 0) //Wrong request { vaild_session = false; } else { int qid = int.Parse(ds_session.Tables[0].Rows[0]["emailquoteid"].ToString()); if (qid != quoteid) //Wrong request { vaild_session = false; } } if (vaild_session == false) { if (!AuthenticationManager.IfAuthenticated || !User.Identity.IsAuthenticated) { FormsAuthentication.SignOut(); } } inquiryinfo = BookDBProvider.getQuoteInfo(quoteid); if (inquiryinfo.IfReplied == 1) { Response.Redirect("/Error.aspx?error=You've already responded."); } if (inquiryinfo.PropertyID == 0) { Response.Redirect("/Error.aspx?error=Wrong Inquiry number"); } if ((inquiryinfo.PropertyOwnerID != userid) && !AuthenticationManager.IfAdmin && vaild_session == false) { Response.Redirect("/Error.aspx?error=You try to see the other info"); } countryinfo = BookDBProvider.getCountryInfo(inquiryinfo.PropertyID); }
private void SendNewPassword(string newPassword, string username) { InquiryInfo inq = new InquiryInfo(); ApplicationUser user = repository.FindByName(username); inq.RecepientName = user.Name; inq.RecepientAddress = user.Email; inq.Subject = "Password reset"; inq.FullMessage = "Hi " + user.Name + ", your new password is " + newPassword; mailProcessor.SendMail(inq); }
public ActionResult ContactUs(InquiryInfo inq) { if (ModelState.IsValid) { ProcessInquiry(inq); TempData["Confirm"] = "Your Message has been successfully sent"; return(View()); } else { TempData["Fail"] = "Unfortunately submission of your inquiry failed"; return(View()); } }
// PHas to add the parameter PropertyOwnerID=userid public static InquiryInfo getQuoteInfo(int quoteid) { InquiryInfo propinfo = new InquiryInfo(); try { using (SqlConnection con = new SqlConnection(connString)) { using (SqlCommand cmd = new SqlCommand("select * from EmailQuote where ID=@id", con)) { con.Open(); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@id", SqlDbType.Int).Value = quoteid; using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { if (reader.Read()) { //SentTime,ContactorName,ContactorEmail,ArrivalDate,DepartDate,Adults,Children,Telephone,UserID,PropertyID,PropertyOwnerID,Nights,IfReplied propinfo.id = quoteid; propinfo.ContactorName = reader["ContactorName"].ToString(); propinfo.ContactorEmail = reader["ContactorEmail"].ToString(); propinfo.Adults = Convert.ToInt32(reader["Adults"]); propinfo.UserID = Convert.ToInt32(reader["UserID"]); propinfo.PropertyID = Convert.ToInt32(reader["PropertyID"]); propinfo.Nights = Convert.ToInt32(reader["Nights"]); propinfo.ArrivalDate = Convert.ToDateTime(reader["ArrivalDate"]).ToString("yyyy-MM-dd"); propinfo.PropertyOwnerID = Convert.ToInt32(reader["PropertyOwnerID"]); } } } con.Close(); } } } catch (Exception ex) { // throw ex; // return 0; } return(propinfo); }
private void ProcessInquiry(InquiryInfo inq) { inq.RecepientAddress = "*****@*****.**"; inq.RecepientName = "Krystsina Kasnikouskaya"; inq.FullMessage = "Hello, my name is " + inq.Title + " " + inq.FirstName + " " + inq.LastName; inq.FullMessage += ". I would like to inquire about " + inq.Subject; inq.FullMessage += ". Following are my contact details : Contact number - "; inq.FullMessage += inq.Telephone; inq.FullMessage += "; Email address - "; inq.FullMessage += inq.EmailAddress; inq.FullMessage += "; Country of residence - "; inq.FullMessage += inq.Country; inq.FullMessage += ". The inquiry: " + inq.Message; mailProcessor.SendMail(inq); }
private void SendConfirmationEmail(ApplicationUser appUser, IMailProcessor sender) { string message = "Hi " + appUser.Name + "!"; message += "\n\rYour profile with " + myBusinessName + " has been successfully created."; message += "\n\rYour username is " + appUser.UserName; message += "\n\rYou can log into your account using the following link http://stesha.com.au/Account/Login"; InquiryInfo inq = new InquiryInfo { RecepientName = appUser.Name, RecepientAddress = appUser.Email, Subject = "new account at " + myBusinessName, FullMessage = message }; sender.SendMail(inq); }
public static bool addPaymentHistory(Transaction_Item item, InquiryInfo inquiry) { try { using (SqlConnection con = new SqlConnection(connString)) { using (SqlCommand cmd = new SqlCommand("dbo.uspAddBookHistory", con)) //payment history completed { con.Open(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@item_number", SqlDbType.Int).Value = item.item_number; cmd.Parameters.Add("@mc_gross", SqlDbType.Decimal).Value = item.mc_gross; cmd.Parameters.Add("@mc_fee", SqlDbType.Decimal).Value = item.mc_fee; cmd.Parameters.Add("@txn_id", SqlDbType.NVarChar, 1000).Value = item.txn_id; cmd.Parameters.Add("@payment_date", SqlDbType.DateTime).Value = item.payment_date; cmd.Parameters.Add("@business", SqlDbType.NVarChar, 1000).Value = item.business; cmd.Parameters.Add("@payer_email", SqlDbType.NVarChar, 300).Value = item.payer_email; cmd.Parameters.Add("@payer_id", SqlDbType.NVarChar, 200).Value = item.payer_id; cmd.Parameters.Add("@mc_currency", SqlDbType.NVarChar, 10).Value = item.mc_currency; cmd.Parameters.Add("@ownerid", SqlDbType.Int).Value = inquiry.PropertyOwnerID; cmd.Parameters.Add("@travelerid", SqlDbType.Int).Value = inquiry.UserID; cmd.Parameters.Add("@propertyid", SqlDbType.Int).Value = inquiry.PropertyID; cmd.Parameters.Add("@arrivedate", SqlDbType.DateTime).Value = inquiry.ArrivalDate; // cmd.Parameters.Add("@txn_type", SqlDbType.NVarChar, 20).Value = item.item_number; // cmd.Parameters.Add("@payment_status", SqlDbType.NVarChar, 30).Value = item.item_number; // cmd.Parameters.Add("@payment_type", SqlDbType.NVarChar, 30).Value = item.item_number; // cmd.Parameters.Add("@pending_reason", SqlDbType.NVarChar, 30).Value = item.item_number; //cmd.Parameters.Add("@item_name", SqlDbType.NVarChar, 100).Value = item.item_number; int rows = cmd.ExecuteNonQuery(); con.Close(); } } } catch (Exception ex) { // throw ex; return(false); } return(true); }
protected void saveLog() { transitem = new Transaction_Item(); PropertyInfo[] props = transitem.GetType().GetProperties(); foreach (PropertyInfo prop in props) { prop.SetValue(transitem, Convert.ChangeType(Request[prop.Name], prop.PropertyType), null); } /* * int item_number = Convert.ToInt32(Request["item_number"]); * decimal mc_gross = Convert.ToDecimal(Request["mc_gross"]); * decimal mc_fee = Convert.ToDecimal(Request["mc_fee"]); * string txn_id = Request["txn_id"]; * string paydate = Request["payment_date"]; * string business = Request["business"]; * string payer_email = Request["payer_email"]; * string payer_id = Request["payer_id"]; * string mc_currency = Request["mc_currency"]; * string txn_type = Request["txn_type"]; * string payment_status = Request["payment_status"]; * string payment_type = Request["payment_type"]; * string pending_reason = Request["pending_reason"]; * string item_name = Request["item_name"]; * */ email_resp = BookResponseEmail.getResponseInfo(transitem.item_number); //respid // if (email_resp.ID == 0 || email_resp.IsValid < 1) Response.Redirect("/Error.aspx?error=Wrong Response number or not valid"); inquiryinfo = BookDBProvider.getQuoteInfo(email_resp.QuoteID); countryinfo = BookDBProvider.getCountryInfo(inquiryinfo.PropertyID); owner_info = BookDBProvider.getUserInfo(inquiryinfo.PropertyOwnerID); traveler_info = BookDBProvider.getUserInfo(inquiryinfo.UserID); prop_info = BookDBProvider.getPropertyInfo(inquiryinfo.PropertyID); PaymentHelper.addPaymentLog(transitem); }
protected void Page_Load(object sender, EventArgs e) { /* * if (!AuthenticationManager.IfAuthenticated || !User.Identity.IsAuthenticated) * { * FormsAuthentication.SignOut(); * } */ string param = AjaxProvider.Base64Decode(Request.QueryString["respid"]); if (!Int32.TryParse(param, out respid)) { respid = 0; } // if (respid == 0) respid = Convert.ToInt32(resp_number.Value); email_resp = BookResponseEmail.getResponseInfo(respid); if (email_resp.ID == 0) { Response.Redirect("/Error.aspx?error=Wrong Response number or not valid"); } // resp_number.Value = respid.ToString(); inquiryinfo = BookDBProvider.getQuoteInfo(email_resp.QuoteID); countryinfo = BookDBProvider.getCountryInfo(inquiryinfo.PropertyID); // _total_sum = email_resp.NightRate * inquiryinfo.Nights; _total_sum = email_resp.NightRate; _lodgingval = _total_sum * email_resp.LoadingTax / 100; _balance = _lodgingval + email_resp.CleaningFee + email_resp.SecurityDeposit; _total = _total_sum + _balance; url = String.Format("https://www.vacations-abroad.com/{0}/{1}/{2}/{3}/default.aspx", countryinfo.country, countryinfo.state, countryinfo.city, inquiryinfo.PropertyID); }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Request.HttpMethod != "POST") { Response.Write("Wrong request"); return; } context = HttpContext.Current; parseTransaction(); PaymentHelper.addPaymentLog(transitem); email_resp = BookResponseEmail.getResponseInfo(transitem.item_number); //respid // if (email_resp.ID == 0 || email_resp.IsValid < 1) Response.Redirect("/Error.aspx?error=Wrong Response number or not valid"); inquiryinfo = BookDBProvider.getQuoteInfo(email_resp.QuoteID); owner_info = BookDBProvider.getDetailedUserInfo(inquiryinfo.PropertyOwnerID); // traveler_info = BookDBProvider.getUserInfo(inquiryinfo.UserID); prop_info = AjaxProvider.getPropertyDetailInfo(inquiryinfo.PropertyID); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // string requestUriString = "https://www.sandbox.paypal.com/cgi-bin/webscr"; string requestUriString = "https://www.paypal.com/cgi-bin/webscr"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUriString); string strFormValues = Encoding.ASCII.GetString( context.Request.BinaryRead(context.Request.ContentLength)); // Set values for the request back request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; string obj2 = strFormValues + "&cmd=_notify-validate"; request.ContentLength = obj2.Length; /* * System.IO.StreamWriter file = new System.IO.StreamWriter(Server.MapPath("/logwrite.txt")); * file.Write(obj2); * file.Close(); */ // Write the request back IPN strings StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII); writer.Write(RuntimeHelpers.GetObjectValue(obj2)); writer.Close(); //send the request, read the response HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream responseStream = response.GetResponseStream(); Encoding encoding = Encoding.GetEncoding("utf-8"); StreamReader reader = new StreamReader(responseStream, encoding); string resp = reader.ReadToEnd(); //_total_sum = email_resp.NightRate * inquiryinfo.Nights; _total_sum = email_resp.NightRate; _lodgingval = _total_sum * email_resp.LoadingTax / 100; _balance = _lodgingval + email_resp.CleaningFee + email_resp.SecurityDeposit; _total = _total_sum + _balance; /* * System.IO.StreamWriter sfile = new System.IO.StreamWriter(Server.MapPath("/log.txt")); * sfile.Write(resp); * sfile.Close(); */ int discount; if (transitem.custom.Length == 13) { List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter("@coupon", transitem.custom)); DataSet ds_coupon = BookDBProvider.getDataSet("uspGetCouponItem", param); if (ds_coupon.Tables[0].Rows.Count > 0) { if (!int.TryParse(ds_coupon.Tables[0].Rows[0]["Discount"].ToString(), out discount)) { discount = 0; } _total = _total_sum * (100 - discount) / 100 + _balance; } } _total = Decimal.Parse(BookDBProvider.DoFormat(_total)); if (resp == "VERIFIED") { //if(transitem.business == ConfigurationManager.AppSettings["PaypalEmail"].ToString() && transitem.txn_type!= "reversal") /* System.IO.StreamWriter ssfile = new System.IO.StreamWriter(Server.MapPath("/logt.txt")); * ssfile.Write(resp); * ssfile.Close(); */ // if (transitem.business == "*****@*****.**" && transitem.txn_type != "reversal") if (transitem.business == ConfigurationManager.AppSettings["PaypalEmail"].ToString() && transitem.txn_type != "reversal") { if ((transitem.mc_gross == (_total)) && transitem.payment_status == "Completed" && transitem.mc_currency == currency_type[email_resp.CurrencyType]) { PaymentHelper.addPaymentHistory(transitem, inquiryinfo); BookResponseEmail.updateEmailResponseState(transitem.item_number); string format_traveler = @"This is your receipt for your reservation with Vacations-Abroad.com <br/> This email confirms that {0} has booked a reservation with {1}. <br/> Your Arrival Date is: {2} <br/> You paid: {3} {4} on {5} <br/> The owner’s cancellation policy is <br/> 90 days prior to arrival:{6}% <br/> 60 days prior to arrival:{7}% <br/> 30 days prior to arrival:{8}% <br/> Owner Contact Details <br/> Owner Name:{9} <br/> Owner Email:{10} <br/> Owner Telephone:{11} <br/> Name of Property:{1} <br/> Owner Website: {12} <br/> Please contact the owner to obtain the actual property address. <br/> If you do not cancel, the funds will be transferred to the owner on (7 days prior to your {13}) <br/> When you return, please write a review of the property and add photos. <br/>"; string msg_traveler = String.Format(format_traveler, inquiryinfo.ContactorName, prop_info.PropertyName, DateTime.Parse(inquiryinfo.ArrivalDate).ToString("MMM d, yyyy"), transitem.mc_gross, transitem.mc_currency, DateTime.Now.ToString("MMM d, yyyy"), email_resp.Cancel90, email_resp.Cancel60, email_resp.Cancel30 , String.Format("{0} {1}", owner_info.FirstName, owner_info.LastName), owner_info.Email, owner_info.MobileTelephone, owner_info.Website, DateTime.Parse(inquiryinfo.ArrivalDate).ToString("MMM d, yyyy")); string trv_subject = String.Format("Reservation Confirmation for {0}", DateTime.Now.ToString("MMM d, yyyy")); BookDBProvider.SendEmail(inquiryinfo.ContactorEmail, trv_subject, msg_traveler); string format_owner = @"This is a confirmation for the reservation completed through Vacations-Abroad.com <br/> This email confirms that {0} has booked a reservation with {1}. <br/> Arrival Date is: {2} <br/> They have paid: {3} {4} on {5} <br/> The owner’s cancellation policy is <br/> 90 days prior to arrival:{6}% <br/> 60 days prior to arrival:{7}% <br/> 30 days prior to arrival:{8}% <br/><br/> Traveler Contact Details <br/><br/> Traveler Name:{9} <br/> Traveler Email:{10} <br/> Traveler Telephone:{11} <br/><br/> Please contact the traveler to provide them with directions to your property and inform them of any check-in procedures. <br/> If the Traveler does not cancel, the funds will be transferred to your Paypal or bank account (7 days prior to your {2}) less a 10% commission fee. If any fees such as cleaning fees, security deposit or lodging taxes are to be collected by you at arrival. <br/> You have specified these additional fees are due at arrival. <br/> Cleaning:{12} {4} <br/> Security Deposit:{13} {4}<br/> Lodging Tax:{14} {4}<br/><br/> Let us know if we can be of further assistance. <br/> Linda Jenkins <br/> 770-687-6889 <br/>"; string owner_subject = String.Format("Reservation Confirmation for {0}", DateTime.Now.ToString("MMM d, yyyy")); string msg_owner = String.Format(format_owner, inquiryinfo.ContactorName, prop_info.PropertyName , DateTime.Parse(inquiryinfo.ArrivalDate).ToString("MMM d, yyyy"), transitem.mc_gross, transitem.mc_currency, DateTime.Now.ToString("MMM d, yyyy"), email_resp.Cancel90, email_resp.Cancel60, email_resp.Cancel30, inquiryinfo.ContactorName, inquiryinfo.ContactorEmail, inquiryinfo.Telephone, BookDBProvider.DoFormat(email_resp.CleaningFee), BookDBProvider.DoFormat(email_resp.SecurityDeposit), BookDBProvider.DoFormat(_lodgingval)); BookDBProvider.SendEmail(owner_info.Email, owner_subject, msg_owner); BookDBProvider.SendEmail("*****@*****.**", String.Format("{0} has paid for property {1} Transaction:{2}", inquiryinfo.ContactorName, transitem.item_number, transitem.txn_id), msg_owner); BookDBProvider.SendEmail("*****@*****.**", "Notification: Transaction:" + transitem.txn_id, msg_owner); } } } else { } }