//======================================================================// //======================================================================// //======================================================================// #endregion #region ORDERS FUNCTIONS //======================================================================// //======================= ORDERS ======================================// //======================================================================// private void btnAddOrder_Click(object sender, EventArgs e) { FormOrders fo = new FormOrders(EmployeeID); fo.ShowDialog(); UpdateOrderList("", false); }
private void button2_Click(object sender, EventArgs e) { var numberColumn = dataGridViewRefill.Columns["Number"].Index; if (dataGridViewRefill.CurrentRow == null) { return; } var valueRef = dataGridViewRefill.CurrentRow.Cells[numberColumn].Value.ToString(); int numberRef = 0; if (Int32.TryParse(valueRef, out numberRef)) { dbContext.Refresh(dbContext.Users); var user = dbContext.Users.FirstOrDefault(x => x.Name == comboBoxUsers.Text); if (!user.isLogin) { user.isLogin = true; dbContext.SaveChanges(); FormOrders formOrders = new FormOrders(dbContext, user, numberRef); var res = formOrders.ShowDialog(); if (res == DialogResult.Cancel) { UpdateGridRefill(dbContext.Refills); } } else { MessageBox.Show("В настоящий момент выбранный аккаунт недоступен, выберите другой аккаунт", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); UpdateCombobox(); UpdateGridRefill(dbContext.Refills); return; } } }
private void dgOrders_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dgOrders.SelectedRows.Count != 0) { try { DBConnector db = new DBConnector(); Order es = db.SearchOrder("o.id", dgOrders.SelectedRows[0].Cells[0].Value.ToString(), false)[0]; FormOrders f = new FormOrders(EmployeeID); f.EditingMode(es); f.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); //throw; } } }