예제 #1
0
        void DeletePicture(int id)
        {
            ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem((rm as ResourceManager).GetString("Message_Delete_Title"), (rm as ResourceManager).GetString("Message_DeletePics"), PackIconKind.WarningCircle);
            Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, true);

            if (msb.ShowDialog() == true)
            {
                System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

                if (WPE.WeddingVenueImages.Any(x => x.ID.Equals(id)))
                {
                    WPE.Dispose();
                    WPE = new Models.WeddingPlannerEntities();
                    Models.WeddingVenueImages wvi = WPE.WeddingVenueImages.FirstOrDefault(x => x.ID.Equals(id));
                    WPE.WeddingVenueImages.Attach(wvi);
                    WPE.WeddingVenueImages.Remove(wvi);
                    WPE.SaveChanges();
                    int delindex = p.FindIndex(x => x.ID.Equals(wvi.ID));
                    p.Remove(p.FirstOrDefault(x => x.ID.Equals(wvi.ID)));
                    Bitimages.RemoveAt(delindex);
                    PicsBox.ItemsSource = null;
                    PicsBox.ItemsSource = p;
                }
            }
            System.Windows.Input.Mouse.OverrideCursor = null;
        }
예제 #2
0
        internal void DeleteCLick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            int id = 0;

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

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

            if (msb.ShowDialog() == true)
            {
                if (WPE.Contacts.FirstOrDefault(x => x.Con_ID.Equals(id)) != null)
                {
                    WPE.Dispose();
                    WPE = new Models.WeddingPlannerEntities();
                    var cont = new Models.Contacts {
                        Con_ID = id
                    };
                    WPE.Contacts.Attach(cont);
                    WPE.Contacts.Remove(cont);
                    WPE.SaveChanges();
                    CreateContactList();
                }
            }
        }
예제 #3
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));
                }
            }
        }
예제 #4
0
        internal void DeleteCLick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            int id = 0;

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

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

            if (msb.ShowDialog() == true)
            {
                if (WPE.CalendarLogEntrys.Any(x => x.ID.Equals(id)))
                {
                    WPE.Dispose();
                    WPE = new Models.WeddingPlannerEntities();
                    var Logentry = WPE.CalendarLogEntrys.FirstOrDefault(x => x.ID.Equals(id));
                    WPE.CalendarLogEntrys.Attach(Logentry);
                    WPE.CalendarLogEntrys.Remove(Logentry);
                    WPE.SaveChanges();

                    if (!WPE.CalendarLogEntrys.Any(x => x.CalID.Equals(Logentry.CalID)))
                    {
                        var cal = WPE.Calendar.FirstOrDefault(x => x.ID.Equals(Logentry.CalID));
                        WPE.Calendar.Attach(cal);
                        WPE.Calendar.Remove(cal);
                        WPE.SaveChanges();

                        int      Userid = Cal.UserID;
                        DateTime Date   = Cal.Date;
                        Cal        = new Models.Calendar();
                        Cal.ID     = 0;
                        Cal.UserID = Userid;
                        Cal.Date   = Date;
                    }
                    CreateList();
                }
            }
        }