Beispiel #1
0
        public List <DtoEmotions> GetAllEmotion(string websitename, string premalink, long userid)
        {
            _lstEmotions = new List <DtoEmotions>();

            try
            {
                sqlparameter    = new SqlParameter[3];
                sqlparameter[0] = new SqlParameter("@WebSiteName", websitename);
                sqlparameter[1] = new SqlParameter("@Premalink", premalink);
                sqlparameter[2] = new SqlParameter("@UserID", userid);

                OpenConnection();
                datareader = ExecuteReader(StoredProcedure.Names.spGetAllEmotion.ToString());

                if (!datareader.HasRows)
                {
                    return(null);
                }
                while (datareader.Read())
                {
                    _dtoemotions = new DtoEmotions
                    {
                        Emotionid   = Convert.ToInt64(datareader["EmotionId"]),
                        EmotionName = datareader["EmotionName"].ToString(),
                        TotalCount  = Convert.ToInt32(datareader["TotalCount"])
                    };

                    if (Convert.ToInt32(datareader["LoggedUserEmotion"]) > 0)
                    {
                        _dtoemotions.IsActive = true;
                    }
                    else
                    {
                        _dtoemotions.IsActive = false;
                    }

                    _lstEmotions.Add(_dtoemotions);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
            finally
            {
                CloseConnection();
            }
            return(_lstEmotions);
        }
Beispiel #2
0
        public List <DtoEmotions> GetUserEmotionForProfile(long currentUserId, long loggedInUser)
        {
            _lstEmotions = new List <DtoEmotions>();

            try
            {
                sqlparameter    = new SqlParameter[2];
                sqlparameter[0] = new SqlParameter("@CurrentUserID", currentUserId);
                sqlparameter[1] = new SqlParameter("@LoggedInUser", loggedInUser);

                OpenConnection();
                datareader = ExecuteReader(StoredProcedure.Names.spGetUserEmotion.ToString());

                if (!datareader.HasRows)
                {
                    return(null);
                }
                while (datareader.Read())
                {
                    _dtoemotions = new DtoEmotions
                    {
                        Emotionid   = Convert.ToInt64(datareader["EmotionId"]),
                        EmotionName = datareader["EmotionName"].ToString(),
                        TotalCount  = Convert.ToInt32(datareader["TotalCount"])
                    };

                    if (Convert.ToInt32(datareader["LoggedUserEmotion"]) > 0)
                    {
                        _dtoemotions.IsActive = true;
                    }
                    else
                    {
                        _dtoemotions.IsActive = false;
                    }

                    _lstEmotions.Add(_dtoemotions);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
            finally
            {
                CloseConnection();
            }
            return(_lstEmotions);
        }
Beispiel #3
0
        public List <DtoEmotions> EmotionIntellisense(string premalink, string emotion)
        {
            _lstEmotions = new List <DtoEmotions>();

            try
            {
                sqlparameter    = new SqlParameter[2];
                sqlparameter[0] = new SqlParameter("@Premalink", premalink);
                sqlparameter[1] = new SqlParameter("@Emotion", emotion);

                OpenConnection();
                datareader = ExecuteReader(StoredProcedure.Names.spEmotionIntellisense.ToString());

                if (!datareader.HasRows)
                {
                    return(null);
                }
                while (datareader.Read())
                {
                    _dtoemotions = new DtoEmotions
                    {
                        Emotionid   = Convert.ToInt64(datareader["Id"]),
                        EmotionName = datareader["Name"].ToString()
                    };

                    _lstEmotions.Add(_dtoemotions);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
            finally
            {
                CloseConnection();
            }
            return(_lstEmotions);
        }
Beispiel #4
0
        public IEnumerable <DtoEmotions> GetTaggedEmotion(long tagId, long loggedInUser)
        {
            _lstEmotions = new List <DtoEmotions>();

            try
            {
                sqlparameter    = new SqlParameter[2];
                sqlparameter[0] = new SqlParameter("@TagId", tagId);
                sqlparameter[1] = new SqlParameter("@LoggedInUser", loggedInUser);

                OpenConnection();
                datareader = ExecuteReader(StoredProcedure.Names.spGetTaggedEmotion.ToString());

                if (!datareader.HasRows)
                {
                    return(null);
                }
                while (datareader.Read())
                {
                    _dtoemotions             = new DtoEmotions();
                    _dtoemotions.Emotionid   = Convert.ToInt64(datareader["EmotionId"]);
                    _dtoemotions.EmotionName = datareader["EmotionName"].ToString();
                    _dtoemotions.TotalCount  = Convert.ToInt32(datareader["TotalCount"]);
                    _dtoemotions.EmotionUser = Convert.ToInt64(datareader["LoggedUserEmotion"]);
                    _lstEmotions.Add(_dtoemotions);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
            finally
            {
                CloseConnection();
            }
            return(_lstEmotions);
        }
Beispiel #5
0
        public List <DtoEmotions> GetEmotionByWebsite(long websiteId)
        {
            _lstEmotions = new List <DtoEmotions>();

            try
            {
                sqlparameter    = new SqlParameter[1];
                sqlparameter[0] = new SqlParameter("@WebsiteId", websiteId);

                OpenConnection();
                datareader = ExecuteReader(StoredProcedure.Names.spGetEmotionByWebsite.ToString());

                if (!datareader.HasRows)
                {
                    return(null);
                }
                while (datareader.Read())
                {
                    _dtoemotions = new DtoEmotions
                    {
                        Emotionid   = Convert.ToInt64(datareader["EmotionId"]),
                        EmotionName = datareader["EmotionName"].ToString(),
                        TotalCount  = Convert.ToInt32(datareader["TotalCount"])
                    };
                    _lstEmotions.Add(_dtoemotions);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
            finally
            {
                CloseConnection();
            }
            return(_lstEmotions);
        }
Beispiel #6
0
        public List <DtoEmotions> GetPremalinkEmotionsById(long id)
        {
            _lstEmotions = new List <DtoEmotions>();

            try
            {
                sqlparameter    = new SqlParameter[1];
                sqlparameter[0] = new SqlParameter("@PremaLinkID", id);

                OpenConnection();
                datareader = ExecuteReader(StoredProcedure.Names.spGetPremalinkEmotionsById.ToString());

                if (!datareader.HasRows)
                {
                    return(null);
                }
                while (datareader.Read())
                {
                    _dtoemotions = new DtoEmotions
                    {
                        Emotionid   = Convert.ToInt64(datareader["EmotionId"]),
                        EmotionName = datareader["EmotionName"].ToString(),
                    };
                    _lstEmotions.Add(_dtoemotions);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
            finally
            {
                CloseConnection();
            }
            return(_lstEmotions);
        }