コード例 #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));
        }
    }
コード例 #2
0
ファイル: Coupons.aspx.cs プロジェクト: pen-tester/vabroad
    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>());
    }
コード例 #3
0
ファイル: Locations.aspx.cs プロジェクト: pen-tester/vabroad
    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);
    }
コード例 #4
0
ファイル: Coupons.aspx.cs プロジェクト: pen-tester/vabroad
 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>());
 }
コード例 #5
0
ファイル: Listings.aspx.cs プロジェクト: pen-tester/vabroad
    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
    }
コード例 #6
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);
    }
コード例 #7
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);
    }
コード例 #8
0
ファイル: PwdReset.aspx.cs プロジェクト: pen-tester/vabroad
    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;
        }
    }
コード例 #9
0
ファイル: Locations.aspx.cs プロジェクト: pen-tester/vabroad
    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.";
            }
        }
    }
コード例 #10
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 />");
    }
コード例 #11
0
ファイル: Coupons.aspx.cs プロジェクト: pen-tester/vabroad
    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);
    }
コード例 #12
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);
                    }
                }
            }
        }
    }
コード例 #13
0
ファイル: Reset.aspx.cs プロジェクト: pen-tester/vabroad
    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;
            }
        }
    }
コード例 #14
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();
    }
コード例 #15
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");
    }
コード例 #16
0
    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;
                    }
                }
            }
        }
    }
