Click here to Skip to main content
15,911,786 members
Home / Discussions / C#
   

C#

 
GeneralRe: Compiler Inside The Program got errors - Gmail Pin
Member 1385811015-Jul-18 2:58
Member 1385811015-Jul-18 2:58 
AnswerRe: Compiler Inside The Program got errors - Gmail Pin
Dave Kreskowiak16-Jul-18 4:29
mveDave Kreskowiak16-Jul-18 4:29 
QuestionStrings were not posted properly? Pin
codeNewer12-Jul-18 17:24
codeNewer12-Jul-18 17:24 
AnswerRe: Strings were not posted properly? Pin
Richard Deeming13-Jul-18 1:16
mveRichard Deeming13-Jul-18 1:16 
QuestionHow to select nodes via HtmlAgilityPack? Pin
MohammadRSZ12-Jul-18 12:54
MohammadRSZ12-Jul-18 12:54 
AnswerRe: How to select nodes via HtmlAgilityPack? Pin
Keviniano Gayo13-Jul-18 3:19
Keviniano Gayo13-Jul-18 3:19 
GeneralRe: How to select nodes via HtmlAgilityPack? Pin
MohammadRSZ13-Jul-18 5:07
MohammadRSZ13-Jul-18 5:07 
QuestionHow to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Kerem Guemruekcue11-Jul-18 18:58
Kerem Guemruekcue11-Jul-18 18:58 
AnswerRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Eddy Vluggen12-Jul-18 0:03
professionalEddy Vluggen12-Jul-18 0:03 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Kerem Guemruekcue12-Jul-18 0:29
Kerem Guemruekcue12-Jul-18 0:29 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Eddy Vluggen12-Jul-18 0:42
professionalEddy Vluggen12-Jul-18 0:42 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Kerem Guemruekcue12-Jul-18 1:13
Kerem Guemruekcue12-Jul-18 1:13 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Eddy Vluggen12-Jul-18 1:17
professionalEddy Vluggen12-Jul-18 1:17 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Kerem Guemruekcue12-Jul-18 1:32
Kerem Guemruekcue12-Jul-18 1:32 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Eddy Vluggen12-Jul-18 1:42
professionalEddy Vluggen12-Jul-18 1:42 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Kerem Guemruekcue12-Jul-18 1:50
Kerem Guemruekcue12-Jul-18 1:50 
AnswerRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Richard Deeming12-Jul-18 2:43
mveRichard Deeming12-Jul-18 2:43 
GeneralRe: How to uncompress zip file into a folder without external dependencies like Interop.Shell32.dll or 3rd-Party Assemblies? Pin
Kerem Guemruekcue12-Jul-18 3:22
Kerem Guemruekcue12-Jul-18 3:22 
QuestionCommunicate With MEF Plugin From Another App Pin
Kevin Marois11-Jul-18 6:29
professionalKevin Marois11-Jul-18 6:29 
AnswerRe: Communicate With MEF Plugin From Another App Pin
Pete O'Hanlon11-Jul-18 7:19
mvePete O'Hanlon11-Jul-18 7:19 
GeneralRe: Communicate With MEF Plugin From Another App Pin
Kevin Marois11-Jul-18 7:40
professionalKevin Marois11-Jul-18 7:40 
GeneralRe: Communicate With MEF Plugin From Another App Pin
Nathan Minier12-Jul-18 1:10
professionalNathan Minier12-Jul-18 1:10 
GeneralRe: Communicate With MEF Plugin From Another App Pin
Pete O'Hanlon12-Jul-18 1:40
mvePete O'Hanlon12-Jul-18 1:40 
QuestionPredicateBuilder Usage Pin
Kevin Marois10-Jul-18 17:45
professionalKevin Marois10-Jul-18 17:45 
I've never used PredicateBuilder before. If anyone has used it, I could use some help
List<PurchasingEntity> results = null;

IQueryable<PurchasingEntity> query = (from c in db.Companies
                                        join p in db.Projects on c.Id equals p.CompanyId
                                        join j in db.Jobs on p.Id equals j.ProjectId
                                        select new PurchasingEntity
                                        {
                                            CompanyId = c.Id,
                                            ProjectId = p.Id,
                                            JobId = j.Id,
                                            Phase = j.Phase,
                                            Quantity = j.Quantity.HasValue ? j.Quantity.Value : 0,
                                            StartDate = j.StartDate.HasValue ? j.StartDate : null
                                        });

var predicate = PredicateBuilder.True<Purchasing>();

if (companyId > 0)
{
    predicate = predicate.And(i => i.CompanyId == companyId);
}

if (projectId    > 0)
{
    predicate = predicate.And(i => i.ProjectId == projectId);
}

if (startDate != null)
{
    predicate = predicate.And(i => i.StartDate >= startDate);
}

if (endDate != null)
{
    predicate = predicate.And(i => i.StartDate <= endDate);
}

results = query.Where(predicate); // <===== ERROR HERE
return results.ToList();

The compilation error is
cannot convert from 'System.Linq.Expressions.Expression<System.Func<Jayhawk.DAL.DataContext.Purchasing, bool>>' to 'System.Linq.Expressions.Expression<System.Func<Jayhawk.Entities.PurchasingEntity, int, bool>>'

Not quitre sure what's wrong here? Can anyone help?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: PredicateBuilder Usage Pin
Gerry Schmitz10-Jul-18 20:51
mveGerry Schmitz10-Jul-18 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.