示例#1
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        prop_category      = BookDBProvider.getDataSet("uspGetPropertyCategory", new List <SqlParameter>());
        all_amenities      = BookDBProvider.getDataSet("uspGetAllAmenity", new List <SqlParameter>());
        allfurnitures      = BookDBProvider.getDataSet("uspGetAllFurniture", new List <SqlParameter>());
        json_allfurnitures = CommonProvider.getJsonStringFromDs(allfurnitures);
        allattractions     = BookDBProvider.getDataSet("uspGetAllAttraction", new List <SqlParameter>());

        //For new property
        if (propertyid == -1)
        {
        }
        else if (propertyid > 0)
        {
            //For the existed property
            propinfo = AjaxProvider.getPropertyDetailInfo(propertyid);
            List <SqlParameter> param = new List <SqlParameter>();
            param.Add(new SqlParameter("@propid", propertyid));
            prop_amenities = BookDBProvider.getDataSet("uspGetPropertyAmenity", param);
            json_amenity   = CommonProvider.getJsonStringFromDs(prop_amenities);
            json_propinfo  = new JavaScriptSerializer().Serialize(propinfo);
            param.Clear();
            param.Add(new SqlParameter("@propid", propertyid));
            json_roomfurnitures = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetRoomFurnitures", param));
            param.Clear();
            param.Add(new SqlParameter("@propid", propertyid));
            json_attractions = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetPropertyAttractionByID", param));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Request.SaveAs(Server.MapPath("~/assets/ss.txt"), true);
        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);
    }
示例#3
0
    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;
    }
示例#4
0
    protected void StateRename_Click(object sender, System.EventArgs e)
    {
        if (StateName.Text.Length < 1)
        {
            return;
        }

        foreach (DataRow datarow in StateProvincesSet.Tables["StateProvinces"].Rows)
        {
            if (datarow.RowState != DataRowState.Deleted)
            {
                if ((int)datarow["ID"] == Convert.ToInt32(StateList.SelectedValue))
                {
                    datarow["StateProvince"] = StateName.Text;
                    break;
                }
            }
        }

        //lock (CommonFunctions.Connection)
        StateProvincesAdapter.Update(StateProvincesSet);

        Finish();
        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@country", CountryList.Text));
        param.Add(new SqlParameter("@state", StateName.Text));
        param.Add(new SqlParameter("@city", CityList.Text));
        param.Add(new SqlParameter("@ocount", CountryList.Text));
        param.Add(new SqlParameter("@ostate", StateList.Text));
        param.Add(new SqlParameter("@ocity", CityList.Text));
        BookDBProvider.getDataSet("uspUpdateLatLong", param);
    }
示例#5
0
    protected void newcoupon_Click(object sender, EventArgs e)
    {
        string coupon = Request["n_coupon"], start_date = Request["n_start"], end_date = Request["n_end"];
        int    discount;

        if (!Int32.TryParse(Request["n_discount"].ToString(), out discount))
        {
            discount = 0;
        }

        if (coupon == "" || start_date == "" || end_date == "")
        {
            return;
        }

        List <SqlParameter> param    = new List <SqlParameter>();
        SqlParameter        p_coupon = new SqlParameter("@coupon", coupon);
        SqlParameter        p_sd     = new SqlParameter("@start", start_date);
        SqlParameter        p_ed     = new SqlParameter("@end", end_date);
        SqlParameter        p_dis    = new SqlParameter("@discount", discount);

        param.Add(p_coupon); param.Add(p_sd); param.Add(p_ed); param.Add(p_dis);

        BookDBProvider.getDataSet("uspAddCouponItem", param);
        ds_coupons = BookDBProvider.getDataSet("uspGetCouponItemList", new List <SqlParameter>());
    }
示例#6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ds_coupons = BookDBProvider.getDataSet("uspGetCouponItemList", new List <SqlParameter>());
     }
     ds_use_coupons = BookDBProvider.getDataSet("uspGetPaymentCouponList", new List <SqlParameter>());
 }
示例#7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!AuthenticationManager.IfAuthenticated)
        {
            FormsAuthentication.SignOut();
        }

        // Response.Write("Uid" + userid);

        userinfo = BookDBProvider.getDetailedUserInfo(userid);

        property_set = BookDBProvider.getPropertySet(userid);

        if (property_set.Tables[0].Rows.Count == 0 && userinfo.Zip == "")
        {
            Response.Redirect("/ownerinformation.aspx?userid=" + userinfo.ID);
        }


        List <SqlParameter> param   = new List <SqlParameter>();
        SqlParameter        puserid = new SqlParameter("@userid", SqlDbType.Int);

        puserid.Value = userid;
        param.Add(puserid);

        owner_ds = BookDBProvider.getDataSet("uspGetOwnerResponseList", param);
        //For Traveller

        /*   param.Clear();
         * SqlParameter pemail = new SqlParameter("@email", SqlDbType.NVarChar, 500);
         * pemail.Value = userinfo.Email;
         * param.Add(pemail);
         *
         * traveler_ds = BookDBProvider.getDataSet("uspGetTravelerResponseList", param);
         *
         */

        if (owner_ds.Tables[0].Rows.Count != 0)
        {
            cssclass_tabs[1] = "active";
        }
        else
        {
            cssclass_tabs[0] = "hidden";
            if (property_set.Tables[0].Rows.Count == 0)
            {
                cssclass_tabs[1] = "hidden";
                cssclass_tabs[2] = "active";
            }
            else
            {
                cssclass_tabs[1] = "active";
            }
        }

        //Displaying the tabs
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            // Response.Write(userid);
            float  hlat, hlng;
            string haddr, hcity;
            int    hcityid, hpropid, hstateid;
            if (!float.TryParse(Request["hlat"], out hlat))
            {
                hlat = 0;
            }
            if (!float.TryParse(Request["hlng"], out hlng))
            {
                hlng = 0;
            }
            haddr = Request["haddr"];
            hcity = Request["hcity"];
            if (!int.TryParse(Request["hcityid"], out hcityid))
            {
                hcityid = 0;
            }
            if (!int.TryParse(Request["hstateid"], out hstateid))
            {
                hstateid = 0;
            }
            if (!int.TryParse(Request["hpropid"], out hpropid))
            {
                hpropid = 0;
            }

            if (hcityid == 0)
            {
                List <SqlParameter> sparam = new List <SqlParameter>();
                sparam.Add(new SqlParameter("@stateid", hstateid));
                sparam.Add(new SqlParameter("@city", hcity));
                DataSet ds = BookDBProvider.getDataSet("uspAddCity", sparam);
                hcityid = int.Parse(ds.Tables[0].Rows[0][0].ToString());
            }
            List <SqlParameter> tparam = new List <SqlParameter>();
            tparam.Add(new SqlParameter("@propid", hpropid));
            tparam.Add(new SqlParameter("@lat", hlat));
            tparam.Add(new SqlParameter("@lng", hlng));
            tparam.Add(new SqlParameter("@cityid", hcityid));
            tparam.Add(new SqlParameter("@addr", haddr));
            BookDBProvider.getDataSet("uspAddPropLatLong", tparam);
        }


        // int userid = int.Parse(Request["userid"]);
        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@userid", userid));
        ds_proplocation = BookDBProvider.getDataSet("uspGetPropertyLocationsByUserID", param);
    }
