示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        uid = Request["uid"];
        string pwd = Request["upwd"];

        if (uid == "")
        {
            Response.Redirect("/default.aspx");
        }

        if (pwd == "")
        {
            errormsg = "You've not input password";
            return;
        }

        if (IsPostBack)
        {
            List <SqlParameter> param = new List <SqlParameter>();
            param.Add(new SqlParameter("@link", uid));
            DataSet ds = BookDBProvider.getDataSet("uspGetPwdReset", param);

            if (ds.Tables[0].Rows.Count == 0)
            {
                errormsg = "You've gotten wrong link.";
                return;
            }

            email = ds.Tables[0].Rows[0]["Email"].ToString();


            byte[] salt    = AuthenticationManager.GenerateSalt();
            int    repeats = AuthenticationManager.GenerateRepeats();
            byte[] pwdhash = AuthenticationManager.HashPassword(pwd, salt, repeats);

            param.Clear();
            param.Add(new SqlParameter("@email", email));
            param.Add(new SqlParameter("@salt", salt));
            param.Add(new SqlParameter("@repeat", repeats));
            param.Add(new SqlParameter("@hash", pwdhash));
            param.Add(new SqlParameter("@link", uid));

            BookDBProvider.getDataSet("uspUpdateUserPwd", param);

            string msg_format = @"Notification from Vacations-abroad.com <br/>
                                   You've reset the password of the account at vacations-abroad.com <br/>
                                   If this is not your activity, please contact administrator of vacation-abroad.com , '*****@*****.**'! <br/>
                                   Vacations-Abroad.com ";

            BookDBProvider.SendEmail(email, "Password changed : Vacations-abroad.com", msg_format);

            triger_redirect = 1;
        }
    }
示例#2
0
    protected void btnsendback_ServerClick(object sender, System.EventArgs e)
    {
        if (pass_recaptcha == false)
        {
            return;
        }
        string name    = Request["username"];
        string email   = Request["useremail"];
        string subject = Request["userselect"];
        string phone   = Request["userphone"];
        string comment = Request["usercomment"];

        if (name == "" || email == "")
        {
            return;
        }
        int ind_subject = 0;

        if (!Int32.TryParse(subject, out ind_subject))
        {
            ind_subject = 0;
        }
        if (ind_subject == 0 || ind_subject > 2)
        {
            return;
        }

        string msg_format = @"Dear Linda <br/>
General Inquiry originating on Vacations-Abroad.com <br/>
Name: {0} <br/>
Email: {1} <br/>
Telephone: {2} <br/>
Message: {3}";
        string msg        = String.Format(msg_format, name, email, phone, comment);

        BookDBProvider.SendEmail("*****@*****.**", questions[ind_subject], msg, email);
        //  BookDBProvider.SendEmail("*****@*****.**", questions[ind_subject], msg, email);
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }
        else
        {
            email = Request["uemail"];
            List <SqlParameter> param = new List <SqlParameter>();
            param.Add(new SqlParameter("@email", email));
            DataSet ds = BookDBProvider.getDataSet("uspGetUserInfo", param);

            if (ds.Tables[0].Rows.Count == 0)
            {
                errormsg = "You didn't input correct registered email!";
                return;
            }
            else
            {
                List <SqlParameter> newparam = new List <SqlParameter>();
                newparam.Add(new SqlParameter("@email", email));
                string uid = generateID();
                newparam.Add(new SqlParameter("@link", uid));
                BookDBProvider.getDataSet("uspAddPwdReset", newparam);

                //Sending email to reset password
                string msg_format = @"Notification from Vacations-abroad.com <br/>
                                   To Reset Password of vacations-abroad account,please click <a href='{0}'>{0}</a> <br />
                                   If this is not your activity, please contact administrator of vacation-abroad.com , '*****@*****.**'! <br/>
                                   Vacations-Abroad.com ";
                BookDBProvider.SendEmail(email, "Password Reset:Vacations-Abroad.com", String.Format(msg_format, String.Format("https://www.vacations-abroad.com/accounts/pwdreset.aspx?uid={0}", uid)));

                triger_redirect = 1;
                return;
            }
        }
    }
