public static void getUsers(DataGridView gv, DataGridViewColumn userIDgv, DataGridViewColumn nameGV, DataGridViewColumn usernameGV, DataGridViewColumn passGV, DataGridViewColumn phoneGV, DataGridViewColumn addressGV, DataGridViewColumn roleIDGV, DataGridViewColumn roleGV) { try { SqlCommand cmd = new SqlCommand("st_getUsers", MainClass.con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable();; da.Fill(dt); userIDgv.DataPropertyName = dt.Columns["User ID"].ToString(); nameGV.DataPropertyName = dt.Columns["User"].ToString(); usernameGV.DataPropertyName = dt.Columns["Username"].ToString(); passGV.DataPropertyName = dt.Columns["Password"].ToString(); phoneGV.DataPropertyName = dt.Columns["Phone"].ToString(); addressGV.DataPropertyName = dt.Columns["Address"].ToString(); roleIDGV.DataPropertyName = dt.Columns["Role ID"].ToString(); roleGV.DataPropertyName = dt.Columns["Role"].ToString(); gv.DataSource = dt; MainClass.sno(gv, "snoGV"); } catch (Exception ex) { MainClass.showMessage(ex.Message, " error"); } }
private void ChefOrderWindow_Load(object sender, EventArgs e) { RetrivalData.getPendingOrders(dataGridView1, orderIDGV, statusGV); MainClass.sno(dataGridView1, "snoGV"); addbtn.Visible = false; deletebtn.Visible = false; searchtxt.Visible = false; }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1 && e.ColumnIndex != 1) { if (e.ColumnIndex == 13) { DataGridViewRow row = dataGridView1.Rows[e.RowIndex]; float prc = Convert.ToSingle(row.Cells["priceGV"].Value.ToString()) * Convert.ToSingle(numericUpDown1.Value); totalAmount -= prc; totalLabel.Text = totalAmount.ToString(); dataGridView1.Rows.Remove(row); MainClass.sno(dataGridView1, "snoGV"); } } }
public static void getCategory(DataGridView gv, DataGridViewColumn catIDGV, DataGridViewColumn catGV) { try { SqlCommand cmd = new SqlCommand("st_getCategories", MainClass.con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable();; da.Fill(dt); catIDGV.DataPropertyName = dt.Columns["ID"].ToString(); catGV.DataPropertyName = dt.Columns["Category"].ToString(); gv.DataSource = dt; MainClass.sno(gv, "snoGV"); } catch (Exception ex) { MainClass.showMessage(ex.Message, " error"); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1 && e.ColumnIndex != -1) { DataGridViewRow row = dataGridView1.Rows[e.RowIndex]; orderID = Convert.ToInt64(row.Cells["orderIDGV"].Value.ToString()); RetrivalData.getPendingOrderdetails(orderID, dataGridView2, productGV, quantityGV); MainClass.sno(dataGridView1, "snoGV"); if (e.ColumnIndex == 3) { DialogResult dr = MessageBox.Show("Are you sure?", "Question..", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Updates.updateOrderStatus(orderID, 1); RetrivalData.getPendingOrders(dataGridView1, orderIDGV, statusGV); MainClass.sno(dataGridView1, "snoGV"); } } } }
public static void getTables(DataGridView gv, DataGridViewColumn floorIDGV, DataGridViewColumn floornameGV, DataGridViewColumn tableNameGV, DataGridViewColumn tableIDGV, DataGridViewColumn chairsGV) { try { SqlCommand cmd = new SqlCommand("st_getTables", MainClass.con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable();; da.Fill(dt); floorIDGV.DataPropertyName = dt.Columns["Floor ID"].ToString(); floornameGV.DataPropertyName = dt.Columns["Floor"].ToString(); tableIDGV.DataPropertyName = dt.Columns["Table ID"].ToString(); chairsGV.DataPropertyName = dt.Columns["Chairs"].ToString(); tableNameGV.DataPropertyName = dt.Columns["Table Number"].ToString(); gv.DataSource = dt; MainClass.sno(gv, "snoGV"); } catch (Exception ex) { MainClass.showMessage(ex.Message, " error"); } }
private void cartButton_Click(object sender, EventArgs e) { if (MainClass.checkControls(leftpanel).Count != 0) { MainClass.showMessage("Please enter all the required field", "error"); } else { bool check = false; foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells["itemIDGV"].Value.ToString() == itemDD.SelectedValue.ToString()) { check = true; break; } } DataRowView drvFloor = floorDD.SelectedItem as DataRowView; DataRowView drvTable = tableDD.SelectedItem as DataRowView; DataRowView drvItems = itemDD.SelectedItem as DataRowView; try { if (check) { MainClass.showMessage("Item added already!", "error"); } else { catID = RetrivalData.CATEGORYID; catName = RetrivalData.CATEGORYNAME; if (orderDD.SelectedIndex == 0) { totalAmount += Convert.ToSingle(priceTxt.Text) * Convert.ToSingle(numericUpDown1.Value); totalLabel.Text = totalAmount.ToString(); dataGridView1.Rows.Add(null, Convert.ToInt32(tableDD.SelectedValue.ToString()), Convert.ToInt32(floorDD.SelectedValue.ToString()), catID, catName, Convert.ToInt32(itemDD.SelectedValue.ToString()), drvItems["Menu Name"], Convert.ToSingle(priceTxt.Text), Convert.ToInt32(numericUpDown1.Text), orderDD.SelectedItem.ToString(), drvFloor["Floor"], drvTable["Table Number"], null); } else if (orderDD.SelectedIndex == 1 || orderDD.SelectedIndex == 2) { totalAmount += Convert.ToSingle(priceTxt.Text) * Convert.ToSingle(numericUpDown1.Value); totalLabel.Text = totalAmount.ToString(); dataGridView1.Rows.Add(null, null, null, catID, catName, Convert.ToInt32(itemDD.SelectedValue.ToString()), drvItems["Menu Name"], Convert.ToSingle(priceTxt.Text), Convert.ToInt32(numericUpDown1.Text), orderDD.SelectedItem.ToString(), null, null, phonetxt.Text); } } } catch (Exception) { MainClass.showMessage("Please enter all the fields.", "error"); } } MainClass.sno(dataGridView1, "snoGV"); }
private void loadButton_Click(object sender, EventArgs e) { RetrivalData.getPendingOrders(dataGridView1, orderIDGV, statusGV); MainClass.sno(dataGridView1, "snoGV"); }