示例#9
0
    protected void PaywithPaypal()
    {
        /*
         *
         * URL is the URL to work with, depending on whether sandbox or a real PayPal account should be used
         * cmd is a command that is sent to PayPal
         * business is the seller's e-mail
         * item_name is the item name -- i.e. what buyer pays for -- that will be shown to user;
         * amount is the payment amount
         * no_shipping is a parameter that determines whether the delivery address should be requested
         * return_url is the URL that the buyer will be redirected to when payment is successfully performed
         * rm is a parameter that determines the way in which information about a successfully finished transaction will be sent to the script specified in the return parameter
         * notify_url is the URL PayPal will send information about transaction (IPN) to
         * cancel_url is the URL that the buyer is redirected to when he cancels payment
         * currency_code is the currency code
         * request_id is an identifier of payment request
         *
         * */


        string redirecturl = "";

        //Mention URL to redirect content to paypal site
        redirecturl += "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + ConfigurationManager.AppSettings["PaypalEmail"].ToString();
        //  redirecturl += "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]";

        //Product Name
        redirecturl += String.Format("&item_name=Property{0} in {1},{2},{3}", inquiryinfo.PropertyID, prop_info.City, prop_info.StateProvince, prop_info.Country);
        //item_number
        redirecturl += "&item_number=" + respid;
        //Product Name
        redirecturl += "&amount=" + BookDBProvider.DoFormat(_total);

        //Shipping charges if any
        redirecturl += "&no_shipping=1";

        redirecturl += "&rm=2";
        redirecturl += "&custom=" + custom;
        //Currency code
        //   redirecturl += "&currency_code=" + "USD";
        redirecturl += ("&currency_code=" + currency_type[email_resp.CurrencyType]);

        //Success return page url
        //redirecturl += "&return=" +      ConfigurationManager.AppSettings["SuccessURL"].ToString();
        redirecturl += "&return=https://www.vacations-abroad.com/paysuccess.aspx";

        //Failed return page url
        //redirecturl += "&cancel_return=" +    ConfigurationManager.AppSettings["FailedURL"].ToString();
        redirecturl += "&cancel_return=https://www.vacations-abroad.com/payfail.aspx";

        //redirecturl += "&notify_url=" +       ConfigurationManager.AppSettings["IPNURL"].ToString();
        //redirecturl += "&notify_url=https://www.vacations-abroad.com/accounts/ipnhelper.aspx";

        Response.Redirect(redirecturl);
    }
示例#10
0
    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);
    }
示例#11
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;
        }
    }
示例#12
0
    protected void CityRename_Click(object sender, System.EventArgs e)
    {
        if (CityName.Text.Length < 1)
        {
            return;
        }

        LatLongInfo latinfo = MainHelper.getCityLocation(CityName.Text, StateList.SelectedItem.Text, CountryList.SelectedItem.Text);

        if (latinfo.status == 0) //Fail to get location info
        {
            error_msg = String.Format("Fail to get {0} location.", NewCity.Text);
        }
        else if (latinfo.status == 1) //Fail to verify the address
        {
            error_msg = String.Format("Fail to verify the location of {0}.", NewCity.Text);
        }
        else  //Success to get the latitude and longitude
        {
            try
            {
                //Update
                foreach (DataRow datarow in CitiesSet.Tables["Cities"].Rows)
                {
                    if (datarow.RowState != DataRowState.Deleted)
                    {
                        if ((int)datarow["ID"] == Convert.ToInt32(CityList.SelectedValue))
                        {
                            datarow["City"] = CityName.Text;
                            break;
                        }
                    }
                }

                //lock (CommonFunctions.Connection)
                CitiesAdapter.Update(CitiesSet);

                List <SqlParameter> param = new List <SqlParameter>();
                param.Add(new SqlParameter("@stateid", StateList.SelectedValue));
                param.Add(new SqlParameter("@city", CityName.Text));
                param.Add(new SqlParameter("@lat", latinfo.latitude));
                param.Add(new SqlParameter("@lng", latinfo.longitude));
                BookDBProvider.getDataSet("uspAddLatLong", param);

                Finish();
            }
            catch {
                error_msg = "Something is wrong.";
            }
        }
    }
示例#13
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string strCountryText     = txtCountryText.Text.Replace(Environment.NewLine, "<br />");
        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@countryid", countryid));//[uspUpdateCountryText]
        param.Add(new SqlParameter("@text", strCountryText));
        param.Add(new SqlParameter("@index", 0));

        BookDBProvider.getDataSet("uspUpdateCountryText", param);

        //For country description
        lblCountryInfo.Text = txtCountryText.Text.Replace(Environment.NewLine, "<br />");
    }
