示例#1
0
 void insertImageData(string[] imageNames)
 {
     try
     {
         if (imageNames != null)
         {
             System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
             FileStream fs = null;
             for (int i = 0; i < imageNames.Length; i++)
             {
                 fs = new FileStream(imageNames[i], FileMode.Open, FileAccess.Read);
                 byte[] imgByteArr = new byte[fs.Length];
                 fs.Read(imgByteArr, 0, Convert.ToInt32(fs.Length));
                 Models.WeddingVenueImages wvi = new Models.WeddingVenueImages();
                 wvi.WeddingVenueID = VenueIDs[CB_Venue.SelectedIndex];
                 wvi.Image          = imgByteArr;
                 wvi.ImageName      = imageNames[i].Split(new[] { @"\" }, StringSplitOptions.None).Last();
                 WPE.WeddingVenueImages.Add(wvi);
                 WPE.SaveChanges();
             }
             fs.Close();
             ShowPics((rm as ResourceManager));
             System.Windows.Input.Mouse.OverrideCursor = null;
         }
     }
     catch (Exception ex)
     {
         ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem("Error", ex.Message, PackIconKind.Error);
         Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, false);
         msb.Show();
         System.Windows.Input.Mouse.OverrideCursor = null;
     }
 }
示例#2
0
 void SaveGuests(object sender)
 {
     WPE = new Models.WeddingPlannerEntities();
     if ((sender as Button).Name == "BT_SaveGroom")
     {
         if (f.IsName(TB_GroomGuests, TB_GroomGuests.Text.Trim(), (rm as ResourceManager)) && f.IsNumber(TB_GroomGuestsCount, f.StringRemoveWhiteSpace(TB_GroomGuestsCount.Text.Trim()), (rm as ResourceManager)))
         {
             Models.Guests gue = new Models.Guests();
             gue.Guest_Name  = TB_GroomGuests.Text.Trim();
             gue.Guest_Count = Convert.ToInt32(f.StringRemoveWhiteSpace(TB_GroomGuestsCount.Text.Trim()));
             gue.Wedding_ID  = Wedding.ID;
             gue.Bride_Groom = 0;
             WPE.Guests.Add(gue);
             WPE.SaveChanges();
             CreateGuestList((rm as ResourceManager));
         }
     }
     else if ((sender as Button).Name == "BT_SaveBride")
     {
         if (f.IsName(TB_BrideGuests, TB_BrideGuests.Text.Trim(), (rm as ResourceManager)) && f.IsNumber(TB_BrideGuestsCount, f.StringRemoveWhiteSpace(TB_BrideGuestsCount.Text.Trim()), (rm as ResourceManager)))
         {
             Models.Guests gue = new Models.Guests();
             gue.Guest_Name  = TB_BrideGuests.Text.Trim();
             gue.Guest_Count = Convert.ToInt32(f.StringRemoveWhiteSpace(TB_BrideGuestsCount.Text.Trim()));
             gue.Wedding_ID  = Wedding.ID;
             gue.Bride_Groom = 1;
             WPE.Guests.Add(gue);
             WPE.SaveChanges();
             CreateGuestList((rm as ResourceManager));
         }
     }
 }
示例#3
0
        void DeleteVenueAndPictures()
        {
            if (CB_Venue.SelectedIndex > -1)
            {
                int VenID = VenueIDs[CB_Venue.SelectedIndex];
                ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem((rm as ResourceManager).GetString("Message_Delete_Title"), (rm as ResourceManager).GetString("Message_DeleteVenue"), PackIconKind.WarningCircle);
                Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, true);

                if (msb.ShowDialog() == true)
                {
                    if (WPE.WeddingVenue.Any(x => x.ID.Equals(VenID)))
                    {
                        WPE.Dispose();
                        WPE = new Models.WeddingPlannerEntities();
                        var ven = new Models.WeddingVenue {
                            ID = VenID
                        };

                        if (WPE.WeddingExpenses.Any(x => x.VenueID.Equals(ven.ID)))
                        {
                            wmsb = new ViewModel.WinMessageBoxItem((rm as ResourceManager).GetString("Message_Delete_Title"), (rm as ResourceManager).GetString("Message_DeleteExpense"), PackIconKind.WarningCircle);
                            msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, null);

                            if (msb.ShowDialog() == true)
                            {
                                WPE.WeddingExpenses.RemoveRange(WPE.WeddingExpenses.Where(X => X.VenueID.Equals(ven.ID)));
                                WPE.SaveChanges();
                            }
                            else
                            {
                                return;
                            }
                        }
                        if (WPE.WeddingVenueImages.Any(x => x.WeddingVenueID.Equals(ven.ID)))
                        {
                            WPE.WeddingVenueImages.RemoveRange(WPE.WeddingVenueImages.Where(x => x.WeddingVenueID.Equals(ven.ID)));
                            WPE.SaveChanges();
                        }
                        WPE.WeddingVenue.Attach(ven);
                        WPE.WeddingVenue.Remove(ven);
                        p.Clear();
                        Bitimages.Clear();
                        WPE.SaveChanges();
                        CB_Reload();
                    }
                }
            }
        }