コード例 #17
0
ファイル: Locations.aspx.cs プロジェクト: pen-tester/vabroad
    protected void CityAdd_Click(object sender, System.EventArgs e)
    {
        EnterCity.Validate();
        InvalidCity.Validate();

        if (!EnterCity.IsValid || !InvalidCity.IsValid)
        {
            return;
        }


        LatLongInfo latinfo = MainHelper.getCityLocation(NewCity.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
        {
            DataRow newrow = CitiesSet.Tables["Cities"].NewRow();

            newrow["City"] = NewCity.Text;
            try
            {
                newrow["StateProvinceID"] = Convert.ToInt32(StateList.SelectedValue);

                CitiesSet.Tables["Cities"].Rows.Add(newrow);

                //lock (CommonFunctions.Connection)
                CitiesAdapter.Update(CitiesSet);
                List <SqlParameter> param = new List <SqlParameter>();
                param.Add(new SqlParameter("@stateid", StateList.SelectedValue));
                param.Add(new SqlParameter("@city", NewCity.Text));
                param.Add(new SqlParameter("@lat", latinfo.latitude));
                param.Add(new SqlParameter("@lng", latinfo.longitude));
                BookDBProvider.getDataSet("uspAddLatLong", param);
                Finish();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

/*
 *
 *
 *                  List<SqlParameter> param = new List<SqlParameter>();
 *                  param.Add(new SqlParameter("@country", country));
 *                  param.Add(new SqlParameter("@state", state));
 *                  param.Add(new SqlParameter("@city", city));
 *                  param.Add(new SqlParameter("@lat", latitude));
 *                  param.Add(new SqlParameter("@lng", longtitude));
 *                  BookDBProvider.getDataSet("uspAddLatLong", param);
 *
 */
    }
コード例 #18
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);
    }
コード例 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (HttpContext.Current.Request.HttpMethod != "POST")
        {
            Response.Write("Wrong request");
            return;
        }

        context = HttpContext.Current;

        parseTransaction();
        PaymentHelper.addPaymentLog(transitem);

        email_resp = BookResponseEmail.getResponseInfo(transitem.item_number); //respid
                                                                               // if (email_resp.ID == 0 || email_resp.IsValid < 1) Response.Redirect("/Error.aspx?error=Wrong Response number or not valid");

        inquiryinfo = BookDBProvider.getQuoteInfo(email_resp.QuoteID);
        owner_info  = BookDBProvider.getDetailedUserInfo(inquiryinfo.PropertyOwnerID);
        // traveler_info = BookDBProvider.getUserInfo(inquiryinfo.UserID);
        prop_info = AjaxProvider.getPropertyDetailInfo(inquiryinfo.PropertyID);



        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol  = (SecurityProtocolType)3072;

        //  string requestUriString = "https://www.sandbox.paypal.com/cgi-bin/webscr";
        string requestUriString = "https://www.paypal.com/cgi-bin/webscr";

        HttpWebRequest request =
            (HttpWebRequest)WebRequest.Create(requestUriString);

        string strFormValues = Encoding.ASCII.GetString(
            context.Request.BinaryRead(context.Request.ContentLength));

        // Set values for the request back
        request.Method      = "POST";
        request.ContentType = "application/x-www-form-urlencoded";
        string obj2 = strFormValues + "&cmd=_notify-validate";

        request.ContentLength = obj2.Length;

/*
 *      System.IO.StreamWriter file = new System.IO.StreamWriter(Server.MapPath("/logwrite.txt"));
 *      file.Write(obj2);
 *      file.Close();
 */
        // Write the request back IPN strings
        StreamWriter writer =
            new StreamWriter(request.GetRequestStream(), Encoding.ASCII);

        writer.Write(RuntimeHelpers.GetObjectValue(obj2));
        writer.Close();

        //send the request, read the response
        HttpWebResponse response       = (HttpWebResponse)request.GetResponse();
        Stream          responseStream = response.GetResponseStream();
        Encoding        encoding       = Encoding.GetEncoding("utf-8");
        StreamReader    reader         = new StreamReader(responseStream, encoding);
        string          resp           = reader.ReadToEnd();

        //_total_sum = email_resp.NightRate * inquiryinfo.Nights;
        _total_sum  = email_resp.NightRate;
        _lodgingval = _total_sum * email_resp.LoadingTax / 100;
        _balance    = _lodgingval + email_resp.CleaningFee + email_resp.SecurityDeposit;
        _total      = _total_sum + _balance;

        /*
         * System.IO.StreamWriter sfile = new System.IO.StreamWriter(Server.MapPath("/log.txt"));
         * sfile.Write(resp);
         * sfile.Close();
         */
        int discount;

        if (transitem.custom.Length == 13)
        {
            List <SqlParameter> param = new List <SqlParameter>();
            param.Add(new SqlParameter("@coupon", transitem.custom));

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

                _total = _total_sum * (100 - discount) / 100 + _balance;
            }
        }

        _total = Decimal.Parse(BookDBProvider.DoFormat(_total));


        if (resp == "VERIFIED")
        {
            //if(transitem.business == ConfigurationManager.AppSettings["PaypalEmail"].ToString() && transitem.txn_type!= "reversal")

/*            System.IO.StreamWriter ssfile = new System.IO.StreamWriter(Server.MapPath("/logt.txt"));
 *          ssfile.Write(resp);
 *          ssfile.Close();
 */
            // if (transitem.business == "*****@*****.**" && transitem.txn_type != "reversal")
            if (transitem.business == ConfigurationManager.AppSettings["PaypalEmail"].ToString() && transitem.txn_type != "reversal")
            {
                if ((transitem.mc_gross == (_total)) && transitem.payment_status == "Completed" && transitem.mc_currency == currency_type[email_resp.CurrencyType])
                {
                    PaymentHelper.addPaymentHistory(transitem, inquiryinfo);


                    BookResponseEmail.updateEmailResponseState(transitem.item_number);

                    string format_traveler = @"This is your receipt for your reservation with Vacations-Abroad.com <br/>
This email confirms that {0} has booked a reservation with {1}. <br/>
Your Arrival Date is: {2} <br/>
You paid: {3} {4} on {5} <br/>
The owner’s cancellation policy is <br/>
90 days prior to arrival:{6}% <br/>
60 days prior to arrival:{7}% <br/>
30 days prior to arrival:{8}% <br/>

Owner Contact Details <br/>
Owner Name:{9} <br/>
Owner Email:{10} <br/>
Owner Telephone:{11} <br/>
Name of Property:{1} <br/>
Owner Website: {12} <br/>
Please contact the owner to obtain the actual property address. <br/>
If you do not cancel, the funds will be transferred to the owner on (7 days prior to your {13}) <br/>
When you return, please write a review of the property and add photos. <br/>";

                    string msg_traveler = String.Format(format_traveler, inquiryinfo.ContactorName, prop_info.PropertyName, DateTime.Parse(inquiryinfo.ArrivalDate).ToString("MMM d, yyyy"),
                                                        transitem.mc_gross, transitem.mc_currency, DateTime.Now.ToString("MMM d, yyyy"), email_resp.Cancel90, email_resp.Cancel60, email_resp.Cancel30
                                                        , String.Format("{0} {1}", owner_info.FirstName, owner_info.LastName), owner_info.Email,
                                                        owner_info.MobileTelephone, owner_info.Website, DateTime.Parse(inquiryinfo.ArrivalDate).ToString("MMM d, yyyy"));

                    string trv_subject = String.Format("Reservation Confirmation for {0}", DateTime.Now.ToString("MMM d, yyyy"));
                    BookDBProvider.SendEmail(inquiryinfo.ContactorEmail, trv_subject, msg_traveler);

                    string format_owner  = @"This is a confirmation for the reservation completed through Vacations-Abroad.com <br/>
This email confirms that {0} has booked a reservation with {1}. <br/>
Arrival Date is: {2} <br/>
They have paid: {3} {4} on {5} <br/>
The owner’s cancellation policy is <br/>
90 days prior to arrival:{6}% <br/>
60 days prior to arrival:{7}% <br/>
30 days prior to arrival:{8}% <br/><br/>
Traveler Contact Details <br/><br/>
Traveler Name:{9} <br/>
Traveler Email:{10} <br/>
Traveler Telephone:{11} <br/><br/> 
Please contact the traveler to provide them with directions to your property and inform them of any check-in procedures. <br/>
If the Traveler does not cancel, the funds will be transferred to your Paypal or bank account  (7 days prior to your {2}) less a 10% commission fee. If any fees such as cleaning fees, security deposit or lodging taxes are to be collected by you at arrival. <br/>
You have specified these additional fees are due at arrival. <br/>
Cleaning:{12} {4} <br/>
Security Deposit:{13} {4}<br/>
Lodging Tax:{14} {4}<br/><br/>

Let us know if we can be of further assistance. <br/>
Linda Jenkins <br/>
770-687-6889 <br/>";
                    string owner_subject = String.Format("Reservation Confirmation for {0}", DateTime.Now.ToString("MMM d, yyyy"));
                    string msg_owner     = String.Format(format_owner, inquiryinfo.ContactorName, prop_info.PropertyName
                                                         , DateTime.Parse(inquiryinfo.ArrivalDate).ToString("MMM d, yyyy"), transitem.mc_gross, transitem.mc_currency,
                                                         DateTime.Now.ToString("MMM d, yyyy"), email_resp.Cancel90, email_resp.Cancel60, email_resp.Cancel30,
                                                         inquiryinfo.ContactorName, inquiryinfo.ContactorEmail, inquiryinfo.Telephone,
                                                         BookDBProvider.DoFormat(email_resp.CleaningFee), BookDBProvider.DoFormat(email_resp.SecurityDeposit), BookDBProvider.DoFormat(_lodgingval));
                    BookDBProvider.SendEmail(owner_info.Email, owner_subject, msg_owner);
                    BookDBProvider.SendEmail("*****@*****.**", String.Format("{0} has paid for property {1} Transaction:{2}", inquiryinfo.ContactorName, transitem.item_number, transitem.txn_id), msg_owner);
                    BookDBProvider.SendEmail("*****@*****.**", "Notification: Transaction:" + transitem.txn_id, msg_owner);
                }
            }
        }
        else
        {
        }
    }
