/// <summary>
        /// 根据当前的Org信息,获取子节点
        /// </summary>
        /// <param name="orgs">如果参数为null,则返回顶级列表</param>
        /// <returns></returns>
        public PartlyCollection <WdOrg> GetChildOrg(WdOrg orgs = null)
        {
            PartlyCollection <WdOrg> result = new PartlyCollection <WdOrg>();
            string sqlCommand = string.Empty;

            if (orgs == null)
            {
                sqlCommand = "SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID, FullPath FROM dbo.wd_org WHERE isRoot = 1  AND  parentStatus = 1 ORDER BY [order]";
            }
            else
            {
                sqlCommand = string.Format("SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID FROM dbo.wd_org WHERE parentUnitID = {0}  AND  parentStatus = 1 ORDER BY [order]", orgs.OrgID);;
            }
            DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);

            if (ds != null)
            {
                DataTable table = ds.Tables[0];
                if (table != null && table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        WdOrg view = new WdOrg();
                        ORMapping.DataRowToObject <WdOrg>(row, view);
                        result.Add(view);
                    }
                }
            }
            return(result);
        }
        public WdOrg GetOrgByName(string orgName)
        {
            WdOrg  result     = null;
            string sqlCommand = string.Empty;

            sqlCommand = string.Format(@"SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID , FullPath
                                         FROM dbo.wd_org WHERE  [orgName] ='{0}' ORDER BY [order]",
                                       SqlTextHelper.SafeQuote(orgName));

            DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);

            if (ds != null)
            {
                DataTable table = ds.Tables[0];
                if (table != null && table.Rows.Count > 0)
                {
                    WdOrg view = new WdOrg();
                    ORMapping.DataRowToObject <WdOrg>(table.Rows[0], view);
                    result = view;
                }
            }
            return(result);
        }
        public List <WdOrg> GetOrgList()
        {
            List <WdOrg> result     = new List <WdOrg>();
            string       sqlCommand = string.Empty;

            sqlCommand = "SELECT parentUnitID  ParentID,OrgID, OrgName,ShortName,[order] OrderID FROM dbo.wd_org WHERE  parentStatus = 1 ORDER BY [order]";

            DataSet ds = DbHelper.RunSqlReturnDS(sqlCommand, ConnectionName);

            if (ds != null)
            {
                DataTable table = ds.Tables[0];
                if (table != null && table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        WdOrg view = new WdOrg();
                        ORMapping.DataRowToObject <WdOrg>(row, view);
                        result.Add(view);
                    }
                }
            }
            return(result);
        }
Exemple #4
0
        public PartlyCollection <WdOrg> GetChildOrg(WdOrg orgs = null)
        {
            PartlyCollection <WdOrg> result = WdOrgAdapter.Instance.GetChildOrg(orgs);

            return(result);
        }