Beispiel #1
0
        public IList<Core.Business.PunishRcd> GetAllPunishRcd()
        {
            IList<Core.Business.PunishRcd> punishRcdlist = new List<Core.Business.PunishRcd>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllPunishRcd);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.PunishRcd punishRcd = new Core.Business.PunishRcd();

                    if (!reader.IsDBNull(0)) punishRcd.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) punishRcd.StdCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) punishRcd.PnshCate = reader.GetString(2);
                    if (!reader.IsDBNull(3)) punishRcd.PnshContent = reader.GetString(3);
                    if (!reader.IsDBNull(4)) punishRcd.PnshDate = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) punishRcd.PnshState = reader.GetString(5);
                    if (!reader.IsDBNull(6)) punishRcd.PnshInCharge = reader.GetString(6);
                    if (!reader.IsDBNull(7)) punishRcd.PnshLastDate = reader.GetDecimal(7);
                    if (!reader.IsDBNull(8)) punishRcd.PnshStopDate = reader.GetDateTime(8);

                    punishRcd.MarkOld();
                    punishRcdlist.Add(punishRcd);
                }
                reader.Close();
            }
            return punishRcdlist;
        }
Beispiel #2
0
        public IList<Core.Business.PunishRcd> GetListByQuery(string wherestr)
        {
            IList<Core.Business.PunishRcd> punishRcdlist = new List<Core.Business.PunishRcd>();
            SqlServerUtility sql = new SqlServerUtility();
            StringBuilder sb = new StringBuilder();
            sb.Append(SqlGetListByQuery);
            if (!string.IsNullOrEmpty(wherestr))
            {
                sb.Append(" Where 1=1 ");
                sb.Append(" AND "+wherestr);
            }
            SqlDataReader reader = sql.ExecuteSqlReader(sb.ToString());

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.PunishRcd punishRcd = new Core.Business.PunishRcd();

                    if (!reader.IsDBNull(0)) punishRcd.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) punishRcd.StdCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) punishRcd.PnshCate = reader.GetString(2);
                    if (!reader.IsDBNull(3)) punishRcd.PnshContent = reader.GetString(3);
                    if (!reader.IsDBNull(4)) punishRcd.PnshDate = reader.GetDateTime(4);
                    if (!reader.IsDBNull(5)) punishRcd.PnshState = reader.GetString(5);
                    if (!reader.IsDBNull(6)) punishRcd.PnshInCharge = reader.GetString(6);
                    if (!reader.IsDBNull(7)) punishRcd.PnshLastDate = reader.GetDecimal(7);
                    if (!reader.IsDBNull(8)) punishRcd.PnshStopDate = reader.GetDateTime(8);

                    punishRcd.MarkOld();
                    punishRcdlist.Add(punishRcd);
                }
                reader.Close();
            }
            else
            {
                return null;
            }
            return punishRcdlist;
        }