private void btnSave_Click(object sender, EventArgs e) { Customer Cust = new Customer(); CustomersFunctions CF = new CustomersFunctions(); if (textBox1.Text == string.Empty || textBox1.Text == null) { MessageBox.Show("Το ID πεδίο δεν μπορεί να είναι κενό"); return; } if (textBox2.Text == string.Empty || textBox1.Text == null) { MessageBox.Show("Το πεδίο Όνομα δεν μπορεί να είναι κενό"); return; } if (textBox3.Text == string.Empty || textBox1.Text == null) { MessageBox.Show("Το πεδίο Επώνυμο δεν μπορεί να είναι κενό"); return; } Cust.ID = Convert.ToInt32(textBox1.Text); Cust.FirstName = textBox2.Text; Cust.LastName = textBox3.Text; Cust.Telephone = textBox4.Text; Cust.Address = textBox5.Text; CF.Add(Cust.ToString()); this.FindForm().Dispose(); }
private void button1_Click(object sender, EventArgs e) { CustomersFunctions CF = new CustomersFunctions(); if (FirstNameReplace.Text == string.Empty || FirstNameReplace.Text == null) { FirstNameReplace.Text = FirstNameExist.Text; } if (LastNameReplace.Text == string.Empty || LastNameReplace.Text == null) { LastNameReplace.Text = LastNameExist.Text; } if (TelephoneReplace.Text == string.Empty || TelephoneReplace.Text == null) { TelephoneReplace.Text = TelephoneExist.Text; } if (AddressReplace.Text == string.Empty || AddressReplace.Text == null) { AddressReplace.Text = AddressExist.Text; } CF.Update(Convert.ToInt32(IDReplace.Text), FirstNameReplace.Text, LastNameReplace.Text, TelephoneReplace.Text, AddressReplace.Text); this.FindForm().Dispose(); }
public MainForm() { InitializeComponent(); CustomersFunctions.CheckandCreate(); OrdersFunctions.CheckandCreate(); RefreshGridCustomers(); }
private void btnDeleteCustomer_Click(object sender, EventArgs e) { DataGridViewRow row = dataGridView1.CurrentCell.OwningRow; int ID = Convert.ToInt32(row.Cells[0].Value.ToString()); string FirstName = row.Cells[1].Value.ToString(); string LastName = row.Cells[2].Value.ToString(); if (MessageBox.Show("ΠΡΟΣΟΧΗ! Εάν ο πελάτης έχει αποθηκευμένες παραγγελίες θα σβηστούν και αυτές!\nΕίστε σίγουροι ότι θέλετε να σβήσετε τον πελάτη;", "Διαγραφή πελάτη " + FirstName + " " + LastName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { CustomersFunctions CF = new CustomersFunctions(); CF.Delete(ID); OrdersFunctions.Delete(ID); RefreshGridCustomers(); } }
private void button1_Click(object sender, EventArgs e) { CustomersFunctions CF = new CustomersFunctions(); if(FirstNameReplace.Text == string.Empty || FirstNameReplace.Text == null) { FirstNameReplace.Text = FirstNameExist.Text; } if (LastNameReplace.Text == string.Empty || LastNameReplace.Text == null) { LastNameReplace.Text = LastNameExist.Text; } if (TelephoneReplace.Text == string.Empty || TelephoneReplace.Text == null) { TelephoneReplace.Text = TelephoneExist.Text; } if (AddressReplace.Text == string.Empty || AddressReplace.Text == null) { AddressReplace.Text = AddressExist.Text; } CF.Update(Convert.ToInt32(IDReplace.Text), FirstNameReplace.Text, LastNameReplace.Text, TelephoneReplace.Text, AddressReplace.Text); this.FindForm().Dispose(); }
public void RefreshGridCustomers() { dataGridView1.DataSource = CustomersFunctions.ReadGrid(); }