/// <summary> /// Tìm kiếm theo tên khách hàng /// </summary> /// <param name="info"></param> /// <returns></returns> public JsonResult seachCusomer(SearchModelRes info) { int total = 0; var list = CusDao.seachCustumer(info, out total); return(Json(new { Data = list, Message = "Success", Total = total })); }
/// <summary> /// danh sách toàn bộ khách hàng /// </summary> /// <param name="info"></param> /// <returns></returns> public JsonResult getCustomer(SearchModelRes info) { int total = 0; var list = CusDao.getAllCustomer(info, out total); return(Json(new { Data = list, Total = total, Message = "Success" })); }
public JsonResult seachProduct(SearchModelRes info) { int total = 0; var message = "Successful"; var list = PrDAO.seachProductName(info, out total); return(Json(new { Data = list, Message = message, Total = total })); }
public Boolean insertCustomer(SearchModelRes info) { using (var db = new DataEntities()) { db.Customers.Add(info.CustomerSMR); db.SaveChanges(); return(true); } return(false); }
/// <summary> /// thêm khách hàng /// </summary> /// <param name="info"></param> /// <returns></returns> public JsonResult insertCustomer(SearchModelRes info) { var Message = "Fail"; var val = CusDao.insertCustomer(info); if (val == true) { Message = "Successful"; } return(Json(new { Message = Message })); }
public List <SearchModelRes> seachCustumer(SearchModelRes info, out int total) { using (var db = new DataEntities()) { List <SearchModelRes> rs = new List <SearchModelRes>(); var list = from cust in db.Customers where ((cust.FirstName + " " + cust.LastName).Contains(info.CustomerSMR.FirstName)) orderby cust.FirstName ascending, cust.LastName ascending select(new SearchModelRes { CustomerSMR = cust }); total = list.Count(); rs = list.Skip((info.pageIndex - 1) * info.pageSize).Take(info.pageSize).ToList(); return(rs); } }
/// <summary> /// Đưa ra toàn bộ danh sách khách hàng /// </summary> /// <returns>List<Customer></returns> public List <SearchModelRes> getAllCustomer(SearchModelRes info, out int total) { using (var db = new DataEntities()) { List <SearchModelRes> rs = new List <SearchModelRes>(); total = 0; var list = from cust in db.Customers orderby cust.Id select new SearchModelRes { CustomerSMR = cust }; total = list.Count(); rs = list.Skip((info.pageIndex - 1) * info.pageSize).Take(info.pageSize).ToList();; return(rs); } }
public List <SearchModelRes> seachProductName(SearchModelRes info, out int total) { using (var db = new DataEntities()) { List <SearchModelRes> rp = new List <SearchModelRes>(); var list = from pr in db.Products join supp in db.Suppliers on pr.SupplierId equals supp.Id where pr.ProductName.Contains(info.ProductSMR.ProductName) orderby pr.Id select(new SearchModelRes { ProductSMR = pr, SupplierSMR = supp }); total = list.Count(); rp = list.Skip((info.pageIndex - 1) * info.pageSize).Take(info.pageSize).ToList(); return(rp); } }