Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Events/Add");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Events/Add");
            }

            if (!IsPostBack)
            {
                Classes.Locations l = new Classes.Locations();
                DataTable dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }

                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                if (locationId == 0)
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = locationId;

                    DataTable dtLocation = l.locationInfoOnlyId(locationId);

                    locationCity(Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString()));
                    locationState(Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString()));
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString();
                    DropDownListState.SelectedValue = dtLocation.Rows[0]["StateId"].ToString();
                    DropDownListCity.SelectedValue = locationId.ToString();
                }
            }

        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Events/Add");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Events/Add");
            }

            if (!IsPostBack)
            {
                Classes.Locations l           = new Classes.Locations();
                DataTable         dtCountries = l.countriesList();

                List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }

                Classes.UserInfo ui = new Classes.UserInfo();
                int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                if (locationId == 0)
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = locationId;

                    DataTable dtLocation = l.locationInfoOnlyId(locationId);

                    locationCity(Convert.ToInt32(dtLocation.Rows[0]["StateId"].ToString()));
                    locationState(Convert.ToInt32(dtLocation.Rows[0]["CountryId"].ToString()));
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryId"].ToString();
                    DropDownListState.SelectedValue   = dtLocation.Rows[0]["StateId"].ToString();
                    DropDownListCity.SelectedValue    = locationId.ToString();
                }
            }
        }
Example #3
0
        void locationCountry()
        {
            DataTable dt;

            Classes.Locations l = new Classes.Locations();
            dt = l.countriesList();

            DropDownListCountry.Items.Clear();
            DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DropDownListCountry.Items.Add(new ListItem(dt.Rows[i]["CountryName"].ToString(), dt.Rows[i]["CountryCode"].ToString()));
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }
            }
        }
Example #5
0
        void locationCountry()
        {
            DataTable dt;

            Classes.Locations l = new Classes.Locations();
            dt = l.countriesList();

            List <System.Web.UI.WebControls.ListItem> states = new List <System.Web.UI.WebControls.ListItem>();

            DropDownListState.Items.Clear();
            DropDownListState.Items.Add(new ListItem("Select Country", "0"));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DropDownListState.Items.Add(new ListItem(dt.Rows[i]["CountryName"].ToString(), dt.Rows[i]["CountryId"].ToString()));
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable         dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Completion");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Completion");
            }

            //check if user entered these information before
            Classes.UserInfo ui = new Classes.UserInfo();

            if (ui.getUserStatus(UserId) != 0) //if user not logged in redirect to login
            {
                //Response.Redirect("~/Explore");
            }

            if (!IsPostBack)
            {
                DataTable         dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //check login
            int UserId = 0;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                UserId = ls.getUserId(VC);
                if (UserId == 0) //if user not logged in redirect to login
                {
                    Response.Redirect("~/Login/Completion");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Completion");
            }

            //check if user entered these information before
            Classes.UserInfo ui = new Classes.UserInfo();

            if (ui.getUserStatus(UserId) != 0) //if user not logged in redirect to login
            {
                //Response.Redirect("~/Explore");
            }

            if (!IsPostBack)
            {
                DataTable dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryId"].ToString()));
                }
            }
        }
Example #9
0
        void locationCountry()
        {
            DataTable dt;
            Classes.Locations l = new Classes.Locations();
            dt = l.countriesList();

            DropDownListCountry.Items.Clear();
            DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DropDownListCountry.Items.Add(new ListItem(dt.Rows[i]["CountryName"].ToString(), dt.Rows[i]["CountryCode"].ToString()));
            }
        }
