public List <ReceiptNoteSelfMadeModels> GetData(ReceiptNoteSelfMadeViewModels model, List <string> ListStoreId) { List <ReceiptNoteSelfMadeModels> lstData = new List <ReceiptNoteSelfMadeModels>(); using (var cxt = new NuWebContext()) { lstData = (from rn in cxt.I_ReceiptNoteForSeftMade where ListStoreId.Contains(rn.StoreId) && rn.Status != (int)Commons.EStatus.Deleted select new ReceiptNoteSelfMadeModels() { Id = rn.Id, ReceiptNo = rn.ReceiptNo, Status = rn.Status, ReceiptDate = rn.ReceiptDate, ReceiptBy = rn.ReceiptBy, StoreId = rn.StoreId, }).ToList(); if (!string.IsNullOrEmpty(model.StoreID)) { lstData = lstData.Where(ww => ww.StoreId.Equals(model.StoreID.ToLower())).ToList(); } if (model.ReceiptNoteDate != null) { DateTime fromDate = new DateTime(model.ReceiptNoteDate.Value.Year, model.ReceiptNoteDate.Value.Month, model.ReceiptNoteDate.Value.Day, 0, 0, 0); DateTime ToDate = new DateTime(model.ReceiptNoteDate.Value.Year, model.ReceiptNoteDate.Value.Month, model.ReceiptNoteDate.Value.Day, 23, 59, 59); lstData = lstData.Where(ww => ww.ReceiptDate >= fromDate && ww.ReceiptDate <= ToDate).ToList(); } return(lstData); } }
// GET: IngReceiptNoteSelfMadeSelfMade public ActionResult Index() { try { ReceiptNoteSelfMadeViewModels model = new ReceiptNoteSelfMadeViewModels(); model.StoreID = CurrentUser.StoreId; return(View(model)); } catch (Exception ex) { _logger.Error("ReceiptNoteSelfMade_Index: " + ex); return(new HttpStatusCodeResult(400, ex.Message)); } }
public ActionResult Search(ReceiptNoteSelfMadeViewModels model) { try { listStoreId = new List <string>(); List <ReceiptNoteSelfMadeModels> data = new List <ReceiptNoteSelfMadeModels>(); if (!string.IsNullOrEmpty(model.StoreID)) { listStoreId.Add(model.StoreID); data = _factory.GetData(model, listStoreId); } model.ListItem = data; CurrentUser.StoreId = model.StoreID; } catch (Exception e) { _logger.Error("ReceiptNoteSelfMade_Search: " + e); return(new HttpStatusCodeResult(400, e.Message)); } return(PartialView("_ListData", model)); }