public JsonResult GetJobNoAutocomp(int id, string term) { List <jobno> lst = new List <jobno>(); //var jobs = (from c in db.JobGenerations where c.ShipperID == id && c.JobCode.Contains(term) select c).ToList(); //if (jobs != null) //{ // foreach (var item in jobs) // { // jobno obj = new jobno(); // obj.JobNo = item.JobCode; // obj.Istrading = false; // lst.Add(obj); // } //} var data1 = (from c in db.SalesInvoices where c.CustomerID == id && c.SalesInvoiceNo.Contains(term) select c).ToList(); foreach (var item in data1) { var salesinvoicedetails = (from d in db.SalesInvoiceDetails where d.SalesInvoiceID == item.SalesInvoiceID select d).ToList(); jobno s = new jobno(); s.JobNo = item.SalesInvoiceNo.ToString() + "/ " + salesinvoicedetails.Sum(d => d.NetValue);; s.Istrading = true; s.JobNum = item.SalesInvoiceID; lst.Add(s); } // lst = lst.Where(d => d.JobNo.Contains(term)).ToList(); return(Json(lst, JsonRequestBehavior.AllowGet)); }
public JsonResult GetJobNo(int id) { List <jobno> lst = new List <jobno>(); var jobs = (from c in db.JobGenerations where c.ShipperID == id select c).ToList(); if (jobs != null) { foreach (var item in jobs) { jobno obj = new jobno(); obj.JobNo = item.JobCode; lst.Add(obj); } } return(Json(lst, JsonRequestBehavior.AllowGet)); }