Exemple #1
0
        public IList<Core.Business.StdStatistic> GetByClass(string ccode)
        {
            IList<Core.Business.StdStatistic> stdStatisticlist = new List<Core.Business.StdStatistic>();
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@ClsCode", SqlDbType.NVarChar, ccode);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetByClass);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StdStatistic stdStatistic = new Core.Business.StdStatistic();

                    if (!reader.IsDBNull(0)) stdStatistic.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) stdStatistic.OrignNum = reader.GetDecimal(1);
                    if (!reader.IsDBNull(2)) stdStatistic.ActualNum = reader.GetDecimal(2);
                    if (!reader.IsDBNull(3)) stdStatistic.LostNum = reader.GetInt32(3);
                    if (!reader.IsDBNull(4)) stdStatistic.Rate = reader.GetDecimal(4);
                    if (!reader.IsDBNull(5)) stdStatistic.Term = reader.GetInt32(5);
                    if (!reader.IsDBNull(6)) stdStatistic.AddDate = reader.GetDateTime(6);
                    if (!reader.IsDBNull(7)) stdStatistic.ClsCode = reader.GetString(7);
                    if (!reader.IsDBNull(8)) stdStatistic.Summary = reader.GetString(8);
                    if (!reader.IsDBNull(9)) stdStatistic.Year = reader.GetString(9);
                    if (!reader.IsDBNull(10)) stdStatistic.Inputter = reader.GetString(10);

                    stdStatistic.MarkOld();
                    stdStatisticlist.Add(stdStatistic);
                }
                reader.Close();
            }
            return stdStatisticlist;
        }
Exemple #2
0
        public Core.Business.StdStatistic Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) stdStatistic.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) stdStatistic.OrignNum = reader.GetDecimal(1);
                if (!reader.IsDBNull(2)) stdStatistic.ActualNum = reader.GetDecimal(2);
                if (!reader.IsDBNull(3)) stdStatistic.LostNum = reader.GetInt32(3);
                if (!reader.IsDBNull(4)) stdStatistic.Rate = reader.GetDecimal(4);
                if (!reader.IsDBNull(5)) stdStatistic.Term = reader.GetInt32(5);
                if (!reader.IsDBNull(6)) stdStatistic.AddDate = reader.GetDateTime(6);
                if (!reader.IsDBNull(7)) stdStatistic.ClsCode = reader.GetString(7);
                if (!reader.IsDBNull(8)) stdStatistic.Summary = reader.GetString(8);
                if (!reader.IsDBNull(9)) stdStatistic.Year = reader.GetString(9);
                if (!reader.IsDBNull(10)) stdStatistic.Inputter = reader.GetString(10);
                reader.Close();
                return stdStatistic;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }