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); } } }
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(); }
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(); } } }