Пример #1
0
 private void check_for_nulls_then_save(FeeTable m)
 {
     if (feeName.Text == "")
     {
         this.ShowMessageAsync("Error", "Fee Name must be provided");
         feeName.Focus();
     }
     else if (amount.Text == "")
     {
         this.ShowMessageAsync("Error", "Amount must be provided");
         amount.Focus();
     }
     else if (discountLimit.Text == "")
     {
         this.ShowMessageAsync("Error", "Discount Limit must be provided");
         discountLimit.Focus();
     }
     else
     {
         context.FeeTables.Add(m);
         context.SaveChanges();
         feeName.Clear();
         amount.Clear();
         discountLimit.Clear();
         loadData();
     }
 }
Пример #2
0
 private void check_for_nulls_then_update(FeeTable u)
 {
     if (UpdatefeeName.Text == "")
     {
         this.ShowMessageAsync("Error", "Fee Name must be provided");
         UpdatefeeName.Focus();
     }
     else if (updateAmount.Text == "")
     {
         this.ShowMessageAsync("Error", "Amount must be provided");
         updateAmount.Focus();
     }
     else if (updateDiscountLimit.Text == "")
     {
         this.ShowMessageAsync("Error", "Discount Limit must be provided");
         updateDiscountLimit.Focus();
     }
     else
     {
         context.Entry(u).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
         UpdatefeeName.Clear();
         updateAmount.Clear();
         updateDiscountLimit.Clear();
         loadData();
     }
 }
Пример #3
0
        private void createbuttonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                var FeeName = feeName.Text.ToString();
                int FeeAmount;
                int.TryParse(amount.Text.ToString(), out FeeAmount);
                int DiscountLimit;
                int.TryParse(discountLimit.Text.ToString(), out DiscountLimit);

                FeeTable Modal = new FeeTable();
                Modal.FeeTitle      = FeeName;
                Modal.Amount        = FeeAmount;
                Modal.DiscountLimit = DiscountLimit;
                check_for_nulls_then_save(Modal);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
            }
        }