コード例 #1
0
ファイル: Credit.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Credit");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Credit");
            }

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

            try
            {
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)
                {
                    LabelCredit.Text = "0";
                    LabelCreditMoney.Text = "0";
                    LabelSpentCredit.Text = "0";
                    LabelSpentMoney.Text = "0";
                }
                else
                {
                    LabelCredit.Text = dt.Rows[0]["Credit"].ToString();
                    LabelCreditMoney.Text = dt.Rows[0]["MoneyCredit"].ToString();
                    LabelSpentCredit.Text = dt.Rows[0]["SpentCredit"].ToString();
                    LabelSpentMoney.Text = dt.Rows[0]["SpentMoney"].ToString();
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {
                sqlConn.Close();
                sda.Dispose();
                sqlConn.Dispose();
            }
        }
コード例 #2
0
ファイル: Support.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Support");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Support");
            }

            if (!IsPostBack)
            {
                DataTable dt = new DataTable();
                DataSet ds = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                SqlDataAdapter sda = new SqlDataAdapter("sp_userMenuRemindersCount", sqlConn);

                try
                {
                    sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                    sda.Fill(ds);
                    dt = ds.Tables[0];

                    if (Convert.ToInt32(dt.Rows[0]["ReminderSupportCount"].ToString()) != 0)
                    {
                        LabelRequestsNewCount.Visible = true;
                        LabelRequestsNewCount.Text = "(" + dt.Rows[0]["ReminderSupportCount"].ToString() + ")";
                    }
                    else
                    {
                        LabelRequestsNewCount.Visible = false;
                    }
                }
                catch (Exception ex)
                {

                }
                finally
                {
                    sqlConn.Close();
                    sda.Dispose();
                    sqlConn.Dispose();
                }
            }
        }
コード例 #3
0
ファイル: Requests.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Requests");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Requests");
            }

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
            SqlCommand sqlCmd = new SqlCommand("sp_requestsAllRead", sqlConn);

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

                sqlConn.Open();
                sqlCmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {

            }
            finally
            {
                sqlConn.Close();
                sqlCmd.Dispose();
                sqlConn.Dispose();
            }

            sqlCmd.Dispose();
            sqlConn.Dispose();

            if (GridViewFriends.Rows.Count == 0)
            {
                LabelFriendsNoRecord.Visible = true;
            }
        }
コード例 #4
0
ファイル: Messages.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Messages");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Messages");
            }

            Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
            int PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));

            if (PrimaryProfileId == 0)
            {
                PanelNoProfile.Visible = true;
                PanelMessages.Visible = false;
            }
            else
            {
                PanelNoProfile.Visible = false;
                PanelMessages.Visible = true;

                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                SqlCommand sqlCmd = new SqlCommand("sp_messagesAllRead", sqlConn);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);

                sqlConn.Open();
                sqlCmd.ExecuteNonQuery();

                sqlCmd.Dispose();
                sqlConn.Dispose();

                if (GridViewMessagesLists.Rows.Count == 0)
                {
                    LabelNoRecord.Visible = true;
                }
            }
        }
コード例 #5
0
ファイル: Default.aspx.cs プロジェクト: farhad85/Iranegan
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["VC"] != null)
     {
         string VC = Request.Cookies["VC"].Values["VC"];
         Classes.LoginSession ls = new Classes.LoginSession();
         int UserId = ls.getUserId(VC);
         if (UserId != 0)
         {
             Response.Redirect("~/Panel");
         }
         else
         {
             Response.Redirect("~/Login");
         }
     }
 }
コード例 #6
0
ファイル: Settings.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Settings");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Settings");
            }

            string HostUrl = ConfigurationManager.AppSettings["HostUrl"].ToString();
            //Mouseover
            ImageButtonChangePassword.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/save-on.png'");
            ImageButtonChangePassword.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/save-off.png'");

            try
            {
                switch (Page.RouteData.Values["Section"].ToString())
                {
                    case "Password":
                        {
                            PanelPassword.Visible = true;
                            ImageTabPassword.ImageUrl = "~/Images/Elements/password48-on.png";
                            break;
                        }
                }
            }
            catch
            {

            }
        }
コード例 #7
0
ファイル: Favorites.aspx.cs プロジェクト: farhad85/Iranegan
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["VC"] != null)
     {
         string VC = Request.Cookies["VC"].Values["VC"];
         Classes.LoginSession ls = new Classes.LoginSession();
         int UserId = ls.getUserId(VC);
         if (UserId == 0)
         {
             Response.Redirect("~/Login/Favorites");
         }
         else
         {
             Session["UserId"] = UserId.ToString();
         }
     }
     else
     {
         Response.Redirect("~/Login/Favorites");
     }
 }
コード例 #8
0
ファイル: Login.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId != 0)
                {
                    Response.Redirect("~/Panel");
                }
            }

            Literal li = (Literal)Master.FindControl("LiteralLogin");
            li.Visible = false;

            string HostUrl = ConfigurationManager.AppSettings["HostUrl"].ToString();
            //Mouseover
            ImageButtonLogin.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/login-on.png'");
            ImageButtonLogin.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/login-off.png'");
            ImageButtonRegister.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/register-on.png'");
            ImageButtonRegister.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/register-off.png'");
        }
