Exemple #1
0
        public void AddEmail(string email, string pwd)
        {
            UserEmail ue = new UserEmail();
            ue.UserID = UserID;

            UserEmail x = new UserEmail();
            x.UserID = UserID;
            x.Email = email;
            x.Password = pwd;

            ue.Insert(x);
        }
Exemple #2
0
        public void AddEmail(string email, string pwd)
        {
            UserEmail ue = new UserEmail();

            ue.UserID = UserID;

            UserEmail x = new UserEmail();

            x.UserID   = UserID;
            x.Email    = email;
            x.Password = pwd;

            ue.Insert(x);
        }
Exemple #3
0
        public List <UserEmail> GetEmailList(int userID)
        {
            List <UserEmail> list = new List <UserEmail>();

            string sql = string.Format("SELECT * FROM UserEmails WHERE UserID = '{0}' ", userID);

            using (Connection cn = new Connection())
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    try
                    {
                        cmd.Connection  = cn.SqlConnection;
                        cmd.CommandText = sql;
                        int           recordsAffected = cmd.ExecuteNonQuery();
                        SqlDataReader reader          = cmd.ExecuteReader();
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                UserEmail ue = new UserEmail();
                                ue.UserID      = (int)reader["UserID"];
                                ue.UserEmailID = (int)reader["UserEmailID"];
                                ue.Email       = reader["Email"].ToString();
                                ue.Password    = reader["Password"].ToString();
                                list.Add(ue);
                            }
                            return(list);
                        }
                        else
                        {
                            return(list);
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                        return(list);
                    }
                }
            }
        }
Exemple #4
0
        public bool Insert(UserEmail userEmail)
        {
            string sql = string.Format("INSERT INTO UserEmails(UserID, Email, Password) VALUES ('{0}', '{1}', '{2}') ", userEmail.UserID, userEmail.Email, userEmail.Password);

            using (Connection cn = new Connection())
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    try
                    {
                        cmd.Connection  = cn.SqlConnection;
                        cmd.CommandText = sql;
                        int recordsAffected = cmd.ExecuteNonQuery();
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                        return(false);
                    }
                }
            }
        }
Exemple #5
0
 public bool Insert(UserEmail userEmail)
 {
     string sql = string.Format("INSERT INTO UserEmails(UserID, Email, Password) VALUES ('{0}', '{1}', '{2}') ", userEmail.UserID, userEmail.Email, userEmail.Password);
     using (Connection cn = new Connection())
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             try
             {
                 cmd.Connection = cn.SqlConnection;
                 cmd.CommandText = sql;
                 int recordsAffected = cmd.ExecuteNonQuery();
                 return true;
             }
             catch (Exception ex)
             {
                 System.Diagnostics.Debug.WriteLine(ex.Message);
                 return false;
             }
         }
     }
 }
Exemple #6
0
        public List<UserEmail> GetEmailList(int userID)
        {
            List<UserEmail> list = new List<UserEmail>();

            string sql = string.Format("SELECT * FROM UserEmails WHERE UserID = '{0}' ", userID);
            using (Connection cn = new Connection())
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    try
                    {
                        cmd.Connection = cn.SqlConnection;
                        cmd.CommandText = sql;
                        int recordsAffected = cmd.ExecuteNonQuery();
                        SqlDataReader reader = cmd.ExecuteReader();
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                UserEmail ue = new UserEmail();
                                ue.UserID = (int)reader["UserID"];
                                ue.UserEmailID = (int)reader["UserEmailID"];
                                ue.Email = reader["Email"].ToString();
                                ue.Password = reader["Password"].ToString();
                                list.Add(ue);
                            }
                            return list;
                        }
                        else
                            return list;
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                        return list;
                    }
                }
            }
        }
Exemple #7
0
 public User()
 {
     EmailList = new List<UserEmail>();
     userEmail = new UserEmail();
 }
Exemple #8
0
 public User()
 {
     EmailList = new List <UserEmail>();
     userEmail = new UserEmail();
 }