示例#14
0
    protected void DelCom_Click(object sender, EventArgs e)
    {
        int cid;

        if (!int.TryParse(Request["del_id"], out cid))
        {
            cid = 0;
        }
        if (cid == 0)
        {
            return;
        }
        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@id", cid));
        ds_coupons = BookDBProvider.getDataSet("uspDelCouponItem", param);
    }
示例#15
0
    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);
    }
示例#16
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);
    }
示例#17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds_country = BookDBProvider.getDataSet("uspGetCityWithNoLoctionList", new List <SqlParameter>());

        int count = ds_country.Tables[0].Rows.Count;

        for (int i = 0; i < count; i++)
        {
            // if (i > 100) return;
            DataRow row = ds_country.Tables[0].Rows[i];
            string  url = "https://maps.google.com/maps/api/geocode/json?address=" + String.Format("{0}, {1}", row["City"], row["StateProvince"]) + "&sensor=false&key=AIzaSyCLLZW2LVHAYTl-iwt4nm21EHWBjOZtA-M";
            //  Response.Write(url);
            //  if (i > 10) break;
            WebRequest request = WebRequest.Create(url);
            using (WebResponse response = request.GetResponse())
            {
                using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
                {
                    string  resp = reader.ReadToEnd();
                    JObject jobj = JObject.Parse(resp);
                    Response.Write(resp);
                    if (jobj["status"].ToString() == "OK")
                    {
                        string latitude           = jobj["results"][0]["geometry"]["location"]["lat"].ToString();
                        string longtitude         = jobj["results"][0]["geometry"]["location"]["lng"].ToString();
                        List <SqlParameter> param = new List <SqlParameter>();
                        param.Add(new SqlParameter("@country", row["Country"]));
                        param.Add(new SqlParameter("@state", row["StateProvince"]));
                        param.Add(new SqlParameter("@city", row["City"]));
                        param.Add(new SqlParameter("@lat", latitude));
                        param.Add(new SqlParameter("@lng", longtitude));
                        BookDBProvider.getDataSet("uspAddLatLong", param);
                    }
                }
            }
        }
    }
示例#18
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;
            }
        }
    }
示例#19
0
    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);
    }
示例#20
0
    protected void payment_Click(object sender, EventArgs e)
    {
        string coupon = Request["coupon"];

        if (coupon.Length == 13)
        {
            string start_date, end_date;
            int    discount, id;

            List <SqlParameter> param = new List <SqlParameter>();
            param.Add(new SqlParameter("@coupon", coupon));

            DataSet ds_coupon = BookDBProvider.getDataSet("uspGetCouponItem", param);
            if (ds_coupon.Tables[0].Rows.Count > 0)
            {
                start_date = ds_coupon.Tables[0].Rows[0]["Start_date"].ToString();
                end_date   = ds_coupon.Tables[0].Rows[0]["End_date"].ToString();
                if (!int.TryParse(ds_coupon.Tables[0].Rows[0]["Discount"].ToString(), out discount))
                {
                    discount = 0;
                }
                id = int.Parse(ds_coupon.Tables[0].Rows[0]["CID"].ToString());

                DateTime s_date = DateTime.Parse(start_date);
                DateTime e_date = DateTime.Parse(end_date);
                DateTime now    = DateTime.Now;
                if (DateTime.Compare(s_date, now) <= 0 && DateTime.Compare(now, e_date) <= 0)
                {
                    _total = _total_sum * (100 - discount) / 100 + _balance;
                    custom = coupon;
                }
            }
        }

        PaywithPaypal();
    }
