private void txt_barcode_TextChanged(object sender, EventArgs e) { int count = 0; int tubeIntId = 0; foreach (char c in txt_barcode.Text) { count++; } if (count == 9) { try { tubeIntId = Convert.ToInt32(txt_barcode.Text.Substring(3)); } catch (Exception E) { } string q = "SELECT t_brand AS Brand, t_size AS Size, t_amps AS Make, t_type AS Tube_Type, t_qty AS Qty, t_prize AS Price FROM tube_add WHERE t_stok_id = '" + tubeIntId + "'"; DataSet ds_tube = middle_access.db_access.SelectData(q); if (ds_tube != null) { DataRow dr_tube = ds_tube.Tables[0].Rows[0]; tube_category_data.brand = dr_tube.ItemArray.GetValue(0).ToString(); tube_category_data.size = dr_tube.ItemArray.GetValue(1).ToString(); // tube_category_data.voltage = voltage; tube_category_data.amps = dr_tube.ItemArray.GetValue(2).ToString(); tube_category_data.type = dr_tube.ItemArray.GetValue(3).ToString(); tube_category_data.qty = dr_tube.ItemArray.GetValue(4).ToString(); tube_category_data.price = dr_tube.ItemArray.GetValue(5).ToString(); this.Enabled = false; tube_qty q1 = new tube_qty(); q1.MdiParent = DHNAULA.ActiveForm; q1.Visible = true; } else { MessageBox.Show("No shuch a tube in the database!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_barcode.Clear(); } txt_barcode.Clear(); } }
private void grdTubesearch_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { int val = e.RowIndex; int r_count = grdTubesearch.RowCount; if (val >= 0) { string brand = grdTubesearch.Rows[e.RowIndex].Cells[0].Value.ToString(); string size = grdTubesearch.Rows[e.RowIndex].Cells[1].Value.ToString(); string amp = grdTubesearch.Rows[e.RowIndex].Cells[2].Value.ToString(); string type = grdTubesearch.Rows[e.RowIndex].Cells[3].Value.ToString(); tube_category_data.brand = brand; tube_category_data.size = size; tube_category_data.amps = amp; tube_category_data.type = type; tube_category_data.qty = grdTubesearch.Rows[e.RowIndex].Cells[4].Value.ToString(); tube_category_data.price = grdTubesearch.Rows[e.RowIndex].Cells[5].Value.ToString(); this.Enabled = false; tube_qty q = new tube_qty(); q.MdiParent = DHNAULA.ActiveForm; q.Visible = true; } }