private void UpdateSuppliers() { var oldSelectedSupplier = _selectedSupplier; Suppliers.Clear(); Suppliers.Add(new SupplierVM { Model = new Supplier { ID = -1, Name = "All" } }); using (var context = new ERPContext()) { var suppliersFromDatabase = context.Suppliers.Where(supplier => !supplier.Name.Equals("-")).OrderBy(supplier => supplier.Name); foreach ( var supplier in suppliersFromDatabase.Where(supplier => supplier.IsActive.Equals(_isSupplierActiveChecked))) { Suppliers.Add(new SupplierVM { Model = supplier }); } } UpdateSelectedSupplier(oldSelectedSupplier); }
public void UpdateSuppliers() { var oldSelectedSupplier = _selectedSupplier; Suppliers.Clear(); var allSupplier = new Supplier { ID = -1, Name = "All" }; Suppliers.Add(new SupplierVM { Model = allSupplier }); using (var context = new ERPContext()) { var suppliersFromDatabase = context.Suppliers.Where(supplier => !supplier.Name.Equals("-")).OrderBy(supplier => supplier.Name); foreach (var supplier in suppliersFromDatabase) { Suppliers.Add(new SupplierVM { Model = supplier }); } } UpdateSelectedSupplier(oldSelectedSupplier); }
protected virtual void OnLoaded() { using (var scope = _container.BeginLifetimeScope()) { var db = scope.Resolve <NorthwindDbContext>(); Suppliers.Clear(); Suppliers.AddRange(new ObservableCollection <Supplier>(db.Suppliers .OrderBy(x => x.SupplierId) .AsNoTracking() )); Categories.Clear(); Categories.AddRange(new ObservableCollection <Category>(db.Categories .OrderBy(x => x.CategoryId) .AsNoTracking() )); if (_notification.Id != 0) { var product = db.Products.AsNoTracking().FirstOrDefault(x => x.ProductId == _notification.Id); ProductId.Value = product.ProductId; ProductName.Value = product.ProductName; SupplierId.Value = product.SupplierId; CategoryId.Value = product.CategoryId; QuantityPerUnit.Value = product.QuantityPerUnit; UnitPrice.Value = product.UnitPrice; UnitsInStock.Value = product.UnitsInStock; UnitsOnOrder.Value = product.UnitsOnOrder; ReorderLevel.Value = product.ReorderLevel; Discontinued.Value = product.Discontinued; } } }
async Task ExecuteLoadItemsCommand() { try { Stores.Clear(); var palletMaster = await DataStore.GetPalletMaterDataAsync(); foreach (var item in palletMaster.Stores) { Stores.Add(item); } Status.Clear(); foreach (var item in palletMaster.Status) { Status.Add(item); } Categories.Clear(); foreach (var item in palletMaster.Categories) { Categories.Add(item); } Wrappers.Clear(); foreach (var item in palletMaster.Wrappers) { Wrappers.Add(item); } Shippers.Clear(); foreach (var item in palletMaster.Shippers) { Shippers.Add(item); } Suppliers.Clear(); foreach (var item in palletMaster.Suppliers) { Suppliers.Add(item); } Builders.Clear(); foreach (var item in palletMaster.Builders) { Builders.Add(item); } PalletTypes.Clear(); foreach (var item in palletMaster.PalletTypes) { PalletTypes.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } }
void GetSupplier() { Suppliers.Clear(); foreach (var item in _ServiceProxy.GetSuppliers()) { Suppliers.Add(item); } }
public virtual void UpdateProductsAndSuppliersByIds(ISession dbSession, string productsIds, string suppliersIds) { var productsListRaw = (productsIds ?? "").Split(',').Select(s => { uint itemId = 0; uint.TryParse(s, out itemId); return(itemId); }).Where(s => s != 0).ToList(); foreach (var item in productsListRaw) { if (!Products.Select(s => s.Product.Id).Any(s => s == item)) { var baseItem = dbSession.Query <Product>().First(s => s.Id == item); var newItem = new PromotionProduct { Promotion = this, Product = baseItem }; dbSession.Save(newItem); Products.Add(newItem); } } var itemsToDelete_Products = Products.Where(s => !productsListRaw.Any(f => f == s.Product.Id)).ToList(); itemsToDelete_Products.ForEach(s => Products.Remove(s)); if (SuppliersType == SuppliersType.All) { Suppliers.Clear(); } else { var suppliersListRaw = (suppliersIds ?? "").Split(',').Select(s => { uint itemId = 0; uint.TryParse(s, out itemId); return(itemId); }).Where(s => s != 0).ToList(); foreach (var item in suppliersListRaw) { if (!Suppliers.Select(s => s.Supplier.Id).Any(s => s == item)) { var baseItem = dbSession.Query <Supplier>().First(s => s.Id == item); var newItem = new PromotionSupplier { Promotion = this, Supplier = baseItem }; dbSession.Save(newItem); Suppliers.Add(newItem); } } var itemsToDelete_Suppliers = Suppliers.Where(s => !suppliersListRaw.Any(f => f == s.Supplier.Id)).ToList(); itemsToDelete_Suppliers.ForEach(s => Suppliers.Remove(s)); } dbSession.Save(this); }
async Task ExecuteLoadSuppliersCommand() { if (IsBusy) { return; } IsBusy = true; try { Geocoder geoCoder = new Geocoder(); Suppliers.Clear(); SupplierPins.Clear(); var suppliers = await SupplierDataStore.GetItemsAsync(true); foreach (var supplier in suppliers) { if (supplier.Latitude == 0 && supplier.Longitude == 0) { var approximateLocations = await geoCoder.GetPositionsForAddressAsync(supplier.Address); foreach (var position in approximateLocations) { supplier.Latitude = position.Latitude; supplier.Longitude = position.Longitude; break; } } var distance = Distance(UserPosition.Latitude, UserPosition.Longitude, supplier.Latitude, supplier.Longitude, 'K'); if (distance <= MapRadius) { Suppliers.Add(supplier); SupplierPins.Add(new CustomPin { Type = PinType.Place, Position = new Position(supplier.Latitude, supplier.Longitude), Label = supplier.Name, Address = supplier.Address, Color = Color.Red, Opacity = 100 }); } } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void UpdateSuppliers() { using (var context = new ERPContext()) { Suppliers.Clear(); var suppliersFromDatabase = context.Suppliers.OrderBy(supplier => supplier.Name); foreach (var supplier in suppliersFromDatabase) { Suppliers.Add(new SupplierVM { Model = supplier }); } } }
public void UpdateSuppliers() { var oldSelectedSupplier = _selectedSupplier; Suppliers.Clear(); using (var context = new ERPContext()) { var suppliers = context.Suppliers.Where(e => !e.Name.Equals("-")); foreach (var supplier in suppliers) { Suppliers.Add(supplier); } } UpdateSelectedSupplier(oldSelectedSupplier); }
private void UpdateSuppliers() { Suppliers.Clear(); using (var context = new ERPContext()) { var suppliersFromDatabase = context.Suppliers.Where( supplier => !supplier.Name.Equals("-") && supplier.IsActive) .OrderBy(supplier => supplier.Name); foreach (var supplier in suppliersFromDatabase) { Suppliers.Add(new SupplierVM { Model = supplier }); } } }
public void GetPartSuppliers() { Suppliers.Clear(); ListsSoapClient proxy = GetListServiceProxy(); proxy.GetListItemsCompleted += proxy_GetSuppliersListItemsCompleted; var query = XElement.Parse(@"<Query> <Where> <Eq> <FieldRef Name='PartLookup' /> <Value Type='Lookup'>" + CurrentPart.Title + @"</Value> </Eq> </Where> </Query>"); var queryOptions = XElement.Parse(@"<QueryOptions></QueryOptions>"); var viewFields = XElement.Parse(@"<ViewFields></ViewFields>"); proxy.GetListItemsAsync("Part Suppliers", null, query, viewFields, null, queryOptions, null); }
public void RetrieveSuppliers() { Suppliers.Clear(); List supplierList = clientContext.Web.Lists.GetByTitle("Suppliers"); var camlQuerySupplierList = new CamlQuery(); camlQuerySupplierList.ViewXml = @"<View> <Query> <Where> <IsNotNull> <FieldRef Name='DUNS' /> </IsNotNull> </Where> </Query> </View>"; supplierListItems = supplierList.GetItems(camlQuerySupplierList); clientContext.Load(supplierListItems); clientContext.ExecuteQueryAsync(onSupplierQuerySucceeded, onQueryFailed); this.Cursor = Cursors.Wait; }
private void UpdateSuppliers() { var oldSelectedSupplier = _selectedSupplier; Suppliers.Clear(); Suppliers.Add(new SupplierVM { Model = new Supplier { ID = -1, Name = "All" } }); using (var context = new ERPContext()) { var suppliers = context.Suppliers.Where(e => !e.Name.Equals("-")).ToList(); foreach (var supplier in suppliers) { Suppliers.Add(new SupplierVM { Model = supplier }); } } UpdateSelectedSupplier(oldSelectedSupplier); }
protected virtual void ClearNavigationProperties() { Suppliers.Clear(); }
public void Query(Guid ProjectId) { try { var QueryResult = _projectcontroller.Query(p => p.Id == ProjectId); if (!QueryResult.HasError) { var data = QueryResult.Result.SingleOrDefault(); BindingFromModel(data, this); if (data.ClientId.HasValue) { Client.QueryModel(data.ClientId.Value); } if (data.SupplierTranscationItem.Any()) { Suppliers.Clear(); foreach (var row in data.SupplierTranscationItem) { SuppliersViewModel model = new SuppliersViewModel(); try { model.ProjectId = row.ProjectId; model.PlaceofReceipt = row.PlaceofReceipt; model.ManufacturersName = row.ManufacturersBussinessItems.Manufacturers.Name; model.TicketPeriod = row.ManufacturersBussinessItems.TicketPeriod.Name; model.MaterialCategories = row.ManufacturersBussinessItems.MaterialCategories.Name; model.PaymentTypeName = row.ManufacturersBussinessItems.PaymentTypes.PaymentTypeName; model.TranscationCategories = row.ManufacturersBussinessItems.TranscationCategories.Name; model.SetModel(row.ManufacturersBussinessItems); } catch (Exception ex) { setErrortoModel(model, ex); } if (!model.HasError) { Suppliers.Add(model); } } } if (data.ProjectContract.Any()) { ProjectContract.Clear(); foreach (var row in data.ProjectContract) { ProjectContractViewModel model = new ProjectContractViewModel(); model.SetModel(row); ProjectContract.Add(model); } } } } catch (Exception ex) { setErrortoModel(this, ex); } }