예제 #1
0
        public IList<Core.Business.Skill> GetAllSkill()
        {
            IList<Core.Business.Skill> skilllist = new List<Core.Business.Skill>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllSkill);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.Skill skill = new Core.Business.Skill();

                    if (!reader.IsDBNull(0)) skill.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) skill.SkillLvl = reader.GetString(1);
                    if (!reader.IsDBNull(2)) skill.StaffCode = reader.GetString(2);
                    if (!reader.IsDBNull(3)) skill.AddDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) skill.Code = reader.GetString(4);

                    skill.MarkOld();
                    skilllist.Add(skill);
                }
                reader.Close();
            }
            return skilllist;
        }
예제 #2
0
        public Core.Business.Skill Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectSkill);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Skill skill = new Core.Business.Skill();

                if (!reader.IsDBNull(0)) skill.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) skill.SkillLvl = reader.GetString(1);
                if (!reader.IsDBNull(2)) skill.StaffCode = reader.GetString(2);
                if (!reader.IsDBNull(3)) skill.AddDate = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) skill.Code = reader.GetString(4);
                reader.Close();
                return skill;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }