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()); }
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 })); }
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 })); }