public async Task <Entities.Store> Update(Entities.Store store) { var entry = _dbContext.Stores.Update(store); await _dbContext.SaveChangesAsync(); return(entry.Entity); }
public async Task <Entities.Store> Post(Entities.Store store) { var entry = await _dbContext.Stores.AddAsync(store); await _dbContext.SaveChangesAsync(); return(entry.Entity); }
/// <summary> /// 初始化要条件的药品信息 /// </summary> /// <param name="rowIndex">行索引号</param> private void ChangePriceInfo(int rowIndex) { DataGridViewRow row = dataGridView1.Rows[rowIndex]; DrugShop.Entities.Store store = row.DataBoundItem as DrugShop.Entities.Store; if (store == null) { return; } if (updateStoreList.Contains(store)) { return; } SalePriceInput input = new SalePriceInput(); input.OldPrice = store.SalePrice; if (input.ShowDialog(this.ParentForm) != DialogResult.OK) { return; } DrugShop.Entities.Store dataStore = new Entities.Store(); DrugShop.Entities.CPrice dataObject = new DrugShop.Entities.CPrice(); ColumnCollection cols = store.GetColumns(); foreach (Property prop in cols) { if (dataObject.ContainsProperty(prop.Name)) { dataObject[prop.Name] = store[prop]; } if (dataStore.ContainsProperty(prop.Name)) { dataStore[prop.Name] = store[prop]; } } //dataObject.Billcode = this.tbBillCode.Tag.ToString(); dataObject.NSalePrice = input.Number; dataObject.Cause = this.tbCause.Text; //dataObject.Operator = 0; //添加到调价集合中 drugChangePriceList.Add(dataObject); dataStore.SalePrice = input.Number; dataStore.JobPrice = input.Number; //添加到要更新的库存记录中 updateStoreList.Add(dataStore); }
public static Store MapStore(Entities.Store s) { return(new Store { StoreId = s.StoreId, StoreName = s.StoreName, City = s.City, Postal = s.Postal }); }
public static Library.Models.Store Map(Entities.Store store) { return(new Library.Models.Store { Id = store.Id, StoreName = store.StoreName, City = store.City, State = store.State, Zipcode = store.Zipcode }); }
private void OnStoreBindingSourceCurrentItemChanged(object sender, System.EventArgs e) { _currentStore = uxStoreBindingSource.Current as Entities.Store; if (_currentStore != null) { _currentStore.Validate(); } //_Store.Validate(); OnCurrentEntityChanged(); }
protected void InitCustomBackInfo(int rowIndex) { DataGridViewRow row = dataGridView1.Rows[rowIndex]; DrugShop.Entities.Store DrugShop = row.DataBoundItem as DrugShop.Entities.Store; if (DrugShop == null) { return; } NumberInput input = new NumberInput(); input.StoreNumber = DrugShop.Number; if (input.ShowDialog(this.ParentForm) != DialogResult.OK) { return; } DrugShop.Entities.Store store = new Entities.Store(); DrugShop.Entities.Lost drugLost = new DrugShop.Entities.Lost(); ColumnCollection cols = DrugShop.GetColumns(); foreach (Property prop in cols) { if (drugLost.ContainsProperty(prop.Name)) { drugLost[prop.Name] = DrugShop[prop.Name]; } if (store.ContainsProperty(prop.Name)) { store[prop.Name] = DrugShop[prop.Name]; } } //保存供应商退药记录 drugLost.ID = ServiceContainer.GetService <IDrugLostService>().GetMaxID(); drugLost.Number = input.Number; this.lostList.Add(drugLost); //更新库存数量 store.Number -= drugLost.Number; this.updateStoreList.Add(store); this.dmrlostBindingSource.DataSource = null; this.dmrlostBindingSource.DataSource = lostList; CaclSumCash(); }
/// <summary> /// Returns a business logic store from information gotten from a Store entity /// </summary> /// <param name="CTXStore"></param> /// <returns></returns> public BusinessLogic.Objects.Store ContextStoreToLogicStore(Entities.Store CTXStore) { StoreApp.BusinessLogic.Objects.Store BLStore = new BusinessLogic.Objects.Store(); BLStore.address.street = CTXStore.Street; BLStore.address.city = CTXStore.City; BLStore.address.state = CTXStore.State; BLStore.address.zip = CTXStore.Zip; BLStore.storeNumber = CTXStore.StoreNumber; return(BLStore); }
protected void InitProviderBackInfo(int rowIndex) { DataGridViewRow row = dataGridView1.Rows[rowIndex]; DrugShop.Entities.Store DrugShop = row.DataBoundItem as DrugShop.Entities.Store; if (DrugShop == null) { return; } NumberInput input = new NumberInput(); input.StoreNumber = DrugShop.Number; if (input.ShowDialog(this.ParentForm) != DialogResult.OK) { return; } DrugShop.Entities.Store store = new Entities.Store(); DrugShop.Entities.PBack drugBack = new DrugShop.Entities.PBack(); ColumnCollection cols = DrugShop.GetColumns(); foreach (Property prop in cols) { if (drugBack.ContainsProperty(prop.Name)) { drugBack[prop.Name] = DrugShop[prop.Name]; } if (store.ContainsProperty(prop.Name)) { store[prop.Name] = DrugShop[prop.Name]; } } //保存供应商退药记录 drugBack.Id = ServiceContainer.GetService <IDrugBackService>().GetPBackMaxID(); drugBack.Number = input.Number; this.backList.Add(drugBack); //更新库存数量 store.Number -= drugBack.Number; this.updateStoreList.Add(store); }
//ContextStore public Logic.Store ContextStoreToLogicStore(Entities.Store contextStore) { Logic.Store LogicStore = new Logic.Store(); LogicStore.address.street = contextStore.Street; LogicStore.address.city = contextStore.City; LogicStore.address.state = contextStore.State; LogicStore.address.zip = contextStore.Zip; LogicStore.storeInventory.items.NumberofAriel = contextStore.Ariel; LogicStore.storeInventory.items.NumberofDownie = contextStore.Downie; LogicStore.storeInventory.items.NumberofSuavitel = contextStore.Suavitel; LogicStore.storeId = contextStore.StoreId; return(LogicStore); }
public virtual void IsValid(Entities.Store currentStore = null) { if (!Email.IsValidEmail()) { throw new ArgumentException("E-mail inválido"); } if (this is Person) { ((Person)this).IsValid(); } else if (this is Company) { ((Company)this).IsValid(); } List <AddressCustomer> addresses = new List <AddressCustomer>(); if (!currentStore.IsNull() && currentStore.IsMain) { addresses = Addresses; } else { var _contactAddress = Addresses.FirstOrDefault(a => a.Purpose == AddressPurposeType.Contact); if (!_contactAddress.IsNull()) { addresses.Add(_contactAddress); } } if (addresses.IsNull() || addresses.Count() == 0) { throw new ArgumentException("Endereço inválido. Informe o endereço de contato"); } else { addresses.ForEach(address => address.IsValid()); } }
public async Task Delete(Entities.Store store) { _dbContext.Stores.Remove(store); await _dbContext.SaveChangesAsync(); }
protected override void Seed(ConnectionDb context) { try { Entities.Store store1 = new Entities.Store() { StoreName = "AVM-1", StoreAdress = "Abc mah.A sokak", StoreManager = "OrnYönetici1", UserName = "******", UserPassword = "******" }; Entities.Store store2 = new Entities.Store() { StoreName = "AVM-2", StoreAdress = "Cba mah.b sokak", StoreManager = "OrnYönetici2", UserName = "******", UserPassword = "******" }; context.TableStores.Add(store1); context.TableStores.Add(store2); context.SaveChanges(); Entities.PromotionalItems promotional1 = new Entities.PromotionalItems() { PromotionalName = "%25", Description = "Tüm Mağalazarda indirim", CurrentDate = Convert.ToDateTime("12.12.2019"), IsUsed = false }; Entities.PromotionalItems promotional2 = new Entities.PromotionalItems() { PromotionalName = "%15", Description = "Tüm Mağalazarda indirim", CurrentDate = Convert.ToDateTime("01.12.01"), IsUsed = false }; Entities.PromotionalItems promotional3 = new Entities.PromotionalItems() { PromotionalName = "%23", Description = "Tüm Mağalazarda indirim", CurrentDate = Convert.ToDateTime("04.12.2019"), IsUsed = false }; Entities.PromotionalItems promotional4 = new Entities.PromotionalItems() { PromotionalName = "%34", Description = "Tüm Mağalazarda indirim", CurrentDate = Convert.ToDateTime("04.12.2019"), IsUsed = false }; Entities.PromotionalItems promotional5 = new Entities.PromotionalItems() { PromotionalName = "%21", Description = "Tüm Mağalazarda indirim", CurrentDate = Convert.ToDateTime("04.12.2019"), IsUsed = false }; Entities.PromotionalItems promotional6 = new Entities.PromotionalItems() { PromotionalName = "%25", Description = "Tüm Mağalazarda indirim", CurrentDate = Convert.ToDateTime("21.11.2019"), IsUsed = false }; Entities.PromotionalItems promotional7 = new Entities.PromotionalItems() { PromotionalName = "%26", Description = "Tüm Mağalazarda indirim", CurrentDate = Convert.ToDateTime("19.11.2019"), IsUsed = false }; context.TablePromotionalItems.Add(promotional1); context.TablePromotionalItems.Add(promotional2); context.TablePromotionalItems.Add(promotional3); context.TablePromotionalItems.Add(promotional5); context.TablePromotionalItems.Add(promotional6); context.TablePromotionalItems.Add(promotional7); context.SaveChanges(); } catch (Exception) { throw new Exception("Failed - DB"); } }