示例#21
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if ((Request.Params["CountryID"] != null) && (Request.Params["CountryID"].Length > 0))
        {
            try
            {
                countryid = Convert.ToInt32(Request.Params["CountryID"]);
            }
            catch (Exception)
            {
            }
        }

        if (countryid == -1)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@countryid", countryid));//[uspGetCountry_Prop_StateInfo]
        ds_allinfo = BookDBProvider.getDataSet("uspGetCountry_Prop_StateInfo", param);

        if (ds_allinfo.Tables.Count != 4)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        region  = ds_allinfo.Tables[0].Rows[0]["Region"].ToString();
        country = ds_allinfo.Tables[0].Rows[0]["Country"].ToString();

        string vText = "Vacations-abroad.com is a " + country + " accommodation directory of " + country + " rentals by owner and privately owned " + country + " holiday accommodation. Our short term " + country + " rentals include luxury " +
                       country + " holiday homes, " + country + " vacation homes and " + country + " vacation home rentals which are perfect for group or family vacation rentals in " + country + " " + region;

        if (!IsPostBack)
        {
            //For country description
            lblCountryInfo.Text = ds_allinfo.Tables[0].Rows[0]["countryText"].ToString().Replace(Environment.NewLine, "<br />");
            txtCountryText.Text = ds_allinfo.Tables[0].Rows[0]["countryText"].ToString().Replace("<br />", Environment.NewLine);

            if (lblCountryInfo.Text == null || lblCountryInfo.Text == "")
            {
                lblCountryInfo.Text = vText;
                txtCountryText.Text = vText;
            }

            lblInfo2.Text = ds_allinfo.Tables[0].Rows[0]["countryText2"].ToString().Replace(Environment.NewLine, "<br />");
            if (string.IsNullOrEmpty(lblInfo2.Text) || lblInfo2.Text == "")
            {
                OrangeTitle.Visible = false;
            }
            txtCountryText2.Text = ds_allinfo.Tables[0].Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
        }



        /*    /////// common for postback and ! postback
         *  List<string> vList = new List<string>();
         *  DataTable dt = new DataTable();
         *  DataFunctions obj = new DataFunctions();
         *  DataTable dtCategories = new DataTable();
         *  DBConnection obj1 = new DBConnection();
         *
         *  try
         *  {
         *      if (!IsPostBack)
         *      {
         *          dt = obj.PropertiesByCase(vList, countryid, "Country");
         *          DataView dv = dt.DefaultView;
         *          dv.Sort = "category asc";
         *          dt = dv.ToTable();
         *          Session["dt"] = dt;
         *           int[] i = new int[4];
         *          i = FindNumAmenities(dt);
         *
         *          dtCategories = obj.FindNumCategories(dt);
         *          DataView dvMax = dtCategories.DefaultView;
         *          dvMax.Sort = "count desc";
         *          DataTable dtMax = dvMax.ToTable();
         *          int vCategoryCount = 0;
         *          string firstCategory = "";
         *          string subCategory = "";
         *          foreach (DataRow row in dtMax.Rows)
         *          {
         *              int index = dtMax.Rows.IndexOf(row);
         *              if (index == 0)
         *              {
         *                  firstCategory = row["category"].ToString();
         *                  subCategory = dt.Rows[0]["SubCategory"].ToString();
         *              }
         *              string vTemp = row["category"].ToString() + " (" + row["count"].ToString() + ")";
         *              vTemp = vTemp.Replace(" ", "&nbsp;");
         *              vCategoryCount = vCategoryCount + Convert.ToInt32(row["count"].ToString());
         *          }
         *
         *          if (!IsPostBack)
         *          {
         *
         *              //dtlStates.DataSource = dtCategories;
         *              //dtlStates.DataBind();
         *          }
         *          //numbedrooms filter
         *          dtCategories = obj.FindNumBedrooms(dt);
         *          int vBedCount = 0;
         *          foreach (DataRow row in dtCategories.Rows)
         *          {
         *              vBedCount += Convert.ToInt32(row["count"]);
         *          }
         *
         *          Page page = (Page)HttpContext.Current.Handler;
         *          if (Request.QueryString["category"] != null)
         *          {
         *              Response.Clear();
         *              Response.StatusCode = 404;
         *              Response.End();
         *          }
         *          if (dt.Rows.Count <= 10)
         *          {
         *              //Implement 404 logic less then 10 property with Prorerty in URL - Develop By Nimesh Sapovadiya
         *              if(Request.QueryString["category"] != null)
         *              {
         *                  Response.Clear();
         *                  Response.StatusCode = 404;
         *                  Response.End();
         *              }
         *              string dispString = "";
         *              string dispString2 = "";
         *              if (subCategory.Contains("_"))
         *              {
         *                  string[] strSplit = subCategory.Split('_');
         *                  dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *              }
         *              else
         *              {
         *                  dispString = UppercaseFirst(subCategory) + "s";
         *              }
         *              firstCategory = dt.Rows[0]["category"].ToString();
         *              if (firstCategory.Contains("_"))
         *              {
         *                  string[] strSplit = firstCategory.Split('_');
         *                  dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *              }
         *              else
         *              {
         *                  dispString2 = UppercaseFirst(firstCategory) + "s";
         *              }
         *
         *              altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
         *              ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *              hyplnkBackLink.NavigateUrl = "/" + region.ToLower().Replace(" ", "_")+"/default.aspx";
         *              ltrBackText.Text = region + "<<";
         *      hyplnkAllProps.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/countryproperties.aspx";
         *              ltrAllProps.Text = " View all " + char.ToUpper(country[0]) + country.Substring(1) + " properties";
         *              string scountry=char.ToUpper(country[0]) + country.Substring(1);
         *              country = scountry;
         *              ltrHeading.Text = scountry + " Vacation Rentals and Boutique Hotels";
         *
         *              page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *
         *             string tempcountry1 = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
         *                                         "/default.aspx";
         *
         *            /*  HtmlMeta description = new HtmlMeta();
         *              description.Name = "description";
         *              description.Content = "Plan your next " + char.ToUpper(country[0]) + country.Substring(1) + " vacation: where to stay and places to visit ";
         *              head.Controls.Add(description);
         *
         *          }
         *          else
         *          {
         *
         *              if (Request.QueryString["category"] != null)
         *              {
         *                  firstCategory = Convert.ToString(Request.QueryString["category"]);
         *              }
         *              {
         *                  string dispString = "";
         *                  string dispString2 = "";
         *                  if (subCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = subCategory.Split('_');
         *                      dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1])+"s";
         *                  }
         *                  else
         *                  {
         *                      dispString = UppercaseFirst(subCategory) + "s";
         *                  }
         *                  if (firstCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = firstCategory.Split('_');
         *                      dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *                  }
         *                  else
         *                  {
         *                      dispString2 = UppercaseFirst(firstCategory) + "s";
         *                  }
         *                  altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
         *                  ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *                  hyplnkBackLink.NavigateUrl = "/" + region.ToLower().Replace(" ", "_")+"/default.aspx";
         *                  ltrBackText.Text = region + " Vacations <<";
         *      hyplnkAllProps.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/countryproperties.aspx";
         *      ltrAllProps.Text = " View all " + char.ToUpper(country[0]) + country.Substring(1) + " properties";
         *                  string scountry = char.ToUpper(country[0]) + country.Substring(1);
         *                  country = scountry;
         *                  ltrHeading.Text = scountry + " Vacation Rentals and Boutique Hotels";
         *
         *                  //ltrCountryThing.Text = char.ToUpper(country[0]) + country.Substring(1);
         *                  page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *
         *              }
         *              if (firstCategory == "bandb")
         *              {
         *                  firstCategory = "B&B";
         *              }
         *
         *
         *              DataTable dtCategory = dt.Clone();
         *              foreach (DataRow dr in dt.Rows)
         *              {
         *                  string vTemp = dr["Category"].ToString();
         *                  if (vTemp.ToLower().Replace(" ", "").Trim() == firstCategory.ToLower().Replace("_", " ").Replace(" ", ""))
         *                  {
         *                      subCategory = dr["SubCategory"].ToString();
         *                      dtCategory.ImportRow(dr);
         *                  }
         *              }
         *              DataView dv1 = dtCategory.DefaultView;
         *              dv1.Sort = "MinNightRate desc";
         *
         *              if (Request.QueryString["category"] != null)
         *              {
         *                  string dispString = "";
         *                  if (firstCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = firstCategory.Split('_');
         *                      dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1])+"s";
         *                  }
         *                  else
         *                  {
         *                      dispString = UppercaseFirst(firstCategory) + "s";
         *                  }
         *                  ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *                  page.Title = char.ToUpper(country[0]) + country.Substring(1) + "Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *                  altTag = subCategory + " in " + country;
         *                  Label3.Text = altTag;
         *              }
         *              else
         *              {
         *                  string dispString = "";
         *                  string dispString2 = "";
         *                  if (subCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = subCategory.Split('_');
         *                      dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *                  }
         *                  else
         *                  {
         *                      dispString = UppercaseFirst(subCategory) + "s";
         *                  }
         *                  if (firstCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = firstCategory.Split('_');
         *                      dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *                  }
         *                  else
         *                  {
         *                      dispString2 = UppercaseFirst(firstCategory) + "s";
         *                  }
         *                  altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
         *                  ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *                  page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *
         *              }
         *              string tempcountry = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
         *                                          "/default.aspx";
         *
         *
         *          }
         *
         *          ViewState["firstCategory"] = firstCategory;
         *          DataTable dt1 = new DataTable();
         *          try
         *          {
         *              dt1 = VADBCommander.CountryTextInd(countryid.ToString(), firstCategory);
         *          }
         *          catch (Exception ex) { lblInfo.Text = ex.Message; }
         *
         *          string vText = "Vacations-abroad.com is a " + country + " accommodation directory of " + country + " rentals by owner and privately owned " + country + " holiday accommodation. Our short term " + country + " rentals include luxury " +
         *         country + " holiday homes, " + country + " vacation homes and " + country + " vacation home rentals which are perfect for group or family vacation rentals in " + country + " " + region;
         *
         *          if (dt1.Rows.Count > 0)
         *          {
         *
         *              if (dt1.Rows[0]["countryText"] != null)
         *              {
         *                  if (!IsPostBack)
         *                  {
         *                      lblCountryInfo.Text = dt1.Rows[0]["countryText"].ToString();
         *                      txtCountryText.Text = dt1.Rows[0]["countryText"].ToString().Replace("<br />", Environment.NewLine);
         *                  }
         *                  ////Editor.Value = dt.Rows[0]["cityText"].ToString();
         *              }
         *              else
         *              {
         *                  lblCountryInfo.Text = vText;
         *                  txtCountryText.Text = vText;
         *              }
         *              if (dt1.Rows[0]["countryText2"] != null)
         *              {
         *                  if (!IsPostBack)
         *                  {
         *                      lblInfo2.Text = dt1.Rows[0]["countryText2"].ToString();
         *                      if (string.IsNullOrEmpty(lblInfo2.Text) || lblInfo2.Text == "")
         *                      {
         *                          OrangeTitle.Visible = false;
         *                      }
         *                      txtCountryText2.Text = dt1.Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
         *                  }
         *              }
         *              else
         *              {
         *                  OrangeTitle.Visible = false;
         *              }
         *          }
         *          else
         *          {
         *              lblCountryInfo.Text = vText;
         *              txtCountryText.Text = vText;
         *              OrangeTitle.Visible = false;
         *          }
         *      }
         *  }
         *  catch (Exception ex) { lblInfo.Text = ex.Message; }
         *
         *  DBConnection obj3 = new DBConnection();
         *  SqlDataReader reader = obj3.ExecuteRecordSetArtificial("SELECT Cities.* FROM Cities WHERE (Cities.StateProvinceID = " + stateprovinceid + ") " + "AND EXISTS ( SELECT * FROM Properties WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND " + "(Properties.CityID = Cities.ID)  AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) ORDER " + "BY City");
         *  string states1 = "";
         *  string regionCountry = "";
         *  foreach (DataRow dr in MainDataSet.Tables["CountriesRegion"].Rows)
         *  {
         *      string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *      temp = temp.ToLower();
         *      temp = temp.Replace(' ', '_');
         *      rtLow3.Text += "<li><a href=\"" + temp + "\"><span class=\"tdNoSleeps\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + ",&nbsp; </span></a></li>";
         *      states1 += "<a href=\"" + temp + "\"><span class=\"tdNoSleeps\" style=\"font-weight:normal;font-style:normal\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
         *      regionCountry = dr["Region"].ToString();
         *  }
         *  states1 = "";
         *  foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows)
         *  {
         *      string temp = "/" + country.ToLower().Replace(" ", "_") + "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *      states1 += "<a href=\"" + temp + "\"><span class=\"tdNoSleeps\" style=\"font-weight:normal;font-style:normal\">" + dr["StateProvince"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
         *  }
         *
         *  states1 = "";
         *  string str_states = "";
         *
         *  int ind = 0;
         *  // string cls = " class='borderright' ";
         *  string cls = "border-right:1px solid #0094ff;";
         *  string li = "";
         *  foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows)
         *  {
         *      DataFunctions objcate = new DataFunctions();
         *      DataTable dt1 = new DataTable();
         *      dt = obj.PropertiesByCase(vList, Convert.ToInt32(dr["id"]), "State");
         *
         *      //li =" style='"+ ((ind > 4) ? "border-top:0px;" : "")+ (((ind++ % 5) == 4) ? cls : "")+"'";
         *
         *      string temp = "/" + country.ToLower().Replace(" ", "_") + "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *      states1 += "<li"+li +"><a href='" + temp + "' class='StateTitle'>" + dr["StateProvince"].ToString().Replace(" ", "&nbsp;") + "</a><br/> ";
         *      states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["StateProvince"]) +" ' title='" + Convert.ToString(dr["StateProvince"])  + "' /></div></a></li>";
         *      //states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["StateProvince"]) + " vacation rentals and boutique hotels in "+country+"' title='" + Convert.ToString(dr["StateProvince"]) + " vacation rentals and boutique hotels in " + country + "' /></div></a></li>";
         *      // states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' title='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' /></div></a></li>";
         *      //states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' title='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' /></div></a></li>";
         *      str_states += Convert.ToString(dr["StateProvince"]) + ", ";
         *      str_keyword += Convert.ToString(dr["StateProvince"]) + " " + country + ", ";
         *  }
         *  //rtLow3.Text = rtLow3.Text.Remove(rtLow3.Text.Length - 1, 1);
         *  rtHd3.InnerHtml = regionCountry + " Countries: ";
         *
         *
         *
         *
         *
         *  Statesul.InnerHtml = states1;
         *  //Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
         *
         *
         *
         *  //For the meta tag
         *  str_meta = "(%number%) %country% vacation rentals and boutique hotels in %states% etc.";
         *  str_meta = str_meta.Replace("%country%", country).Replace("%states%", str_states).Replace("%number%", Convert.ToString(num_properties));
         *  str_keyword = str_keyword + "etc.";
         */
        //For meta tag
        int    num_states = ds_allinfo.Tables[1].Rows.Count;
        string str_states = "";

        for (int ind_state = 0; ind_state < num_states; ind_state++)
        {
            string  comma = (ind_state == (num_states - 1)) ? "" : ", ";
            DataRow row   = ds_allinfo.Tables[1].Rows[ind_state];
            str_states  += (row["StateProvince"].ToString() + comma);
            str_keyword += String.Format("{0} {1}{2}", row["StateProvince"].ToString(), country, comma);
        }

        string num_properties = ds_allinfo.Tables[3].Rows[0][0].ToString();

        if (num_states == 0)
        {
            Response.Redirect("/default.aspx");
        }
        // str_meta = String.Format("({0}) {1} vacation rentals and boutique hotels in {2} etc.", num_properties, country, str_states);
        str_meta    = String.Format("Explore {0} while staying in our vacation rentals and boutique hotels.", country);
        str_keyword = str_keyword + " etc.";


        //For google map
        List <SqlParameter> sparam = new List <SqlParameter>();

        sparam.Add(new SqlParameter("@countryid", countryid));
        ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCountry", sparam);

        markers = CommonProvider.getMarkersJsonString(ds_citylocations);
        sparam.Clear();
        sparam.Add(new SqlParameter("@country", country));
        ds_airports      = BookDBProvider.getDataSet("usp_list_airports_bycountry", sparam);
        airports_markers = CommonProvider.getMarkersJsonString(ds_airports, "airport");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@country", "England"));
        DataSet airports = BookDBProvider.getDataSet("usp_list_allairports_bycountry", param);

        //For the english ....
        if (airports.Tables.Count > 0)
        {
            int rows = airports.Tables[0].Rows.Count;
            for (int i = 0; i < rows; i++)
            {
                DataRow row = airports.Tables[0].Rows[i];
                string  lat = row["latitude"].ToString();
                string  lan = row["longitude"].ToString();
                //string requestUri = string.Format("http ://maps.googleapis.com/maps/api/geocode/json?address={0}&sensor=false", key=AIzaSyD5PJ9egY0xvdrEKU_MFSDqKKxTCT4vwJM&);
                string      requestUri = string.Format("https://maps.googleapis.com/maps/api/geocode/json?latlng={0},{1}&key=AIzaSyD5PJ9egY0xvdrEKU_MFSDqKKxTCT4vwJM&sensor=false", lat, lan);
                WebRequest  request    = WebRequest.Create(requestUri);
                WebResponse response   = request.GetResponse();

                string result = "";
                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                {
                    result = reader.ReadToEnd();
                    //Response.Write(result);
                    JObject json_result = JObject.Parse(result);
                    JArray  addr_results = (JArray)json_result["results"];
                    string  country, state, city, addr;
                    foreach (JObject address_obj in addr_results)
                    {
                        country = ""; state = ""; city = ""; addr = "";
                        JArray address_comp = (JArray)address_obj["address_components"];
                        foreach (JObject obj in address_comp)
                        {
                            JArray types = (JArray)obj["types"];
                            if (types.Count > 0)
                            {
                                if (types[0].ToString() == "administrative_area_level_1")
                                {
                                    country = obj["long_name"].ToString();
                                }
                                else if (types[0].ToString() == "administrative_area_level_2")
                                {
                                    state = obj["long_name"].ToString();
                                }
                                else if (types[0].ToString() == "locality")
                                {
                                    city = obj["long_name"].ToString();
                                }
                            }
                        }
                        addr = address_obj["formatted_address"].ToString();
                        Response.Write(String.Format("id:{3}==>{0}, {1}, {2} <br>", country, state, city, row["id"]));
                        //usp_update_airport_withcityid
                        param.Clear();
                        param.Add(new SqlParameter("@id", row["id"]));
                        param.Add(new SqlParameter("@country", country));
                        param.Add(new SqlParameter("@state", state));
                        param.Add(new SqlParameter("@city", city));
                        BookDBProvider.getDataSet("usp_update_airport_withcityid", param);
                        break;
                    }
                }
            }
        }
    }
