public List<DDMemberInfoCustomer> File_GetByAll() { List<DDMemberInfoCustomer> list = new List<DDMemberInfoCustomer>(); using (SqlConnection Conn = new SqlConnection(Common.GetConnectString())) { try { Conn.Open(); using (SqlCommand dbCmd = new SqlCommand("DDV_GetMemberInfo", Conn)) { DDMemberInfoCustomer obj = new DDMemberInfoCustomer(); dbCmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = dbCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { list.Add(obj.CustomerIDataReader(dr)); } } dr.Close(); obj = null; } } catch (Exception ex) { throw ex; } finally { Conn.Close(); } } return list; }
public DDMemberInfoCustomer CustomerIDataReader(IDataReader dr) { DDMemberInfoCustomer obj = new DDMemberInfoCustomer(); obj.Account = (dr["Account"] is DBNull) ? string.Empty : dr["Account"].ToString(); obj.Name = (dr["Name"] is DBNull) ? string.Empty : dr["Name"].ToString(); obj.Email = (dr["Email"] is DBNull) ? string.Empty : dr["Email"].ToString(); obj.Pw = (dr["Pw"] is DBNull) ? string.Empty : dr["Pw"].ToString(); return obj; }