コード例 #1
0
        public static CompanyDepartMent GetChildOne(int departId, int companyId)
        {
            string sql = @" select a.Id,b.Name+'-'+ a.Name  Name,a.companyId,a.pid from [CompanyDepartMent](nolock) a
  inner join [CompanyDepartMent](nolock) b on a.pid = b.id where a.Id=@DepartId and a.CompanyId=@CompanyId";

            return(DBAccess.GetEntityList <CompanyDepartMent>(sql, new { DepartId = departId, CompanyId = companyId }).FirstOrDefault());
        }
コード例 #2
0
        public static List <CompanyDepartMent> GetList(int companyId)
        {
            string sql = string.Format(@"select Id,Name,PId,CompanyId,ModifyDate,IsDeleted from {0} (nolock) where CompanyId=0 ", TableName);

            if (companyId != 0)
            {
                sql += " or CompanyId=@CompanyId ";
            }
            return(DBAccess.GetEntityList <CompanyDepartMent>(sql, new { CompanyId = companyId }));
        }
コード例 #3
0
        public static List <CompanyDepartMent> GetListChild(int companyId)
        {
            string sql = @" select a.Id,b.Name+'-'+ a.Name  Name,a.companyId,a.pid from [CompanyDepartMent](nolock) a
  inner join [CompanyDepartMent](nolock) b on a.pid = b.id where a.CompanyId=0 ";

            if (companyId != 0)
            {
                sql += " or a.companyId=@CompanyId";
            }
            return(DBAccess.GetEntityList <CompanyDepartMent>(sql, new { CompanyId = companyId }));
        }