private void ButtonShowNotesCustomer_Click(object sender, EventArgs e) { var cell = this.dataGridViewCustomerUserControl.SelectedCells[0]; string clickedCellNotes = Reader.LoadCustomersDataTable().Rows[cell.RowIndex].Field <string>("Notes"); var NotesPopUp = new PopUpDataGridViewChanges(true, clickedCellNotes); NotesPopUp.FormClosed += new FormClosedEventHandler(Notes_Form_Closed); NotesPopUp.Show(); }
private void buttonEditProduct_Click(object sender, EventArgs e) { var cell = this.dataGridViewProductUserControl.SelectedCells[0]; var productTable = Reader.GetProductsDataTable(); int productID = productTable.Rows[cell.RowIndex].Field <int>("ProductID"); string productName = productTable.Rows[cell.RowIndex].Field <string>("Productname"); var price = productTable.Rows[cell.RowIndex].Field <float>("Price"); string colour = productTable.Rows[cell.RowIndex].Field <string>("Colour"); string brand = productTable.Rows[cell.RowIndex].Field <string>("Brand"); string frameType = productTable.Rows[cell.RowIndex].Field <string>("FrameType"); string glassType = productTable.Rows[cell.RowIndex].Field <string>("Glasstype"); int? rightLensID = productTable.Rows[cell.RowIndex].Field <int?>("RightLensID"); int? leftLensID = productTable.Rows[cell.RowIndex].Field <int?>("LeftLensID"); string productDescription = productTable.Rows[cell.RowIndex].Field <string>("Productdescription"); var EditPopUp = new PopUpDataGridViewChanges(PopUpDataGridViewChanges.EditWindowState.ProductEdit, productID, productName, price, colour, brand, frameType, glassType, productDescription, rightLensID, leftLensID); EditPopUp.FormClosed += new FormClosedEventHandler(Edit_Form_Closed); EditPopUp.Show(); }
private void buttonEditCustomer_Click(object sender, EventArgs e) { var cell = this.dataGridViewCustomerUserControl.SelectedCells[0]; var Customerstable = Reader.LoadCustomersDataTable(); int customerID = Customerstable.Rows[cell.RowIndex].Field <int>("CustomerID"); string forename = Customerstable.Rows[cell.RowIndex].Field <string>("Forename"); string surname = Customerstable.Rows[cell.RowIndex].Field <string>("Lastname"); string address = Customerstable.Rows[cell.RowIndex].Field <string>("Adress"); int phonenumber = Customerstable.Rows[cell.RowIndex].Field <int>("PhoneNumber"); string email = Customerstable.Rows[cell.RowIndex].Field <string>("Email"); float strenghtRight = Customerstable.Rows[cell.RowIndex].Field <float>("StrengthRight"); float strenghtLeft = Customerstable.Rows[cell.RowIndex].Field <float>("StrengthLeft"); string notes = Customerstable.Rows[cell.RowIndex].Field <string>("Notes"); DateTime signupDate = Customerstable.Rows[cell.RowIndex].Field <DateTime>("SignupDate"); var EditPopUp = new PopUpDataGridViewChanges(PopUpDataGridViewChanges.EditWindowState.CustumerEdit, customerID, forename, surname, address, phonenumber, email, strenghtLeft, strenghtRight, notes, signupDate); EditPopUp.FormClosed += new FormClosedEventHandler(Edit_Form_Closed); EditPopUp.Show(); }
void Edit_Form_Closed(object sender, FormClosedEventArgs e) { PopUpDataGridViewChanges editChanges = (PopUpDataGridViewChanges)sender; SetUpDefaultDataTableProducts(); }
void Notes_Form_Closed(object sender, FormClosedEventArgs e) { PopUpDataGridViewChanges notesClosed = (PopUpDataGridViewChanges)sender; SetUpDefaultDataTableCustomers(); }