Example #1
0
        public IList<ISO> Fill(DateTime? StartDate, DateTime? EndDate)
        {
            if (StartDate == null || EndDate == null)
            {
                return null;
            }

            IList<Core.Business.ISO> iSOlist = new List<Core.Business.ISO>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@StartDate", SqlDbType.DateTime, StartDate);

            sql.AddParameter("@EndDate", SqlDbType.DateTime, EndDate);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlFillISOs);

            if (reader != null && !reader.IsClosed)
            {
                while (reader.Read())
                {
                    Core.Business.ISO iSO = new Core.Business.ISO();

                    if (!reader.IsDBNull(0)) iSO.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) iSO.CheckDate = reader.GetDateTime(1);
                    if (!reader.IsDBNull(2)) iSO.Sum = reader.GetDecimal(2);
                    if (!reader.IsDBNull(3)) iSO.CheckCode = reader.GetString(3);
                    if (!reader.IsDBNull(4)) iSO.LeftCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) iSO.Title = reader.GetString(5);
                    if (!reader.IsDBNull(6)) iSO.DepartCode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) iSO.CheckedSign = reader.GetString(7);
                    if (!reader.IsDBNull(8)) iSO.CheckSign = reader.GetString(8);
                    if (!reader.IsDBNull(9)) iSO.Inputter = reader.GetString(9);
                    if (!reader.IsDBNull(10)) iSO.Term = reader.GetInt32(10);
                    if (!reader.IsDBNull(11)) iSO.Year = reader.GetString(11);

                    iSO.MarkOld();

                    iSOlist.Add(iSO);
                }
                reader.Close();
            }
            return iSOlist;
        }
Example #2
0
        public ISO Select(Department Depart, string year, int term)
        {
            if (Depart == null || string.IsNullOrEmpty(year) || term == 0)
            {
                return null;
            }

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Depart", SqlDbType.NVarChar, Depart.DepartCode, 30);

            sql.AddParameter("@Year", SqlDbType.NVarChar, year, 10);

            sql.AddParameter("@Term", SqlDbType.Int, term);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectIS0WithParam);

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

                if (!reader.IsDBNull(0)) iSO.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) iSO.Term = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) iSO.CheckDate = reader.GetDateTime(2);
                if (!reader.IsDBNull(3)) iSO.Sum = reader.GetDecimal(3);
                if (!reader.IsDBNull(4)) iSO.CheckCode = reader.GetString(4);
                if (!reader.IsDBNull(5)) iSO.LeftCode = reader.GetString(5);
                if (!reader.IsDBNull(6)) iSO.Title = reader.GetString(6);
                if (!reader.IsDBNull(7)) iSO.DepartCode = reader.GetString(7);
                if (!reader.IsDBNull(8)) iSO.CheckedSign = reader.GetString(8);
                if (!reader.IsDBNull(9)) iSO.CheckSign = reader.GetString(9);
                if (!reader.IsDBNull(10)) iSO.Inputter = reader.GetString(10);
                if (!reader.IsDBNull(11)) iSO.Year = reader.GetString(11);

                reader.Close();

                iSO.MarkOld();

                return iSO;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Example #3
0
        public List<ISO> GetISOs(string queryParam)
        {
            if (string.IsNullOrEmpty(queryParam))
            {
                return this.GetAllISO() as List<ISO>;
            }
            IList<Core.Business.ISO> iSOlist = new List<Core.Business.ISO>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllISO + queryParam);

            if (reader != null && !reader.IsClosed)
            {
                while (reader.Read())
                {
                    Core.Business.ISO iSO = new Core.Business.ISO();

                    if (!reader.IsDBNull(0)) iSO.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) iSO.Term = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) iSO.CheckDate = reader.GetDateTime(2);
                    if (!reader.IsDBNull(3)) iSO.Sum = reader.GetDecimal(3);
                    if (!reader.IsDBNull(4)) iSO.CheckCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) iSO.LeftCode = reader.GetString(5);
                    if (!reader.IsDBNull(6)) iSO.Title = reader.GetString(6);
                    if (!reader.IsDBNull(7)) iSO.DepartCode = reader.GetString(7);
                    if (!reader.IsDBNull(8)) iSO.CheckedSign = reader.GetString(8);
                    if (!reader.IsDBNull(9)) iSO.CheckSign = reader.GetString(9);
                    if (!reader.IsDBNull(10)) iSO.Inputter = reader.GetString(10);
                    if (!reader.IsDBNull(11)) iSO.Year = reader.GetString(11);

                    iSO.MarkOld();
                    iSOlist.Add(iSO);
                }
                reader.Close();

            }
            return iSOlist as List<ISO>;
        }
