Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("Пустое поле!");
                return;
            }
            bool flag = false;

            foreach (var book in CurrentProfile.bookings)
            {
                if (book.id == Int32.Parse(textBox1.Text))
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                MessageBox.Show("Бронь не найдена!");
                return;
            }
            ReseptionistCommands.sendBookSettle(Int32.Parse(textBox1.Text));
            AllForms.receptionistMenu.Show();
            this.Close();
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!CurrentProfile.updSettle)
     {
         CurrentProfile.updSettle = true;
         ReseptionistCommands.sendUpdateSettle();
     }
     AllForms.infoNumbers = new InfoNumbers();
     AllForms.infoNumbers.Show();
     this.Hide();
 }
Exemplo n.º 3
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (!CurrentProfile.updSettle)
     {
         CurrentProfile.updSettle = true;
         ReseptionistCommands.sendUpdateSettle();
     }
     AllForms.unsettling = new Unsettling();
     AllForms.unsettling.Show();
     this.Hide();
 }
Exemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!CurrentProfile.updBook)
     {
         CurrentProfile.updBook  = true;
         CurrentProfile.windOpen = 3;
         ReseptionistCommands.sendUpdateBook();
     }
     else
     {
         AllForms.bookingSettle = new BookingSettle();
         AllForms.bookingSettle.Show();
         this.Hide();
     }
 }
Exemplo n.º 5
0
 public static void addSettle(string message)
 {
     string[] words = message.Split(':');
     settles.Add(new Settling(Int32.Parse(words[0]), Int32.Parse(words[1]), Int32.Parse(words[2]), Int32.Parse(words[3]), words[4], words[5], Int32.Parse(words[6])));
     if (settles.Count() < sizeSettle)
     {
         ReseptionistCommands.sendSettle(settles.Count);
     }
     else
     {
         if (AllForms.unsettling != null && AllForms.unsettling.Visible)
         {
             AllForms.unsettling.Invoke(AllForms.unsettling.upgr);
         }
     }
 }
Exemplo n.º 6
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!CurrentProfile.updgue)
     {
         CurrentProfile.updgue = true;
         CurrentProfile.openin = true;
         ReseptionistCommands.sendUpdateGuests();
     }
     else
     {
         if (!AllForms.infoGuests.Visible)
         {
             AllForms.infoGuests = new InfoGuests();
             AllForms.infoGuests.Show();
         }
     }
 }
Exemplo n.º 7
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         MessageBox.Show("Пустое поле!");
         return;
     }
     foreach (var settle in CurrentProfile.settles)
     {
         if (settle.id == Int32.Parse(textBox1.Text))
         {
             ReseptionistCommands.sendUnsettle(settle.number, 0);
             AllForms.receptionistMenu.Show();
             this.Close();
             return;
         }
     }
     MessageBox.Show("Id не найдено!");
     textBox1.Text = "";
 }
Exemplo n.º 8
0
 public static void addfgue(string message)
 {
     string[] words = message.Split(':');
     guests.Add(new User(words[0], "", words[1], words[2], words[3], words[4], words[5], words[6], words[7]));
     if (guests.Count() < sizegue)
     {
         ReseptionistCommands.sendGuest(guests.Count);
     }
     else
     {
         if (openin)
         {
             openin = false;
             AllForms.faceSettling.Invoke(AllForms.faceSettling.opening);
         }
         if (AllForms.infoGuests != null && AllForms.infoGuests.Visible)
         {
             AllForms.infoGuests.Invoke(AllForms.infoGuests.upgr);
         }
     }
 }
Exemplo n.º 9
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (Id.Text == "" || guests.Text == "" || number.Text == "")
            {
                MessageBox.Show("Пустое поле");
                return;
            }
            bool flag = false;

            foreach (var guest in CurrentProfile.guests)
            {
                if (Id.Text == guest.id)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                MessageBox.Show("Гость не найден!");
                return;
            }
            flag = false;
            foreach (var numbe in CurrentProfile.numbers)
            {
                if (numbe.number == Int32.Parse(number.Text))
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                MessageBox.Show("Номер не найден!");
                return;
            }
            ReseptionistCommands.sendSettle(Int32.Parse(Id.Text), SettleDate.Text, UnsettleDate.Text, Int32.Parse(guests.Text), Int32.Parse(number.Text));
            AllForms.receptionistMenu.Show();
            this.Hide();
        }
Exemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("Пустое поле!");
                return;
            }
            bool flag = false;

            foreach (var number in CurrentProfile.numbers)
            {
                if (Int32.Parse(textBox1.Text) == number.number)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                MessageBox.Show("Номер не найден!");
                return;
            }
            ReseptionistCommands.sendUnsettle(Int32.Parse(textBox1.Text), 1);
        }
