3
Answers

How to correct this porblem?

FK DS

FK DS

9y
784
1
Here I wanted to save or update the result and precedent_case entities. I don't know why is not working or what still left behind the code? Can someone check for me and help me, please. Thank you so much.

public aSite[] returnLocalResult(string callerID, string query, string queryType)
{
LocalPrecedentEntities _local = new LocalPrecedentEntities();
SES1 ses1 = new SES1();
var precedent = from p in _local.Precedent__case_.AsEnumerable()
where ses1.FindSES1(query.ToLower(), p.Query.ToLower()) > 80
select p;
if (precedent.Count() <= 0)
{
var iSites = this.getSitesFromDB(query, queryType);
return iSites;
}
else
{
var sites = new List<string>();
Precedent__case_ Pc = new Precedent__case_
{
CaseId = _local.Precedent__case_.Count() + 1,
Query = query,
Username="NEW"
};
_local.Precedent__case_.AddObject(Pc);
_local.SaveChanges();
foreach (var p in precedent)
{
var pRes = from res in _local.Result
where res.CaseId == p.CaseId
select res;

foreach (var si in pRes)
{
int i = _local.Result.Count();


i = i + 1;

Result pR = new Result
{
ResultId = i,
SiteId = si.SiteId,
CaseId = Pc.CaseId,
SES = si.SES*(float)ses1.FindSES1(query.ToLower(), p.Query.ToLower())/100

};

_local.Result.AddObject(pR);

}


var pSite = from r in _local.Result
where r.CaseId == p.CaseId
select r.SiteId;
sites.AddRange(pSite);

}
_local.SaveChanges();
Answers (3)