Beispiel #1
0
    // Fetch All usersname who post comment on existing content type
    public static List <Member_Struct> Fetch_Comment_UserNames(long id, int type)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);

        con.Open();
        System.Collections.Generic.List <Member_Struct> items = new System.Collections.Generic.List <Member_Struct>();
        Member_Struct str_ct = default(Member_Struct);
        //// generate query
        string     Query = "SELECT Distinct c.username,u.email,u.isautomail from comments as c inner join users as u on u.username=c.username WHERE c.VideoID=@videoid AND c.type=@type";
        SqlCommand cmd   = new SqlCommand(Query, con);

        cmd.Parameters.Add(new SqlParameter("@videoid", id));
        cmd.Parameters.Add(new SqlParameter("@type", type));
        SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

        while (reader.Read())
        {
            str_ct            = new Member_Struct();
            str_ct.UserName   = reader["username"].ToString();
            str_ct.Email      = reader["email"].ToString();
            str_ct.isAutoMail = Convert.ToInt32(reader["isautomail"]);
            items.Add(str_ct);
        }
        reader.Close();
        con.Close();
        return(items);
    }
    // load user privacy options
    public static List <Member_Struct> Fetch_User_Privacy_Options(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);

        con.Open();
        List <Member_Struct> _items = new List <Member_Struct>();
        Member_Struct        _item;

        // generate sql query
        StringBuilder str = new StringBuilder();

        str.Append("SELECT privacy_fmessages from users WHERE isEnabled=1 AND username=@username");

        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);

        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);

        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.Privacy_FMessages = int.Parse(reader["privacy_fmessages"].ToString());
            _items.Add(_item);
        }
        reader.Close();
        con.Close();

        return(_items);
    }
Beispiel #3
0
    private string ProcessThumb(Member_Struct ph)
    {
        StringBuilder str = new StringBuilder();

        if (this.ThumbCssClass == "")
        {
            this.ThumbCssClass = "thumbnail";
        }
        // photo thumb
        string image_src = UrlConfig.Return_User_Profile_Photo(ph.UserName, ph.PictureName, this.ThumbPreviewOption, 0);

        if (ph.PictureName == "none" || ph.PictureName == "")
        {
            image_src = Config.GetUrl("images/dmember.png");
        }
        else if (ph.PictureName.Contains("http"))
        {
            image_src = ph.PictureName;
        }

        str.Append("<a class=\"" + ThumbCssClass + "\" style=\"width:" + this.Width + "px;\" href=\"" + this.PreviewUrl + "\" title=\"" + ph.UserName + "\">"); // thumb link setup

        str.Append("<img  src=\"" + image_src + "\" height=\"" + this.Height + "\" width=\"" + this.Width + "\">");
        str.Append("</a>");
        return(str.ToString());
    }
    // Load user mail options
    public static List<Member_Struct> Fetch_User_Mail_Options(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // generate sql query
        StringBuilder str = new StringBuilder();
        str.Append("SELECT email,isautomail,mail_vcomment,mail_ccomment,mail_pmessage,mail_finvite,mail_subscribe from users WHERE isEnabled=1 AND username=@username");

        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);
        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.isAutoMail = int.Parse(reader["isautomail"].ToString());
            _item.Mail_VComment = int.Parse(reader["mail_vcomment"].ToString());
            _item.Mail_CComment = int.Parse(reader["mail_ccomment"].ToString());
            _item.Mail_PMessage = int.Parse(reader["mail_pmessage"].ToString());
            _item.Mail_FInvite = int.Parse(reader["mail_finvite"].ToString());
            _item.Mail_Subscribe = int.Parse(reader["mail_subscribe"].ToString());
            _item.Email = reader["email"].ToString();
            _items.Add(_item);
        }
        reader.Close();
        con.Close();

        return _items;
    }
    // Load user mail options
    public static List <Member_Struct> Fetch_User_Mail_Options(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);

        con.Open();
        List <Member_Struct> _items = new List <Member_Struct>();
        Member_Struct        _item;

        // generate sql query
        StringBuilder str = new StringBuilder();

        str.Append("SELECT email,isautomail,mail_vcomment,mail_ccomment,mail_pmessage,mail_finvite,mail_subscribe from users WHERE isEnabled=1 AND username=@username");

        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);

        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);

        while (reader.Read())
        {
            _item                = new Member_Struct();
            _item.isAutoMail     = int.Parse(reader["isautomail"].ToString());
            _item.Mail_VComment  = int.Parse(reader["mail_vcomment"].ToString());
            _item.Mail_CComment  = int.Parse(reader["mail_ccomment"].ToString());
            _item.Mail_PMessage  = int.Parse(reader["mail_pmessage"].ToString());
            _item.Mail_FInvite   = int.Parse(reader["mail_finvite"].ToString());
            _item.Mail_Subscribe = int.Parse(reader["mail_subscribe"].ToString());
            _item.Email          = reader["email"].ToString();
            _items.Add(_item);
        }
        reader.Close();
        con.Close();

        return(_items);
    }