示例#23
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");
        }
    }
示例#24
0
    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;
        }
    }
示例#25
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);
    }
示例#26
0
    public int UpdateRoomInfo()
    {   //Get Current room info
        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@propid", propid));
        DataSet ds_roomfurniture = BookDBProvider.getDataSet("uspGetRoomFurnitures", param);

        roomid_list.Clear();
        room_furniture_list.Clear();

        if (ds_roomfurniture.Tables.Count > 0)
        {
            foreach (DataRow row in ds_roomfurniture.Tables[0].Rows)
            {
                if (!roomid_list.Contains(row["RoomID"].ToString()))  //if existed roomid
                {
                    roomid_list.Add(row["RoomID"].ToString());
                }
                RoomInfoFurniture tmp = new RoomInfoFurniture();
                tmp.RoomID          = row["RoomID"].ToString();
                tmp.FurnitureItemID = row["FurnitureItemID"].ToString();
                if (!room_furniture_list.Contains(tmp))
                {
                    room_furniture_list.Add(tmp);
                }
            }
        }
        //For requested room infos
        char[] spliter = { ',' };

        if (Request["_roomids"] != null && Request["_roomids"].ToString() != "")
        {
            string[] req_roomid_list = Request["_roomids"].ToString().Split(spliter);
            string[] req_roomnames   = Request["_roomnames"].ToString().Split(new char[] { ',' });
            int      index           = 0;
            foreach (string req_roomid in req_roomid_list)
            {
                string req_roomname = req_roomnames[index++];
                if (roomid_list.Contains(req_roomid))//For existed room , furniture changes
                {
                    //Update RoomTitle
                    param.Clear();
                    param.Add(new SqlParameter("@id", req_roomid));
                    param.Add(new SqlParameter("@title", req_roomname));
                    param.Add(new SqlParameter("@method", 2));                       //update method
                    CommonProvider.getScalarValueFromDB("uspUpdateRoomInfo", param); //if return value = -1 error

                    UpdateFurnitureID(Request["room" + req_roomid].ToString(), req_roomid);

                    roomid_list.Remove(req_roomid);
                }
                else // New Room Info
                {
                    param.Clear();
                    param.Add(new SqlParameter("@title", req_roomname));
                    param.Add(new SqlParameter("@propid", propid));
                    param.Add(new SqlParameter("@method", 0));                                                     //add method
                    string newroomid = CommonProvider.getScalarValueFromDB("uspUpdateRoomInfo", param).ToString(); //if return value = -1 error
                    UpdateFurnitureID(Request["room" + req_roomid].ToString(), newroomid);
                }
            }
        }

        //For removed room info and furniture changes;
        foreach (string removed_roomid in roomid_list)
        {
            param.Clear();
            param.Add(new SqlParameter("@id", removed_roomid));
            param.Add(new SqlParameter("@method", 1)); //delete method
            string newroomid = CommonProvider.getScalarValueFromDB("uspUpdateRoomInfo", param).ToString();
        }
        foreach (RoomInfoFurniture removed_furniture in room_furniture_list)//Removed furniture changes;
        {
            if (removed_furniture.FurnitureItemID != null && removed_furniture.FurnitureItemID != "")
            {
                param.Clear();
                param.Add(new SqlParameter("@roomid", removed_furniture.RoomID));
                param.Add(new SqlParameter("@furid", removed_furniture.FurnitureItemID));
                param.Add(new SqlParameter("@method", 1));
                CommonProvider.getScalarValueFromDB("uspUpdatePropertyFurnitureID", param); //if return value = -1 error
            }
        }
        return(0);
    }