示例#4
0
        void Modification()
        {
            System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            Models.Login _user = WPE.Login.SingleOrDefault(b => b.IDLogin == ActualUser.IDLogin);

            if (_user != null && f.IsYourPassword(T_OldPassword, T_OldPassword.Password, ActualUser, (rm as ResourceManager)))
            {
                if (TB_user.Text != string.Empty)
                {
                    if (f.IsName(TB_user, TB_user.Text.Trim(), (rm as ResourceManager)))
                    {
                        _user.User = TB_user.Text.Trim();
                    }
                }
                if (T_passwd.Password != string.Empty || T_passwdAgain.Password != string.Empty)
                {
                    if (f.IsPassword(T_passwd, T_passwd.Password, (rm as ResourceManager)) && f.IsPasswordAreEqual(T_passwd, T_passwdAgain, T_passwd.Password, T_passwdAgain.Password, (rm as ResourceManager)))
                    {
                        _user.Password = f.Encrypt(T_passwd.Password.Trim());
                    }
                }
                if (TB_email.Text != string.Empty)
                {
                    if (f.IsValidEmail(TB_email, TB_email.Text.Trim(), (rm as ResourceManager)))
                    {
                        _user.EmailAddress = TB_email.Text.Trim();
                    }
                }
                WPE.SaveChanges();
                WPE                    = new Models.WeddingPlannerEntities();
                ActualUser             = _user;
                h.LB_TitleHome.Content = h.LB_TitleHome.Content.ToString().Split(' ')[0] + " " + ActualUser.User.Trim();
            }
            System.Windows.Input.Mouse.OverrideCursor = null;
        }
示例#5
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;
        }
示例#6
0
        void ReadBasicRadioChannels()
        {
            if (File.Exists("RadioChannels/RadioChannels.txt"))
            {
                StreamReader sr = new StreamReader("RadioChannels/Radiochannels.txt", System.Text.Encoding.UTF8);
                try
                {
                    while (!sr.EndOfStream)
                    {
                        string row            = sr.ReadLine().Trim();
                        string rowStreamLink  = row.Split(';')[0].Trim();
                        string rowChannelName = row.Split(';')[1].Trim();

                        if (!WPE.Radio.Any(x => x.UserID.Equals(ActualUser.IDLogin) && x.StreamLink.Trim().Equals(rowStreamLink.Trim()) && x.ChannelName.Trim().Equals(rowChannelName.Trim())))
                        {
                            Models.Radio r = new Models.Radio();

                            r.UserID      = ActualUser.IDLogin;
                            r.StreamLink  = row.Split(';')[0].Trim();
                            r.ChannelName = row.Split(';')[1].Trim();
                            WPE.Radio.Add(r);
                        }
                    }
                    sr.Close();
                    WPE.SaveChanges();
                }
                catch (Exception ex)
                {
                    sr.Close();
                    ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem("Error", ex.Message, PackIconKind.Error);
                    Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, false);
                    msb.Show();
                }
            }
        }
示例#7
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();
                }
            }
        }
示例#8
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));
                }
            }
        }
示例#9
0
 void Save_Channel()
 {
     if (f.isRadioLink(TB_StreamLink, TB_StreamLink.Text.Trim(), (rm as ResourceManager)) && f.IsNormalText(TB_RadioChannelName, TB_RadioChannelName.Text.Trim(), (rm as ResourceManager)))
     {
         if (!WPE.Radio.Any(x => x.UserID.Equals(User.IDLogin) && x.StreamLink.Trim().Equals(TB_StreamLink.Text.Trim()) && x.ChannelName.Trim().Equals(TB_RadioChannelName.Text.Trim())))
         {
             Models.Radio rad = new Models.Radio();
             rad.UserID      = User.IDLogin;
             rad.StreamLink  = TB_StreamLink.Text.Trim();
             rad.ChannelName = TB_RadioChannelName.Text.Trim();
             WPE.Radio.Add(rad);
             WPE.SaveChanges();
             CB_Reload();
         }
     }
 }