コード例 #9
0
ファイル: ProfileAdd.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/ProfileAdd");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/ProfileAdd");
            }


            Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
            int PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));
            if (PrimaryProfileId == 0)
            {
                Response.Redirect("~/Error/NoPrimaryProfile");
            }

            //Mouseover
            ImageButtonAdd.Attributes.Add("onmouseover", "this.src='Images/Buttons/addprofile-on.png'");
            ImageButtonAdd.Attributes.Add("onmouseout", "this.src='Images/Buttons/addprofile-off.png'");
            TextBoxProfileName.Attributes.Add("value", "نام پروفایل");
            TextBoxProfileName.Attributes.Add("onfocus", "if (this.value=='نام پروفایل') this.value='';");
            TextBoxProfileName.Attributes.Add("onblur", "if (this.value=='') this.value='نام پروفایل';");

            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
            SqlDataAdapter sda = new SqlDataAdapter("sp_userProfileAddRequests", sqlConn);
            SqlDataAdapter sdaGC = new SqlDataAdapter("sp_categories", sqlConn);

            try
            {
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                int ProfileRequestsVerified = Convert.ToInt32(dt.Rows[0]["ProfileRequestsVerified"].ToString());
                int ProfileRequestsRejected = Convert.ToInt32(dt.Rows[0]["ProfileRequestsRejected"].ToString());
                int ProfileRequestsPending = Convert.ToInt32(dt.Rows[0]["ProfileRequestsPending"].ToString());
                int ProfileRequestsPercent = 0;
                if (ProfileRequestsVerified == 0)
                {
                    ProfileRequestsPercent = 0;
                }
                else
                {
                    ProfileRequestsPercent = ProfileRequestsVerified / (ProfileRequestsVerified + ProfileRequestsRejected) * 100;
                }

                LabelRequestsCount.Text = (ProfileRequestsVerified + ProfileRequestsRejected + ProfileRequestsPending).ToString();
                LabelRequestsVerifiedCount.Text = ProfileRequestsVerified.ToString();
                LabelRequestsVerifiedPercent.Text = ProfileRequestsPercent.ToString();
                LabelRequestsPendingCount.Text = ProfileRequestsPending.ToString();

                //GC : General Categories
                DataTable dtPeopleGC = new DataTable();
                DataTable dtPlacesGC = new DataTable();
                DataTable dtProductsGC = new DataTable();
                DataSet dsGC = new DataSet();

                sdaGC.SelectCommand.CommandType = CommandType.StoredProcedure;
                sdaGC.Fill(dsGC);
                dtPeopleGC = dsGC.Tables[0];
                dtPlacesGC = dsGC.Tables[1];
                dtProductsGC = dsGC.Tables[2];

                StringBuilder sbPeopleGC = new StringBuilder();
                if (dtPeopleGC.Rows.Count != 0)
                {
                    for (int i = 0; i < dtPeopleGC.Rows.Count; i++)
                    {
                        sbPeopleGC.AppendLine(dtPeopleGC.Rows[i]["CategoryName"].ToString());
                        sbPeopleGC.AppendLine("<br/>");
                    }
                    LiteralGCPeople.Text = sbPeopleGC.ToString();
                }

                StringBuilder sbPlacesGC = new StringBuilder();
                if (dtPlacesGC.Rows.Count != 0)
                {
                    for (int i = 0; i < dtPlacesGC.Rows.Count; i++)
                    {
                        sbPlacesGC.AppendLine(dtPlacesGC.Rows[i]["CategoryName"].ToString());
                        sbPlacesGC.AppendLine("<br/>");
                    }
                    LiteralGCPlaces.Text = sbPlacesGC.ToString();
                }

                StringBuilder sbProductsGC = new StringBuilder();
                if (dtProductsGC.Rows.Count != 0)
                {
                    for (int i = 0; i < dtProductsGC.Rows.Count; i++)
                    {
                        sbProductsGC.AppendLine(dtProductsGC.Rows[i]["CategoryName"].ToString());
                        sbProductsGC.AppendLine("<br/>");
                    }
                    LiteralGCProducts.Text = sbProductsGC.ToString();
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {
                sqlConn.Close();
                sda.Dispose();
                sdaGC.Dispose();
                sqlConn.Dispose();
            }
        }
コード例 #10
0
ファイル: myProfiles.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/myProfiles");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/myProfiles");
            }

            Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
            int PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));
            if (PrimaryProfileId == 0)
            {
                HyperLinkPersonalProfileName.NavigateUrl = "~/PrimaryProfileAdd";
                HyperLinkPersonalProfileName.Text = "پروفایل شخصی خود را ایجاد نمایید!";
                HyperLinkPersonalProfilePhoto.NavigateUrl = "~/PrimaryProfileAdd";
                HyperLinkPersonalProfilePhoto.ImageUrl = "~/Images/Elements/addprimaryprofile80.png";
                HyperLinkProfileAdd.NavigateUrl = "~/PrimaryProfileAdd";
                HyperLinkProfileAdd.Text = "ایجاد پروفایل شخصی";
            }
            else
            {
                DataTable dt = new DataTable();
                DataSet ds = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                SqlDataAdapter sda = new SqlDataAdapter("sp_personalProfileDetails", sqlConn);

                try
                {
                    sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sda.SelectCommand.Parameters.Add("@ProfileId", SqlDbType.Int).Value = PrimaryProfileId;
                    sda.Fill(ds);
                    dt = ds.Tables[0];

                    HyperLinkPersonalProfileName.Text = dt.Rows[0]["ProfileName"].ToString();
                    HyperLinkPersonalProfileName.NavigateUrl = "~/Profile/" + PrimaryProfileId.ToString();
                    HyperLinkPersonalProfilePhoto.NavigateUrl = "~/Profile/" + PrimaryProfileId.ToString();
                    if (Convert.ToBoolean(dt.Rows[0]["HasPhoto"].ToString()))
                    {
                        HyperLinkPersonalProfilePhoto.ImageUrl = "~/Files/ProfilesPhotos/" + PrimaryProfileId.ToString() + "-60.jpg";
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {

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

                HyperLinkProfileAdd.NavigateUrl = "ProfileAdd";
                HyperLinkProfileAdd.Text = "ایجاد پروفایل";
            }
        }
コード例 #11
0
ファイル: Friends.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Friends");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Friends");
            }

            Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
            int PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));
            if (PrimaryProfileId == 0)
            {
                Response.Redirect("~/Error/NoPrimaryProfile");
            }

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

            try
            {
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@ProfileId", SqlDbType.Int).Value = PrimaryProfileId;
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)
                {
                    LabelNoFriend.Visible = true;
                }
                else
                {
                    DataTable dt2 = new DataTable();
                    DataRow dr2 = null;

                    //define the columns
                    dt2.Columns.Add(new DataColumn("FriendId", typeof(string)));
                    dt2.Columns.Add(new DataColumn("FriendName", typeof(string)));
                    dt2.Columns.Add(new DataColumn("PhotoUrl", typeof(string)));
                    dt2.Columns.Add(new DataColumn("Location", typeof(string)));
                    dt2.Columns.Add(new DataColumn("Job", typeof(string)));

                    //create new row
                    dr2 = dt2.NewRow();

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //create new row
                        dr2 = dt2.NewRow();

                        //add values to each rows
                        dr2["FriendId"] = dt.Rows[i]["OtherId"].ToString();
                        dr2["FriendName"] = dt.Rows[i]["FriendName"].ToString();
                        if (dt.Rows[i]["City"].ToString() != "")
                        {
                            dr2["Location"] = "<img alt='' height='16' src='Images/Information/location.png' width='16' />&nbsp;" + dt.Rows[i]["City"].ToString();
                        }
                        if (dt.Rows[i]["JobTitle"].ToString() != "")
                        {
                            dr2["Job"] = "<img alt='' height='16' src='Images/Information/job.png' width='16' />&nbsp;" + dt.Rows[i]["JobTitle"].ToString();
                        }

                        if (Convert.ToBoolean(dt.Rows[i]["HasPhoto"].ToString()))
                        {
                            dr2["PhotoUrl"] = "~/Files/ProfilesPhotos/" + dt.Rows[i]["OtherId"].ToString() + "-60.jpg";
                        }
                        else
                        {
                            dr2["PhotoUrl"] = "~/Files/ProfilesPhotos/nophoto60-people.png";
                        }

                        //add the row to DataTable
                        dt2.Rows.Add(dr2);
                    }

                    DataListProfiles.Visible = true;
                    DataListProfiles.DataSource = dt2;
                    DataListProfiles.DataBind();
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {
                sqlConn.Close();
                sda.Dispose();
                sqlConn.Dispose();
            }
        }