示例#27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!int.TryParse(Request["CountryID"].ToString(), out countryid))
        {
            countryid = 0;
        }
        if (countryid == 0)
        {
            return;
        }
        List <SqlParameter> sparam = new List <SqlParameter>();

        sparam.Add(new SqlParameter("@countryid", countryid));
        ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCountry", sparam);

        markers = CommonProvider.getMarkersJsonString(ds_citylocations);

        /*
         * ClientScriptManager cs = Page.ClientScript;
         * string url = Request.Url.AbsoluteUri;
         * string[] token = url.Split('/');
         *
         * //cs.RegisterStartupScript(Page.GetType(), "JSON", "alert(" + token.Length + ");", true);
         * if (Convert.ToInt32(Request.QueryString["StateProvinceID"]) != null && Convert.ToInt32(Request.QueryString["StateProvinceID"]) > 0)
         * {
         *  SqlConnection con = CommonFunctions.GetConnection();
         *  CitiesAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);
         *  CitiesAdapter.SelectCommand.Parameters.Add("@StateId", SqlDbType.Int);
         *  CitiesAdapter.SelectCommand.Parameters["@StateId"].Value = Convert.ToInt32(Request.QueryString["StateProvinceID"]);
         *
         *
         *  //cs.RegisterStartupScript(Page.GetType(), "JSON", "alert(" + Convert.ToInt32(Request.QueryString["StateProvinceID"]) + ");", true);
         *
         *  DataTable dt = new DataTable();
         *  CitiesAdapter.Fill(dt);
         *  List<Location> eList = new List<Location>();
         *  string maxLat = "";
         *  string maxLong = "";
         *  foreach (DataRow dr in dt.Rows)
         *  {
         *      try
         *      {
         *          Location e1 = new Location();
         *          e1.title = dr["City"].ToString();
         *          e1.lat = Convert.ToDouble(dr["Latitude"]);
         *          e1.lng = Convert.ToDouble(dr["Longitude"]); ;
         *          e1.description = dr["City"].ToString();
         *          string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") +
         *           "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *          e1.URL = temp;
         *          eList.Add(e1);
         *      }
         *      catch { }
         *  }
         *  // Response.Write(CitiesAdapter.SelectCommand.CommandText);
         *  string ans = JsonConvert.SerializeObject(eList, Formatting.Indented);
         *
         *
         *
         *  // ClientScriptManager cs = Page.ClientScript;
         *  cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true);
         * }
         * else
         *  if (token.Length == 4)
         *  {
         *      SqlConnection con = CommonFunctions.GetConnection();
         *      CitiesAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesCountryId, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);
         *      CitiesAdapter.SelectCommand.Parameters.Add("@CountryID", SqlDbType.Int);
         *      CitiesAdapter.SelectCommand.Parameters["@CountryID"].Value = Convert.ToInt32(Request.QueryString["CountryID"]);
         *
         *      DataTable dt = new DataTable();
         *      CitiesAdapter.Fill(dt);
         *      List<Location> eList = new List<Location>();
         *      string maxLat = "";
         *      string maxLong = "";
         *      foreach (DataRow dr in dt.Rows)
         *      {
         *          try
         *          {
         *              Location e1 = new Location();
         *              e1.title = dr["City"].ToString();
         *              e1.lat = Convert.ToDouble(dr["Latitude"]);
         *              e1.lng = Convert.ToDouble(dr["Longitude"]); ;
         *              e1.description = dr["City"].ToString();
         *              string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") +
         *               "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *              e1.URL = temp;
         *              eList.Add(e1);
         *          }
         *          catch { }
         *      }
         *      // Response.Write(CitiesAdapter.SelectCommand.CommandText);
         *      string ans = JsonConvert.SerializeObject(eList, Formatting.Indented);
         *
         *
         *
         *
         *      cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true);
         *  }
         */
    }