Example #4
0
        public IList<Core.Business.ISO> Search(string title, string dcode)
        {
            IList<Core.Business.ISO> iSOlist = new List<Core.Business.ISO>();
            SqlServerUtility sql = new SqlServerUtility();
            string sqlstr = string.Empty;
            if (title == string.Empty || title == "" || (String.IsNullOrEmpty(title)))
            {
                if (dcode == "alldepart")
                {
                    return ISO.GetAllISO();
                }
                else
                {
                    sqlstr = SqlSearchByDepart;
                    sql.AddParameter("@DepartCode", SqlDbType.NVarChar, dcode);
                }

            }
            else
            {
                sql.AddParameter("@Title", SqlDbType.NVarChar, title);
                if (dcode == "alldepart")
                {
                    sqlstr = SqlSearchByName;

                }
                else
                {
                    sqlstr = SqlSearchByNameAndDepart;
                    sql.AddParameter("@DepartCode", SqlDbType.NVarChar, dcode);
                }
            }

            SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ISO iSO = new Core.Business.ISO();

                    if (!reader.IsDBNull(0)) iSO.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) iSO.CheckDate = reader.GetDateTime(1);
                    if (!reader.IsDBNull(2)) iSO.Sum = reader.GetDecimal(2);
                    if (!reader.IsDBNull(3)) iSO.CheckCode = reader.GetString(3);
                    if (!reader.IsDBNull(4)) iSO.LeftCode = reader.GetString(4);
                    if (!reader.IsDBNull(5)) iSO.Title = reader.GetString(5);
                    if (!reader.IsDBNull(6)) iSO.DepartCode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) iSO.CheckedSign = reader.GetString(7);
                    if (!reader.IsDBNull(8)) iSO.CheckSign = reader.GetString(8);
                    if (!reader.IsDBNull(9)) iSO.Inputter = reader.GetString(9);

                    if (!reader.IsDBNull(10)) iSO.Term = reader.GetInt32(10);
                    if (!reader.IsDBNull(11)) iSO.Year = reader.GetString(11);

                    iSO.MarkOld();

                    iSOlist.Add(iSO);
                }
                reader.Close();
            }
            return iSOlist;
        }
Example #5
0
        public Core.Business.ISO GetByCode(string code)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@CheckCode", SqlDbType.NVarChar, code);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetByCode);

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

                if (!reader.IsDBNull(0)) iSO.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) iSO.CheckDate = reader.GetDateTime(1);
                if (!reader.IsDBNull(2)) iSO.Sum = reader.GetDecimal(2);
                if (!reader.IsDBNull(3)) iSO.CheckCode = reader.GetString(3);
                if (!reader.IsDBNull(4)) iSO.LeftCode = reader.GetString(4);
                if (!reader.IsDBNull(5)) iSO.Title = reader.GetString(5);
                if (!reader.IsDBNull(6)) iSO.DepartCode = reader.GetString(6);
                if (!reader.IsDBNull(7)) iSO.CheckedSign = reader.GetString(7);
                if (!reader.IsDBNull(8)) iSO.CheckSign = reader.GetString(8);
                if (!reader.IsDBNull(9)) iSO.Inputter = reader.GetString(9);
                if (!reader.IsDBNull(10)) iSO.Term = reader.GetInt32(10);
                if (!reader.IsDBNull(11)) iSO.Year = reader.GetString(11);

                reader.Close();

                iSO.MarkOld();

                return iSO;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }