Exemple #1
0
 public void datagridviewload()
 {
     try
     {
         DataTable dt = blbar.get_all_item_barcode();
         if (dt.Rows.Count > 0)
         {
             dataGridView1.Rows.Clear();
             for (int i = 0; dt.Rows.Count > i; i++)
             {
                 int abc = dataGridView1.Rows.Add();
                 dataGridView1.Rows[i].Cells["cal_sn"].Value         = i + 1;
                 dataGridView1.Rows[i].Cells["cal_product_id"].Value = dt.Rows[i]["product_id"].ToString();
                 int       product_id    = Convert.ToInt32(dataGridView1.Rows[i].Cells["cal_product_id"].Value);
                 DataTable dt_product_id = blpur.getallproductid(product_id);
                 dataGridView1.Rows[i].Cells["cal_product_name"].Value = dt_product_id.Rows[0]["product_name"].ToString();
                 dataGridView1.Rows[i].Cells["calitem_id"].Value       = dt.Rows[i]["item_id"].ToString();
                 int       item_id      = Convert.ToInt32(dataGridView1.Rows[i].Cells["calitem_id"].Value);
                 DataTable dt_item_name = blod.getallitemprice(item_id);
                 dataGridView1.Rows[i].Cells["calitem_name"].Value    = dt_item_name.Rows[0]["item_name"].ToString();
                 dataGridView1.Rows[i].Cells["cal_bar_code"].Value    = dt.Rows[i]["bar_code"].ToString();
                 dataGridView1.Rows[i].Cells["cal_bar_code_id"].Value = dt.Rows[i]["bar_code_id"].ToString();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #2
0
 private void cboitem_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboitem.SelectedIndex != 0)
     {
         DataTable dt = blord.getallitemprice(Convert.ToInt32(cboitem.SelectedValue.ToString()));
         if (dt.Rows.Count > 0)
         {
             txtcost.Text = dt.Rows[0]["item_price"].ToString();
             txtquantity.Focus();
         }
     }
 }