示例#28
0
    public JsonResult processRequest()
    {
        JsonResult jsonresult = new JsonResult();

        if (!AuthenticationManager.IfAuthenticated || !User.Identity.IsAuthenticated)
        {
            jsonresult.error = "Not Signed";
            return(jsonresult);
        }
        else if (HttpContext.Current.Request.HttpMethod != "POST")
        {
            jsonresult.error = "The function works in POST method";
            return(jsonresult);
        }
        //else{}  //If the user is signed

        if (!Int32.TryParse(Request["propid"], out propid))
        {
            propid = -1;
        }

        //Validate parameters from the request
        int wizard_step = -1;

        if (!Int32.TryParse(Request["wizardstep"], out wizard_step))
        {
            wizard_step = -1;
        }
        if (wizard_step == -1)
        {
            jsonresult.error = "Wizard Step is not set.";
            return(jsonresult);
        }
        if (!ValdateWizardStep(wizard_step))  //Valdation for step parameters by step number
        {
            jsonresult.error = "Wizard Step is not set.";
            return(jsonresult);
        }

        if (wizard_step == 0 && (propid == -1 || propid == 0))
        {
            propid = createNewProperty();
            if (propid == -1)
            {
                jsonresult.error = "Server something wrong error: get new property id";
                return(jsonresult);
            }
        }
        else //For the existed property
        {
            if (propid == -1 || propid == 0)
            {
                jsonresult.error = "Server something wrong error: step is not 0, and propid is -1";
                return(jsonresult);
            }
            propinfo = AjaxProvider.getPropertyDetailInfo(propid);
            if (propinfo.UserID != userid && !AuthenticationManager.IfAdmin)
            {
                jsonresult.error = "You are trying to do malicious action. Property doesn't include to you.";
                return(jsonresult);
            }
            if (UpdatePropertyInfo(wizard_step) == -1)
            {
                jsonresult.error = "Server something wrong error: update property info step " + wizard_step;
                return(jsonresult);
            }
        }

        List <SqlParameter> param = new List <SqlParameter>();

        if (propid > 0)
        {
            propinfo            = AjaxProvider.getPropertyDetailInfo(propid); //Get the property id
            jsonresult.propinfo = propinfo;
            if (wizard_step == 1)
            {
                param.Add(new SqlParameter("@propid", propid));
                amenity_list            = MainHelper.getListFromDB <AmenityInfo>("uspGetPropertyAmenity", param);
                jsonresult.amenity_list = amenity_list;
                param.Clear();
                param.Add(new SqlParameter("@propid", propid));
                jsonresult.room_furniture = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetRoomFurnitures", param));
            }
            else if (wizard_step == 2)
            {
                param.Clear();
                param.Add(new SqlParameter("@propid", propid));
                jsonresult.attractions = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetPropertyAttractionByID", param));
            }
        }

        jsonresult.propid = propid;
        if (propid == propinfo.ID)
        {
            jsonresult.status = 0;
        }
        return(jsonresult);
    }
