Exemplo n.º 1
0
        public IList<Core.Business.ParentCode> GetAllParentCode()
        {
            IList<Core.Business.ParentCode> parentCodelist = new List<Core.Business.ParentCode>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllParentCode);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.ParentCode parentCode = new Core.Business.ParentCode();

                    if (!reader.IsDBNull(0)) parentCode.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) parentCode.PCateCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) parentCode.PName = reader.GetString(2);
                    if (!reader.IsDBNull(3)) parentCode.Des = reader.GetString(3);

                    parentCode.MarkOld();
                    parentCodelist.Add(parentCode);
                }
                reader.Close();
            }
            return parentCodelist;
        }
Exemplo n.º 2
0
        public ParentCode Select(string ParentCode)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@PCateCode", SqlDbType.NVarChar,ParentCode,30);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectParentCodeWithCode);

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

                if (!reader.IsDBNull(0)) parentCode.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) parentCode.PCateCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) parentCode.PName = reader.GetString(2);
                if (!reader.IsDBNull(3)) parentCode.Des = reader.GetString(3);

                reader.Close();

                parentCode.MarkOld();

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

                return null;
            }
        }