Example #10
0
        protected void getDataLocation()
        {
            hidePanels();
            PanelLocation.Visible = true;

            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlDataAdapter sda = new SqlDataAdapter("sp_settingsLocationGet", sqlConn);
            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);

            //try
            //{
                sda.Fill(ds);
                dt = ds.Tables[0];
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
                sqlConn.Close();
                sda.Dispose();
                sqlConn.Dispose();
            //}

            if (dt.Rows.Count == 0)// Profile doesn't exist
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                if (!IsPostBack)
                {
                    Classes.Locations l = new Classes.Locations();
                    DataTable dtCountries = l.countriesList();

                    List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                    DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                    for (int i = 0; i < dtCountries.Rows.Count; i++)
                    {
                        DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                    }

                    Classes.UserInfo ui = new Classes.UserInfo();
                    int locationId = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    if (locationId == 0)
                    {
                        DropDownListCountry.SelectedValue = "0";
                    }
                    else
                    {
                        string countryCode = l.locationInfoOnlyId(locationId);

                        locationCity(countryCode);
                        DropDownListCountry.SelectedValue = countryCode;
                        DropDownListCity.SelectedValue = locationId.ToString();
                    }

                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                    }
                }

                if (dt.Rows[0]["LocationId"].ToString() == "0")
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int cityId = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());
                    DataTable dtLocation = new DataTable();
                    DataSet dsLocation = new DataSet();
                    SqlConnection sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlDataAdapter sdaLocation = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation);
                    sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId;

                    //try
                    //{
                        sdaLocation.Fill(dsLocation);
                        dtLocation = dsLocation.Tables[0];
                    //}
                    //catch (Exception ex)
                    //{

                    //}
                    //finally
                    //{
                        sqlConnLocation.Close();
                        sdaLocation.Dispose();
                        sqlConnLocation.Dispose();
                    //}

                    locationCity(dtLocation.Rows[0]["CountryCode"].ToString());
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString();
                    DropDownListCity.SelectedValue = dt.Rows[0]["LocationId"].ToString();
                }

            }
        }
Example #11
0
        protected void getDataLocation()
        {
            hidePanels();
            PanelLocation.Visible = true;

            DataTable      dt      = new DataTable();
            DataSet        ds      = new DataSet();
            SqlConnection  sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlDataAdapter sda     = new SqlDataAdapter("sp_settingsLocationGet", sqlConn);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);

            //try
            //{
            sda.Fill(ds);
            dt = ds.Tables[0];
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
            sqlConn.Close();
            sda.Dispose();
            sqlConn.Dispose();
            //}

            if (dt.Rows.Count == 0)// Profile doesn't exist
            {
                Response.Redirect("~/Error/NoProfileForSettings");
            }
            else
            {
                if (!IsPostBack)
                {
                    Classes.Locations l           = new Classes.Locations();
                    DataTable         dtCountries = l.countriesList();

                    List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                    DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                    for (int i = 0; i < dtCountries.Rows.Count; i++)
                    {
                        DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                    }

                    Classes.UserInfo ui = new Classes.UserInfo();
                    int locationId      = ui.locationIdByUserId(Convert.ToInt32(Session["UserId"]));

                    if (locationId == 0)
                    {
                        DropDownListCountry.SelectedValue = "0";
                    }
                    else
                    {
                        string countryCode = l.locationInfoOnlyId(locationId);

                        locationCity(countryCode);
                        DropDownListCountry.SelectedValue = countryCode;
                        DropDownListCity.SelectedValue    = locationId.ToString();
                    }

                    DataTable dtLocation = l.getLocationInfoByCityId(Convert.ToInt32(dt.Rows[0]["LocationId"].ToString()));
                    if (dtLocation.Rows.Count == 0)
                    {
                        LabelLocation.Text = "Not Available!";
                    }
                    else
                    {
                        LabelLocation.Text = dtLocation.Rows[0]["CityName"].ToString();
                    }
                }

                if (dt.Rows[0]["LocationId"].ToString() == "0")
                {
                    DropDownListCountry.SelectedValue = "0";
                }
                else
                {
                    int            cityId          = Convert.ToInt32(dt.Rows[0]["LocationId"].ToString());
                    DataTable      dtLocation      = new DataTable();
                    DataSet        dsLocation      = new DataSet();
                    SqlConnection  sqlConnLocation = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
                    SqlDataAdapter sdaLocation     = new SqlDataAdapter("sp_locationInfoOnlyId", sqlConnLocation);
                    sdaLocation.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sdaLocation.SelectCommand.Parameters.Add("@CityId", SqlDbType.Int).Value = cityId;

                    //try
                    //{
                    sdaLocation.Fill(dsLocation);
                    dtLocation = dsLocation.Tables[0];
                    //}
                    //catch (Exception ex)
                    //{

                    //}
                    //finally
                    //{
                    sqlConnLocation.Close();
                    sdaLocation.Dispose();
                    sqlConnLocation.Dispose();
                    //}

                    locationCity(dtLocation.Rows[0]["CountryCode"].ToString());
                    DropDownListCountry.SelectedValue = dtLocation.Rows[0]["CountryCode"].ToString();
                    DropDownListCity.SelectedValue    = dt.Rows[0]["LocationId"].ToString();
                }
            }
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2)
            {
                Response.Redirect("~/Maintenance.html");
            }

            //check login
            int UserId     = 0;
            int userStatus = 0;

            Classes.UserInfo ui = new Classes.UserInfo();
            if (Session["UserId"] != null)
            {
                UserId     = Convert.ToInt32(Session["UserId"]);
                userStatus = ui.getUserStatus(UserId);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Completion");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Completion");
                }
            }


            if (!IsPostBack)
            {
                //check if user entered these information before
                userStatus = ui.getUserStatus(UserId);
                if (userStatus != 0)
                {
                    if (userStatus != 4)
                    {
                        Response.Redirect("~/Done/Welcome");
                    }
                }

                if (userStatus == 4)
                {
                    Tuple <string, string, string, string> result = ui.fbCompletion(UserId);

                    TextBoxFirstName.Text            = result.Item1;
                    TextBoxLastName.Text             = result.Item2;
                    HiddenFieldHasPhoto.Value        = result.Item3;
                    DropDownListGender.SelectedValue = result.Item4;
                    if (Convert.ToBoolean(result.Item3))
                    {
                        HiddenFieldPhotoUrl.Value = "Files/Temp/" + UserId.ToString() + "-100.jpg";
                    }
                }

                DataTable         dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List <System.Web.UI.WebControls.ListItem> countries = new List <System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                }
            }
        }