コード例 #12
0
ファイル: Panel.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Panel");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Panel");
            }

            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
            SqlDataAdapter sda = new SqlDataAdapter("sp_panelInfo", sqlConn);
            SqlDataAdapter sda2 = new SqlDataAdapter("sp_personalProfileDetails", sqlConn);

            try
            {
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                LabelFavoritePeople.Text = dt.Rows[0]["FavoritePeople"].ToString();
                LabelFavoritePlaces.Text = dt.Rows[0]["FavoritePlaces"].ToString();
                LabelFavoriteProducts.Text = dt.Rows[0]["FavoriteProducts"].ToString();
                LabelProfilesOwn.Text = dt.Rows[0]["ProfilesOwn"].ToString();
                LabelProfilesModerate.Text = dt.Rows[0]["ProfilesModerate"].ToString();
                LabelProfilesCreate.Text = dt.Rows[0]["ProfilesCreate"].ToString();
                LabelMessages.Text = dt.Rows[0]["ReminderMessagesCount"].ToString();
                LabelNotifications.Text = dt.Rows[0]["ReminderNotificationsCount"].ToString();
                LabelRequests.Text = dt.Rows[0]["ReminderRequestsCount"].ToString();
                LabelSupport.Text = dt.Rows[0]["ReminderSupportCount"].ToString();

                Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
                int PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));
                if (PrimaryProfileId == 0)
                {
                    HyperLinkPersonalProfileName.NavigateUrl = "PrimaryProfileAdd";
                    HyperLinkPersonalProfileName.Text = "پروفایل شخصی خود را ایجاد نمایید!";
                    HyperLinkPersonalProfilePhoto.NavigateUrl = "~/PrimaryProfileAdd";
                    HyperLinkPersonalProfilePhoto.ImageUrl = "~/Images/Elements/addprimaryprofile80.png";
                    LabelCategoryName.Visible = false;
                    ImageCategory.Visible = false;
                }
                else
                {
                    DataTable dt2 = new DataTable();
                    DataSet ds2 = new DataSet();
                    sda2.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sda2.SelectCommand.Parameters.Add("@ProfileId", SqlDbType.Int).Value = PrimaryProfileId;
                    sda2.Fill(ds2);
                    dt2 = ds2.Tables[0];

                    HyperLinkPersonalProfileName.Text = dt2.Rows[0]["ProfileName"].ToString();
                    HyperLinkPersonalProfileName.NavigateUrl = "~/Profile/" + PrimaryProfileId.ToString();
                    HyperLinkPersonalProfilePhoto.NavigateUrl = "~/Profile/" + PrimaryProfileId.ToString();
                    LabelCategoryName.Text = dt2.Rows[0]["CategoryName"].ToString();
                    ImageCategory.ImageUrl = "~/Images/TypesImages/Category" + dt2.Rows[0]["ProfileCategoryId"].ToString() + "-24.png";
                    if (Convert.ToBoolean(dt2.Rows[0]["HasPhoto"].ToString()))
                    {
                        HyperLinkPersonalProfilePhoto.ImageUrl = "~/Files/ProfilesPhotos/" + PrimaryProfileId.ToString() + "-60.jpg";
                    }
                    else
                    {
                    }

                    sda2.Dispose();
                }
            }
            catch (Exception ex)
            {

            }
            finally
            {
                sqlConn.Close();
                sda.Dispose();
                sda2.Dispose();
                sqlConn.Dispose();
            }
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/Messages");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/Messages");
            }

            Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
            int PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));

            DataTable dtUserName = new DataTable();
            DataTable dtOtherName = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
            SqlDataAdapter sda = new SqlDataAdapter("sp_messagesSenderReceiverInfo", sqlConn);

            try
            {
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@OwnerId", SqlDbType.Int).Value = PrimaryProfileId;
                sda.SelectCommand.Parameters.Add("@OtherId", SqlDbType.Int).Value = Convert.ToInt32(Page.RouteData.Values["Id"].ToString());
                sda.Fill(ds);
                dtUserName = ds.Tables[0];
                dtOtherName = ds.Tables[1];

                if (dtUserName.Rows.Count == 0 || dtOtherName.Rows.Count == 0) //news doesn't exist
                {
                    Response.Redirect("~/Messages");
                }
                else //news exists
                {
                    HiddenFieldOwnerName.Value = dtUserName.Rows[0]["UserName"].ToString();
                    HiddenFieldOtherName.Value = dtOtherName.Rows[0]["OtherName"].ToString();
                    Page.Title = "پیغام ها : " + dtOtherName.Rows[0]["OtherName"].ToString(); ;
                }
            }
            catch (Exception ex)
            {

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

            string HostUrl = ConfigurationManager.AppSettings["HostUrl"].ToString();
            //Mouseover
            ImageButtonSend.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/send-on.png'");
            ImageButtonSend.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/send-off.png'");
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string HostUrl = ConfigurationManager.AppSettings["HostUrl"].ToString();

            LiteralTopProfilesLinks.Text = "<a href='" + HostUrl + "/Profiles/Products'><img alt='' src='" + HostUrl + "/Images/Tabs/Products0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/Products1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/Products0.png&#39;;' border='0'/></a><a href='" + HostUrl + "/Profiles/Places'><img alt='' src='" + HostUrl + "/Images/Tabs/Places0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/Places1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/Places0.png&#39;;' border='0'/></a><a href='" + HostUrl + "/Profiles/People'><img alt='' src='" + HostUrl + "/Images/Tabs/People0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/People1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/People0.png&#39;;' border='0'/></a>";

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    PanelUserMenu.Visible = false;
                    PanelLogin.Visible = true;
                    Session.Remove("UserId");
                    Response.Cookies.Remove("VC");
                    LiteralLogin.Text = "<a href='" + HostUrl + "/Login'><img alt='' src='" + HostUrl + "/Images/menu/login0.png' width='120' height='40'onmouseover='this.src=&#39;" + HostUrl + "/Images/menu/login1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/menu/login0.png&#39;;' border='0' /></a>";
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                    PanelUserMenu.Visible = true;
                    PanelLogin.Visible = false;

                    Classes.UserMenu um = new Classes.UserMenu();
                    LiteralUserMenu.Text = um.getUserMenuCode(Path.GetFileName(Request.Path), 1);
                }
            }
            else
            {
                PanelUserMenu.Visible = false;
                PanelLogin.Visible = true;
                Session.Remove("UserId");
                Response.Cookies.Remove("VC");
                LiteralLogin.Text = "<a href='" + HostUrl + "/Login'><img alt='' src='" + HostUrl + "/Images/menu/login0.png' width='120' height='40'onmouseover='this.src=&#39;" + HostUrl + "/Images/menu/login1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/menu/login0.png&#39;;' border='0' /></a>";
            }

            if (Path.GetFileName(Request.Path) == "Login")
            {
                PanelLogin.Visible = false;
            }

            if (Path.GetFileName(Request.Path) == "People")
            {
                LiteralTopProfilesLinks.Text = "<a href='" + HostUrl + "/Profiles/Products'><img alt='' src='" + HostUrl + "/Images/Tabs/Products0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/Products1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/Products0.png&#39;;' border='0'/></a><a href='" + HostUrl + "/Profiles/Places'><img alt='' src='" + HostUrl + "/Images/Tabs/Places0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/Places1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/Places0.png&#39;;' border='0'/></a><a href='" + HostUrl + "/Profiles/People'><img alt='' src='" + HostUrl + "/Images/Tabs/People2.png' width='94' height='30' border='0'/>";
            }
            else if(Path.GetFileName(Request.Path) == "Places")
            {
                LiteralTopProfilesLinks.Text = "<a href='" + HostUrl + "/Profiles/Products'><img alt='' src='" + HostUrl + "/Images/Tabs/Products0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/Products1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/Products0.png&#39;;' border='0'/></a><a href='" + HostUrl + "/Profiles/Places'><img alt='' src='" + HostUrl + "/Images/Tabs/Places2.png' width='94' height='30' border='0'/><a href='" + HostUrl + "/Profiles/People'><img alt='' src='" + HostUrl + "/Images/Tabs/People0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/People1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/People0.png&#39;;' border='0'/></a>";
            }
            else if(Path.GetFileName(Request.Path) == "Products")
            {
                LiteralTopProfilesLinks.Text = "<a href='" + HostUrl + "/Profiles/Products'><img alt='' src='" + HostUrl + "/Images/Tabs/Products2.png' width='94' height='30' border='0'/></a><a href='" + HostUrl + "/Profiles/Places'><img alt='' src='" + HostUrl + "/Images/Tabs/Places0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/Places1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/Places0.png&#39;;' border='0'/></a><a href='" + HostUrl + "/Profiles/People'><img alt='' src='" + HostUrl + "/Images/Tabs/People0.png' width='94' height='30' onmouseover='this.src=&#39;" + HostUrl + "/Images/Tabs/People1.png&#39;;' onmouseout='this.src=&#39;" + HostUrl + "/Images/Tabs/People0.png&#39;;' border='0'/></a>";
            }


            //Mouseover
            TextBoxTopSearch.Attributes.Add("value", "جستجو");
            TextBoxTopSearch.Attributes.Add("onfocus", "if (this.value=='جستجو') this.value='';");
            TextBoxTopSearch.Attributes.Add("onblur", "if (this.value=='') this.value='جستجو';");
        }