示例#10
0
 void SaveEntrys()
 {
     if (Cal.ID == 0)
     {
         WPE.Calendar.Add(Cal);
         WPE.SaveChanges();
     }
     if (Cal != null && f.IsNormalText(TB_LogEntry, TB_LogEntry.Text, (rm as ResourceManager)))
     {
         Models.CalendarLogEntrys cl = new Models.CalendarLogEntrys();
         cl.CalID    = Cal.ID;
         cl.LogEntry = TB_LogEntry.Text.Trim();
         WPE.CalendarLogEntrys.Add(cl);
         WPE.SaveChanges();
     }
     CreateList();
 }
示例#11
0
        internal void BrowsePictures()
        {
            try
            {
                OpenFileDialog fldlg = new OpenFileDialog();
                fldlg.InitialDirectory = Environment.SpecialFolder.MyPictures.ToString();
                fldlg.Filter           = (rm as ResourceManager).GetString("Dialog_ImageFiles") + "(*.jpg; *.jpeg; *.png; *.gif; *.bmp)| *.jpg; *.jpeg; *.png; *.gif; *.bmp";
                if (fldlg.ShowDialog() == true)
                {
                    System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

                    System.IO.FileStream fs = null;
                    fs = new System.IO.FileStream(fldlg.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                    byte[] imgByteArr = new byte[fs.Length];
                    fs.Read(imgByteArr, 0, Convert.ToInt32(fs.Length));

                    h.ImageBetrothed.Source = f.CreateBitmapFromBytes(imgByteArr);
                    if (wedd != null)
                    {
                        Models.WeddingData wd = wedd;
                        wd.Image = imgByteArr;
                        WPE.SaveChanges();
                    }
                    BetrothedImage = imgByteArr;
                    fs.Close();
                    fldlg = null;

                    System.Windows.Input.Mouse.OverrideCursor = null;
                }
                fldlg = null;
            }
            catch (Exception ex)
            {
                System.Windows.Input.Mouse.OverrideCursor = null;
                ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem("Error", ex.Message, MaterialDesignThemes.Wpf.PackIconKind.Error);
                Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, false);
                msb.Show();
            }
        }
示例#12
0
        void Modification()
        {
            var result = WPE.CalendarLogEntrys.SingleOrDefault(b => b.ID == Entry.ID);

            if (result != null && f.IsNormalText(RTB_Entry, new TextRange(RTB_Entry.Document.ContentStart, RTB_Entry.Document.ContentEnd).Text.Trim(), rm))
            {
                result.LogEntry = new TextRange(RTB_Entry.Document.ContentStart, RTB_Entry.Document.ContentEnd).Text.Trim();
                WPE.SaveChanges();
                RefreshCalendarList re = cli.CreateList;
                re();
                this.Close();
            }
        }
示例#13
0
 void Modification()
 {
     Models.Radio result = WPE.Radio.SingleOrDefault(b => b.ID == rad.ID);
     if (result != null && f.IsNormalText(TB_StreamLink, TB_StreamLink.Text.Trim(), rm) && f.IsNormalText(TB_RadioChannelName, TB_RadioChannelName.Text.Trim(), rm))
     {
         result.StreamLink  = TB_StreamLink.Text.Trim();
         result.ChannelName = TB_RadioChannelName.Text.Trim();
         WPE.SaveChanges();
         RefreshRadioChannelList re = RadPage.CB_Reload;
         re();
         this.Close();
     }
 }
示例#14
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();
                }
            }
        }
示例#15
0
 void SaveContact()
 {
     if (f.IsName(TB_Name, TB_Name.Text.Trim(), (rm as ResourceManager)) && f.IsPhoneNumber(TB_Phone, TB_Phone.Text.Trim(), (rm as ResourceManager)) && f.IsValidEmail(TB_Email, TB_Email.Text.Trim(), (rm as ResourceManager)))
     {
         Models.Contacts cont = new Models.Contacts();
         cont.User_Id   = User.IDLogin;
         cont.Con_Name  = TB_Name.Text.Trim();
         cont.Con_Phone = TB_Phone.Text.Trim();
         cont.Con_Email = TB_Email.Text.Trim();;
         WPE.Contacts.Add(cont);
         WPE.SaveChanges();
         CreateContactList();
     }
 }