示例#4
0
    protected void SendQuote_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        if (rates.Value == "")
        {
            return;
        }
        decimal _rates, _cleanfee, _secfee, _lodgingtax, _cancel90, _cancel60, _cancel30, _total_sum, _lodgingvalue, _balance;
        int     _validnumber;

        if (!Decimal.TryParse(rates.Value, out _rates))
        {
            _rates = 0;
        }
        if (!Decimal.TryParse(cleaningfee.Value, out _cleanfee))
        {
            _cleanfee = 0;
        }
        if (!Decimal.TryParse(secdeposit.Value, out _secfee))
        {
            _secfee = 0;
        }
        if (!Decimal.TryParse(loadingtax.Value, out _lodgingtax))
        {
            _lodgingtax = 0;
        }
        if (!Decimal.TryParse(cancel90.Value, out _cancel90))
        {
            _cancel90 = 0;
        }
        if (!Decimal.TryParse(cancel60.Value, out _cancel60))
        {
            _cancel60 = 0;
        }
        if (!Decimal.TryParse(cancel30.Value, out _cancel30))
        {
            _cancel30 = 0;
        }
        if (!Int32.TryParse(validnumber.Value, out _validnumber))
        {
            _validnumber = 0;
        }

        //_total_sum = _rates * inquiryinfo.Nights;
        _total_sum    = _rates;
        _lodgingvalue = _total_sum * _lodgingtax / 100;
        _balance      = _lodgingvalue + _secfee + _cleanfee;

        int newrespid = 0;
        int _currency = Convert.ToInt32(currency.SelectedValue);

        if ((newrespid = BookDBProvider.addEmailResponse(inquiryinfo.PropertyOwnerID, inquiryinfo.UserID, quoteid, _rates, _cleanfee, _secfee, _lodgingtax, _cancel30, _cancel60, _cancel90, DateTime.Now, _validnumber, _currency, comment.InnerText)) > 0)
        {
            BookDBProvider.updateEmailQuoteState(quoteid);
        }



        UserInfo userinfo = BookDBProvider.getUserInfo(inquiryinfo.PropertyOwnerID);
        //  BookResponseEmail  /for owner
        string toOwner = String.Format("Hi, {0}!<br> You have replied the inquiry for the property {1} in {2},{3},{4}.<br> Thanks.",
                                       userinfo.firstname + " " + userinfo.lastname, inquiryinfo.PropertyID, countryinfo.city, countryinfo.state, countryinfo.country);

        BookDBProvider.SendEmail(userinfo.email, "You have replied for the inquiry", toOwner);

        PropertyDetailInfo propinfo = AjaxProvider.getPropertyDetailInfo(inquiryinfo.PropertyID);
        string             url      = String.Format("https://www.vacations-abroad.com/{0}/{1}/{2}/{3}/default.aspx", propinfo.Country, propinfo.StateProvince, propinfo.City, propinfo.ID).ToLower().Replace(" ", "_");

        //To traveler
        // UserInfo traveler = BookDBProvider.getUserInfo(inquiryinfo.UserID);
        string  toTraveler = @"<body>
  {22}
  <table border='0px' width='600px' >
    <tr>
      <td>
         <table  style='width:600px;'>
            <tr>
              <td style='color:#000;font-size:16pt;width:300px;font-family: Verdana;'>
                <b>Vacations Abroad</b>
              </td>
              <td style='color:#000;font-size:10pt;width:300px;text-align: right;font-family: Verdana;'>
                {0}
              </td>
            </tr>
         </table>
      </td>
    </tr>
    <tr>
      <td bgcolor='#4472c4' style='border:1px solid #2f528f;text-align:center;padding: 10px 0px;color:#fff;font-size:12pt;font-family: Verdana;'>
            <a href='https://www.vacations-abroad.com/quoteresponse.aspx?respid={21}' style='cursor: pointer;color: #fff;text-decoration: none;font-size:12pt;font-family: Verdana;'>
                <b>Book Now!<b>
            </a>
      </td>
    </tr>
    <tr>
      <td style='text-align: center;padding: 10px 0px;'>
        <img src='{2}' style='width:350px;height: 220px;'  width='350' height='220' />
      </td>
    </tr>
    <tr>
        <td style='text-align: center;font-size:10pt;font-family: Verdana;'>
           Name of property:{3} &nbsp;&nbsp; Type of property:{4}
        </td>
    </tr>
    <tr>
      <td style='padding: 10px;'>
        <table style='border:1px dashed #000;width:600px;font-size:12pt;'>
            <tr>
                <td style='padding:10px;font-family: Verdana;'>
              <a href='{5}'>Property {6}</a> <br/>
              Date of Arrival: {7} <br/>
              {8} of nights <br/>
              # of Guests:  {9} Adults, {10} children <br/><br/>
             
                  Total Amount Due:{12} {19}<br/>
                  Amount Due to Reserve:{13} {19} <br/>

              
                </td>
            </tr>
            <tr>
            <td style='background: none; border: dotted 1px #999999; border-width:1px 0 0 0; height:1px;font-size:1px;'></td>
            </tr>
            <tr>
                <td style='padding:3px;font-family: Verdana;'>
                  Cleaning Fee:{15} {19}<br/>
                  Security Deposit:{16} {19}<br/>
                  Lodging Tax:{17}% {20}{19}<br/>
                  Amount Due Upon Arrival:{18}  <br/>
                  Comment:{23}<br/>
                </td>            
            </tr>
          </table>
      </td>
    </tr>
    <tr>
     <td style='padding: 15px; text-align: center;'>
        <a href='https://www.vacations-abroad.com/quoteresponse.aspx?respid={21}' style='padding:3px 20px;border:1px solid #000;cursor: pointer;color: #f86308;text-decoration: none;font-size:12pt;font-family: Verdana;'>
	      <b>Book Now</b>
	    </a> 
     </td>
    </tr>
    <tr>
      <td style='text-align: center;'>
        <img src='https://www.vacations-abroad.com/images/elogo.jpg' style='width:240px;height: 100px;' width='240' height='100' />     
      </td>
    </tr>
  </table>
