Ejemplo n.º 1
0
    protected void GridViewFriends_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.CompareTo("FriendsReject") == 0)
        {
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
            SqlCommand    sqlCmd;

            try
            {
                sqlCmd             = new SqlCommand("sp_requestsConnectionsFriendsReject", sqlConn);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.Add("@RequestId", SqlDbType.Int).Value = Convert.ToInt32(e.CommandArgument.ToString());
                sqlConn.Open();
                sqlCmd.ExecuteNonQuery();
            }
            catch
            {
            }
            finally
            {
                sqlConn.Close();
            }

            GridViewFriends.DataBind();
        }

        if (e.CommandName.CompareTo("FriendsAccept") == 0)
        {
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
            SqlCommand    sqlCmd;

            try
            {
                DataTable      dt  = new DataTable();
                DataTable      dt2 = new DataTable();
                DataSet        ds  = new DataSet();
                SqlDataAdapter sda = new SqlDataAdapter("sp_requestsConnectionsFriendsVerify", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@RequestId", SqlDbType.Int).Value = Convert.ToInt32(e.CommandArgument.ToString());
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value    = Convert.ToInt32(Session["UserId"]);
                sda.Fill(ds);
                dt  = ds.Tables[0];
                dt2 = ds.Tables[1];

                NotificationsClass nc = new NotificationsClass();
                nc.addNotification(1, Convert.ToInt32(dt.Rows[0]["FriendId"].ToString()), 7, dt2.Rows[0]["FullName"].ToString(), "");
            }
            catch
            {
            }
            finally
            {
                sqlConn.Close();
            }

            GridViewFriends.DataBind();
        }
    }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable panelPopup = new DataTable();

            panelPopup.Columns.Add("Input");
            panelPopup.Columns.Add("Name");
            panelPopup.Columns.Add("Output");

            createActionTable("User", panelPopup);
            GridViewUser.DataSource = panelPopup;
            GridViewUser.DataBind();

            panelPopup.Clear();
            createActionTable("Friend", panelPopup);
            GridViewFriends.DataSource = panelPopup;
            GridViewFriends.DataBind();

            panelPopup.Clear();
            createActionTable("Album", panelPopup);
            GridViewAlbum.DataSource = panelPopup;
            GridViewAlbum.DataBind();

            panelPopup.Clear();
            createActionTable("Photo", panelPopup);
            GridViewPhoto.DataSource = panelPopup;
            GridViewPhoto.DataBind();

            panelPopup.Clear();
            createActionTable("Post", panelPopup);
            GridViewPost.DataSource = panelPopup;
            GridViewPost.DataBind();

            panelPopup.Clear();
            createActionTable("Video", panelPopup);
            GridViewVideo.DataSource = panelPopup;
            GridViewVideo.DataBind();

            panelPopup.Clear();
            createActionTable("Like", panelPopup);
            GridViewLike.DataSource = panelPopup;
            GridViewLike.DataBind();

            panelPopup.Clear();
            createActionTable("Comment", panelPopup);
            GridViewComment.DataSource = panelPopup;
            GridViewComment.DataBind();
        }