Exemple #1
0
 public StaffInfo StaffInfoIDataReader(IDataReader dr)
 {
     DataAccess.StaffInfo obj = new DataAccess.StaffInfo();
     obj.StaffID     = (dr["StaffID"] is DBNull) ? string.Empty : dr["StaffID"].ToString();
     obj.Fullname    = (dr["Fullname"] is DBNull) ? string.Empty : dr["Fullname"].ToString();
     obj.Gender      = (dr["Gender"] is DBNull) ? string.Empty : dr["Gender"].ToString();
     obj.Address     = (dr["Address"] is DBNull) ? string.Empty : dr["Address"].ToString();
     obj.IdNumber    = (dr["IdNumber"] is DBNull) ? string.Empty : dr["IdNumber"].ToString();
     obj.PhoneNumber = (dr["PhoneNumber"] is DBNull) ? string.Empty : dr["PhoneNumber"].ToString();
     obj.HomePhone   = (dr["HomePhone"] is DBNull) ? string.Empty : dr["HomePhone"].ToString();
     obj.Email       = (dr["Email"] is DBNull) ? string.Empty : dr["Email"].ToString();
     return(obj);
 }
        public List <StaffInfo> StaffInfo_GetByLevel(string Level, int LevelLength)
        {
            List <DataAccess.StaffInfo> list = new List <DataAccess.StaffInfo>();

            DataAccess.StaffInfo obj = new DataAccess.StaffInfo();
            DbCommand            cmd = db.GetStoredProcCommand("sp_StaffInfo_GetByLevel", Level, LevelLength);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    list.Add(obj.StaffInfoIDataReader(dr));
                }
                dr.Close();
                dr.Dispose();
            }
            return(list);
        }
        public List <StaffInfo> StaffInfo_GetByAll()
        {
            List <DataAccess.StaffInfo> list = new List <DataAccess.StaffInfo>();

            DataAccess.StaffInfo obj = new DataAccess.StaffInfo();
            DbCommand            cmd = db.GetStoredProcCommand("Group_SelectAll");

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    list.Add(obj.StaffInfoIDataReader(dr));
                }
                dr.Close();
                dr.Dispose();
            }
            return(list);
        }
        public List <StaffInfo> StaffInfo_Paging(string CurentStaffInfo, string StaffInfoSize)
        {
            List <DataAccess.StaffInfo> list = new List <DataAccess.StaffInfo>();

            DataAccess.StaffInfo obj = new DataAccess.StaffInfo();
            DbCommand            cmd = db.GetStoredProcCommand("Group_SelectPage", CurentStaffInfo, StaffInfoSize);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                while (dr.Read())
                {
                    list.Add(obj.StaffInfoIDataReader(dr));
                }
                dr.Close();
                dr.Dispose();
            }
            return(list);
        }