</body>";
        decimal _total     = _total_sum + _balance;
        string  msg        = String.Format(toTraveler, DateTime.Now.ToString("MMM d, yyyy"), inquiryinfo.ContactorName, "https://www.vacations-abroad.com/images/" + propinfo.FileName, propinfo.Name2, propinfo.CategoryTypes, url, propinfo.ID, inquiryinfo.ArrivalDate, inquiryinfo.Nights, inquiryinfo.Adults, inquiryinfo.Children, userinfo.name, BookDBProvider.DoFormat(_total), BookDBProvider.DoFormat(_total_sum), BookDBProvider.DoFormat(_rates), BookDBProvider.DoFormat(_cleanfee), BookDBProvider.DoFormat(_secfee), _lodgingtax, BookDBProvider.DoFormat(_balance), currency.SelectedItem.Text, BookDBProvider.DoFormat(_lodgingvalue), AjaxProvider.Base64Encode(newrespid.ToString()), "<style>a:hover{color:#8bbdeb;} </style>", comment.InnerText);

        //BookDBProvider.SendEmail(traveler.email, toTraveler, "You have received the response from the property owner");
        BookDBProvider.SendEmail(inquiryinfo.ContactorEmail, String.Format("{0}, here is your quote for {1}", inquiryinfo.ContactorName, inquiryinfo.ArrivalDate), msg);
        BookDBProvider.SendEmail("*****@*****.**", String.Format("{0} has responded to {1}", userinfo.name, inquiryinfo.ContactorName), msg);

        if (AuthenticationManager.IfAdmin)
        {
            Response.Redirect("/userowner/listings.aspx?userid=" + inquiryinfo.PropertyOwnerID);
        }
        else
        {
            Response.Redirect("/userowner/listings.aspx");
        }
    }