コード例 #20
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //Check the state province id;
        if (!Int32.TryParse(Request["StateProvinceID"].ToString(), out stateprovinceid))
        {
            stateprovinceid = -1;
        }
        if (stateprovinceid == -1)
        {
            Response.Redirect("/internalerror.aspx");
        }

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

        sparam.Add(new SqlParameter("@stateid", stateprovinceid));

        countryinfo     = CommonProvider.ConvertToClassFromDataSet <CountryInfoWithCityID>(BookDBProvider.getDataSet("uspGetCountryInfoWithStateID", sparam));
        str_propcate[0] = String.Format("{0} {1}", countryinfo.StateProvince, str_propcate[0]);
        str_propcate[1] = String.Format("{0} {1}", countryinfo.StateProvince, str_propcate[1]);

        //For H1 title, state province text, links
        hyperRegion.NavigateUrl           = "/" + countryinfo.Region.ToLower().Replace(" ", "_") + "/default.aspx";
        hyplnkCountryBackLink.NavigateUrl = "/" + countryinfo.Country.ToLower().Replace(" ", "_") + "/default.aspx";


        ltrHeading.Text = String.Format("{0} Vacation Rentals and Boutique Hotels", countryinfo.StateProvince);

        //For stepbox radio button value, description text
        if (!IsPostBack)
        {
            txtCityText.Text  = Server.HtmlDecode(countryinfo.CityText).Replace("<br />", Environment.NewLine);
            txtCityText2.Text = Server.HtmlDecode(countryinfo.CityText2).Replace("<br />", Environment.NewLine);
            //txtCityText2.Text = countryinfo.CityText2;
            rproptype_id = 0;
            rbedroom_id  = 0;
            ramenity_id  = 0;
            rsort_id     = 0;
            pagenum      = 0;
        }
        else
        {
            rproptype_id = Int32.Parse(Request.Form["proptype"]);
            rbedroom_id  = Int32.Parse(Request.Form["roomnums"]);
            ramenity_id  = Int32.Parse(Request.Form["amenitytype"]);
            rsort_id     = Int32.Parse(Request.Form["pricesort"]);
            pagenum      = Int32.Parse(Request.Form["pagenums"]);
        }


        ltrH1.Text       = countryinfo.StateProvince + " Vacations";
        lblcityInfo.Text = Server.HtmlDecode(countryinfo.CityText).Replace(Environment.NewLine, "<br />");
        if (countryinfo.CityText == null || countryinfo.CityText == "")
        {
            lblcityInfo.Text = String.Format("Vacations-abroad.com is a {0} {1} vacation rental directory of short term {0} vacation condos, privately owned {0} villas and {0} rentals by owner. Our unique and exotic boutique {0} hotels and luxury {0} resorts are perfect {0} {1} rentals for family and groups that are looking for vacation rentals in {0} {1}", countryinfo.City, countryinfo.Country);
            txtCityText.Text = String.Format("Vacations-abroad.com is a {0} {1} vacation rental directory of short term {0} vacation condos, privately owned {0} villas and {0} rentals by owner. Our unique and exotic boutique {0} hotels and luxury {0} resorts are perfect {0} {1} rentals for family and groups that are looking for vacation rentals in {0} {1}", countryinfo.City, countryinfo.Country);
        }

        //Get the step box value

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

        for (int i = 0; i < 4; i++)
        {
            numparam.Clear();
            numparam.Add(new SqlParameter("@stateid", stateprovinceid));
            numparam.Add(new SqlParameter("@roomnum", i));
            numparam.Add(new SqlParameter("@amenityid", ramenity_id));
            numparam.Add(new SqlParameter("@proptype", rproptype_id));
            bedroominfo[i] = CommonProvider.getScalarValueFromDB("uspGetStatePropNumsByCondition", numparam);
        }

        for (int i = 0; i < 5; i++)
        {
            numparam.Clear();
            numparam.Add(new SqlParameter("@stateid", stateprovinceid));
            numparam.Add(new SqlParameter("@roomnum", rbedroom_id));
            numparam.Add(new SqlParameter("@proptype", rproptype_id));
            numparam.Add(new SqlParameter("@amenityid", amenity_id[i]));
            amenity_nums[i] = CommonProvider.getScalarValueFromDB("uspGetStatePropNumsByCondition", numparam);
        }

        for (int i = 0; i < 3; i++)
        {
            numparam.Clear();
            numparam.Add(new SqlParameter("@stateid", stateprovinceid));
            numparam.Add(new SqlParameter("@proptype", prop_typeval[i]));
            // numparam.Add(new SqlParameter("@roomnum", rbedroom_id));
            //numparam.Add(new SqlParameter("@proptype", rproptype_id));
            // numparam.Add(new SqlParameter("@amenityid", ramenity_id));
            prop_nums[i] = CommonProvider.getScalarValueFromDB("uspGetStatePropNumsByCondition", numparam);
        }


        //Get the property list for the state province

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

        dsparam.Add(new SqlParameter("@stateid", stateprovinceid));
        dsparam.Add(new SqlParameter("@proptype", rproptype_id));
        dsparam.Add(new SqlParameter("@roomnum", rbedroom_id));
        dsparam.Add(new SqlParameter("@amenityid", ramenity_id));
        dsparam.Add(new SqlParameter("@ratesort", rsort_id));
        ds_PropList = BookDBProvider.getDataSet("uspGetStatePropListByCondition", dsparam);

        if (!IsPostBack)
        {
            if (ds_PropList.Tables[0].Rows.Count == 0)
            {
                Response.StatusCode = 404;
                // Response.Status = "There is no state province";
                Response.End();
            }
        }

        //Get the city location info
        List <SqlParameter> param = new List <SqlParameter>();

        param.Clear();
        param.Add(new SqlParameter("@stateid", stateprovinceid));
        param.Add(new SqlParameter("@proptype", rproptype_id));
        param.Add(new SqlParameter("@roomnum", rbedroom_id));
        param.Add(new SqlParameter("@amenityid", ramenity_id));
        ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCondition", param);
        markers          = CommonProvider.getMarkersJsonString(ds_citylocations);

        sparam.Clear();
        sparam.Add(new SqlParameter("@state", countryinfo.StateProvince));
        ds_airports     = BookDBProvider.getDataSet("usp_list_airports_bystate", sparam);
        airport_markers = CommonProvider.getMarkersJsonString(ds_airports, "airport");


        lblInfo2.Text = Server.HtmlDecode(countryinfo.CityText2).Replace(Environment.NewLine, "<br />");

        param.Clear();
        param.Add(new SqlParameter("@stateid", stateprovinceid));
        //For state list
        ds_statelist = BookDBProvider.getDataSet("uspGetStateNameListbyCondition", param);

        int citycount = ds_citylocations.Tables[0].Rows.Count;

        for (int stid = 0; stid < citycount; stid++)
        {
            DataRow drow  = ds_citylocations.Tables[0].Rows[stid];
            string  comma = (stid == (citycount - 1)) ? "" : ", ";
            city_lists += (drow["City"] + comma);
            list_city.Add(drow["City"].ToString());
        }

        /*
         *
         *      HtmlHead head = Page.Header;
         *
         *
         *
         *
         *      //FillCitiesColumn();
         *      /* HtmlMeta description = new HtmlMeta();
         *
         *       description.Name = "description";
         *       description.Content = Description.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
         *           Replace("%cities%", cities);
         *       // Description OVER RIDE area
         *
         *       string DescripReplacement = MainDataSet.Tables["Location"].Rows[0]["descriptionoverride"].ToString();
         *       if (DescripReplacement.Length > 0)
         *           description.Content = DescripReplacement;
         *      description.Content = "Plan your next " + stateprovince + " vacation: where to stay and places to visit!";
         *
         *      head.Controls.Add(description);
         *      /////
         *      List<SqlParameter> param = new List<SqlParameter>();
         *      param.Add(new SqlParameter("@stid", stateprovinceid));
         *      ds_PTypeNum = BookDBProvider.getDataSet("uspGetPropNumListbyState", param);
         *
         * ///*       if (!IsPostBack)
         * //      {
         *          List<SqlParameter> sparam = new List<SqlParameter>();
         *          sparam.Add(new SqlParameter("@stid", stateprovinceid));
         *          ds_PropList = BookDBProvider.getDataSet("uspGetStatePropList", sparam);
         *
         *           sparam.Clear();
         *          sparam.Add(new SqlParameter("@stid", stateprovinceid));
         *          ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCondition", sparam);
         *
         *      markers = CommonProvider.getMarkersJsonString(ds_citylocations);
         *      // }
         *
         *      if (IsPostBack)
         *      {
         *          ptype = int.Parse(Request["ptypes"]);
         *          psleep = int.Parse(Request["psleep"]);
         *      }
         *
         *      for (int i=0; i < 4; i++)
         *      {
         *          param.Clear();
         *          param.Add(new SqlParameter("@stid", stateprovinceid));
         *          param.Add(new SqlParameter("@sleep", i));
         *          param.Add(new SqlParameter("@ptype", ptype));
         *          DataSet ds_tmp = BookDBProvider.getDataSet("uspGetStatePropNumListbySleep",param);
         *          sleeps[i] = int.Parse(ds_tmp.Tables[0].Rows[0]["Num"].ToString());
         *      }
         *
         *
         *
         *
         *      Page page1 = (Page)HttpContext.Current.Handler;
         *
         *
         *      HtmlMeta newdescription = new HtmlMeta();
         *
         *      int counts = AjaxProvider.getPropertyNumsbyState(stateprovinceid);
         *
         *      string str_meta = "(%counts%) %state% vacation rentals and boutique hotels in %cities%.";
         *      newdescription.Name = "description";
         *      newdescription.Content = str_meta.Replace("%state%", stateprovince ).Replace("%cities%", str_cities).Replace("%counts%", ds_PropList.Tables[0].Rows.Count.ToString());
         *
         *      head.Controls.Add(newdescription);
         *
         *
         *
         *      HtmlMeta keywords = new HtmlMeta();
         *
         *      keywords.Name = "keywords";
         *      keywords.Content = Keywords.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
         *          Replace("%cities%", cities);
         *      keywords.Content = page1.Title;
         *      head.Controls.Add(keywords);
         *     // ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = page1.Title;
         *     // Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
         */
    }
