private void btn_NewCustomer_Click(object sender, EventArgs e) { f_AddCustomer fad = new f_AddCustomer(); fad.login_profile = Login_profile; fad.sqlc = Sqlc; fad.sqlc2 = Sqlc2; fad.ShowDialog(); if (fad.reload) { fillMainList(); } int cid = -1; if (fad.OK) { cid = fad.customer_id; fillMainList(); fad = new f_AddCustomer(); fad.login_profile = Login_profile; fad.sqlc = Sqlc; fad.sqlc2 = Sqlc2; fad.edit = true; fad.customer_id = cid; fad.ShowDialog(); } }
private void btn_Edit_Click(object sender, EventArgs e) { if (dg_DataTable.SelectedRows != null && dg_DataTable.SelectedRows.Count > 0 && dg_DataTable.SelectedRows[0].Cells[0].Tag != null) { object[] oo = dg_DataTable.SelectedRows[0].Cells[0].Tag as object[]; if (oo.Length == 2) { f_AddCustomer fa = new f_AddCustomer() { edit = true, sqlc = Sqlc, sqlc2 = Sqlc2, customer_id = Convert.ToInt32(oo[1]), login_profile = Login_profile }; fa.ShowDialog(); if (fa.reload) { fillMainList(); } } } }