Пример #1
0
        internal void DeleteExpense(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            int id = 0;

            Int32.TryParse((sender as PackIcon).DataContext.ToString(), out id);

            ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem((rm as ResourceManager).GetString("Message_Delete_Title"), (rm as ResourceManager).GetString("Message_DeleteExp"), PackIconKind.WarningCircle);
            Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, true);

            if (msb.ShowDialog() == true)
            {
                if (WPE.WeddingExpenses.Any(x => x.ID.Equals(id)))
                {
                    WPE.Dispose();
                    WPE = new Models.WeddingPlannerEntities();
                    var ex = new Models.WeddingExpenses {
                        ID = id
                    };
                    WPE.WeddingExpenses.Attach(ex);
                    WPE.WeddingExpenses.Remove(ex);
                    WPE.SaveChanges();
                    CreateExpenseList((rm as ResourceManager));
                }
            }
        }
Пример #2
0
 public ExpenseModify(ResourceManager _rm, Models.WeddingExpenses _exp, string[] _ResourceNames, Pages.Expenses _ExpPage)
 {
     InitializeComponent();
     rm              = _rm;
     exp             = _exp;
     ResourceNames   = _ResourceNames;
     TB_Expense.Text = exp.ExpenseName.Trim();
     TB_Cost.Text    = exp.Expense.ToString().Trim();
     TB_Count.Text   = exp.Count.ToString().Trim();
     ExpPage         = _ExpPage;
     LoadFormats();
 }
Пример #3
0
        void IconModify(object sender, MouseButtonEventArgs e)
        {
            int id = 0;

            Int32.TryParse((sender as PackIcon).DataContext.ToString(), out id);
            Models.WeddingExpenses ex = WPE.WeddingExpenses.FirstOrDefault(x => x.ID == id);
            if (ex != null)
            {
                Windows.ExpenseModify expm = new Windows.ExpenseModify((rm as ResourceManager), ex, ResourceNames, expPage);
                expm.Show();
            }
        }
Пример #4
0
 void SaveExpense()
 {
     if (CB_Offer.SelectedIndex > -1)
     {
         if (f.IsName(TB_Expense, TB_Expense.Text.Trim(), (rm as ResourceManager)) && f.IsNumber(TB_Cost, f.StringRemoveWhiteSpace(TB_Cost.Text.Trim()), (rm as ResourceManager)) && f.IsNumber(TB_Count, f.StringRemoveWhiteSpace(TB_Count.Text.Trim()), (rm as ResourceManager)))
         {
             Exp = WPE.WeddingExpenses.FirstOrDefault(x => x.ID.Equals(Wedding.ID));
             Models.WeddingExpenses wexp = new Models.WeddingExpenses();
             wexp.ExpenseName = TB_Expense.Text.Trim();
             wexp.Expense     = Convert.ToInt32(f.StringRemoveWhiteSpace(TB_Cost.Text.Trim()));
             wexp.VenueID     = VenueIDs[CB_Offer.SelectedIndex];
             wexp.Count       = Convert.ToInt32(f.StringRemoveWhiteSpace(TB_Count.Text));
             WPE.WeddingExpenses.Add(wexp);
             WPE.SaveChanges();
             CreateExpenseList((rm as ResourceManager));
         }
     }
 }