Exemplo n.º 11
0
 public static void GetMessage()
 {
     while (true)
     {
         try
         {
             byte[]        data    = new byte[255];
             StringBuilder builder = new StringBuilder();
             int           bytes   = 0;
             do
             {
                 bytes = stream.Read(data, 0, data.Length);
                 builder.Append(Encoding.Unicode.GetString(data, 0, bytes));
             } while (stream.DataAvailable);
             string message = builder.ToString();
             if (message == "")
             {
                 continue;
             }
             string[] words = message.Split('#');
             if (words.Length == 0)
             {
                 continue;
             }
             if (words[0] == "ESTABLISHED")
             {
                 continue;
             }
             if (words[0] == "CLOSE")
             {
                 continue;
             }
             if (words[0] == "GOODLOGIN")
             {
                 Program.authorisation.Invoke(Program.authorisation.loginDelegate, words[1]);
             }
             if (words[0] == "BADLOGIN")
             {
                 Program.authorisation.badLogin();
             }
             if (words[0] == "GOODANKETA")
             {
                 AllForms.anketa.Invoke(AllForms.anketa.anketDelegate, words[1]);
             }
             if (words[0] == "BADREGISTRATION")
             {
                 MessageBox.Show("Данный логин уже занят");
             }
             if (words[0] == "GOODREGISTRATION")
             {
                 AllForms.registration.Invoke(AllForms.registration.regDelegate);
             }
             if (words[0] == "NEWTYPE")
             {
                 if (Int32.Parse(words[1].Split(':')[4]) == 0)
                 {
                     CurrentProfile.stype   = 0;
                     CurrentProfile.types   = new List <Type>();
                     CurrentProfile.numbers = new List <Number>();
                 }
                 CurrentProfile.addType(words[1]);
             }
             if (words[0] == "NEWNUMBER")
             {
                 CurrentProfile.addNumber(words[1]);
             }
             if (words[0] == "FOUNDBOOKED")
             {
                 CurrentProfile.sizefil = Int32.Parse(words[1]);
                 if (CurrentProfile.filtrs == null)
                 {
                     CurrentProfile.filtrs = new List <int>();
                 }
                 CurrentProfile.filtrs.Clear();
                 if (CurrentProfile.sizefil == 0)
                 {
                     AllForms.booked.Invoke(AllForms.booked.closeDelegate);
                 }
                 else
                 {
                     GuestCommands.sendFilt(0);
                 }
             }
             if (words[0] == "NEWFILTER")
             {
                 CurrentProfile.addfilt(words[1]);
             }
             if (words[0] == "BADBOOK")
             {
                 MessageBox.Show("Номер уже занят, извините");
             }
             if (words[0] == "GOODBOOK")
             {
                 AllForms.offers.Invoke(AllForms.offers.closing);
             }
             if (words[0] == "NEWBOOKING")
             {
                 CurrentProfile.addBook(words[1]);
             }
             if (words[0] == "FOUNDBOOKINGS")
             {
                 CurrentProfile.sizebooking = Int32.Parse(words[1]);
                 CurrentProfile.bookings    = new List <Booking>();
                 if (CurrentProfile.sizebooking > 0)
                 {
                     GuestCommands.sendNextBook(0);
                 }
             }
             if (words[0] == "GOODEMAIL")
             {
                 MessageBox.Show("Email успешно изменен!");
             }
             if (words[0] == "GOODPASS")
             {
                 MessageBox.Show("Пароль успешно изменен!");
                 AllForms.changePass.Invoke(AllForms.changePass.closDelegate);
             }
             if (words[0] == "BADPASS")
             {
                 MessageBox.Show("Неправильно введен старый пароль!");
             }
             if (words[0] == "GOODPHONE")
             {
                 MessageBox.Show("Телефон успешно изменен!");
             }
             if (words[0] == "UPDATEBOOKINGS")
             {
                 ReseptionistCommands.sendUpdateBook();
             }
             if (words[0] == "UPDATEGUESTINGS")
             {
                 CurrentProfile.sizegue = Int32.Parse(words[1]);
                 CurrentProfile.guests  = new List <User>();
                 if (CurrentProfile.sizegue > 0)
                 {
                     ReseptionistCommands.sendGuest(0);
                 }
             }
             if (words[0] == "NEWGUEST")
             {
                 CurrentProfile.addfgue(words[1]);
             }
             if (words[0] == "UPDATESETTLING")
             {
                 CurrentProfile.sizeSettle = Int32.Parse(words[1]);
                 CurrentProfile.settles    = new List <Settling>();
                 if (CurrentProfile.sizeSettle > 0)
                 {
                     ReseptionistCommands.sendSettle(0);
                 }
             }
             if (words[0] == "NEWSETTLE")
             {
                 CurrentProfile.addSettle(words[1]);
             }
         }
         catch (Exception ex)
         {
             Close();
         }
     }
 }