コード例 #1
0
ファイル: DataEntryDetailFactory.cs プロジェクト: ttcp112/FJ
        public List <DataEntryDetailModels> GetData(DataEntryViewModels model, List <string> listStoreId)
        {
            using (NuWebContext cxt = new NuWebContext())
            {
                try
                {
                    var lstResult = (from tb in cxt.I_DataEntryDetail
                                     from i in cxt.I_Ingredient
                                     where tb.IngredientId.Equals(i.Id)
                                     select new DataEntryDetailModels()
                    {
                        Id = tb.Id,
                        DataEntryId = tb.DataEntryId,
                        IngredientId = tb.IngredientId,
                        IngredientCode = i.Code,
                        IngredientName = i.Name,

                        //CloseBal = 0 //tb.CloseBal,
                    }).ToList();
                    return(lstResult);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex.Message);
                    return(null);
                }
            }
        }
コード例 #2
0
 public List <IngredientUOMModels> GetData(DataEntryViewModels model, List <string> listStoreId)
 {
     using (NuWebContext cxt = new NuWebContext())
     {
         try
         {
             var lstResult = (from tb in cxt.I_Ingredient_UOM
                              select new IngredientUOMModels()
             {
                 Id = tb.Id,
                 IngredientId = tb.IngredientId,
                 UOMId = tb.UOMId,
                 BaseUOM = tb.BaseUOM,
                 ReceivingQty = tb.ReceivingQty,
                 CreatedBy = tb.CreatedBy,
                 CreatedDate = tb.CreatedDate,
                 UpdatedBy = tb.UpdatedBy,
                 UpdatedDate = tb.UpdatedDate,
                 IsActived = tb.IsActived
             }).ToList();
             return(lstResult);
         }
         catch (Exception ex)
         {
             _logger.Error(ex.Message);
             return(null);
         }
     }
 }
コード例 #3
0
        // GET: IngDataEntry
        public ActionResult Index()
        {
            DataEntryViewModels model = new DataEntryViewModels();

            model.StoreId = CurrentUser.StoreId;
            return(View(model));
        }
コード例 #4
0
        public ActionResult Search(DataEntryViewModels model)
        {
            try
            {
                if (model.StoreId != null)
                {
                    var data = _factory.GetData(model, listStoreId);

                    foreach (var item in data)
                    {
                        item.StoreName     = lstStore.Where(z => z.Value.Equals(item.StoreId)).Select(ss => ss.Text).FirstOrDefault();
                        item.BusinessValue = CommonHelper.BusinessDayDisplay(item.StartedOn, item.ClosedOn);
                    }
                    //data.ForEach(x =>
                    //{
                    //    x.StoreName = lstStore.Where(z => z.Value.Equals(x.StoreId)).Select(ss => ss.Text).FirstOrDefault();

                    //});
                    model.ListItem      = data;
                    CurrentUser.StoreId = model.StoreId;
                }
            }
            catch (Exception e)
            {
                _logger.Error("DataEntrySearch: " + e);
                return(new HttpStatusCodeResult(400, e.Message));
            }
            return(PartialView("_ListData", model));
        }
コード例 #5
0
ファイル: DataEntryFactory.cs プロジェクト: ttcp112/FJ
        public List <DataEntryModels> GetData(DataEntryViewModels model, List <string> listStoreId)
        {
            using (NuWebContext cxt = new NuWebContext())
            {
                try
                {
                    var query = (from tb in cxt.I_DataEntry where tb.IsActived select tb);

                    //var lstResult = (from tb in cxt.I_DataEntry
                    //                 where tb.IsActived
                    //                 select new DataEntryModels()
                    //                 {
                    //                     Id = tb.Id,
                    //                     EntryCode = tb.EntryCode,
                    //                     BusinessId = tb.BusinessId,
                    //                     EntryDate = tb.EntryDate,
                    //                     StoreId = tb.StoreId
                    //                 }).ToList();

                    if (model.StoreId != null)
                    {
                        query = query.Where(x => x.StoreId.Equals(model.StoreId));
                    }
                    var lstResult = query.Select(ss => new DataEntryModels()
                    {
                        Id         = ss.Id,
                        EntryCode  = ss.EntryCode,
                        BusinessId = ss.BusinessId,
                        EntryDate  = ss.EntryDate,
                        StoreId    = ss.StoreId,
                        StartedOn  = ss.StartedOn,
                        ClosedOn   = ss.ClosedOn
                    }).ToList();

                    if (lstResult != null)
                    {
                        lstResult = lstResult.OrderByDescending(oo => oo.EntryDate).ToList();
                        var lstNotHaveBusinessId = lstResult.Where(ww => ww.BusinessId == null || ww.BusinessId == string.Empty).ToList();
                        if (lstNotHaveBusinessId != null && lstNotHaveBusinessId.Any())
                        {
                            foreach (var item in lstNotHaveBusinessId)
                            {
                                item.IsVisible = false;
                            }
                        }
                    }
                    return(lstResult);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex.Message);
                    return(null);
                }
            }
        }