private void CreateOutgo() { if (dgIncomes.SelectedItem != null) { SpareInOutgoEditView v = new SpareInOutgoEditView(); v._SpareName = (dgIncomes.SelectedItem as SpareInSpareIncomeView).SpareName; v._SpareInSpareIncomeID = (dgIncomes.SelectedItem as SpareInSpareIncomeView).id; v._AvailableQuantity = (dgIncomes.SelectedItem as SpareInSpareIncomeView).QRest.Value; v._SpareOutgoID = _SpareOutgoID; v._Price = (dgIncomes.SelectedItem as SpareInSpareIncomeView).DF_PriceInCurrency.Value; v.CurrentCurrencyCode = this.CurrentCurrencyCode; v.ShowDialog(); int SpareID = (dgIncomes.SelectedItem as SpareInSpareIncomeView).SpareID.Value; DataAccess da = new DataAccess(); SpareContainer.Instance.Update(SpareID); if (ParentWindow != null) { ParentWindow.LoadOfferings(); ParentWindow.dgSpares.UpdateLayout(); ParentWindow.dgSpares.ScrollIntoView(dgSpares.Items[dgSpares.Items.Count - 1]); } LoadSpares(); } }
private bool CreateSpareInSpareOutgo() { if (dgIncomes.SelectedItem != null) { SpareInOutgoEditView v = new SpareInOutgoEditView(); v._SpareName = (dgIncomes.SelectedItem as SpareInSpareIncomeView).SpareName; v._SpareInSpareIncomeID = (dgIncomes.SelectedItem as SpareInSpareIncomeView).id; v._AvailableQuantity = (int)(dgIncomes.SelectedItem as SpareInSpareIncomeView).QRest.Value; da = new DataAccess(); // получаем ID текущей открытой накладной spare_outgo CurrentOutgo = da.SpareOutgoOpened(); if (CurrentOutgo == null) { MessageBox.Show("Не указана текущая открытая накладная!"); return false; } v._SpareOutgoID = CurrentOutgo.id; CurrentOutgo.currencyReference.Load(); v.CurrentCurrencyCode = CurrentOutgo.currency.code; decimal BasicPrice = (dgIncomes.SelectedItem as SpareInSpareIncomeView).POutBasic.Value; decimal Price = CurrencyHelper.GetPrice(v.CurrentCurrencyCode, BasicPrice); v._Price = Price; v.ShowDialog(); } return true; }