예제 #1
0
        public IList<Core.Business.CLASSCODE> GetAllCLASSCODE()
        {
            IList<Core.Business.CLASSCODE> cLASSCODElist = new List<Core.Business.CLASSCODE>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectCLASSCODEsAll");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.CLASSCODE cLASSCODE = new Core.Business.CLASSCODE();

                    if (!reader.IsDBNull(0)) cLASSCODE.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) cLASSCODE.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) cLASSCODE.ParentId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) cLASSCODE.RootPath = reader.GetString(3);

                    cLASSCODE.MarkOld();
                    cLASSCODElist.Add(cLASSCODE);
                }
                reader.Close();
            }
            return cLASSCODElist;
        }
예제 #2
0
        public IList<CY.CSTS.Core.Business.CLASSCODE> GetClassCodeDynamic(string whereCondition, string orderByExpression)
        {
            IList<Core.Business.CLASSCODE> list = new List<Core.Business.CLASSCODE>();
            SqlServerUtility db = new SqlServerUtility();
            db.AddParameter("@WhereCondition", SqlDbType.NVarChar, whereCondition);
            db.AddParameter("@OrderByExpression", SqlDbType.NVarChar, orderByExpression);
            SqlDataReader reader = db.ExecuteSPReader("usp_SelectCLASSCODEsDynamic");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.CLASSCODE classList = new Core.Business.CLASSCODE();

                    if (!reader.IsDBNull(0)) classList.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) classList.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) classList.ParentId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) classList.RootPath = reader.GetString(3);

                    classList.MarkOld();
                    list.Add(classList);
                }
                reader.Close();
            }
            return list;
        }
예제 #3
0
        public List<CLASSCODE> SelectLayerCate(int layer, int parent)
        {
            List<Core.Business.CLASSCODE> list = new List<Core.Business.CLASSCODE>();

            StringBuilder strSql = new StringBuilder();

            //  ���㼶
            if (layer == 0)
            {
                strSql.Append("select * from ClassCode where parentID not in (select Id from ClassCode ) and Id=" + parent);
            }
            else
            {
                strSql.Append("select Id from ClassCode where parentID not in (select Id from ClassCode)");
            }

            // �ӵ�һ����ʼ
            for (int i = 0; i < layer; i++)
            {
                if (i == layer - 1)
                {
                    strSql.Insert(0, "select * from ClassCode where ParentId in ( ");

                    strSql.Append(")");

                }
                else
                {
                    strSql.Insert(0, "select Id from ClassCode where ParentId in ( ");

                    strSql.Append(")");
                }

            }

            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(strSql.ToString());

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

                    if (!reader.IsDBNull(0)) classList.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) classList.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) classList.ParentId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) classList.RootPath = reader.GetString(3);

                    classList.MarkOld();

                    list.Add(classList);
                }
                reader.Close();
            }
            return list;
        }
예제 #4
0
        /// <summary>
        ///  5 9 13 17
        /// </summary>
        /// <param name="layer"></param>
        /// <returns></returns>
        public List<CLASSCODE> SelectLayerCate(int layer)
        {
            List<Core.Business.CLASSCODE> list = new List<Core.Business.CLASSCODE>();

            StringBuilder strSql = new StringBuilder();
            int replacenum = 0, replacenum2 = 0;

            if (layer == 1)
            {
                replacenum = 5;

                replacenum2 = 8;
            }
            if (layer == 2)
            {
                replacenum = 9;

                replacenum2 = 12;
            }
            if (layer == 3)
            {
                replacenum = 13;

                replacenum2 = 16;
            }

            strSql.Append(string.Format(Sql_PickUpLayerClassCode, replacenum, replacenum2));

            ////  ���㼶
            //if (layer == 0)
            //{
            //    strSql.Append("select * from ClassCode where parentID not in (select Id from ClassCode)");
            //}
            //else
            //{
            //    strSql.Append("select Id from ClassCode where parentID not in (select Id from ClassCode)");
            //}

            //// �ӵ�һ����ʼ
            //for (int i = 0; i < layer; i++)
            //{
            //    if (i == layer - 1)
            //    {
            //        strSql.Insert(0, "select * from ClassCode where ParentId in ( ");

            //        strSql.Append(")");
            //    }
            //    else
            //    {
            //        strSql.Insert(0, "select Id from ClassCode where ParentId in ( ");

            //        strSql.Append(")");
            //    }
            //}

            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(strSql.ToString());

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

                    if (!reader.IsDBNull(0)) classcode.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) classcode.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) classcode.ParentId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) classcode.RootPath = reader.GetString(3);
                    if (!reader.IsDBNull(4)) classcode.Count = reader.GetInt32(4);

                    classcode.MarkOld();

                    list.Add(classcode);
                }
                reader.Close();
            }
            return list;
        }