示例#29
0
    public int UpdateLocalAttraction()
    {
        List <_AttractionInfo> list_attractionobjects = new List <_AttractionInfo>();
        List <string>          list_cur_attracts      = new List <string>();

        List <SqlParameter> param = new List <SqlParameter>();

        param.Clear();
        param.Add(new SqlParameter("@propid", propid));
        DataSet ds_attraction = BookDBProvider.getDataSet("uspGetPropertyAttractionByID", param);

        if (ds_attraction.Tables.Count > 0)
        {
            foreach (DataRow row in ds_attraction.Tables[0].Rows)
            {
                _AttractionInfo tmp = new _AttractionInfo();
                tmp.attrid     = row["AttractionID"].ToString();
                tmp.distanceid = row["DistanceID"].ToString();
                list_attractionobjects.Add(tmp);
                list_cur_attracts.Add(tmp.attrid);
            }
        }

        ds_allattraction = BookDBProvider.getDataSet("uspGetAllAttraction", new List <SqlParameter>());
        List <string> list_attraction = new List <string>();

        foreach (DataRow row in ds_allattraction.Tables[0].Rows)
        {
            list_attraction.Add(row["ID"].ToString());
        }

        if (Request["attractids"] != null && Request["attractids"].ToString() != "")
        {
            string[] req_attractionids = Request["attractids"].ToString().Split(new char[] { ',' });
            string[] req_attractnear   = Request["attract_near"].ToString().Split(new char[] { ',' });
            foreach (string req_attractid in req_attractionids)
            {
                int index = list_attraction.IndexOf(req_attractid);
                if (index >= req_attractnear.Length)
                {
                    return(-1);
                }
                string attract_distanceid = req_attractnear[index];
                if (list_cur_attracts.Contains(req_attractid)) //Current attract
                {
                    foreach (_AttractionInfo tmp in list_attractionobjects)
                    {
                        if (tmp.attrid == req_attractid && tmp.distanceid != attract_distanceid) //Modified
                        {
                            param.Clear();
                            param.Add(new SqlParameter("@propid", propid));
                            param.Add(new SqlParameter("@attrid", req_attractid));
                            param.Add(new SqlParameter("@distanceid", attract_distanceid));
                            param.Add(new SqlParameter("@method", 2));
                            CommonProvider.getScalarValueFromDB("uspUpdatePropertyAttractionByID", param); //if return value = -1 error
                            break;
                        }
                    }
                    list_cur_attracts.Remove(req_attractid);
                }
                else //New attract
                {
                    param.Clear();
                    param.Add(new SqlParameter("@propid", propid));
                    param.Add(new SqlParameter("@attrid", req_attractid));
                    param.Add(new SqlParameter("@distanceid", attract_distanceid));
                    param.Add(new SqlParameter("@method", 0));
                    CommonProvider.getScalarValueFromDB("uspUpdatePropertyAttractionByID", param); //if return value = -1 error
                }
            }
        }
        foreach (string removed_attract in list_cur_attracts)
        {
            param.Clear();
            param.Add(new SqlParameter("@propid", propid));
            param.Add(new SqlParameter("@attrid", removed_attract));
            param.Add(new SqlParameter("@method", 1));
            CommonProvider.getScalarValueFromDB("uspUpdatePropertyAttractionByID", param); //if return value = -1 error
        }
        return(0);
    }
示例#30
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");
        }
    }