Example #1
0
 public virtual int Update(Users user)
 {
     return 0;
 }
Example #2
0
 public virtual int QuickAdd(Users user)
 {
     return 0;
 }
Example #3
0
 public virtual int ShortAdd(Users user)
 {
     return 0;
 }
Example #4
0
 /// <summary>
 /// Perform Update
 /// </summary>
 /// <returns></returns>
 public override int Update(Users user)
 {
     return Blogic.UpdateUser(user);
 }
Example #5
0
 public virtual int Deactivate(Users user)
 {
     return 0;
 }
Example #6
0
 public override int QuickAdd(Users user)
 {
     return Blogic.QuickAddNewUser(user);
 }
Example #7
0
 public override int ShortAdd(Users user)
 {
     return Blogic.ShortAddNewUser(user);
 }
        /// <summary>
        /// Delete user
        /// </summary>
        public static int DeleteUser(Users user)
        {
            SqlParameter prmUserID = new SqlParameter("@UserID", SqlDbType.Int, 4);
              prmUserID.Value = user.UID;

              return DataAccess.Execute("spDeleteUser", prmUserID);
        }
Example #9
0
 /// <summary>
 /// Perform Delete
 /// </summary>
 /// <returns></returns>
 public override int Deactivate(Users user)
 {
     return Blogic.DeleteUser(user);
 }
        /// <summary>
        /// Add new user
        /// </summary>
        /// <returns></returns>
        public static int AddNewUser(Users user)
        {
            SqlParameter prmUsername = new SqlParameter("@Username", SqlDbType.VarChar, 50);
              prmUsername.Value = user.UserName;

              SqlParameter prmPassword = new SqlParameter("@Password", SqlDbType.VarChar, 50);
              prmPassword.Value = user.Password;

              SqlParameter prmEmail = new SqlParameter("@Email", SqlDbType.VarChar, 50);
              prmEmail.Value = user.Email1;

              SqlParameter prmFirstName = new SqlParameter("@Firstname", SqlDbType.VarChar, 50);
              prmFirstName.Value = user.FirstName;

              SqlParameter prmLastName = new SqlParameter("@Lastname", SqlDbType.VarChar, 50);
              prmLastName.Value = user.LastName;

              SqlParameter prmCity = new SqlParameter("@City", SqlDbType.SmallInt);
              prmCity.Value = user.CityID;

              SqlParameter prmState = new SqlParameter("@State", SqlDbType.SmallInt);
              prmState.Value = user.StateID;

              SqlParameter prmCountry = new SqlParameter("@Country", SqlDbType.SmallInt);
              prmCountry.Value = user.CountryID;

              SqlParameter prmMobile = new SqlParameter("@Mobile", SqlDbType.VarChar,20);
              prmMobile.Value = user.Mobile;

              SqlParameter prmAddress = new SqlParameter("@Address", SqlDbType.VarChar, 80);
              prmAddress.Value = user.Address;

              SqlParameter prmDOB = new SqlParameter("@DOB", SqlDbType.DateTime);
              prmDOB.Value = user.DOB;

              SqlParameter prmSex = new SqlParameter("@Sex", SqlDbType.SmallInt);
              prmSex.Value = user.GetSex;

              SqlParameter prmEC = new SqlParameter("@EC", SqlDbType.VarChar, 50);
              prmEC.Value = user.ECPreference;

              SqlParameter prmCanEmailSend = new SqlParameter("@canEmailSend", SqlDbType.SmallInt);
              prmCanEmailSend.Value = user.canEmailSend;

              /*
              SqlParameter prmNewsletter = new SqlParameter("@Newsletter", SqlDbType.SmallInt, 4);
              prmNewsletter.Value = user.NewsLetter;

              SqlParameter prmContactMe = new SqlParameter("@ContactMe", SqlDbType.Int, 4);
              prmContactMe.Value = user.ContactMe;
              */

              SqlParameter prmWebsite = new SqlParameter("@Website", SqlDbType.VarChar, 100);
              prmWebsite.Value = user.Website;

              SqlParameter prmAboutMe = new SqlParameter("@AboutMe", SqlDbType.VarChar, 1000);
              prmAboutMe.Value = user.AboutMe;

              SqlParameter prmPhoto = new SqlParameter("@Photo", SqlDbType.VarChar, 50);
              prmPhoto.Value = user.Photo;

              /*
              SqlParameter prmGUID = new SqlParameter("@Guid", SqlDbType.VarChar, 100);
              prmGUID.Value = user.GUID;
              */
              /*return DataAccess.Execute("spInsertUser", prmUsername, prmPassword, prmEmail, prmFirstName, prmLastName, prmCity, prmState, prmCountry, prmAddress, prmSex, prmDOB,
               prmCanEmailSend, prmEC, prmWebsite, prmAboutMe, prmPhoto, prmMobile );*/
              return DataAccess.Execute("spInsertUser", prmUsername, prmPassword, prmFirstName, prmLastName, prmEmail, prmCity, prmState, prmCountry, prmSex, prmDOB,
               prmCanEmailSend, prmEC, prmMobile, prmAddress, prmWebsite, prmAboutMe/*, prmPhoto*/);
        }
        /// <summary>
        /// Update user
        /// </summary>
        /// <returns></returns>
        public static int UpdateUser(Users user)
        {
            /*
              SqlParameter prmUserId = new SqlParameter("@UserID", SqlDbType.Int, 4);
              prmUserId.Value = user.UID;

              SqlParameter prmPassword = new SqlParameter("@Password", SqlDbType.VarChar, 50);
              prmPassword.Value = user.Password;

              SqlParameter prmEmail = new SqlParameter("@Email", SqlDbType.VarChar, 50);
              prmEmail.Value = user.Email;

              SqlParameter prmFirstName = new SqlParameter("@Firstname", SqlDbType.VarChar, 50);
              prmFirstName.Value = user.FirstName;

              SqlParameter prmLastName = new SqlParameter("@Lastname", SqlDbType.VarChar, 50);
              prmLastName.Value = user.LastName;

              SqlParameter prmCity = new SqlParameter("@City", SqlDbType.VarChar, 50);
              prmCity.Value = user.City;

              SqlParameter prmState = new SqlParameter("@State", SqlDbType.VarChar, 50);
              prmState.Value = user.State;

              SqlParameter prmCountry = new SqlParameter("@Country", SqlDbType.VarChar, 50);
              prmCountry.Value = user.Country;

              SqlParameter prmDOB = new SqlParameter("@DOB", SqlDbType.DateTime);
              prmDOB.Value = user.DOB;

              SqlParameter prmFavoriteFoods1 = new SqlParameter("@FavoriteFoods1", SqlDbType.VarChar, 50);
              prmFavoriteFoods1.Value = user.FavoriteFoods1;

              SqlParameter prmFavoriteFoods2 = new SqlParameter("@FavoriteFoods2", SqlDbType.VarChar, 50);
              prmFavoriteFoods2.Value = user.FavoriteFoods2;

              SqlParameter prmFavoriteFoods3 = new SqlParameter("@FavoriteFoods3", SqlDbType.VarChar, 50);
              prmFavoriteFoods3.Value = user.FavoriteFoods3;

              SqlParameter prmNewsletter = new SqlParameter("@Newsletter", SqlDbType.Int, 4);
              prmNewsletter.Value = user.NewsLetter;

              SqlParameter prmContactMe = new SqlParameter("@ContactMe", SqlDbType.Int, 4);
              prmContactMe.Value = user.ContactMe;

              SqlParameter prmWebsite = new SqlParameter("@Website", SqlDbType.VarChar, 100);
              prmWebsite.Value = user.Website;

              SqlParameter prmAboutMe = new SqlParameter("@AboutMe", SqlDbType.VarChar, 1000);
              prmAboutMe.Value = user.AboutMe;

              SqlParameter prmPhoto = new SqlParameter("@Photo", SqlDbType.VarChar, 50);
              prmPhoto.Value = user.Photo;

              return DataAccess.Execute("spUpdateUser", prmUserId, prmPassword, prmEmail, prmFirstName, prmLastName, prmCity, prmState, prmCountry, prmDOB,
              prmFavoriteFoods1, prmFavoriteFoods2, prmFavoriteFoods3, prmNewsletter, prmContactMe, prmWebsite, prmAboutMe, prmPhoto);
             * */
              return 0;
        }
 /// <summary>
 /// Short Add new user
 /// </summary>
 /// <returns></returns>
 public static int ShortAddNewUser(Users user)
 {
     return 0;
 }
        /// <summary>
        /// Quick Add new user
        /// </summary>
        /// <returns></returns>
        public static int QuickAddNewUser(Users user)
        {
            SqlParameter prmUsername = new SqlParameter("@Username", SqlDbType.VarChar, 50);
              prmUsername.Value = user.UserName;

              SqlParameter prmPassword = new SqlParameter("@Password", SqlDbType.VarChar, 50);
              prmPassword.Value = user.Password;

              SqlParameter prmEmail = new SqlParameter("@Email", SqlDbType.VarChar, 50);
              prmEmail.Value = user.Email1;

              SqlParameter prmFirstName = new SqlParameter("@Firstname", SqlDbType.VarChar, 50);
              prmFirstName.Value = user.FirstName;

              SqlParameter prmLastName = new SqlParameter("@Lastname", SqlDbType.VarChar, 50);
              prmLastName.Value = user.LastName;

              return DataAccess.Execute("spInsertUser", prmUsername, prmPassword, prmEmail, prmFirstName, prmLastName);
        }
        public ExtendedCollection<Users> GetAllUsers()
        {
            ExtendedCollection<Users> list = new ExtendedCollection<Users>();

            IDataReader dr = GetData;

            while (dr.Read())
            {
                Users item = new Users();

                if (dr["UID"] != DBNull.Value)
                {
                    item.UID = (int)dr["UID"];
                }
                if (dr["uname"] != DBNull.Value)
                {
                    item.UserName = (string)dr["uname"];
                }
                if (dr["pswd"] != DBNull.Value)
                {
                    item.Password = (string)dr["pswd"];
                }
                if (dr["Email1"] != DBNull.Value)
                {
                    item.Email1 = (string)dr["Email1"];
                }
                if (dr["fName"] != DBNull.Value)
                {
                    item.FirstName = (string)dr["fName"];
                }
                if (dr["lName"] != DBNull.Value)
                {
                    item.LastName = (string)dr["lName"];
                }
                /*
                if (dr["CityID"] != DBNull.Value)
                {
                    item.CityID = (int)dr["CityID"];
                }
                if (dr["StateID"] != DBNull.Value)
                {
                    item.StateID = (int)dr["StateID"];
                }
                if (dr["CountryID"] != DBNull.Value)
                {
                    item.CountryID = (int)dr["CountryID"];
                }

                if (dr["UserImage"] != DBNull.Value)
                {
                    item.Photo = (string)dr["UserImage"];
                }*/
                if (dr["isActive"] != DBNull.Value)
                {
                    item.isActive = (Int16)dr["isActive"];
                }
                if (dr["RegistrationDate"] != DBNull.Value)
                {
                    item.RegistrationDate = (DateTime)dr["RegistrationDate"];
                }
                /*
                if (dr["Activation"] != DBNull.Value)
                {
                    item.isActive = (int)dr["Activation"];
                }

                if (dr["Hits"] != DBNull.Value)
                {
                    item.Hits = (int)dr["Hits"];
                }
                if (dr["TotalSavedRecipe"] != DBNull.Value)
                {
                    item.SavedrecipeCount = (int)dr["TotalSavedRecipe"];
                }
                if (dr["TotalFriends"] != DBNull.Value)
                {
                    item.FriendsCount = (int)dr["TotalFriends"];
                }
                if (dr["TotalSubmittedRecipe"] != DBNull.Value)
                {
                    item.PostedRecipeCount = (int)dr["TotalSubmittedRecipe"];
                }
                if (dr["TotalSubmittedArticle"] != DBNull.Value)
                {
                    item.PostedArticleCount = (int)dr["TotalSubmittedArticle"];
                }
                 * */
                if (dr["lastlogin"] != DBNull.Value)
                {
                    item.LastLoginDate = (DateTime)dr["lastlogin"];
                }
                if (dr["LastUpdated"] != DBNull.Value)
                {
                    item.LastUpdated = (DateTime)dr["LastUpdated"];
                }
                if (dr["UserType"] != DBNull.Value)
                {
                    item.UserType = (Int16)dr["UserType"];
                }
                /*
                if (dr["ShowFriendsListinProfile"] != DBNull.Value)
                {
                    item.ShowFriendsListinProfile = (int)dr["ShowFriendsListinProfile"];
                }
                if (dr["ShowCookBookinProfile"] != DBNull.Value)
                {
                    item.ShowCookBookinProfile = (int)dr["ShowCookBookinProfile"];
                }
                if (dr["NumRecordsCookBookQuickView"] != DBNull.Value)
                {
                    item.NumRecordsCookBookQuickView = (int)dr["NumRecordsCookBookQuickView"];
                }
                if (dr["NumRecordsFriendsList"] != DBNull.Value)
                {
                    item.NumRecordsFriendsList = (int)dr["NumRecordsFriendsList"];
                }
                if (dr["PreferredLayout"] != DBNull.Value)
                {
                    item.PreferredLayout = (int)dr["PreferredLayout"];
                }
                if (dr["PreferredPageSize"] != DBNull.Value)
                {
                    item.PreferredPageSize = (int)dr["PreferredPageSize"];
                }
                if (dr["IsUserChoosePreferredLayout"] != DBNull.Value)
                {
                    item.IsUserChoosePreferredLayout = (int)dr["IsUserChoosePreferredLayout"];
                }
                if (dr["ReceivePM"] != DBNull.Value)
                {
                    item.ReceivePM = (int)dr["ReceivePM"];
                }
                if (dr["PMEmailNotification"] != DBNull.Value)
                {
                    item.PMEmailNotification = (int)dr["PMEmailNotification"];
                }
                if (dr["TotalCommentRecipe"] != DBNull.Value)
                {
                    item.CommentRecipeCount = (int)dr["TotalCommentRecipe"];
                }
                if (dr["TotalCommentArticle"] != DBNull.Value)
                {
                    item.CommentArticleCount = (int)dr["TotalCommentArticle"];
                }
                */
                list.Add(item);
            }

            dr.Close();

            return list;
        }