コード例 #21
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);
    }
コード例 #22
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);
    }
コード例 #23
0
ファイル: Maps.aspx.cs プロジェクト: pen-tester/vabroad
    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);
         *  }
         */
    }
コード例 #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
    public List <SqlParameter> getParamListBasicInfo(int newid)
    {
        List <SqlParameter> param = new List <SqlParameter>();

        try {
            if (Request["citylist"].ToString() == "0")
            {
                string newcity   = Request["additionalcity"];
                int    stateid   = int.Parse(Request["statelist"]);
                int    newcityid = createNewCity(stateid, newcity);
                if (newcityid == -1)
                {
                    return(null);
                }
                param.Add(new SqlParameter("@CityID", newcityid));

                if (Request["statename"] != null && Request["countryname"] != null)
                {
                    LatLongInfo latinfo = MainHelper.getCityLocation(newcity, Request["statename"].ToString(), Request["countryname"].ToString());
                    if (latinfo.status == 0) //Fail to get location info
                    {
                        error_msg = String.Format("Fail to get {0} location.", newcity);
                    }
                    else if (latinfo.status == 1) //Fail to verify the address
                    {
                        error_msg = String.Format("Fail to verify the location of {0}.", newcity);
                    }
                    else  //Success to get the latitude and longitude
                    {
                        try
                        {
                            //Update
                            List <SqlParameter> tmpparam = new List <SqlParameter>();
                            tmpparam.Add(new SqlParameter("@stateid", stateid));
                            tmpparam.Add(new SqlParameter("@city", newcity));
                            tmpparam.Add(new SqlParameter("@lat", latinfo.latitude));
                            tmpparam.Add(new SqlParameter("@lng", latinfo.longitude));
                            BookDBProvider.getDataSet("uspAddLatLong", tmpparam);
                        }
                        catch
                        {
                            error_msg = "Something is wrong.";
                        }
                    }
                }
            }
            else
            {
                param.Add(new SqlParameter("@CityID", Request["citylist"]));
            }

            param.Add(new SqlParameter("@ID", newid));
            param.Add(new SqlParameter("@UserID", userid));
            // param.Add(new SqlParameter("@UserID", 7332));
            param.Add(new SqlParameter("@Name", Request["_propname"]));
            param.Add(new SqlParameter("@Name2", Request["_propname2"]));
            param.Add(new SqlParameter("@VirtualTour", Request["_virttour"]));
            param.Add(new SqlParameter("@Address", Request["_propaddr"]));
            param.Add(new SqlParameter("@IfShowAddress", Request["_propdisplay"]));
            param.Add(new SqlParameter("@NumBedrooms", Request["_propbedroom"]));
            param.Add(new SqlParameter("@NumBaths", Request["_propbathrooms"]));
            param.Add(new SqlParameter("@NumSleeps", Request["_propsleep"]));
            param.Add(new SqlParameter("@MinimumNightlyRentalID", Request["_propminrental"]));
            param.Add(new SqlParameter("@NumTVs", Request["_proptv"]));
            param.Add(new SqlParameter("@NumVCRs", 0));
            param.Add(new SqlParameter("@NumCDPlayers", Request["_propcd"]));
            param.Add(new SqlParameter("@DateAdded", DateTime.Now));
            param.Add(new SqlParameter("@DateStartViewed", DateTime.Now));

            string newtype      = Request["additional_type"];
            int    categorytype = int.Parse(Request["propcategory"]);
            int    newtypeid    = createNewPropertyType(categorytype, newtype);
            if (newtypeid == -1)
            {
                return(null);
            }
            param.Add(new SqlParameter("@TypeID", newtypeid));
        }
        catch (Exception ex)
        {
            throw ex;
            return(null);
        }
        return(param);
    }