예제 #5
0
        public Core.Business.CLASSCODE Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) cLASSCODE.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) cLASSCODE.Name = reader.GetString(1);
                if (!reader.IsDBNull(2)) cLASSCODE.ParentId = reader.GetInt32(2);
                if (!reader.IsDBNull(3)) cLASSCODE.RootPath = reader.GetString(3);
                cLASSCODE.MarkOld();
                reader.Close();
                return cLASSCODE;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
예제 #6
0
        public IEnumerable<CLASSCODE> GetTypes(Guid unitId, int layer)
        {
            IList<Core.Business.CLASSCODE> cLASSCODElist = new List<Core.Business.CLASSCODE>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@id", SqlDbType.UniqueIdentifier, unitId);

            SqlDataReader reader = null;
            if (layer == 1)
            {
                reader = sql.ExecuteSqlReader(Sql_GetTypes_UnitId_First);
            }
            else if (layer == 2)
            {
                reader = sql.ExecuteSqlReader(Sql_GetTypes_UnitId_Second);
            }
            else if (layer == 3)
            {
                reader = sql.ExecuteSqlReader(Sql_GetTypes_UnitId_Third);
            }

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.CLASSCODE cLASSCODE = new Core.Business.CLASSCODE();

                    if (!reader.IsDBNull(0)) cLASSCODE.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) cLASSCODE.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) cLASSCODE.ParentId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) cLASSCODE.RootPath = reader.GetString(3);
                    if (!reader.IsDBNull(4)) cLASSCODE.count = reader.GetInt32(4);
                    cLASSCODE.MarkOld();
                    cLASSCODElist.Add(cLASSCODE);
                }
                reader.Close();
            }
            return cLASSCODElist;
        }
예제 #7
0
        public IEnumerable<CY.CSTS.Core.Business.CLASSCODE> GetClassCodes(string typename)
        {
            try
            {
                if (string.IsNullOrEmpty(typename))
                    return null;

                List<CY.CSTS.Core.Business.CLASSCODE> ClassCodes = new List<CLASSCODE>();

                SqlServerUtility sql = new SqlServerUtility();

                sql.AddParameter("@Name", SqlDbType.NVarChar, typename);

                SqlDataReader reader = sql.ExecuteSqlReader(string.Format(Sql_Load_ClassCode, typename));

                if (reader != null)
                {
                    while (reader.Read())
                    {
                        Core.Business.CLASSCODE cLASSCODE = new Core.Business.CLASSCODE();

                        if (!reader.IsDBNull(0)) cLASSCODE.Id = reader.GetInt32(0);
                        if (!reader.IsDBNull(1)) cLASSCODE.Name = reader.GetString(1);
                        if (!reader.IsDBNull(2)) cLASSCODE.ParentId = reader.GetInt32(2);
                        if (!reader.IsDBNull(3)) cLASSCODE.RootPath = reader.GetString(3);

                        cLASSCODE.MarkOld();
                        ClassCodes.Add(cLASSCODE);
                    }
                    reader.Close();
                }
                return ClassCodes;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #8
0
        public IEnumerable<CLASSCODE> GetClassCodeNCount()
        {
            IList<Core.Business.CLASSCODE> cLASSCODElist = new List<Core.Business.CLASSCODE>();

            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(Sql_GetClassCodeNCount);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.CLASSCODE cLASSCODE = new Core.Business.CLASSCODE();

                    if (!reader.IsDBNull(0)) cLASSCODE.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) cLASSCODE.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) cLASSCODE.ParentId = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) cLASSCODE.RootPath = reader.GetString(3);

                    cLASSCODE.MarkOld();
                    cLASSCODElist.Add(cLASSCODE);
                }
                reader.Close();
            }
            return cLASSCODElist;
        }