示例#16
0
        void Modification()
        {
            var result = WPE.Guests.SingleOrDefault(b => b.Guest_ID == gue.Guest_ID);

            if (result != null && f.IsName(TB_Guest, TB_Guest.Text.Trim(), rm) && f.IsNumber(TB_GuestsCount, f.StringRemoveWhiteSpace(TB_GuestsCount.Text.Trim()), rm))
            {
                result.Guest_Name  = TB_Guest.Text.Trim();
                result.Guest_Count = Convert.ToInt32(f.StringRemoveWhiteSpace(TB_GuestsCount.Text.Trim()));
                WPE.SaveChanges();
                RefreshGuestList re = GuePage.CreateGuestList;
                re((rm as ResourceManager));
                this.Close();
            }
        }
示例#17
0
        void Modification()
        {
            var result = WPE.WeddingExpenses.SingleOrDefault(b => b.ID == exp.ID);

            if (result != null && f.IsName(TB_Expense, TB_Expense.Text.Trim(), rm) && f.IsNumber(TB_Cost, f.StringRemoveWhiteSpace(TB_Cost.Text.Trim()), rm) && f.IsNumber(TB_Count, f.StringRemoveWhiteSpace(TB_Count.Text.Trim()), rm))
            {
                result.ExpenseName = TB_Expense.Text.Trim();
                result.Expense     = Convert.ToInt32(f.StringRemoveWhiteSpace(TB_Cost.Text.Trim()));
                result.Count       = Convert.ToInt32(f.StringRemoveWhiteSpace(TB_Count.Text.Trim()));
                WPE.SaveChanges();
                RefreshExpenseList re = ExpPage.CreateExpenseList;
                re((rm as ResourceManager));
                this.Close();
            }
        }
示例#18
0
        void Modification()
        {
            var result = WPE.Contacts.SingleOrDefault(b => b.Con_ID == Con.Con_ID);

            if (result != null && f.IsName(Tb_Name, Tb_Name.Text.Trim(), (rm as ResourceManager)) && f.IsValidEmail(Tb_Email, Tb_Email.Text.Trim(), (rm as ResourceManager)) && f.IsPhoneNumber(Tb_Phone, Tb_Phone.Text.Trim(), (rm as ResourceManager)))
            {
                result.Con_Name  = Tb_Name.Text.Trim();
                result.Con_Phone = Tb_Phone.Text.Trim();
                result.Con_Email = Tb_Email.Text.Trim();
                WPE.SaveChanges();
                RefreshContactsList re = conpage.CreateContactList;
                re();
                this.Close();
            }
        }
示例#19
0
        void Modification()
        {
            var result = WPE.WeddingVenue.SingleOrDefault(b => b.ID == ven.ID);

            if (result != null && f.IsName(TB_Venue, TB_Venue.Text.Trim(), rm) && f.IsName(TB_Address, TB_Address.Text.Trim(), rm))
            {
                result.Wedding_Venue = TB_Venue.Text.Trim();
                result.Venue_Address = TB_Address.Text.Trim();
                WPE.SaveChanges();
                RefreshVenueCombobox re = VenPage.CB_Reload;

                re(cbindex);
                this.Close();
            }
        }
示例#20
0
        void Modification()
        {
            if (Wedding != null && f.IsNormalText(RTB_Entry, new TextRange(RTB_Entry.Document.ContentStart, RTB_Entry.Document.ContentEnd).Text.Trim(), rm))
            {
                Models.WeddingData wedd  = WPE.WeddingData.FirstOrDefault(x => x.ID.Equals(Wedding.ID));
                string             quote = new TextRange(RTB_Entry.Document.ContentStart, RTB_Entry.Document.ContentEnd).Text.Trim();
                if (quote.Trim().Length > 1000)
                {
                    quote = quote.Trim().Substring(0, 1000);
                }

                wedd.Quote = quote;
                WPE.SaveChanges();
                h.Tbl_Quote.Text = quote.Trim();
                this.Close();
            }
        }
示例#21
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));
         }
     }
 }