private void confirmbutton_Click(object sender, EventArgs e) { if (fromWho == 1) { BookmakerService.getInstance.pay(currentOrder); Form confirm = new DialogWithOne_Buttom("Оплата подтверждена", Text); confirm.ShowDialog(); } if (fromWho == 2) { StoreKeeperService.getInstance.collectOrder(currentOrder); Form confirm = new DialogWithOne_Buttom("Заказ передан Курьеру", Text); confirm.ShowDialog(); } if (fromWho == 3) { CourierService.getInstance.takeOrder(currentOrder); Form confirm = new DialogWithOne_Buttom("Заказ добавлен в Доставки", Text); confirm.ShowDialog(); } if (fromWho == 4) { CourierService.getInstance.giveOrder(currentOrder); Form confirm = new DialogWithOne_Buttom("Доставлен", Text); confirm.ShowDialog(); } Close(); }
private void addbutton_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("") || textBox2.Text.Equals("") || textBox3.Equals("")) { Form err = new DialogWithOne_Buttom("Заполните все поля", Text); err.ShowDialog(); } else { if (textBox3.TextLength == 13) { ProviderManagerService service = ProviderManagerService.getInstance(); service.addProvider(textBox1.Text, textBox2.Text, textBox3.Text); Form createProvider = new DialogWithOne_Buttom("Поставщик добавлен", Text); createProvider.ShowDialog(); Close(); } else { Form err = new DialogWithOne_Buttom("Длина номера должна состоять из 12 цифр", Text); err.ShowDialog(); } } }
private void editbutton_Click(object sender, EventArgs e) { if (textBox2.Text.Equals("") || textBox3.Equals("")) { Form err = new DialogWithOne_Buttom("Заполните все поля", Text); err.ShowDialog(); } else { if (textBox3.TextLength == 13) { currentProvider.Address = textBox2.Text; currentProvider.PhoneNumber = textBox3.Text; Form createProvider = new DialogWithOne_Buttom("Поставщик изменен", Text); createProvider.ShowDialog(); Close(); } else { Form err = new DialogWithOne_Buttom("Длина номера должна состоять из 12 цифр", Text); err.ShowDialog(); } } }
private void textBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { string outPut = ClientManagerService.getInstance().showFindOrder(textBox1.Text); if (textBox1.Text.Equals("")) { refreshFind(); } else if (outPut != null) { timer1.Stop(); listBox1.Items.Clear(); string[] order = outPut.Split('/'); for (int i = 0; i < order.Length - 1; i++) { listBox1.Items.Add(order[i]); } } else { Form err = new DialogWithOne_Buttom("Проверте запрос на поиск", Text); err.ShowDialog(); } } }
private void editbutton_Click(object sender, EventArgs e) { ClientManagerService.getInstance().editOrder(int.Parse(textBox3.Text), textBox5.Text); Form editOrder = new DialogWithOne_Buttom("Заказ изменён", Text); editOrder.ShowDialog(); Close(); }
private void deletebutton_Click(object sender, EventArgs e) { ClientManagerService.getInstance().deleteOrder(currentOrder); Form deleteOrder = new DialogWithOne_Buttom("Заказ удален", Text); deleteOrder.ShowDialog(); Close(); }
private void timerError_Tick(object sender, EventArgs e) { int count0 = listBox8.Items.Count; //чтобы тестить ставь == refreshError(); if ((count0 != listBox8.Items.Count) && (-count0 + listBox8.Items.Count > 0)) { string msg = "Проверте список Ошибок! \nДобавлено " + (listBox8.Items.Count - count0).ToString() + " новых заказов"; Form info = new DialogWithOne_Buttom(msg, Text); info.Show(); } }
private void button2_Click(object sender, EventArgs e) { ProviderManagerService.getInstance().clearTxt("ProviderList.txt"); for (int i = 0; i < listBox1.Items.Count; i++) { string[] provider = listBox1.Items[i].ToString().Split('|'); ProviderManagerService.getInstance().exportToTxt("ProviderList.txt", provider); } Form confirm = new DialogWithOne_Buttom("Список Поставщиков Сохранен", Text); confirm.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { if (fromWho == 1) { //добавить новый товар if (comboBox1.Text.Trim().Equals("") || comboBox2.Text.Trim().Equals("") || comboBox3.Text.Trim().Equals("") || comboBox4.Text.Trim().Equals("")) { Form err = new DialogWithOne_Buttom("Введены пустые поля", Text); err.ShowDialog(); return; } Product product = new Product(comboBox1.Text.Trim(), comboBox2.Text.Trim(), comboBox3.Text.Trim(), comboBox4.Text.Trim()); try { ProviderManagerService.getInstance().addNewProduct(product); Close(); } catch (ServiceException ex) { Form err = new DialogWithOne_Buttom(ex.Message, Text); err.ShowDialog(); Close(); } } if (fromWho == 2) { int count = 0; try { count = int.Parse(textBox5.Text.Trim()); } catch (Exception) { Form err = new DialogWithOne_Buttom("Неправильный формат \n количества", Text); err.ShowDialog(); return; } //переписать введенные параметры if (comboBox4.Text.Trim().Equals("") || textBox5.Text.Trim().Equals("")) { Form err = new DialogWithOne_Buttom("Пустые поля", Text); err.Show(); } Product changed = new Product(comboBox1.Text, comboBox2.Text, comboBox3.Text, comboBox4.Text.Trim()); ProviderManagerService.getInstance().changeProduct(product, changed, count, comboBox4.Text.Trim()); Close(); } }
private void createOrderbutton_Click(object sender, EventArgs e) { if (comboBox1.Text.Equals("") || comboBox2.Text.Equals("") || comboBox3.Text.Equals("") || comboBox4.Text.Equals("") || textBox2.Text.Equals("") || textBox3.Text.Equals("") || textBox4.Text.Equals("") || textBox5.Text.Equals("") || textBox6.Text.Equals("")) { Form err = new DialogWithOne_Buttom("Заполните все поля", Text); err.ShowDialog(); } else { try { double price = double.Parse(textBox6.Text); int number = int.Parse(textBox3.Text); if ((number < 1) || (price < 1)) { if (number < 1) { Form err = new DialogWithOne_Buttom("Количество не может быть \nотрицательным либо равным нулю", Text); err.ShowDialog(); } if (price < 1) { Form err = new DialogWithOne_Buttom("Цена не может быть \nотрицательным либо равным нулю", Text); err.ShowDialog(); } } else { ClientManagerService clientManagerService = ClientManagerService.getInstance(); if (clientManagerService.isExistId(int.Parse(textBox5.Text))) { new DialogWithOne_Buttom("Такой номер заказа уже существет", Text).ShowDialog(); } else { clientManagerService.addClientOrder(int.Parse(textBox5.Text), comboBox1.Text, comboBox2.Text, comboBox3.Text, comboBox4.Text, int.Parse(textBox3.Text), textBox2.Text, textBox4.Text, double.Parse(textBox6.Text), DateTime.Parse(dateTimePicker1.Text)); Form createOrder = new DialogWithOne_Buttom("Заказ оформлен", Text); createOrder.ShowDialog(); Close(); } } } catch (Exception) { Form err = new DialogWithOne_Buttom("Количество или Цена \nсостоит только из цифр", Text); err.ShowDialog(); } } }
private void timerClient_Tick(object sender, EventArgs e) { int count0 = listBox4.Items.Count; //чтобы тестить ставь == refreshClient(); //может сделать задержку? if ((count0 != listBox4.Items.Count) && (-count0 + listBox4.Items.Count > 0)) { string msg = "Проверте список Заказов! \nДобавлено " + (listBox4.Items.Count - count0).ToString() + " новых заказов"; count0 = listBox4.Items.Count; Form info = new DialogWithOne_Buttom(msg, Text); info.Show(); } }
private void addErrorbutton_Click(object sender, EventArgs e) { if (fromWho == 4) { CourierService.getInstance.deniedOrder(currentOrder); Form confirm = new DialogWithOne_Buttom("Заказ отклонен", Text); confirm.ShowDialog(); Close(); } if (fromWho == 3) { CourierService.getInstance.addInErrorList(currentOrder); Form confirm = new DialogWithOne_Buttom("Добавлен в список ошибочных", Text); confirm.ShowDialog(); Close(); } }
private void button3_Click(object sender, EventArgs e) { string[] product = new string[listBox2.Items.Count]; for (int i = 0; i < listBox2.Items.Count; i++) { string[] str = listBox2.Items[i].ToString().Split('|'); product[i] = str[1].Trim(); } ProviderManagerService.getInstance().exportToExcel(product); Form confirm = new DialogWithOne_Buttom("Список Товаров \nконвертирован в Excel", Text); confirm.ShowDialog(); }
private void createProviderOrderbutton_Click(object sender, EventArgs e) { if (comboBox1.Text.Equals("") || comboBox2.Text.Equals("") || comboBox3.Text.Equals("") || comboBox5.Text.Equals("") || textBox3.Text.Equals("")) { Form err = new DialogWithOne_Buttom("Заполните все поля", Text); err.ShowDialog(); } else { try { int number = int.Parse(textBox2.Text); double price = double.Parse(textBox3.Text); if ((number < 1) || (price < 1)) { if (number < 1) { Form err = new DialogWithOne_Buttom("Количество не может быть \nотрицательным либо равным нулю", Text); err.ShowDialog(); } else { Form err = new DialogWithOne_Buttom("Цена не может быть \nотрицательной либо равной нулю", Text); err.ShowDialog(); } } else { ProviderManagerService providerService = ProviderManagerService.getInstance(); Product product = new Product(comboBox1.Text, comboBox2.Text, comboBox3.Text, comboBox5.Text); providerService.addNewOrder(product, int.Parse(textBox2.Text), double.Parse(textBox3.Text), comboBox4.Text, DateTime.Parse(dateTimePicker1.Value.ToString())); Form createOrder = new DialogWithOne_Buttom("Заказ оформлен", Text); createOrder.ShowDialog(); Close(); } } catch (Exception) { Form err = new DialogWithOne_Buttom("Количество или Цена состоит только из цифр", Text); err.ShowDialog(); } } }
private void confirmbutton_Click(object sender, EventArgs e) { ProviderManagerService provider = ProviderManagerService.getInstance(); if (provider.deleteProvider(currentProvider)) { Form confirm = new DialogWithOne_Buttom("Поставщик удален", Text); confirm.ShowDialog(); Close(); } else { Form reject = new DialogWithOne_Buttom("Поставщик не был удален, \n т.к. еще не все его заказы отработаны", Text); reject.ShowDialog(); Close(); } }
private void confirmbutton_Click(object sender, EventArgs e) { if (textBox1.Text.Equals("") || comboBox1.Text.Equals("") || textBox2.Text.Equals("") || textBox3.Text.Equals("")) { Form err = new DialogWithOne_Buttom("Заполните все поля", Text); err.ShowDialog(); } else { try { int number = int.Parse(textBox1.Text); if (number < 1) { Form err = new DialogWithOne_Buttom("Номер заказа не может быть\n отрицательным либо равным нулю", Text); err.ShowDialog(); } else { ProviderManagerService providerService = ProviderManagerService.getInstance(); providerService.makeOrder(int.Parse(textBox1.Text.Trim()), comboBox1.Text, int.Parse(textBox2.Text.Trim()), int.Parse(textBox3.Text.Trim()), DateTime.Parse(dateTimePicker1.Value.ToString())); Form confirm = new DialogWithOne_Buttom("Захаз оформлен", Text); confirm.ShowDialog(); Close(); Refresh(); } } catch (ServiceException) { Form err = new DialogWithOne_Buttom("Кол-во заказанных товаров меньше требуемого", Text); err.ShowDialog(); } catch (Exception) { Form err = new DialogWithOne_Buttom("Номер заказа состоит только из цифр", Text); err.ShowDialog(); } } }
private void confirmbutton_Click(object sender, EventArgs e) { if (fromWho == 1) { BookmakerService.getInstance.pay(currentOrder); Form confirm = new DialogWithOne_Buttom("Оплата подтверждена", Text); confirm.ShowDialog(); } if (fromWho == 2) { StoreKeeperService.getInstance.takeProviderOrder(currentOrder); Form confirm = new DialogWithOne_Buttom("Заказ выполнен", Text); confirm.ShowDialog(); } if (fromWho == 3) { ProviderManagerService.getInstance().removeProviderOrder(currentOrder); Form confirm = new DialogWithOne_Buttom("Заказ удален", Text); confirm.ShowDialog(); } Close(); }