public IActionResult OnClickmaDh([FromBody] NhapHangRequet requet) { var dt = _nhap.GetAll().Where(j => (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)); if (requet.Name.Equals("0")) { dt = _nhap.GetAll().ToList().FindAll(j => j.MaDonHang.Equals(requet.MaDh) && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)); } if (requet.Name.Equals("1")) { dt = _nhap.GetAll().ToList().FindAll(j => j.TenHang.Equals(requet.MaDh) && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)); } return(Json(dt.ToList())); }
//---------------------------------------------// public IActionResult GetSearching([FromBody] NhapHangRequet requet) { if (requet.MaDh == null) { requet.MaDh = _all; } if (requet.Name == null) { requet.Name = _all; } var dt = _nhap.GetAll().Where(j => (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList();; //1 -- All,All _list = dt; //2 All, # if (requet.MaDh == _all && requet.Name != _all) { _list = dt.Where(j => j.TenHang.ToLower().Equals(requet.Name.ToLower()) || j.MaDonHang.ToLower().Equals(requet.Name.ToLower())).ToList(); } //3 #,All if (requet.MaDh != _all && requet.Name == _all) { _list = dt.Where(j => j.TenNcc.ToLower().Equals(requet.MaDh.ToLower())).ToList(); } // 4 #,# if (requet.MaDh != _all && requet.Name != _all) { _list = dt.Where(j => j.TenNcc.ToLower().Equals(requet.MaDh.ToLower()) && (j.TenHang.ToLower().Equals(requet.Name.ToLower()) || j.MaDonHang.ToLower().Equals(requet.Name.ToLower()))).ToList(); } //if (requet.MaDh == "All" || requet.Name == "All") //{ // dt = _nhap.GetAll().Where(j => // (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList(); // _list = dt; //} //if (requet.Name.Equals("0") && !requet.MaDh.Equals("All")) //{ // var dt1 = _nhap.GetAll().Where(j => (j.TenNcc.Equals(requet.MaDh)) // && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList(); // _list = dt1; // return Json(dt1); //} //if (requet.Name.Equals("0") && requet.MaDh.Equals("All")) //{ // var dt2 = _nhap.GetAll().Where(j => (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList(); // _list = dt2; // return Json(dt2); //} //TempData["dt"] = _list; return(Json(dt)); }
public IActionResult GetSearching([FromBody] NhapHangRequet requet) { var dt = _nhap.GetAll().Where(j => (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList();; if (requet.Name == _all) { dt = All(requet); } //_list = dt; //TempData["dta"] = dt; return(Json(dt)); }
public List <NhapHang> GetData([FromBody] NhapHangRequet requet) { List <NhapHang> dt = new List <NhapHang>(); if (requet.Memory.Equals("-1")) { dt = _nhap.GetAll().Where(j => (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList(); if (requet.Name == _all) { dt = All(requet); } } if (requet.Memory.Equals("0")) { dt = _nhap.GetAll().Where(j => j.TenHang.Equals(requet.Name) && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList(); if (requet.Name == _all) { dt = All(requet); } } if (requet.Memory.Equals("1")) { dt = _nhap.GetAll().Where(j => j.MaDonHang.Equals(requet.Name) && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList();; if (requet.Name == _all) { dt = All(requet); } } if (requet.Memory.Equals("2")) { dt = _nhap.GetAll().Where(j => j.TenNcc.Equals(requet.Name) && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList();; if (requet.Name == _all) { dt = All(requet); } } if (requet.Memory.Equals("3")) { if (requet.MaDh == null) { requet.MaDh = _all; } dt = _nhap.GetAll().Where(j => (j.TenNcc.ToLower().Contains(requet.Name.ToLower()) || j.TenHang.ToLower().Contains(requet.Name.ToLower()) || j.MaDonHang.ToLower().Contains(requet.Name.ToLower())) && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList();; if (requet.Name == _all) { dt = All(requet); } } return(dt); }
//3 public IActionResult OnSearch([FromBody] NhapHangRequet requet) { if (requet.MaDh == null) { requet.MaDh = _all; } var dt = _nhap.GetAll().Where(j => (j.TenNcc.ToLower().Contains(requet.Name.ToLower()) || j.TenHang.ToLower().Contains(requet.Name.ToLower()) || j.MaDonHang.ToLower().Contains(requet.Name.ToLower())) && (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList();; if (requet.Name == _all) { dt = All(requet); } // _list = dt; //TempData["dta"] = dt; return(Json(dt)); }
public List <NhapHang> All([FromBody] NhapHangRequet requet) { return(_nhap.GetAll().Where(j => (j.NgayGhi >= Fn.StartHour(Fn.ParseDate(requet.Begin)) && Fn.EnDhour(Fn.ParseDate(requet.End)) >= j.NgayGhi && j.IsActive)).ToList());; }