private void btn_cancel_Click(object sender, EventArgs e) { Nav_panel.SendToBack(); Nav_panel.Hide(); clear(); StockAdjustments_Load(null, null); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridView1.Columns["colAdjust"].Index && e.RowIndex >= 0) { AdminAccess acc = new AdminAccess(); acc.ShowDialog(); user_access_check = AdminAccess.discount_access_value; if (user_access_check == true) { category_id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_categoryid"].Value.ToString()); product_id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_productid"].Value.ToString()); department_id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["col_departmentid"].Value.ToString()); lbl_productName.Text = dataGridView1.CurrentRow.Cells["calproduct_name"].Value.ToString(); lbl_stockonHand.Text = dataGridView1.CurrentRow.Cells["calquantity"].Value.ToString(); lbl_stockid.Text = dataGridView1.CurrentRow.Cells["calstock_id"].Value.ToString(); cbo_location.Text = dataGridView1.CurrentRow.Cells["col_location"].Value.ToString(); lbl_department.Text = dataGridView1.CurrentRow.Cells["col_department"].Value.ToString(); DataTable dt = bls.getproductunit(product_id, category_id); if (dt.Rows.Count > 0) { if (dt.Rows[0]["inhouse_unit_3"].ToString() != "") { lbl_unit.Text = dt.Rows[0]["inhouse_unit_3"].ToString(); } else if (dt.Rows[0]["inhouse_unit_2"].ToString() != "") { lbl_unit.Text = dt.Rows[0]["inhouse_unit_2"].ToString(); } else { lbl_unit.Text = dt.Rows[0]["inhouse_unit_1"].ToString(); } } Nav_panel.BringToFront(); Nav_panel.Show(); } else { Nav_panel.SendToBack(); Nav_panel.Hide(); clear(); StockAdjustments_Load(null, null); } } if (e.ColumnIndex == dataGridView1.Columns["colviewAdjusts"].Index && e.RowIndex >= 0) { string id = dataGridView1.CurrentRow.Cells["calstock_id"].Value.ToString(); string productname = dataGridView1.CurrentRow.Cells["calproduct_name"].Value.ToString(); DataTable getalldata = bsa.getallAdStocksbyId(id); if (getalldata.Rows.Count > 0) { lbl_productnames.Text = productname; dgv_stocks.Rows.Clear(); dgv_stocks.ClearSelection(); for (int ink = 0; ink < getalldata.Rows.Count; ink++) { dgv_stocks.Rows.Add(getalldata.Rows[ink]["stock_id"].ToString(), productname, getalldata.Rows[ink]["qty"].ToString() + " " + getalldata.Rows[ink]["unit"].ToString(), getalldata.Rows[ink]["unit"].ToString(), Convert.ToDecimal(getalldata.Rows[ink]["stockon_hand"].ToString()), getalldata.Rows[ink]["username"].ToString(), getalldata.Rows[ink]["adjust_date"].ToString(), getalldata.Rows[ink]["status"].ToString()); } ShowAdjusted_stockPanel.BringToFront(); ShowAdjusted_stockPanel.Show(); } else { MessageBox.Show("No Adjustments on Selected Product", "No Adjustments Notice:", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }