コード例 #1
0
 public bool Person_Update(Person person)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@user_id", person.User_id),
         new SqlParameter("@FullName", person.FullName),
         new SqlParameter("@Email", person.Email),
     };
     return(SqlDBHelper.ExecuteNonQuery("Person_Update", CommandType.StoredProcedure, parameters));
 }
コード例 #2
0
 public bool Tweet_Add(Tweet tweet)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@User_id", tweet.User_id),
         new SqlParameter("@Message", tweet.Message),
         new SqlParameter("@Created", tweet.Created)
     };
     return(SqlDBHelper.ExecuteNonQuery("Tweet_Add", CommandType.StoredProcedure, parameters));
 }
コード例 #3
0
 public bool Reply_Add(Reply reply)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@tweet_id", reply.User_id),
         new SqlParameter("@user_id", reply.Message),
         new SqlParameter("@message", reply.Created),
         new SqlParameter("@created", reply.Created)
     };
     return(SqlDBHelper.ExecuteNonQuery("Reply_Add", CommandType.StoredProcedure, parameters));
 }
コード例 #4
0
 public bool Person_Add(Person person)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@user_id", person.User_id),
         new SqlParameter("@Password", person.Password),
         new SqlParameter("@FullName", person.FullName),
         new SqlParameter("@Email", person.Email),
         new SqlParameter("@Joined", person.Joined),
         new SqlParameter("@Active", person.Active)
     };
     return(SqlDBHelper.ExecuteNonQuery("Person_Add", CommandType.StoredProcedure, parameters));
 }
コード例 #5
0
        public int Tweet_Count(string user_id)
        {
            int count = 0;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@user_id", user_id)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("Tweet_Count", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count == 1)
                {
                    count = Convert.ToInt32(table.Rows[0][0]);
                }
            }
            return(count);
        }
コード例 #6
0
        public List <Tweet> Reply_List(string reply_id)
        {
            List <Tweet> tweetListFollowing = null;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@user_id", reply_id)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("Reply_List", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count > 0)
                {
                    tweetListFollowing = new List <Tweet>();

                    foreach (DataRow row in table.Rows)
                    {
                        Tweet tweet = new Tweet();

                        tweet.Tweet_id   = Convert.ToInt32(row["tweet_id"]);
                        tweet.User_id    = row["user_id"].ToString();
                        tweet.FullName   = row["fullName"].ToString();
                        tweet.Message    = row["message"].ToString();
                        tweet.ProfilePic = (bool)row["profilepic"];
                        if (tweet.ProfilePic == true)
                        {
                            tweet.ProfilepicUrl = "~/ProfilePic/" + reply_id + ".jpg";
                        }
                        else
                        {
                            tweet.ProfilepicUrl = "~/ProfilePic/default.png";
                        }
                        tweet.User_idShow = "(@" + tweet.User_id + ")";

                        tweetListFollowing.Add(tweet);
                    }
                }
            }
            return(tweetListFollowing);
        }
コード例 #7
0
        public ProfileCoverPic ProfileCoverPic_Details(string user_id)
        {
            ProfileCoverPic profilecoverpic = null;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@user_id", user_id)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("ProfileCoverPic_Details", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    profilecoverpic = new ProfileCoverPic();

                    profilecoverpic.ProfilePic = (bool)row["profilepic"];
                    profilecoverpic.CoverPic   = (bool)row["coverpic"];
                }
            }
            return(profilecoverpic);
        }
コード例 #8
0
        public Person Login(string user_id)
        {
            Person person = null;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@user_id", user_id)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("Login", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    person = new Person();

                    person.User_id  = row["user_id"].ToString();
                    person.Password = ObjectToByteArray(row["password"]);
                }
            }
            return(person);
        }
コード例 #9
0
        public List <Person> Search_Results(string user)
        {
            List <Person> personList = null;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@user", user)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("Search_Results", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count > 0)
                {
                    personList = new List <Person>();

                    foreach (DataRow row in table.Rows)
                    {
                        Person person = new Person();

                        person.User_id    = row["user_id"].ToString();
                        person.FullName   = row["fullName"].ToString();
                        person.ProfilePic = (bool)row["profilepic"];
                        if (person.ProfilePic == true)
                        {
                            person.ProfilepicUrl = "~/ProfilePic/" + person.User_id + ".jpg";
                        }
                        else
                        {
                            person.ProfilepicUrl = "~/ProfilePic/default.png";
                        }
                        person.User_idShow = "(@" + person.User_id + ")";

                        personList.Add(person);
                    }
                }
            }
            return(personList);
        }
コード例 #10
0
        public List <Following> Find_Followers_Names(string following_id)
        {
            List <Following> followersList = null;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Following_id", following_id)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("Find_Followers_Names", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count > 0)
                {
                    followersList = new List <Following>();

                    foreach (DataRow row in table.Rows)
                    {
                        Following following = new Following();

                        following.User_id    = row["user_id"].ToString();
                        following.FullName   = row["fullName"].ToString();
                        following.ProfilePic = (bool)row["profilepic"];
                        if (following.ProfilePic == true)
                        {
                            following.ProfilepicUrl = "~/ProfilePic/" + following.User_id + ".jpg";
                        }
                        else
                        {
                            following.ProfilepicUrl = "~/ProfilePic/default.png";
                        }
                        following.User_idShow = "(@" + following.User_id + ")";

                        followersList.Add(following);
                    }
                }
            }
            return(followersList);
        }
コード例 #11
0
        public Person Person_Details(string user_id)
        {
            Person person = null;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@user_id", user_id)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("Person_Details", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    person = new Person();

                    person.FullName = row["fullName"].ToString();
                    person.Password = ObjectToByteArray(row["password"]);
                    person.Email    = row["email"].ToString();
                    person.Joined   = (DateTime)row["joined"];
                }
            }
            return(person);
        }