private void Delete() { if (CurrentPay == null) { return; } Pays.Remove(CurrentPay); }
private void AddData(int mID, int oID, decimal summ) { var tempPay = new Pay(_connectionSettings, mID, oID, summ); Pays.Add(tempPay.ToString(), tempPay); PayPanels.Add(tempPay.ToString(), tempPay.Create()); tempPay.Button.Click += (o, args) => { if (tempPay.Delete(Id)) { PayList.Items.Remove(PayPanels[tempPay.ToString()]); PayPanels.Remove(tempPay.ToString()); Pays.Remove(tempPay.ToString()); } }; tempPay.Button.Visibility = type == OpenType.View ? Visibility.Collapsed : Visibility.Visible; PayList.Items.Add(PayPanels[tempPay.ToString()]); SummField.Text = (Convert.ToDecimal( Extensions.PrepareStringToConvert(string.IsNullOrEmpty(SummField.Text) ? "0" : SummField.Text)) + summ).ToString(); }