private void LoginButton_Click(object sender, EventArgs e) { int value; if (int.TryParse(ID_TEXTBOX.Text, out value) == false) // Dont Continue if null or String { MessageBox.Show(" Please enter a vaild ID!", "Invaild Input", MessageBoxButtons.OK); ID_TEXTBOX.Clear(); } else { Employee emp = Program.seekEmployee(int.Parse(ID_TEXTBOX.Text)); if (emp == null) { MessageBox.Show(" employee ID is not exists!", "Wrong Input", MessageBoxButtons.OK); ID_TEXTBOX.Clear(); } else //valid input { if (emp.get_employeePassword() != PasswordTextBox.Text) { MessageBox.Show(" Password incorrect! please", "Wrong Input", MessageBoxButtons.OK); PasswordTextBox.Clear(); } else { Main_Menu New_MM = new Main_Menu(emp.get_employeeID()); New_MM.Enabled = true;//maybe not needed New_MM.Show(); this.Hide(); } } } }
private void CancelButton_Click(object sender, EventArgs e) { this.Close(); Main_Menu New_MM = new Main_Menu(EMP_ID); New_MM.Enabled = true; New_MM.Show(); }
private void BacklButton_Click(object sender, EventArgs e) { Main_Menu mm = new Main_Menu(this.ID); mm.Enabled = true; mm.Show(); this.Hide(); }
private void Save_Click(object sender, EventArgs e) { if (OrderOutput.Text == "" || Int32.Parse(OrderOutput.Text) == 0) { MessageBox.Show(" Please field all the fields ", "Invaild Input", MessageBoxButtons.OK); } else { DateTime date = Convert.ToDateTime(OrderDateInput.Text, CultureInfo.InvariantCulture); DateTime duedate = Convert.ToDateTime(dateTimePicker1.Value, CultureInfo.InvariantCulture); string description1 = DescrriptionBox.Text; // str = dataGridView1.Rows[DataGridView.SelectedRows[0].Index].Cells[X].Value.ToString(); OrderFromSupplier OFS = new OrderFromSupplier(Convert.ToInt32(OrderIDInput.Text, CultureInfo.InvariantCulture), date, duedate, Convert.ToDouble(Total_Price, CultureInfo.InvariantCulture), (PaymentMethod)Enum.Parse(typeof(PaymentMethod), PMInput.Text), (OrderStatus)Enum.Parse(typeof(OrderStatus), "UnderTreatment"), Program.seekEmployee(EMP_ID), Program.seekSupplierByName(SupllierInput.Text), description1, true); string data = string.Empty; foreach (DataGridViewRow row in dataGridView1.Rows) { data = Convert.ToString(row.Cells[2].Value); int quantity1 = Convert.ToInt32(row.Cells[3].Value); Product pnew = Program.seekProductByName(data); if (pnew != null) { ProductInOrder NewPIP = new ProductInOrder(pnew, OFS, quantity1, true); } } } foreach (OrderFromSupplier o in Program.ordersFromSuppliers) //check of hahalot - products of every order { o.PrintAll(); } foreach (Product p in Program.products) //check of hahalot - orders of this product { Console.WriteLine("printing ProductInOrder lists of products"); p.printAllSupplierOrdersOfThisProduct(); } this.Close(); Main_Menu New_MM = new Main_Menu(EMP_ID); New_MM.Enabled = true; New_MM.Show(); }
private void SendPromotionCodeMail_Click(object sender, EventArgs e) { int value; List <String> emailsToSendList = new List <String>(); if (int.TryParse(IDtextbook.Text, out value) == false && comboBox1.Text == "") // Check Integer or null { MessageBox.Show(" Please Choose a vaild Id or Targeted Group!", "Invaild Input", MessageBoxButtons.OK); } else if (int.TryParse(IDtextbook.Text, out value) == true && comboBox1.Text != "") // Check if 2 textbox filled { MessageBox.Show(" You can't choose both options! Please choose one.", "Wrong Input", MessageBoxButtons.OK); IDtextbook.Clear(); comboBox1.SelectedIndex = -1; // clear combobox } else if (int.TryParse(IDtextbook.Text, out value) == true && comboBox1.Text == "") //Specifiec ID { Customer customer = Program.seekCustomer(int.Parse(IDtextbook.Text)); if (customer == null) { MessageBox.Show(" Customer ID is not exists!", "Wrong Input", MessageBoxButtons.OK); //dont find Specifiec ID IDtextbook.Clear(); } else { emailsToSendList.Add(customer.get_Email()); } } else//Targeted Group { emailsToSendList = getEmailsToPromotion(comboBox1.Text); } if (emailsToSendList.Count() != 0) { // send email to supplier after creating an order MessageBox.Show(" PromoCode " + PromoCodeChooseBox.Text + " was sent to the customer!"); foreach (String EM in emailsToSendList)//SEND MAILS { String messageMail = "Hello " + Program.seekCustomerByEmail(EM).get_CustomerFirstName() + " " + Program.seekCustomerByEmail(EM).get_CustomerLastName() + ",\n" + "You have received a PromoCode: " + PromoCodeChooseBox.Text + "\n" + "The PromoCode Descripion:" + DescrriptionBox.Text + "\n" + "We are looking forward to see you soon at our store " + "\n" + "Thank you!" + "\n" + "Shorashim - Yavne Nature House!"; Email.sendingEmail(EM, messageMail); } this.Close(); Main_Menu New_MM = new Main_Menu(EMP_ID); New_MM.Enabled = true; New_MM.Show(); } }
private void Submit_Click(object sender, EventArgs e) { //Customer C = Program.seekCustomer(Convert.ToInt32(CID.Text)); //ShorashimCourse sc = Program.seekCourse(this.courseNumber1); string data = string.Empty; foreach (DataGridViewRow row in dataGridView1.Rows) { data = Convert.ToString(row.Cells[1].Value); int customer1 = Convert.ToInt32(row.Cells[0].Value); Customer chosenCustomer = Program.seekCustomer(customer1); ShorashimCourse chosenCourse = Program.seekCourseByName(data); if (chosenCustomer != null && chosenCourse != null) { CustomerInCourse NewCIC = new CustomerInCourse(chosenCourse, chosenCustomer, true); } } //EMAIL HERE this.Close(); Main_Menu mainMenu1 = new Main_Menu(EID); mainMenu1.Enabled = true; mainMenu1.Show(); foreach (ShorashimCourse o in Program.Shorashim_Courses) //check of hahalot - products of every order { o.printAllcustomersInThisCourse(); } foreach (Customer c in Program.customers) //check of hahalot - orders of this product { Console.WriteLine("printing CustomersInCourse lists of Customers"); c.printAllCustomersInCourse(); } }
public void messageBoxForInventoryAlert() { string s = Program.InventoryAlert(); if (!String.Equals(s, "")) { DialogResult result = MessageBox.Show(s + "\n" + "Do you wish to make an order?", "INVENTORY ALERT!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { this.Close(); OrderProducts OrderProducts = new OrderProducts(EID); OrderProducts.Enabled = true; OrderProducts.Show(); } else { this.Close(); Main_Menu mainMenu1 = new Main_Menu(EID); mainMenu1.Enabled = true; mainMenu1.Show(); } } }