Example #13
0
        void locationCountry()
        {
            DataTable dt;
            Classes.Locations l = new Classes.Locations();
            dt = l.countriesList();

            List<System.Web.UI.WebControls.ListItem> states = new List<System.Web.UI.WebControls.ListItem>();
            DropDownListState.Items.Clear();
            DropDownListState.Items.Add(new ListItem("Select Country", "0"));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DropDownListState.Items.Add(new ListItem(dt.Rows[i]["CountryName"].ToString(), dt.Rows[i]["CountryId"].ToString()));
            }
        }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html");

            //check login
            int UserId = 0;
            int userStatus = 0;
            Classes.UserInfo ui = new Classes.UserInfo();
            if (Session["UserId"] != null)
            {
                UserId = Convert.ToInt32(Session["UserId"]);
                userStatus = ui.getUserStatus(UserId);
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    UserId = ls.getUserId(VC);
                    if (UserId == 0) //if user not logged in redirect to login
                    {
                        Response.Redirect("~/Login/Completion");
                    }
                    else
                    {
                        Session["UserId"] = UserId.ToString();
                    }
                }
                else
                {
                    Response.Redirect("~/Login/Completion");
                }
            }


            if (!IsPostBack)
            {
                //check if user entered these information before
                userStatus = ui.getUserStatus(UserId);
                if (userStatus != 0)
                {
                    if (userStatus != 4) Response.Redirect("~/Done/Welcome");
                }

                if (userStatus == 4)
                {
                    Tuple<string, string, string, string> result = ui.fbCompletion(UserId);

                    TextBoxFirstName.Text = result.Item1;
                    TextBoxLastName.Text = result.Item2;
                    HiddenFieldHasPhoto.Value = result.Item3;
                    DropDownListGender.SelectedValue = result.Item4;
                    if(Convert.ToBoolean(result.Item3))
                    {
                        HiddenFieldPhotoUrl.Value = "Files/Temp/" + UserId.ToString() + "-100.jpg";
                    }
                }

                DataTable dtCountries;
                Classes.Locations l = new Classes.Locations();
                dtCountries = l.countriesList();

                List<System.Web.UI.WebControls.ListItem> countries = new List<System.Web.UI.WebControls.ListItem>();
                DropDownListCountry.Items.Add(new ListItem("Select Country", "0"));
                for (int i = 0; i < dtCountries.Rows.Count; i++)
                {
                    DropDownListCountry.Items.Add(new ListItem(dtCountries.Rows[i]["CountryName"].ToString(), dtCountries.Rows[i]["CountryCode"].ToString()));
                }
            }
        }