Beispiel #6
0
    // Fetch user channel and channel settings
    public static List<Member_Struct> Fetch_User_Channel(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // execute sql query
        //SqlCommand user_cmd = new SqlCommand("VSK_Members_FetchProfile", con);
        //user_cmd.CommandType = CommandType.StoredProcedure;
        SqlCommand user_cmd = new SqlCommand("SELECT u.firstname,u.lastname,u.birthdate,u.countryname,u.gender,u.picturename,u.relationshipstatus,u.website,u.hometown,u.currentcity,u.zipcode,u.stat_comments,u.last_login,u.views,u.register_date,u.channel_iscomments,u.channel_name,u.channel_theme FROM users as u WHERE u.isEnabled=1 AND u.username=@username", con);

        user_cmd.CommandType = CommandType.Text;
        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.FirstName = reader["firstname"].ToString();
            _item.LastName = reader["lastname"].ToString();
            _item.CountryName = reader["countryname"].ToString();
            _item.Gender = reader["gender"].ToString();
            _item.PictureName = reader["picturename"].ToString();
            _item.RelationshipStatus = reader["relationshipstatus"].ToString();
            
            _item.Website = reader["website"].ToString();
            _item.HometTown = reader["hometown"].ToString();
            _item.CurrentCity = reader["currentcity"].ToString();
            _item.Zipcode = reader["zipcode"].ToString();
            string llogin = reader["last_login"].ToString();
            if (llogin != "")
                _item.Last_Login = DateTime.Parse(llogin);
            else
                _item.Last_Login = DateTime.Now;
            _item.RegisterDate = (DateTime)reader["register_date"];
            _item.Views = Convert.ToInt32(reader["views"]);
            // count data
        
            _item.Count_Comments =  Convert.ToInt32(reader["stat_comments"]);
            
            // channel settings
            _item.Channel_isComments = Convert.ToInt32(reader["channel_iscomments"]);
           
            _item.Channel_Name = reader["channel_name"].ToString();
            _item.Channel_Theme = reader["channel_theme"].ToString();

            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #7
0
    // Get Encrypted Password For Encoding Purpose
    public static List<Member_Struct> Get_Hash_Password(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // generate sql query
        StringBuilder str = new StringBuilder();
        // execute sql query
        SqlCommand user_cmd = new SqlCommand("SELECT username, password FROM users WHERE isEnabled=1 AND username=@uname", con);
        user_cmd.CommandType = CommandType.Text;
        //SqlCommand user_cmd = new SqlCommand("VSK_Members_GetPassword", con);
        //user_cmd.CommandType = CommandType.StoredProcedure;
        user_cmd.Parameters.Add(new SqlParameter("@uname", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.UserName = reader["username"].ToString();
            _item.Password = reader["password"].ToString();
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #8
0
    private string ProcessContent(Member_Struct ph)
    {
        StringBuilder str = new StringBuilder();

        // username
        str.Append("<div class=\"item_pad_2\">\n");
        if (Config.isFeature_UserName() && this.ShowUserName)
        {
            // if username enabled
            string _usr = ph.UserName;
            if (_usr.Length > this.TitleLength && this.TitleLength != 0)
            {
                _usr = _usr.Substring(0, this.TitleLength) + "..";
            }
            string _usr_link = "<a class=\"" + this.NormalLinkCssClass + "\" href=\"" + this.PreviewUrl + "\"  title=\"" + ph.UserName + "\">" + _usr + "</a>";

            if (this.UserCaption != "")
            {
                str.Append("<span class=\"" + this.AltLinkCssClass + "\">" + this.UserCaption + "</span> \n");
            }
            str.Append(_usr_link);
        }
        // show location information
        if (this.ShowLocationInfo)
        {
            str.Append("<br />");
            str.Append(ph.Gender);
            if (ph.RelationshipStatus != "")
            {
                str.Append(", " + ph.RelationshipStatus);
            }
            if (ph.HometTown != "" || ph.CurrentCity != "")
            {
                if (ph.CurrentCity != "")
                {
                    str.Append(", " + ph.HometTown);
                }
                else
                {
                    str.Append(", " + ph.CurrentCity);
                }
            }
            if (ph.Zipcode != "")
            {
                str.Append(", " + ph.Zipcode);
            }
            str.Append(", " + ph.CountryName);
        }
        // show views
        if (Config.isFeature_Views() && this.ShowViews)
        {
            string _views = "0";
            if (ph.Views > 0)
            {
                _views = string.Format("{0:#,###}", ph.Views);
            }

            str.Append("<br /><span class=\"" + this.AltLinkCssClass + "\">" + _views + " " + Resources.vsk.views + "</span>");
        }
        // Added
        if (Config.isFeature_Date() && this.ShowDate)
        {
            str.Append("<br />");
            if (this.DateCaption != "")
            {
                str.Append("<span class=\"" + this.AltLinkCssClass + "\">" + this.DateCaption + " </span>");
            }
            str.Append("<span class=\"" + this.AltLinkCssClass + "\">Joined " + UtilityBLL.Generate_Date(ph.RegisterDate, this.DateFormat) + "</span>");
        }
        if (this.ShowDisabled)
        {
            string _disabled = "<span class=\"" + this.GoodCssClass + "\">" + Resources.vsk.enabled + "</span>\n";
            if (ph.isEnabled == 0)
            {
                _disabled = "<span class=\"" + this.BadCssClass + "\">Disabled</span>\n";
            }
            str.Append("<br />" + _disabled);
        }
        str.Append("</div>\n");
        return(str.ToString());
    }
    // load user privacy options
    public static List<Member_Struct> Fetch_User_Privacy_Options(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // generate sql query
        StringBuilder str = new StringBuilder();
        str.Append("SELECT privacy_fmessages from users WHERE isEnabled=1 AND username=@username");

        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);
        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.Privacy_FMessages = int.Parse(reader["privacy_fmessages"].ToString());
            _items.Add(_item);
        }
        reader.Close();
        con.Close();

        return _items;
    }
Beispiel #10
0
    public string Process(Member_Struct ph)
    {
        if (this.PreviewUrl == "")
        {
            this.PreviewUrl = UrlConfig.Prepare_User_Profile_Url(ph.UserName, this.isAdmin);
        }
        StringBuilder str      = new StringBuilder();
        string        _bxwidth = "100%";

        if (this.BoxWidth > 0)
        {
            _bxwidth = this.BoxWidth + "px;";
        }
        string _cntwidth = "";

        if (this.BoxWidth == 0)
        {
            _cntwidth = "99%";
        }
        else
        {
            int containerwidth = this.BoxWidth;
            if (this.BoxSpace > 0)
            {
                containerwidth = this.BoxWidth - this.BoxSpace;
            }
            _cntwidth = containerwidth + "px";
        }

        str.Append("<div class=\"" + this.BoxCssClass + "\" style=\"float:left; width:" + _bxwidth + "\">\n");
        string container = "class=\"item\"";

        if (this.isHoverEffect)
        {
            container = "class=\"" + this.HoverCssClass + "\"";
        }
        str.Append("<div " + container + " style=\"width:" + _cntwidth + "\">\n");
        if (this.ThumbOnly)
        {
            str.Append(ProcessThumb(ph));
        }
        else
        {
            if (this.ContentLayout == 0)
            {
                // Content on bottom of thumb
                str.Append("<div class=\"item\">\n");
                str.Append(ProcessThumb(ph));
                str.Append("</div>\n");
                str.Append("<div class=\"item\">\n");
                str.Append(ProcessContent(ph));
                str.Append("</div>\n");
            }
            else
            {
                // Content on left side of thumb
                str.Append("<div style=\"float:left; width:" + this.LeftWidth + "%;\">\n");
                str.Append(ProcessThumb(ph));
                str.Append("</div>\n");
                str.Append("<div style=\"float:right; width:" + this.RightWidth + "%;\">\n");
                str.Append(ProcessContent(ph));
                str.Append("</div>\n");
                str.Append("<div class=\"clear\"></div>\n");
            }
        }
        str.Append("</div>\n"); // close sub box
        str.Append("</div>\n"); // close main box
        if (this.BreakLine)
        {
            str.Append("<div class=\"clear\"></div>\n");
            this.BreakLine = false;
        }

        // reset urls for next item
        this.PreviewUrl = "";
        return(str.ToString());
    }
    private string ProcessThumb(Member_Struct ph)
    {
        StringBuilder str = new StringBuilder();
        if (this.ThumbCssClass == "")
            this.ThumbCssClass = "thumbnail";
        // photo thumb
        string image_src = UrlConfig.Return_User_Profile_Photo(ph.UserName, ph.PictureName, this.ThumbPreviewOption, 0);
        if (ph.PictureName == "none" || ph.PictureName == "")
            image_src = Config.GetUrl("images/dmember.png");
        else if (ph.PictureName.Contains("http"))
            image_src = ph.PictureName;

        str.Append("<a class=\"" + ThumbCssClass + "\" style=\"width:" + this.Width + "px;\" href=\"" + this.PreviewUrl + "\" title=\"" + ph.UserName + "\">"); // thumb link setup

        str.Append("<img  src=\"" + image_src + "\" height=\"" + this.Height + "\" width=\"" + this.Width + "\">");
        str.Append("</a>");
        return str.ToString();
    }
Beispiel #12
0
    // load all user usernames
    public static List<Member_Struct> Fetch_User_UserNames(int type)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // Query Building
        StringBuilder str = new StringBuilder();
        str.Append("SELECT username FROM users WHERE type=@type");
        // execute sql query
        SqlCommand video_cmd = new SqlCommand(str.ToString(), con);
        video_cmd.Parameters.Add(new SqlParameter("@type", type));
        SqlDataReader reader = video_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.UserName = reader["username"].ToString();
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #13
0
    // fetch user information for generating preview
    public static List<Member_Struct> Fetch_User_Info(string UserName)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;
        // generate sql query
        StringBuilder str = new StringBuilder();
        str.Append("SELECT countryname,firstname,lastname,gender,picturename,relationshipstatus,aboutme,website,hometown,currentcity FROM users WHERE username=@username AND isenabled=1");
        // execute sql query
        SqlCommand video_cmd = new SqlCommand(str.ToString(), con);
        video_cmd.Parameters.Add(new SqlParameter("@username", UserName));
        SqlDataReader reader = video_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.CountryName = reader["countryname"].ToString();
            _item.FirstName = reader["firstname"].ToString();
            _item.LastName = reader["lastname"].ToString();
            _item.Gender = reader["gender"].ToString();
            _item.PictureName = reader["picturename"].ToString();
            _item.RelationshipStatus = reader["relationshipstatus"].ToString();
            _item.AboutMe = reader["aboutme"].ToString();
            _item.Website = reader["website"].ToString();
            _item.HometTown = reader["hometown"].ToString();
            _item.CurrentCity = reader["currentcity"].ToString();
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #14
0
    // load all user users info for sending email
    public static List<Member_Struct> Fetch_User_UserNames()
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // Query Building
        StringBuilder str = new StringBuilder();
        str.Append("SELECT username,email,isautomail FROM users where isEnabled=1");
        // execute sql query
        SqlCommand cmd = new SqlCommand(str.ToString(), con);
        SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.UserName = reader["username"].ToString();
            _item.Email = reader["email"].ToString();
            _item.isAutoMail = Convert.ToInt32(reader["isautomail"].ToString());
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #15
0
    // Load user profile data
    public static List<Member_Struct> Fetch_User_Profile(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;
        // execute sql query
        //SqlCommand user_cmd = new SqlCommand("VSK_Members_FetchProfileSM", con);
        //user_cmd.CommandType =CommandType.StoredProcedure;
        SqlCommand user_cmd = new SqlCommand("SELECT u.firstname,u.lastname,u.countryname,u.gender,u.picturename,u.relationshipstatus,u.aboutme,u.website,u.hometown,u.currentcity,u.zipcode,u.occupations,u.companies,u.schools,u.interests,u.movies,u.musics,u.books,u.isallowbirthday FROM users as u WHERE u.isEnabled=1 AND u.username=@username", con);
        user_cmd.CommandType =CommandType.Text;
        user_cmd.Parameters.Add(new SqlParameter("@username",username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.FirstName = reader["firstname"].ToString();
            _item.LastName = reader["lastname"].ToString();
            _item.CountryName = reader["countryname"].ToString();
            _item.Gender = reader["gender"].ToString();
            _item.PictureName = reader["picturename"].ToString();
            _item.RelationshipStatus = reader["relationshipstatus"].ToString();
            _item.AboutMe = reader["aboutme"].ToString();
            _item.Website = reader["website"].ToString();
            _item.HometTown = reader["hometown"].ToString();
            _item.CurrentCity = reader["currentcity"].ToString();
            _item.Zipcode = reader["zipcode"].ToString();
            _item.Occupations = reader["occupations"].ToString();
            _item.Companies = reader["companies"].ToString();
            _item.Schools = reader["schools"].ToString();
            _item.Movies = reader["movies"].ToString();
            _item.Musics = reader["musics"].ToString();
            _item.Interests = reader["interests"].ToString();
            _item.Books = reader["books"].ToString();
            _item.isAllowBirthDay = int.Parse(reader["isallowbirthday"].ToString());
            
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #16
0
    // Fetch Video Data for Main Video Listing
    private List<Member_Struct> Fetch_Channels(string Term, string Character, string accounttype, string country, string gender, bool havephoto, int filteroption, string order,int PageNumber,int PageSize,bool AdvList)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;
              
        // generate sql query
        StringBuilder str = new StringBuilder();
        StringBuilder query = new StringBuilder();
        string _fields = "u.UserName,u.Register_Date,u.Views,u.PictureName";
        if (AdvList)
            _fields = "u.UserName,u.Register_Date,u.Views,u.PictureName,u.countryname,u.firstname,u.lastname,u.gender,u.relationshipstatus,u.hometown,u.currentcity,u.zipcode";

        query.Append(_fields + " FROM users as u WHERE u.isEnabled=1 " + Process_Channels_Logic(Term, Character, accounttype,country,gender,havephoto, filteroption));
        // implement paging script for differnt data sources.
        switch (Site_Settings.Pagination_Type)
        {
            case 0:
                // SQL SERVER 2005 or Later Supported Query
                str.Append(Pagination_Process.Prepare_SQLSERVER2005_Pagination(query.ToString(), order, PageNumber, PageSize));
                break;
            case 1:
                // MySQL Supported Query
                string mysql_query = "SELECT " + query.ToString() + " ORDER BY " + order;
                str.Append(Pagination_Process.Prepare_MySQL_Pagination(mysql_query, PageNumber, PageSize));
                break;
            case 2:
                // SQL SERVER 2000 Supported Query
                string normal_query = "SELECT " + query.ToString() + " ORDER BY " + order;
                str.Append(normal_query);
                break;
        }
     
        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);
        if (Term != "")
            user_cmd.Parameters.Add(new SqlParameter("@term", '%' + Term + '%'));
        if (Character != "")
            user_cmd.Parameters.Add(new SqlParameter("@character", Character + '%'));
        if (accounttype != "all")
            user_cmd.Parameters.Add(new SqlParameter("@accounttype", accounttype));
        if (gender != "")
            user_cmd.Parameters.Add(new SqlParameter("@gender", gender));
        if (country != "")
            user_cmd.Parameters.Add(new SqlParameter("@countryname", country));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.UserName = reader["username"].ToString();
            _item.Views = (int)reader["views"];
            _item.PictureName = reader["picturename"].ToString();
            _item.RegisterDate = (DateTime)reader["Register_Date"];
            if (AdvList)
            {
                _item.CountryName = reader["countryname"].ToString();
                _item.FirstName = reader["firstname"].ToString();
                _item.LastName = reader["lastname"].ToString();
                _item.Gender = reader["gender"].ToString();
                _item.RelationshipStatus = reader["relationshipstatus"].ToString();
                _item.HometTown = reader["hometown"].ToString();
                _item.CurrentCity = reader["currentcity"].ToString();
                _item.Zipcode = reader["zipcode"].ToString();
            }
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #17
0
    public static List<Member_Struct> Load_Members(string search, string gender, string accounttype, string countryname, string isEnabled, string type, int filteroption, string order, string direction, int PageNumber, int PageSize)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // generate sql query
        StringBuilder str = new StringBuilder();
        StringBuilder query = new StringBuilder();
        string _fields = "u.UserName,u.Register_Date,u.Views,u.PictureName,u.countryname,u.firstname,u.lastname,u.gender,u.relationshipstatus,u.hometown,u.currentcity,u.zipcode,u.isenabled";
        query.Append(_fields + " FROM users as u" + Load_Members_Admin_Logic(search,gender,accounttype,countryname,isEnabled,type,filteroption));
        // implement paging script for differnt data sources.
        switch (Site_Settings.Pagination_Type)
        {
            case 0:
                // SQL SERVER 2005 or Later Supported Query
                str.Append(Pagination_Process.Prepare_SQLSERVER2005_Pagination(query.ToString(), order, PageNumber, PageSize));
                break;
            case 1:
                // MySQL Supported Query
                string mysql_query = "SELECT " + query.ToString() + " ORDER BY " + order;
                str.Append(Pagination_Process.Prepare_MySQL_Pagination(mysql_query, PageNumber, PageSize));
                break;
            case 2:
                // SQL SERVER 2000 Supported Query
                string normal_query = "SELECT " + query.ToString() + " ORDER BY " + order;
                str.Append(normal_query);
                break;
        }

        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.UserName = reader["username"].ToString();
            _item.Views = (int)reader["views"];
            _item.PictureName = reader["picturename"].ToString();
            _item.RegisterDate = (DateTime)reader["Register_Date"];
            _item.CountryName = reader["countryname"].ToString();
            _item.FirstName = reader["firstname"].ToString();
            _item.LastName = reader["lastname"].ToString();
            _item.Gender = reader["gender"].ToString();
            _item.RelationshipStatus = reader["relationshipstatus"].ToString();
            _item.HometTown = reader["hometown"].ToString();
            _item.CurrentCity = reader["currentcity"].ToString();
            _item.Zipcode = reader["zipcode"].ToString();
            _item.isEnabled = Convert.ToInt32(reader["isenabled"]);
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
Beispiel #18
0
 // Fetch All usersname who post comment on existing content type
 public static List<Member_Struct> Fetch_Comment_UserNames(long id,int type)
 {
     SqlConnection con = new SqlConnection(Config.ConnectionString);
     con.Open();
     System.Collections.Generic.List<Member_Struct> items = new System.Collections.Generic.List<Member_Struct>();
     Member_Struct str_ct = default(Member_Struct);
     //// generate query
     string Query = "SELECT Distinct c.username,u.email,u.isautomail from comments as c inner join users as u on u.username=c.username WHERE c.VideoID=@videoid AND c.type=@type";
     SqlCommand cmd = new SqlCommand(Query, con);
     cmd.Parameters.Add(new SqlParameter("@videoid", id));
     cmd.Parameters.Add(new SqlParameter("@type", type));
     SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         str_ct = new Member_Struct();
         str_ct.UserName = reader["username"].ToString();
         str_ct.Email = reader["email"].ToString();
         str_ct.isAutoMail = Convert.ToInt32(reader["isautomail"]);
         items.Add(str_ct);
     }
     reader.Close();
     con.Close();
     return items;
 }
Beispiel #19
0
      // Fetch user detail profile
    public static List<Member_Struct> Fetch_User_DetailProfile(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // execute sql query
        //SqlCommand user_cmd = new SqlCommand("VSK_Members_DetailProfile", con);
        //user_cmd.CommandType = CommandType.StoredProcedure;
        SqlCommand user_cmd = new SqlCommand("SELECT u.aboutme,u.occupations,u.companies,u.schools,u.movies,u.musics,u.interests,u.books,u.isallowbirthday,u.birthdate,channel_iscomments FROM users as u WHERE u.isEnabled=1 AND u.username=@username", con);
        user_cmd.CommandType = CommandType.Text;
        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.AboutMe = reader["aboutme"].ToString();
            _item.Occupations = reader["occupations"].ToString();
            _item.Companies = reader["companies"].ToString();
            _item.Schools = reader["schools"].ToString();
            _item.Movies = reader["movies"].ToString();
            _item.Musics = reader["musics"].ToString();
            _item.Channel_isComments = Convert.ToInt32(reader["channel_iscomments"]);
            _item.Interests = reader["interests"].ToString();
            _item.Books = reader["books"].ToString();
            _item.isAllowBirthDay = Convert.ToInt32(reader["isallowbirthday"]);
            string birthdate = reader["birthdate"].ToString();
            if (birthdate != "")
                _item.BirthDate = DateTime.Parse(birthdate);
            else
                _item.Last_Login = DateTime.Now;

            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
    public string Process(Member_Struct ph)
    {
        if (this.PreviewUrl == "")
            this.PreviewUrl = UrlConfig.Prepare_User_Profile_Url(ph.UserName, this.isAdmin);
        StringBuilder str = new StringBuilder();
        string _bxwidth = "100%";
        if (this.BoxWidth > 0)
            _bxwidth = this.BoxWidth + "px;";
        string _cntwidth = "";
        if (this.BoxWidth == 0)
            _cntwidth = "99%";
        else
        {
            int containerwidth = this.BoxWidth;
            if (this.BoxSpace > 0)
                containerwidth = this.BoxWidth - this.BoxSpace;
            _cntwidth = containerwidth + "px";
        }

        str.Append("<div class=\"" + this.BoxCssClass + "\" style=\"float:left; width:" + _bxwidth + "\">\n");
        string container = "class=\"item\"";
        if (this.isHoverEffect)
            container = "class=\"" + this.HoverCssClass + "\"";
        str.Append("<div " + container + " style=\"width:" + _cntwidth + "\">\n");
        if (this.ThumbOnly)
        {
            str.Append(ProcessThumb(ph));
        }
        else
        {
            if (this.ContentLayout == 0)
            {
                // Content on bottom of thumb
                str.Append("<div class=\"item\">\n");
                str.Append(ProcessThumb(ph));
                str.Append("</div>\n");
                str.Append("<div class=\"item\">\n");
                str.Append(ProcessContent(ph));
                str.Append("</div>\n");
            }
            else
            {
                // Content on left side of thumb
                str.Append("<div style=\"float:left; width:" + this.LeftWidth + "%;\">\n");
                str.Append(ProcessThumb(ph));
                str.Append("</div>\n");
                str.Append("<div style=\"float:right; width:" + this.RightWidth + "%;\">\n");
                str.Append(ProcessContent(ph));
                str.Append("</div>\n");
                str.Append("<div class=\"clear\"></div>\n");
            }
        }
        str.Append("</div>\n"); // close sub box
        str.Append("</div>\n"); // close main box
        if (this.BreakLine)
        {
            str.Append("<div class=\"clear\"></div>\n");
            this.BreakLine = false;
        }

        // reset urls for next item
        this.PreviewUrl = "";
        return str.ToString();
    }
Beispiel #21
0
    // Fetch user channel sm information
    // NoCache Version
    public static List<Member_Struct> Fetch_User_Channel_SM_NoCache(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        //// generate sql query
        StringBuilder str = new StringBuilder();
        // load user profile
        str.Append("SELECT u.picturename,u.stat_comments,u.channel_iscomments,u.channel_name,u.channel_theme");
        // remaining query
        str.Append(" FROM users as u WHERE u.isEnabled=1 AND u.username=@username");

        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);
        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.PictureName = reader["picturename"].ToString();
            // count data
          
            _item.Count_Comments = Convert.ToInt32(reader["stat_comments"]);
           
          
            // channel settings
            _item.Channel_isComments = Convert.ToInt32(reader["channel_iscomments"]);
          
            _item.Channel_Name = reader["channel_name"].ToString();
            _item.Channel_Theme = reader["channel_theme"].ToString();
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }
    private string ProcessContent(Member_Struct ph)
    {
        StringBuilder str = new StringBuilder();
        // username 
        str.Append("<div class=\"item_pad_2\">\n");
        if (Config.isFeature_UserName() && this.ShowUserName)
        {
            // if username enabled
            string _usr = ph.UserName;
            if (_usr.Length > this.TitleLength && this.TitleLength!=0)
                _usr = _usr.Substring(0, this.TitleLength) + "..";
            string _usr_link = "<a class=\"" + this.NormalLinkCssClass + "\" href=\"" + this.PreviewUrl + "\"  title=\"" + ph.UserName + "\">" + _usr + "</a>";

            if (this.UserCaption != "")
                str.Append("<span class=\"" + this.AltLinkCssClass + "\">" + this.UserCaption + "</span> \n");
            str.Append(_usr_link);
        }
        // show location information
        if (this.ShowLocationInfo)
        {
            str.Append("<br />");
            str.Append(ph.Gender);
            if (ph.RelationshipStatus != "")
                str.Append(", " + ph.RelationshipStatus);
            if (ph.HometTown != "" || ph.CurrentCity != "")
            {
                if (ph.CurrentCity != "")
                    str.Append(", " + ph.HometTown);
                else
                    str.Append(", " + ph.CurrentCity);
            }
            if (ph.Zipcode != "")
                str.Append(", " + ph.Zipcode);
            str.Append(", " + ph.CountryName);
        }
        // show views
        if (Config.isFeature_Views() && this.ShowViews)
        {
            string _views = "0";
            if (ph.Views > 0)
                _views = string.Format("{0:#,###}", ph.Views);

            str.Append("<br /><span class=\"" + this.AltLinkCssClass + "\">" + _views + " " + Resources.vsk.views + "</span>");
        }
        // Added
        if (Config.isFeature_Date() && this.ShowDate)
        {
            str.Append("<br />");
            if (this.DateCaption != "")
                str.Append("<span class=\"" + this.AltLinkCssClass + "\">" + this.DateCaption + " </span>");
            str.Append("<span class=\"" + this.AltLinkCssClass + "\">Joined " + UtilityBLL.Generate_Date(ph.RegisterDate, this.DateFormat) + "</span>");
        }
        if (this.ShowDisabled)
        {
            string _disabled = "<span class=\"" + this.GoodCssClass + "\">" + Resources.vsk.enabled + "</span>\n";
            if (ph.isEnabled == 0)
                _disabled = "<span class=\"" + this.BadCssClass + "\">Disabled</span>\n";
            str.Append("<br />" + _disabled);
        }
        str.Append("</div>\n");
        return str.ToString();
    }
Beispiel #23
0
    // get account status information for admin use
    public static List<Member_Struct> Fetch_User_Status_Info(string username)
    {
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        if (con.State != ConnectionState.Open) con.Open();
        List<Member_Struct> _items = new List<Member_Struct>();
        Member_Struct _item;

        // generate sql query
        StringBuilder str = new StringBuilder();
        str.Append("SELECT isEnabled,Type,roleid FROM users where username=@username");

        // execute sql query
        SqlCommand user_cmd = new SqlCommand(str.ToString(), con);
        user_cmd.Parameters.Add(new SqlParameter("@username", username));
        SqlDataReader reader = user_cmd.ExecuteReader(CommandBehavior.CloseConnection);
        while (reader.Read())
        {
            _item = new Member_Struct();
            _item.isEnabled = Convert.ToInt32(reader["isEnabled"]);
            _item.Type = Convert.ToInt32(reader["type"]);
          
            _items.Add(_item);
        }
        reader.Close();
        con.Close(); con.Dispose();

        return _items;
    }