public void clearAll() { AdmissionNumber.Clear(); StdName.Clear(); FatheName.Clear(); Grade.Clear(); TotalFee.Clear(); PreviousDues.Clear(); Calculated.Clear(); Paid.Clear(); Dues.Clear(); }
private void DepositButtonClick(object sender, RoutedEventArgs e) { try { InvoiceTable newDeposit = new InvoiceTable(); newDeposit.AdmissionNumber = Id; newDeposit.PayingMonth = GetFeeMonth(); newDeposit.TotalFeeOfMonth = int.Parse(Calculated.Text.ToString()); newDeposit.Paid = int.Parse(Paid.Text.ToString()); newDeposit.Dues = int.Parse(Dues.Text.ToString()); if (DepositDate.Text.Contains("/")) { newDeposit.InvoiceDate = DateTime.ParseExact(DepositDate.Text.ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture); } else { newDeposit.InvoiceDate = DateTime.ParseExact(DepositDate.Text.ToString(), "dd-MM-yyyy", CultureInfo.InvariantCulture); } context.InvoiceTables.Add(newDeposit); context.SaveChanges(); context.FeePaid(admissionNumber: Id, feeMonth: GetFeeMonth()); nextInvoice(); loadData(); clearAll(); this.ShowMessageAsync("Done", "Fee Deposit"); } catch (FormatException) { if (AdmissionNumber.Text == "") { this.ShowMessageAsync("Obstructed", "Couldn't calculate the students fee of the month or the Admission ID is missing"); AdmissionNumber.Focus(); } else if (Paid.Text == "") { Paid.Focus(); } } catch (Exception err) { MessageBox.Show(err.ToString()); } }