Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. public void seat_reser_Load(object sender, EventArgs e)
  2. {
  3. string asd = "";
  4.  
  5. DataTable dt = ob.dataview("Select * from seat_res where bus_id='"+ bus_select.Id+"'and date='"+bus_select.date +"'");
  6.  
  7. foreach (DataRow d in dt.Rows)
  8. {
  9. asd += d[2].ToString(); // d[2] is seat column
  10. asd+=",";
  11. }
  12.  
  13. box[0] = CheckBox1;
  14. box[1] = CheckBox2;
  15. box[2] = checkBox3;
  16. box[3] = checkBox4;
  17. box[4] = checkBox5;
  18. box[5] = checkBox6;
  19. box[6] = checkBox7;
  20. box[7] = checkBox8;
  21. box[8] = checkBox9;
  22. box[9] = checkBox10;
  23. box[10] = checkBox11;
  24. box[11] = checkBox12;
  25. box[12] = checkBox13;
  26. box[13] = checkBox14;
  27. box[14] = checkBox15;
  28. box[15] = checkBox16;
  29. box[16] = checkBox17;
  30. box[17] = checkBox18;
  31. box[18] = checkBox19;
  32. box[19] = checkBox20;
  33. box[20] = checkBox21;
  34. box[21] = checkBox22;
  35. box[22] = checkBox23;
  36. box[23] = checkBox24;
  37. box[24] = checkBox25;
  38.  
  39. for (int h = 0; h < box.Length; h++)
  40. {
  41. box[h].Enabled = true;
  42. }
  43.  
  44. string[] n = asd.Split(',');
  45.  
  46. for (int i = 0; i < n.Length; i++)
  47. {
  48. for (int j = 0; j < box.Length; j++)
  49. {
  50. if (n[i] == box[j].Text)
  51. {
  52. box[j].Enabled = false;
  53. j++;
  54. }
  55. else if (!(box[j].Enabled == false))
  56. {
  57. box[j].Enabled = true;
  58. }
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement