示例#1
0
        public SYS_Staff SelectSYS_Staff(int IDUser, DbConnection conn)
        {
            SYS_Staff    sys_staff = new SYS_Staff();
            DbDataReader reader    = null;

            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_USERID, IDUser, false));

                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Staff_SelectByIdUser]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_StaffDataAccess.SetSYS_StaffInfo(reader, ref sys_staff);
                }
                return(sys_staff);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_StaffDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
示例#2
0
        public List <SYS_Staff> SelectAllSYS_Staff()
        {
            DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            List <SYS_Staff> sys_staff = new List <SYS_Staff>();
            DbDataReader     reader    = null;

            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Staff_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_StaffDataAccess.SetListSYS_StaffInfo(ref reader, ref sys_staff);
                }
                return(sys_staff);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_StaffDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
示例#3
0
        private static void SetListSYS_StaffInfo(ref DbDataReader reader, ref List <SYS_Staff> sys_staffs)
        {
            SYS_Staff sys_staff = null;

            while (reader.Read())
            {
                sys_staff = new SYS_Staff();
                SYS_StaffDataAccess.SetSYS_StaffInfo(reader, ref sys_staff);
                sys_staffs.Add(sys_staff);
            }
        }