public PartialViewResult View(string id) { PurchaseOrderModels model = GetDetail(id); model.Supplier = new SupplierModels(); model.Supplier = _Supplierfactory.GetDetail(model.SupplierId); model.Symbol = GetSymbol(model.StoreID); model.Store = new SStoreModels(); model.Store = _Storefactory.GetListStores(null, model.StoreID)[0]; if (model.TaxType == (int)Commons.ETax.Inclusive) { model.TaxAmountInclusive = string.Format("{0} {1:N2}", model.Symbol, (model.SubTotal - (model.SubTotal / (1 + (model.TaxValue / 100))))); } //============ return(PartialView("_View", model)); }
public SupplierModels GetDetail(string id) { try { SupplierModels model = _factory.GetDetail(id); if (!string.IsNullOrEmpty(model.CompanyId)) { model.CompanyName = lstCompany.Where(z => z.Value.Equals(model.CompanyId)).FirstOrDefault().Text; } //============= var ListSupIng = _IngredientSupplierFactory.GetDataForSupplier(model.Id, model.CompanyId); var ListIng = _ingredientFactory.GetIngredient(null).Where(x => x.IsActive).ToList(); foreach (var item in ListIng) { model.ListSupIng.Add(new Ingredients_SupplierModel { IngredientId = item.Id, IngredientName = item.Name, IngredientCode = item.Code, //IsCheck = ListSupIng.Any(z => z.Equals(item.Id)), IsActived = ListSupIng.Any(x => x.Equals(item.Id)), }); } //model.ListSupIng.ForEach(x => //{ // x.IsCheck = ListSupIng.Any(z => z.Equals(x.IngredientId)); //}); model.ListSupIng = model.ListSupIng.Where(x => x.IsActived).OrderByDescending(x => x.IsActived ? 1 : 0).ThenBy(x => x.IngredientName).ToList(); //model.ListSupIng = model.ListSupIng.OrderByDescending(x => x.IsActived ? 1 : 0).ThenBy(x => x.IngredientName).ToList(); return(model); } catch (Exception ex) { _logger.Error("SupplierDetail: " + ex); return(null); } }