Stylus STYLUS

Stylus STYLUS

  • NA
  • 17
  • 1.3k

Quantity increment dont work with leterQuantity +1 dont work

Feb 21 2019 1:33 PM
Some help
 
In line 10 setup IsLetterOrDigit..
 
When add some value in datagrid
 
 Line 34-39 have problem...
 
Every time add new row, if put number  it ok kolicina (quantity go up +1), if is bar code type vm1403 add new row...not kolicina (quantity) +1...why? Some help?
  1. int cqty = Convert.ToInt32(row.Cells["kolicina"].Value) + 1;  
  2.   
  3.                           if (textBox1.Text == row.Cells["bar_kod"].Value.ToString())  
  4.                           {  
  5.                               row.Cells["kolicina"].Value = cqty; 
 
 
  1. private void prijavaAction()  
  2.       {  
  3.           PullData();  
  4.                 
  5.                 
  6.           int sno = dataGridView1.Rows.Count + 1;  
  7.   
  8.           SqlConnection con2 = new SqlConnection(con);  
  9.   
  10.           if (textBox1.Text.All(char.IsLetterOrDigit))  
  11.   
  12.           {  
  13.               string queryString = "select [bar_kod], [naziv], [cijena_sa_porezom] from dbo.roba_usluge WHERE [bar_kod] = '" + textBox1.Text + "'";// pronaci artikl u bazi                
  14.               using (SqlConnection connection = new SqlConnection(con))  
  15.               {  
  16.                   SqlCommand command = new SqlCommand(queryString, connection);  
  17.                   connection.Open();  
  18.                   SqlDataReader reader = command.ExecuteReader();  
  19.   
  20. /////////////////////////////////
  21.  errorr                 var itemAndPrice = textBox1.Text;  
  22.   
  23.                   var SingleRow = (from Rows in dataGridView1.Rows.Cast() where !Rows.IsNewRow && Rows.Cells["bar_kod"].Value.ToString().ToUpper() == textBox1.Text.ToUpper() select Rows).FirstOrDefault();  
  24.   
  25.   
  26.                   if (reader.Read())  
  27.                   {  
  28.   
  29.                       bool barcodeexist = false;  
  30.                       foreach (DataGridViewRow row in dataGridView1.Rows)  
  31.                       {  
  32.                           int cqty = Convert.ToInt32(row.Cells["kolicina"].Value) + 1;  
  33.   
  34.                           if (textBox1.Text == row.Cells["bar_kod"].Value.ToString())  
  35.                           {  
  36.                               row.Cells["kolicina"].Value = cqty;  
  37.   ////////////////////////////////
  1.                               foreach (DataGridViewRow g1 in dataGridView1.Rows)  
  2.                               {  
  3.   
  4.   
  5.                                   g1.Cells["ukupno"].Value = (Convert.ToDouble(g1.Cells["kolicina"].Value) * Convert.ToDouble(g1.Cells["cijena"].Value)).ToString("0.00");  
  6.   
  7.                               }