示例#5
0
    protected void sendcomments_Click(object sender, EventArgs e)
    {
        string comments = Request["comments"];

        //  Response.Write(comments);
        if (comments == "")
        {
            return;
        }

        int newrespid = 0;
        int _currency = Convert.ToInt32(currency.SelectedValue);

        if ((newrespid = BookDBProvider.addEmailResponse(inquiryinfo.PropertyOwnerID, inquiryinfo.UserID, quoteid, 0, 0, 0, 0, 0, 0, 0, DateTime.Now, -1, _currency, comments)) > 0)
        {
            BookDBProvider.updateEmailQuoteState(quoteid);
        }



        UserInfo userinfo = BookDBProvider.getUserInfo(inquiryinfo.PropertyOwnerID);
        //  BookResponseEmail  /for owner
        string toOwner = String.Format("Hi, {0}!<br> You have replied the inquiry for the property {1} in {2},{3},{4}.<br> Thanks.",
                                       userinfo.firstname + " " + userinfo.lastname, inquiryinfo.PropertyID, countryinfo.city, countryinfo.state, countryinfo.country);

        BookDBProvider.SendEmail(userinfo.email, "You have replied for the inquiry", toOwner);

        PropertyDetailInfo propinfo = AjaxProvider.getPropertyDetailInfo(inquiryinfo.PropertyID);
        string             url      = String.Format("https://www.vacations-abroad.com/{0}/{1}/{2}/{3}/default.aspx", propinfo.Country, propinfo.StateProvince, propinfo.City, propinfo.ID).ToLower().Replace(" ", "_");

        //To traveler
        // UserInfo traveler = BookDBProvider.getUserInfo(inquiryinfo.UserID);
        string toTraveler = @"<body>
  <table border='0px' width='600px' >
    <tr>
      <td>
         <table  style='width:600px;'>
            <tr>
              <td style='color:#000;font-size:16pt;width:300px;font-family: Verdana;'>
                <b>Vacations Abroad</b>
              </td>
              <td style='color:#000;font-size:10pt;width:300px;text-align: right;font-family: Verdana;'>
                {0}
              </td>
            </tr>
         </table>
      </td>
    </tr>
    <tr>
      <td bgcolor='#4472c4' style='border:1px solid #2f528f;text-align:center;padding: 10px 0px;color:#fff;font-size:12pt;font-family: Verdana;'>
            <a style='cursor: pointer;color: #fff;text-decoration: none;font-size:12pt;font-family: Verdana;'>
                <b>Sorry! The property is not available on {6}<b>
            </a>
      </td>
    </tr>
    <tr>
      <td style='text-align: center;padding: 10px 0px;'>
        <img src='{1}' style='width:350px;height: 220px;'  width='350' height='220' />
      </td>
    </tr>
    <tr>
        <td style='text-align: center;font-size:10pt;font-family: Verdana;'>
           Name of property:{2} &nbsp;&nbsp; Type of property:{3}
        </td>
    </tr>
    <tr>
      <td style='padding: 10px;'>
        <table style='border:1px dashed #000;width:600px;font-size:12pt;'>
            <tr>
                <td style='padding:10px;font-family: Verdana;'>
              <a href='{4}'>Property {5}</a> <br/>
              Date of Arrival: {6} <br/>
              {7} of nights <br/>
              # of Guests:  {8} Adults, {9} children <br/><br/>
                
                </td>
            </tr>
            <tr>
            <td style='background: none; border: dotted 1px #999999; border-width:1px 0 0 0; height:1px;font-size:1px;'></td>
            </tr>
            <tr>
                <td style='padding:3px;font-family: Verdana;'>
                  Comment:{10}<br/>
                </td>            
            </tr>
          </table>
      </td>
    </tr>
    <tr>
     <td style='padding: 15px; text-align: center;'>
        <a style='padding:3px 20px;border:1px solid #000;cursor: pointer;color: #f86308;text-decoration: none;font-size:12pt;font-family: Verdana;'>
	      <b>Sorry! The property is not available on {6}</b>
	    </a> 
     </td>
    </tr>
    <tr>
      <td style='text-align: center;'>
        <img src='https://www.vacations-abroad.com/images/elogo.jpg' style='width:240px;height: 100px;' width='240' height='100' />     
      </td>
    </tr>
  </table>
</body>";
        string msg        = String.Format(toTraveler, DateTime.Now.ToString("MMM d, yyyy"), "https://www.vacations-abroad.com/images/" + propinfo.FileName, propinfo.Name2, propinfo.CategoryTypes, url, propinfo.ID, inquiryinfo.ArrivalDate, inquiryinfo.Nights, inquiryinfo.Adults, inquiryinfo.Children, comments);

        //BookDBProvider.SendEmail(traveler.email, toTraveler, "You have received the response from the property owner");
        BookDBProvider.SendEmail(inquiryinfo.ContactorEmail, String.Format("{0}, here is your quote for {1}", inquiryinfo.ContactorName, inquiryinfo.ArrivalDate), msg);
        BookDBProvider.SendEmail("*****@*****.**", String.Format("{0} has responded to {1}", userinfo.name, inquiryinfo.ContactorName), msg);

        if (AuthenticationManager.IfAdmin)
        {
            Response.Redirect("/userowner/listings.aspx?userid=" + inquiryinfo.PropertyOwnerID);
        }
        else
        {
            Response.Redirect("/userowner/listings.aspx");
        }
    }