コード例 #15
0
ファイル: Profile.aspx.cs プロジェクト: farhad85/Iranegan
        protected void Page_Load(object sender, EventArgs e)
        {
            bool userLogin = false;

            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    
                }
                else
                {
                    userLogin = true;
                    Session["UserId"] = UserId.ToString();
                }
            }

            bool userHasProfile = false;
            int PrimaryProfileId = 0;
            if (userLogin)
            {
                Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
                PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));
                if (PrimaryProfileId != 0)
                {
                    userHasProfile = true;
                }
            }

            //see if profile exists
            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
            SqlDataAdapter sda = new SqlDataAdapter("sp_profileInfo", sqlConn);

            try
            {
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@ProfileId", SqlDbType.Int).Value = Convert.ToInt32(Page.RouteData.Values["Id"]);
                sda.Fill(ds);
                dt = ds.Tables[0];
            }
            catch (Exception ex)
            {

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

//////////// Profile doesn't exist
            if (dt.Rows.Count == 0)
            {
                Response.Redirect("~/Error/NoProfile");
            }
            else
            {
//////////// Profile is redistrected
                if(!Convert.ToBoolean(dt.Rows[0]["ProfileStatus"].ToString()))
                {
                    Response.Redirect("~/Error/RedistrictedProfile");
                }
                else
                {
//////////// Popularity is disabled
                    if (!Convert.ToBoolean(dt.Rows[0]["PopularityStatus"].ToString()))
                    {
                        PanelPopularity.Visible = false;
                    }
//////////// Popularity is enabled
                    else
                    {
                        LabelPopularityRateCount.Text = dt.Rows[0]["RatingCount"].ToString();
                        if (dt.Rows[0]["RatingCount"].ToString() == "0" || dt.Rows[0]["RatingScore"].ToString() == "0")
                        {
                            LabelPopularityPercent.Text = "0";
                            ImagePopularityImage.ImageUrl = "~/Images/Popularity/1.png";
                        }
                        else
                        {
                            int PopularityPercent = (20 * Convert.ToInt32(dt.Rows[0]["RatingScore"].ToString())) / Convert.ToInt32(dt.Rows[0]["RatingCount"].ToString());
                            LabelPopularityPercent.Text = PopularityPercent.ToString();
                            ImagePopularityImage.ImageUrl = "~/Images/Popularity/" + ((PopularityPercent * 36) / 100).ToString() + ".png";
                        }
                        PanelPopularity.Visible = true;
                    }
                }

//////////// Profile is verified
                if (Convert.ToBoolean(dt.Rows[0]["VerificationStatus"].ToString()))
                {
                    ImageVerificationProfileStatus.Visible = true;
                }
//////////// Profile is not verified
                else
                {
                    ImageVerificationProfileStatus.Visible = false;
                }

//////////// Show profile's photo
                if (Convert.ToBoolean(dt.Rows[0]["HasPhoto"].ToString()))
                {
                    ImageProfilePhoto.ImageUrl = "~/Files/ProfilesPhotos/" + Page.RouteData.Values["Id"] + "-220.jpg";
                }
                else
                {
                    switch (Convert.ToInt32(dt.Rows[0]["ProfileTypeId"].ToString()))
                    {
                        case 1:
                            {
                                ImageProfilePhoto.ImageUrl = "~/Files/ProfilesPhotos/nophoto220-people.png";
                                break;
                            }
                        case 2:
                            {
                                ImageProfilePhoto.ImageUrl = "~/Files/ProfilesPhotos/nophoto220-places.png";
                                break;
                            }
                        case 3:
                            {
                                ImageProfilePhoto.ImageUrl = "~/Files/ProfilesPhotos/nophoto220-products.png";
                                break;
                            }
                    }
                }

//////////// Show profile's ownership
                switch (Convert.ToInt32(dt.Rows[0]["OwnershipStatus"].ToString()))
                {
                    case 1:
                        {
                            LabelOwnershipStatus.Text = "شخصی";
                            break;
                        }
                    case 2:
                        {
                            LabelOwnershipStatus.Text = "دارای مالک";
                            break;
                        }
                    case 3:
                        {
                            LabelOwnershipStatus.Text = "عمومی";
                            break;
                        }
                }

//////////// Show action buttons
                if (userLogin && userHasProfile)
                {
                    bool isVisitorOwner = false;
                    bool isVisitorCreator = false;
                    bool isPersonalProfile = false;
                    bool isVisitorFriend = false;
                    bool isVisitorFan = false;

                    if (dt.Rows[0]["OwnerId"].ToString() == Session["UserId"].ToString())
                    {
                        isVisitorOwner = true;
                    }
                    if (dt.Rows[0]["CreatorId"].ToString() == Session["UserId"].ToString())
                    {
                        isVisitorCreator = true;
                    }
                    if (Convert.ToInt32(dt.Rows[0]["OwnershipStatus"].ToString()) == 1)
                    {
                        isPersonalProfile = true;
                    }
                    if (isVisitorOwner || isVisitorCreator)
                    {
                        HyperLinkEditPhoto.NavigateUrl = "~/Profile/" + Page.RouteData.Values["Id"].ToString() + "/EditPhoto";
                        PanelEditPhoto.Visible = true;
                    }
                    if (!isVisitorOwner && isPersonalProfile)
                    {
                        DataTable dtFriend = new DataTable();
                        DataSet dsFriend = new DataSet();
                        SqlConnection sqlConn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                        SqlDataAdapter sdaFriend = new SqlDataAdapter("sp_isUserFriend", sqlConn2);
                        SqlDataAdapter sdaFan = new SqlDataAdapter("sp_isUserFan", sqlConn2);

                        try
                        {
                            sdaFriend.SelectCommand.CommandType = CommandType.StoredProcedure;
                            sdaFriend.SelectCommand.Parameters.Add("@OwnerId", SqlDbType.Int).Value = Convert.ToInt32(dt.Rows[0]["OwnerId"].ToString());
                            sdaFriend.SelectCommand.Parameters.Add("@OtherId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                            sdaFriend.Fill(dsFriend);
                            dtFriend = dsFriend.Tables[0];

                            DataTable dtFan = new DataTable();
                            DataSet dsFan = new DataSet();

                            if (dtFriend.Rows.Count != 0)
                            {
                                isVisitorFriend = true;
                            }

                            sdaFan.SelectCommand.CommandType = CommandType.StoredProcedure;
                            sdaFan.SelectCommand.Parameters.Add("@ProfileId", SqlDbType.Int).Value = Convert.ToInt32(Page.RouteData.Values["Id"]);
                            sdaFan.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                            sdaFan.Fill(dsFan);
                            dtFan = dsFan.Tables[0];

                            if (dtFan.Rows.Count != 0)
                            {
                                isVisitorFan = true;
                            }
                        }
                        catch (Exception ex)
                        {

                        }
                        finally
                        {
                            sqlConn2.Close();
                            sdaFriend.Dispose();
                            sdaFan.Dispose();
                            sqlConn2.Dispose();
                        }
                    }

                    if (isVisitorOwner)
                    {
                        PanelActionsMessage.Visible = false;
                        PanelActionsFriend.Visible = false;
                        PanelTaskEdit.Visible = true;
                    }
                    else
                    {
                        PanelTaskClaim.Visible = true;
                        PanelTaskReport.Visible = true;

                        if (isPersonalProfile && isVisitorFriend)
                        {
                            PanelActionsFriend.Visible = true;
                            ImageButtonActionsFriend.ImageUrl = "~/Images/Buttons/friendremove-off.png";
                            //Mouseover
                            ImageButtonActionsFriend.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/friendremove-on.png'");
                            ImageButtonActionsFriend.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/friendremove-off.png'");
                        }
                        else if (isPersonalProfile && !isVisitorFriend)
                        {
                            PanelActionsFriend.Visible = true;
                            ImageButtonActionsFriend.ImageUrl = "~/Images/Buttons/friendadd-off.png";
                            //Mouseover
                            ImageButtonActionsFriend.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/friendadd-on.png'");
                            ImageButtonActionsFriend.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/friendadd-off.png'");
                        }

                        if (Convert.ToInt32(dt.Rows[0]["OwnershipStatus"].ToString()) == 1 || Convert.ToInt32(dt.Rows[0]["OwnershipStatus"].ToString()) == 2)
                        {
                            PanelActionsMessage.Visible = true;
                            ImageButtonActionsMessage.ImageUrl = "~/Images/Buttons/sendmessage-off.png";
                            //Mouseover
                            ImageButtonActionsMessage.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/sendmessage-on.png'");
                            ImageButtonActionsMessage.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/sendmessage-off.png'");
                        }
                    }

                    if (isVisitorFan)
                    {
                        PanelActionsLike.Visible = true;
                        ImageButtonActionsLike.ImageUrl = "~/Images/Buttons/favoriteremove-off.png";
                        //Mouseover
                        ImageButtonActionsLike.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/favoriteremove-on.png'");
                        ImageButtonActionsLike.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/favoriteremove-off.png'");
                    }
                    else
                    {
                        PanelActionsLike.Visible = true;
                        ImageButtonActionsLike.ImageUrl = "~/Images/Buttons/favoriteadd-off.png";
                        //Mouseover
                        ImageButtonActionsLike.Attributes.Add("onmouseover", "this.src='" + HostUrl + "/Images/Buttons/favoriteadd-on.png'");
                        ImageButtonActionsLike.Attributes.Add("onmouseout", "this.src='" + HostUrl + "/Images/Buttons/favoriteadd-off.png'");
                    }
                }
                else
                {
                    PanelActionsLike.Visible = true;
                    ImageButtonActionsLike.Enabled = false;
                    ImageButtonActionsLike.ImageUrl = "~/Images/Buttons/favoriteadd-grey.png";

                    switch (Convert.ToInt32(dt.Rows[0]["OwnershipStatus"].ToString()))
                    {
                        case 1:
                            {
                                PanelActionsFriend.Visible = true;
                                ImageButtonActionsFriend.Enabled = false;
                                ImageButtonActionsFriend.ImageUrl = "~/Images/Buttons/friendadd-grey.png";
                                PanelActionsMessage.Visible = true;
                                ImageButtonActionsMessage.Enabled = false;
                                ImageButtonActionsMessage.ImageUrl = "~/Images/Buttons/sendmessage-grey.png";
                                break;
                            }
                        case 2:
                            {
                                PanelActionsMessage.Visible = true;
                                ImageButtonActionsMessage.Enabled = false;
                                ImageButtonActionsMessage.ImageUrl = "~/Images/Buttons/sendmessage-grey.png";
                                break;
                            }
                    }

                    if (userLogin)
                    {
                        if (!userHasProfile)
                        {
                            PanelActionsShowMessage.Visible = true;
                            HyperLinkActionsMessage.Text = "ابتدا پروفایل اصلی خود را ایجاد نمایید.";
                            HyperLinkActionsMessage.NavigateUrl = "~/PersonalProfileAdd";
                            RatingProfile.ReadOnly = true;
                        }
                    }
                    else
                    {
                        PanelActionsShowMessage.Visible = true;
                        HyperLinkActionsMessage.Text = "وارد سیستم شوید.";
                        HyperLinkActionsMessage.NavigateUrl = "~/Login";
                        RatingProfile.ReadOnly = true;
                    }

                }
                




//////////// Show profile basic info
                LabelProfileId.Text = Page.RouteData.Values["Id"].ToString();
                LabelProfileName.Text = dt.Rows[0]["ProfileFName"].ToString() + " " + dt.Rows[0]["ProfileLName"].ToString();
                Page.Title = dt.Rows[0]["ProfileFName"].ToString() + " " + dt.Rows[0]["ProfileLName"].ToString();
                ImageProfileType.ImageUrl = "~/Images/TypesImages/ProfileType" + dt.Rows[0]["ProfileTypeId"].ToString() + ".png";
                LabelProfileType.Text = dt.Rows[0]["ProfileTypeName"].ToString();
                ImageProfileCategory.ImageUrl = "~/Images/TypesImages/category" + dt.Rows[0]["ProfileCategoryId"].ToString() + "-24.png";
                LabelProfileCategory.Text = dt.Rows[0]["CategoryName"].ToString();
                LabelStatsFavorite.Text = dt.Rows[0]["Favorites"].ToString();
                LabelStatsVisists.Text = dt.Rows[0]["Visits"].ToString();
                LabelProfileCreateDate.Text = ShowDate(dt.Rows[0]["CreateDate"].ToString());

//////////// Show profile specific info by profile type





////////////////Show rating
                if (userLogin)
                {
                    SqlConnection sqlConn3 = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                    DataTable dtRating = new DataTable();
                    DataSet dsRating = new DataSet();
                    SqlDataAdapter sdaRating = new SqlDataAdapter("sp_profileUserRatingGet", sqlConn3);

                    try
                    {
                        sdaRating.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sdaRating.SelectCommand.Parameters.Add("@ProfileId", SqlDbType.Int).Value = Convert.ToInt32(Page.RouteData.Values["Id"]);
                        sdaRating.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                        sdaRating.Fill(dsRating);
                        dtRating = dsRating.Tables[0];

                        if (dtRating.Rows.Count != 0)
                        {
                            RatingProfile.CurrentRating = Convert.ToInt32(dtRating.Rows[0]["Rate"].ToString());
                        }
                    }
                    catch (Exception ex)
                    {

                    }
                    finally
                    {
                        sqlConn3.Close();
                        sdaRating.Dispose();
                        sqlConn3.Dispose();
                    }
                }
                
////////////////Tools Tabs
                SqlConnection sqlConn4 = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                DataTable dtTools = new DataTable();
                DataSet dsTools = new DataSet();
                SqlDataAdapter sdaTools = new SqlDataAdapter("sp_profileTools", sqlConn4);

                try
                {
                    sdaTools.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sdaTools.SelectCommand.Parameters.Add("@ProfileId", SqlDbType.Int).Value = Convert.ToInt32(Page.RouteData.Values["Id"]);
                    sdaTools.Fill(dsTools);
                    dtTools = dsTools.Tables[0];

                    string selectedTool = " ";

                    try
                    {
                        if (Page.RouteData.Values["ToolName"].ToString().Length > 0)
                        {
                            selectedTool = Page.RouteData.Values["ToolName"].ToString();
                        }
                    }
                    catch
                    {
                    }

                    StringBuilder sbToolsTabs = new StringBuilder();
                    if (dtTools.Rows.Count != 0)
                    {
                        for (int i = 0; i < dtTools.Rows.Count; i++)
                        {
                            if (dtTools.Rows[i]["ProfileToolNameEn"].ToString() == selectedTool)
                            {
                                sbToolsTabs.AppendLine("<div id='Menu" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "' class='ProfileMenuItemSelected'>");
                                sbToolsTabs.AppendLine("<a href='" + HostUrl + "/Profile/" + Page.RouteData.Values["Id"] + "/" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "'><img alt='' height='30' src='" + HostUrl + "/Images/Tools/" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "/Tab-on.png' width='120' /></a>");
                                sbToolsTabs.AppendLine("</div>");
                            }
                            else
                            {
                                sbToolsTabs.AppendLine("<div id='Menu" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "' class='ProfileMenuItem' onmouseover='document.getElementById(&#39;Menu" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "&#39;).style.width = &#39;120px&#39;;' onmouseout='document.getElementById(&#39;Menu" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "&#39;).style.width = &#39;37px&#39;;'>");
                                sbToolsTabs.AppendLine("<a href='" + HostUrl + "/Profile/" + Page.RouteData.Values["Id"] + "/" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "'><img id='imageMenu" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "' alt='' height='30' src='" + HostUrl + "/Images/Tools/" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "/Tab-off.png' width='120' onmouseover='document.getElementById(&#39;imageMenu" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "&#39;).src = &#39;" + HostUrl + "/Images/Tools/" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "/Tab-on.png&#39;;' onmouseout='document.getElementById(&#39;imageMenu" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "&#39;).src = &#39;" + HostUrl + "/Images/Tools/" + dtTools.Rows[i]["ProfileToolNameEn"].ToString() + "/Tab-off.png&#39;;'/></a>");
                                sbToolsTabs.AppendLine("</div>");
                            }
                        }
                        LiteralToolsTabs.Text = sbToolsTabs.ToString();
                    }

                    sdaTools.Dispose();
                }
                catch (Exception ex)
                {

                }
                finally
                {
                    sqlConn4.Close();
                    sdaTools.Dispose();
                    sqlConn4.Dispose();
                }

                HyperLinkTaskEdit.NavigateUrl = HostUrl + "/Profile/" + Page.RouteData.Values["Id"].ToString() + "/Edit";
                HyperLinkTaskReport.NavigateUrl = HostUrl + "/Profile/" + Page.RouteData.Values["Id"].ToString() + "/Report";
                HyperLinkTaskClaim.NavigateUrl = HostUrl + "/Profile/" + Page.RouteData.Values["Id"].ToString() + "/Claim";

//////////// Show profile view
                try
                {
                    if (Page.RouteData.Values["ToolName"].ToString().Length > 0)
                    {
                        string pathToUserControl = "~/ProfileTools/" + Page.RouteData.Values["ToolName"].ToString() + ".ascx";
                        var ucSrc = LoadControl(pathToUserControl);
                        PanelTool.Controls.Add(ucSrc);
                    }
                }
                catch
                {
                }
                
//////////// Profile view
                string cookieName = Page.RouteData.Values["Id"].ToString();
                cookieName = (((Convert.ToInt32(cookieName) + 5) * 1364) - 9).ToString();

                if (Request.Cookies[cookieName] == null)
                {
                    HttpCookie _profileViewCookie = new HttpCookie(cookieName);
                    _profileViewCookie[cookieName] = cookieName;
                    _profileViewCookie.Expires = DateTime.Now.AddHours(2);
                    Response.Cookies.Add(_profileViewCookie);
                    SqlConnection sqlConn5 = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                    SqlCommand sqlCmd = new SqlCommand("sp_profileView", sqlConn5);

                    try
                    {
                        sqlCmd.CommandType = CommandType.StoredProcedure;
                        sqlCmd.Parameters.Add("@ProfileId", SqlDbType.Int).Value = Convert.ToInt32(Page.RouteData.Values["Id"]);

                        sqlConn.Open();
                        sqlCmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {

                    }
                    finally
                    {
                        sqlConn5.Close();
                        sqlCmd.Dispose();
                        sqlConn5.Dispose();
                    }
                }
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["VC"] != null)
            {
                string VC = Request.Cookies["VC"].Values["VC"];
                Classes.LoginSession ls = new Classes.LoginSession();
                int UserId = ls.getUserId(VC);
                if (UserId == 0)
                {
                    Response.Redirect("~/Login/PrimaryProfileAdd");
                }
                else
                {
                    Session["UserId"] = UserId.ToString();
                }
            }
            else
            {
                Response.Redirect("~/Login/PrimaryProfileAdd");
            }


            Classes.userPrimaryProfile upp = new Classes.userPrimaryProfile();
            int PrimaryProfileId = upp.getUserPrimaryProfileId(Convert.ToInt32(Session["UserId"]));
            if (PrimaryProfileId != 0)
            {
                Response.Redirect("~/Profile/" + PrimaryProfileId.ToString());
            }
            else
            {
                DataTable dt = new DataTable();
                DataSet ds = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                SqlDataAdapter sda = new SqlDataAdapter("sp_primaryProfileStep", sqlConn);

                try
                {
                    sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                    sda.Fill(ds);
                    dt = ds.Tables[0];

                    if (dt.Rows.Count == 0)
                    {
                        showHideItems(1);
                    }
                    else
                    {
                        showHideItems(Convert.ToInt32(dt.Rows[0]["Step"].ToString()));
                    }
                }
                catch (Exception ex)
                {

                }
                finally
                {
                    sqlConn.Close();
                    sda.Dispose();
                    sqlConn.Dispose();
                }
            }
        }
コード例 #17
0
ファイル: Login.aspx.cs プロジェクト: farhad85/Iranegan
        protected void ImageButtonLogin_Click(object sender, ImageClickEventArgs e)
        {
            if (TextBoxLoginEmail.Text.Length == 0 || TextBoxLoginPassword.Text.Length == 0)
            {
                LabelLoginError.Visible = true;
                LabelLoginError.Text = "پست الکترونیک یا کلمه عبور وارد شده اشتباه است!";
            }
            else
            {
                string mail = TextBoxLoginEmail.Text;
                string expression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";

                Match match = Regex.Match(mail, expression, RegexOptions.IgnoreCase);
                if (!match.Success)
                {
                    LabelLoginError.Visible = true;
                    LabelLoginError.Text = "پست الکترونیک یا کلمه عبور وارد شده اشتباه است!";
                }
                else
                {
                    MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
                    Byte[] PassByte;
                    UTF8Encoding encoder = new UTF8Encoding();
                    PassByte = md5Hasher.ComputeHash(encoder.GetBytes(TextBoxLoginPassword.Text));

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

                    try
                    {
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@Email", SqlDbType.VarChar).Value = TextBoxLoginEmail.Text;
                        sda.SelectCommand.Parameters.Add("@Password", SqlDbType.Binary).Value = PassByte;
                        sda.Fill(ds);
                        dt = ds.Tables[0];
                    }
                    catch (Exception ex)
                    {

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

                    if (dt.Rows.Count == 0)
                    {
                        LabelLoginError.Visible = true;
                        LabelLoginError.Text = "پست الکترونیک یا کلمه عبور وارد شده اشتباه است!";
                        sqlConn.Close();
                        sqlConn.Dispose();
                    }
                    else
                    {
                        Session["UserId"] = dt.Rows[0]["UserId"].ToString();

                        int Hours = 4;
                        string VerificationCode = Convert.ToString(Guid.NewGuid());

                        if (CheckBoxLoginRemember.Checked)
                        {
                            Hours = 168;
                        }

                        Classes.LoginSession ls = new Classes.LoginSession();
                        ls.setLoginSession(Convert.ToInt32(Session["UserId"]), VerificationCode, Hours);

                        HttpCookie _userInfoCookies = new HttpCookie("VC");
                        _userInfoCookies["VC"] = VerificationCode;
                        _userInfoCookies.Expires = DateTime.Now.AddHours(Hours);
                        Response.Cookies.Add(_userInfoCookies);

                        Response.Redirect("~/Panel");
                    }
                }
            }
        }
コード例 #18
0
ファイル: Login.aspx.cs プロジェクト: farhad85/Iranegan
        protected void ImageButtonRegister_Click(object sender, ImageClickEventArgs e)
        {
            if (TextBoxEmail.Text.Length == 0)
            {
                LabelError.Visible = true;
                LabelError.Text = "پست الکترونیکی را وارد نمایید!";
            }
            else
            {
                string mail = TextBoxEmail.Text;
                string expression = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";

                Match match = Regex.Match(mail, expression, RegexOptions.IgnoreCase);
                if (!match.Success)
                {
                    LabelError.Visible = true;
                    LabelError.Text = "پست الکترونیکی صحیح نمی باشد!";
                }
                else
                {
                    DataTable dt = new DataTable();
                    DataSet ds = new DataSet();
                    SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProfilesConnectionString"].ConnectionString);
                    SqlDataAdapter sda = new SqlDataAdapter("sp_registerCheckEmail", sqlConn);
                    SqlCommand sqlCmd = new SqlCommand("sp_register", sqlConn);
                    SqlDataAdapter sda2 = new SqlDataAdapter("sp_userIdByEmail", sqlConn);

                    try
                    {
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar));
                        sda.SelectCommand.Parameters["@Email"].Value = TextBoxEmail.Text;
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count > 0) //email registered before
                        {
                            LabelError.Visible = true;
                            LabelError.Text = "پست الکترونیکی وارد شده در سیستم وجود دارد!";
                            sqlConn.Close();
                            sqlConn.Dispose();
                            sda.Dispose();
                        }
                        else
                        {
                            if (TextBoxMobile.Text.Length == 0)
                            {
                                LabelError.Visible = true;
                                LabelError.Text = "تلفن همراه را وارد نمایید!";
                            }
                            else
                            {
                                if (TextBoxMobile.Text.Length < 10)
                                {
                                    LabelError.Visible = true;
                                    LabelError.Text = "تلفن همراه صحیح نمی باشد!";
                                }
                                else
                                {
                                    if (TextBoxPassword1.Text.Length == 0)
                                    {
                                        LabelError.Visible = true;
                                        LabelError.Text = "کلمه عبور را وارد نمایید!";
                                    }
                                    else
                                    {
                                        if (TextBoxPassword1.Text.Length < 4)
                                        {
                                            LabelError.Visible = true;
                                            LabelError.Text = "کلمه عبور حداقل می بایست 4 کاراکتر باشد!";
                                        }
                                        else
                                        {
                                            if (TextBoxPassword1.Text != TextBoxPassword2.Text)
                                            {
                                                LabelError.Visible = true;
                                                LabelError.Text = "کلمه عبور و تکرار کلمه عبور می بایست یکسان باشند!";
                                            }
                                            else
                                            {
                                                MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
                                                byte[] hashedBytes;
                                                UTF8Encoding encoder = new UTF8Encoding();
                                                hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(TextBoxPassword1.Text));

                                                sqlCmd.CommandType = CommandType.StoredProcedure;
                                                sqlCmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = TextBoxEmail.Text;
                                                sqlCmd.Parameters.Add("@Mobile", SqlDbType.NVarChar).Value = TextBoxMobile.Text;
                                                sqlCmd.Parameters.Add("@Password", SqlDbType.Binary, 16).Value = hashedBytes;

                                                sqlConn.Open();
                                                sqlCmd.ExecuteNonQuery();

                                                DataTable dt2 = new DataTable();
                                                DataSet ds2 = new DataSet();

                                                sda2.SelectCommand.CommandType = CommandType.StoredProcedure;
                                                sda2.SelectCommand.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar));
                                                sda2.SelectCommand.Parameters["@Email"].Value = TextBoxEmail.Text;
                                                sda2.Fill(ds2);
                                                dt2 = ds2.Tables[0];

                                                Session["UserId"] = Convert.ToInt32(dt2.Rows[0]["UserId"].ToString());

                                                Classes.Notifications no = new Classes.Notifications();
                                                no.addNotification(Convert.ToInt32(dt2.Rows[0]["UserId"].ToString()), 1, "", "");

                                                sqlConn.Close();
                                                sqlConn.Dispose();


                                                int Hours = 4;
                                                string VerificationCode = Convert.ToString(Guid.NewGuid());

                                                Classes.LoginSession ls = new Classes.LoginSession();
                                                ls.setLoginSession(Convert.ToInt32(dt2.Rows[0]["UserId"].ToString()), VerificationCode, Hours);

                                                HttpCookie _userInfoCookies = new HttpCookie("VC");
                                                _userInfoCookies["VC"] = VerificationCode;
                                                _userInfoCookies.Expires = DateTime.Now.AddHours(Hours);
                                                Response.Cookies.Add(_userInfoCookies);

                                                Response.Redirect("~/Instruction");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {

                    }
                    finally
                    {
                        sqlConn.Close();
                        sda.Dispose();
                        sda2.Dispose();
                        sqlCmd.Dispose();
                        sqlConn.Dispose();
                    }
                }
            }
            
        }