示例#6
0
    protected bool InsertNewUser(SocialUser social)
    {
        try
        {
            int newid;
            using (SqlConnection connection = CommonFunctions.GetConnection())
            {
                connection.Open();
                //lock(CommonFunctions.Connection)
                SqlCommand getmaxid = new System.Data.SqlClient.SqlCommand("SELECT MAX(ID) FROM Users", connection);

                object maxid = getmaxid.ExecuteScalar();

                if (maxid is int)
                {
                    newid = (int)maxid + 1;
                }
                else
                {
                    newid = 1;
                }

                byte[] salt    = AuthenticationManager.GenerateSalt();
                int    repeats = AuthenticationManager.GenerateRepeats();
                byte[] pwdhash = AuthenticationManager.HashPassword(social.id, salt, repeats);

                string         sqlQuery    = "select * from Users where 0 = 1";
                SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, connection);
                DataSet        MainDataSet = new DataSet();
                dataAdapter.Fill(MainDataSet, "Users");

                DataRow newuser = MainDataSet.Tables["Users"].NewRow();

                newuser["ID"]           = newid;
                newuser["Username"]     = social.username;
                newuser["PasswordSalt"] = salt;
                newuser["Repeats"]      = repeats;
                newuser["PasswordHash"] = pwdhash;
                newuser["Email"]        = social.email;
                newuser["IfAdmin"]      = 0;

                newuser["UserID"] = social.id;
                newuser["AdministrativeEmail"] = newuser["Email"];
                newuser["IfAgent"]             = 0;
                newuser["ReservationEmail"]    = newuser["Email"];
                newuser["DateCreated"]         = DateTime.Now;

                newuser["FirstName"] = "";
                newuser["LastName"]  = "";
                //new part
                newuser["dateModified"] = DateTime.Today.ToString();

                int type = (acctype.Value == "1") ? 1 : 2;
                newuser["AccountType"] = type;  //0:email 1: facebook 2:twitter
                bool bl_show = showproperty.Checked;
                newuser["Listing"] = (bl_show) ? 1 : 0;

                MainDataSet.Tables["Users"].Rows.Add(newuser);

                new SqlCommandBuilder(dataAdapter);
                int rows = dataAdapter.Update(MainDataSet, "Users");

                if (rows < 1)
                {
                    return(false);
                }

                // CommonFunctions.sendEmail(social.username, social.email);
                string msg = "New owner registered at " + CommonFunctions.GetSiteName() + ". <br>" +
                             "Owner details: <br>" +
                             "Login name:" + social.username + " <br>" +
                             "Email address:" + social.email + " <br>";
                BookDBProvider.SendEmail(ConfigurationManager.AppSettings["NewOwnerEmail"], "New owner registered at Vacations-abroad.com", msg, social.email);


                connection.Close();
                if (AuthenticationManager.Login(social.email, social.id, type) != "")
                {
                    FormsAuthentication.RedirectFromLoginPage(LoginName.Text, false);
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return(true);
    }
    protected void SendButton_Click(object sender, System.EventArgs e)
    {
        EmailRequired.Validate();

        bool toall = false;

        if (!EmailRequired.IsValid)
        {
            return;
        }

        PropertiesSet.Clear();
        if (SendProperty.Checked)
        {
            PropertyNumberRequired.Validate();
            PropertyNumberValid.Validate();

            if (!PropertyNumberRequired.IsValid || !PropertyNumberValid.IsValid)
            {
                return;
            }

            GetIDsByNumber.SelectCommand.Parameters["@PropertyID"].Value = Convert.ToInt32(PropertyNumber.Text);
            //lock (CommonFunctions.Connection)
            GetIDsByNumber.Fill(PropertiesSet);
        }
        else if (SendOwner.Checked)
        {
            OwnerUsernameRequired.Validate();
            OwnerUsernameValid.Validate();

            if (!OwnerUsernameRequired.IsValid || !OwnerUsernameValid.IsValid)
            {
                return;
            }

            GetIDsByUsername.SelectCommand.Parameters["@Username"].Value = OwnerUsername.Text;
            //lock (CommonFunctions.Connection)
            GetIDsByUsername.Fill(PropertiesSet);
        }
        else if (SendAll.Checked)
        {
            toall = true;
            List <SqlParameter> sparam = new List <SqlParameter>();
            ds_owners = BookDBProvider.getDataSet("usp_get_all_owners_proved_properties", sparam);
        }
        //lock (CommonFunctions.Connection)

        if (toall)
        {
            if (ds_owners.Tables.Count > 0)
            {
                string emails = "";
                foreach (DataRow datarow in ds_owners.Tables[0].Rows)
                {
                    System.Text.RegularExpressions.Regex regex =
                        new System.Text.RegularExpressions.Regex("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");

                    if ((datarow["Email"] is string) && regex.Match((string)datarow["Email"]).Success)
                    {
                        SmtpClient smtpclient = new SmtpClient("mail.vacations-abroad.com", 25);

                        MailMessage message = new MailMessage("noreply@" + CommonFunctions.GetDomainName(), (string)datarow["Email"]);
                        message.Subject = CommonFunctions.GetSiteAddress() +
                                          CommonFunctions.PrepareURL(((string)datarow["Country"]).Replace(" ", "_").ToLower() + "/" +
                                                                     ((string)datarow["StateProvince"]).Replace(" ", "_").ToLower() + "/" +
                                                                     ((string)datarow["City"]).Replace(" ", "_").ToLower() + "/" + ((int)datarow["ID"]).ToString() +
                                                                     "/default.aspx");
                        message.Body = "Dear " + (string)datarow["FirstName"] + " " + (string)datarow["LastName"] + "!\n\n" +
                                       "You received a new message from " + CommonFunctions.GetSiteName() + " administration:\n\n" +
                                       EmailBody.Text;
                        message.IsBodyHtml = false;

                        message.Body = message.Body.Replace("\r", "").Replace("\n", Environment.NewLine);
                        message.Headers["Content-Type"] = "text/plain; charset = \"iso-8859-1\"";


                        BookDBProvider.SendEmail((string)datarow["Email"], message.Subject, message.Body);
                    }

                    DataRow newrow = EmailsSet.Tables["Emails"].NewRow();

                    newrow["PropertyID"] = datarow["ID"];
                    newrow["DateTime"]   = DateTime.Now;
                    newrow["Email"]      = EmailBody.Text;
                    newrow["IfCustom"]   = true;

                    EmailsSet.Tables["Emails"].Rows.Add(newrow);
                }
                EmailsAdapter.Update(EmailsSet);
                EmailsSent.Text = ds_owners.Tables[0].Rows.Count.ToString() + " e-mails sent";
            }
            else
            {
                EmailsSent.Text = "0 e-mails sent";
            }
            //lock (CommonFunctions.Connection)

            EmailsSent.Visible = true;
        }
        else
        {
            foreach (DataRow datarow in PropertiesSet.Tables["Properties"].Rows)
            {
                System.Text.RegularExpressions.Regex regex =
                    new System.Text.RegularExpressions.Regex("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");

                if ((datarow["Email"] is string) && regex.Match((string)datarow["Email"]).Success)
                {
                    SmtpClient smtpclient = new SmtpClient("mail.vacations-abroad.com", 25);

                    MailMessage message = new MailMessage("noreply@" + CommonFunctions.GetDomainName(), (string)datarow["Email"]);
                    message.Subject = CommonFunctions.GetSiteAddress() +
                                      CommonFunctions.PrepareURL(((string)datarow["Country"]).Replace(" ", "_").ToLower() + "/" +
                                                                 ((string)datarow["StateProvince"]).Replace(" ", "_").ToLower() + "/" +
                                                                 ((string)datarow["City"]).Replace(" ", "_").ToLower() + "/" + ((int)datarow["ID"]).ToString() +
                                                                 "/default.aspx");
                    message.Body = "Dear " + (string)datarow["FirstName"] + " " + (string)datarow["LastName"] + "!\n\n" +
                                   "You received a new message from " + CommonFunctions.GetSiteName() + " administration:\n\n" +
                                   EmailBody.Text;
                    message.IsBodyHtml = false;

                    message.Body = message.Body.Replace("\r", "").Replace("\n", Environment.NewLine);
                    message.Headers["Content-Type"] = "text/plain; charset = \"iso-8859-1\"";

                    try
                    {
                        smtpclient.Send(message);
                    }
                    catch (Exception ex)
                    {
                    }
                }

                DataRow newrow = EmailsSet.Tables["Emails"].NewRow();

                newrow["PropertyID"] = datarow["ID"];
                newrow["DateTime"]   = DateTime.Now;
                newrow["Email"]      = EmailBody.Text;
                newrow["IfCustom"]   = true;

                EmailsSet.Tables["Emails"].Rows.Add(newrow);
            }

            //lock (CommonFunctions.Connection)
            EmailsAdapter.Update(EmailsSet);

            EmailsSent.Text    = PropertiesSet.Tables["Properties"].Rows.Count.ToString() + " e-mails sent";
            EmailsSent.Visible = true;
        }
    }
示例#8
0
    protected void bt_register_Click(object sender, EventArgs e)
    {
        logtype = 0;
        if (!IsValid)
        {
            return;
        }

        try
        {
            int newid;
            using (SqlConnection connection = CommonFunctions.GetConnection())
            {
                connection.Open();
                //lock(CommonFunctions.Connection)
                SqlCommand getmaxid = new System.Data.SqlClient.SqlCommand("SELECT MAX(ID) FROM Users", connection);

                object maxid = getmaxid.ExecuteScalar();

                if (maxid is int)
                {
                    newid = (int)maxid + 1;
                }
                else
                {
                    newid = 1;
                }

                byte[] salt    = AuthenticationManager.GenerateSalt();
                int    repeats = AuthenticationManager.GenerateRepeats();
                byte[] pwdhash = AuthenticationManager.HashPassword(Password.Text, salt, repeats);

                string         sqlQuery    = "select * from Users where 0 = 1";
                SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, connection);
                DataSet        MainDataSet = new DataSet();
                dataAdapter.Fill(MainDataSet, "Users");

                DataRow newuser = MainDataSet.Tables["Users"].NewRow();

                newuser["ID"]           = newid;
                newuser["Username"]     = LoginName.Text;
                newuser["PasswordSalt"] = salt;
                newuser["Repeats"]      = repeats;
                newuser["PasswordHash"] = pwdhash;
                newuser["Email"]        = Email.Text;
                newuser["IfAdmin"]      = 0;

                newuser["UserID"] = newuser["Username"];
                newuser["AdministrativeEmail"] = newuser["Email"];
                newuser["IfAgent"]             = 0;
                newuser["ReservationEmail"]    = newuser["Email"];
                newuser["DateCreated"]         = DateTime.Now;

                newuser["FirstName"] = reg_firstname.Text;
                newuser["LastName"]  = reg_lastname.Text;
                //new part
                newuser["dateModified"] = DateTime.Today.ToString();
                newuser["AccountType"]  = 0; //0:email 1: facebook 2:twitter
                bool bl_show = false;        // showproperty.Checked;
                newuser["Listing"] = (bl_show) ? 1 : 0;
                MainDataSet.Tables["Users"].Rows.Add(newuser);

                new SqlCommandBuilder(dataAdapter);
                int rows = dataAdapter.Update(MainDataSet, "Users");

                if (rows < 1)
                {
                    return;
                }

                // CommonFunctions.sendEmail(LoginName.Text, Email.Text);
                string msg = "New owner registered at " + CommonFunctions.GetSiteName() + ". <br>" +
                             "Owner details: <br>" +
                             "Login name:" + LoginName.Text + " <br>" +
                             "Email address:" + Email.Text + " <br>";
                BookDBProvider.SendEmail(ConfigurationManager.AppSettings["NewOwnerEmail"], "New owner registered at Vacations-abroad.com", msg, Email.Text);

                //                if (regex.Match(message.To.ToString()).Success)
                //                  smtpclient.Send(message);

                //CommonFunctions.Connection.Close ();
                connection.Close();

                try
                {
                    using (WebClient client = new WebClient())
                    {
                        byte[] response =
                            client.UploadValues("https://api.madmimi.com/audience_lists/Owners/add", new NameValueCollection()
                        {
                            { "username", "*****@*****.**" },
                            { "api_key", "9881316569391d3dbfba35b71670b4b2" },
                            { "email", Email.Text },
                            { "first_name", reg_firstname.Text },
                            { "last_name", reg_lastname.Text }
                        });

                        //string result = System.Text.Encoding.UTF8.GetString(response);
                    }
                }
                catch
                {
                }
                string username;
                if ((username = AuthenticationManager.Login(LoginName.Text, Password.Text, 0)) != "")
                {
                    FormsAuthentication.SetAuthCookie(username, true);
                    //            if (backlinkpassed) Response.Redirect("http://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + backlinkurl);
                    if (backlinkpassed)
                    {
                        Response.Redirect(backlinkurl);
                    }
                    else
                    {
                        Response.Redirect("/userowner/Listings.aspx?UserID=" + AuthenticationManager.UserID.ToString());
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        //CommonFunctions.Connection.Open ();

        Response.Redirect(backlinkurl);
    }
示例#9
0
    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
        {
        }
    }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //   Request.SaveAs(Server.MapPath("~/assets/ss.txt"),true);

        pass_recaptcha = false;
        string sec_key = "6LeiuBcUAAAAAPEGRRVqTcLsdO83GSnGetOwOfMM";
        string g_url   = "https://www.google.com/recaptcha/api/siteverify";

        using (WebClient wc = new WebClient())
        {
            byte[] response =
                wc.UploadValues(g_url, new NameValueCollection()
            {
                { "secret", sec_key },
                { "response", Request["g-recaptcha-response"] }
            });

            string  result = System.Text.Encoding.UTF8.GetString(response);
            JObject json   = JObject.Parse(result);
            if (json["success"].ToString() != "True" || json["hostname"].ToString() != "www.vacations-abroad.com")
            {
                // Response.Write(String.Format("{0} <<<<  {1}<<<< {2}", Request["g-recaptcha-response"], json["success"].ToString(), json["hostname"].ToString()));
                return;
            }
            pass_recaptcha = true;
        }


        if (!pass_recaptcha)
        {
            return;
        }

        propNum     = Int32.Parse(Request.Form["propid"]);
        image_count = Int32.Parse(Request.Form["image_count"]);
        fname       = Server.HtmlEncode(Request.Form["txtFName"]);
        lname       = Server.HtmlEncode(Request.Form["txtLName"]);
        vmon        = Server.HtmlEncode(Request.Form["ddlMonth"]);
        vyear       = Server.HtmlEncode(Request.Form["ddlYear"]);
        email       = Server.HtmlEncode(Request.Form["email"]);
        phonenumber = Server.HtmlEncode(Request.Form["txtPhone"]);
        comment     = Server.HtmlEncode(Request.Form["txtComments"]);
        rate        = Int32.Parse(Request.Form["ratings"]);
        int newid = BookDBProvider.addComment(propNum, rate, fname, lname, vmon, vyear, email, phonenumber, comment);

        List <string> imgname  = new List <string>();
        List <string> comments = new List <string>();

        for (int i = 0; i < image_count; i++)
        {
            imgname.Add(Request.Form["img" + i]);
            comments.Add(Request.Form["com" + i]);
        }
        BookDBProvider.addImagecomment(propNum, newid, comments, imgname);

        string msg_format = @"Dear Linda <br/>
 {0} has commented to property {1} <br/>
 Travel Date: {2} <br/>
 Email: {3} <br/>
 Phone: {4} <br/>
 Comment: {5} <br/>
 Rate: {6} <br/>";
        string msg        = String.Format(msg_format, String.Format("{0} {1}", fname, lname), propNum, String.Format("{0} {1}", vyear, vmon)
                                          , email, phonenumber, comment, rate);

        BookDBProvider.SendEmail("*****@*****.**", "Comment Notification", msg);
    }