Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. public Guid BoxGUID {get;set;}
  2. [Required(ErrorMessage="A box number is required")]
  3. public int BoxID { get; set; }
  4. public DateTime Date { get; set; }
  5. [Required(ErrorMessage="Please pick an option")]
  6. public string BCAppearance { get; set; }
  7. [Required(ErrorMessage = "Please pick an option")]
  8. public string BCTrash { get; set; }
  9. [Required(ErrorMessage = "Please pick an option")]
  10. public string BCPad { get; set; }
  11. [Required(ErrorMessage = "Please pick an option")]
  12. public string BCClean { get; set; }
  13. [Required(ErrorMessage = "Please pick an option")]
  14. public string BCStrap { get; set; }
  15. [Required(ErrorMessage = "Please pick an option")]
  16. public string BCDoc { get; set; }
  17. [Required(ErrorMessage = "Please pick an option")]
  18. public string BCMaint { get; set; }
  19. public string BCMaintNote { get; set; }
  20. [Required(ErrorMessage = "Please pick an option")]
  21. public string UBWrap { get; set; }
  22. [Required(ErrorMessage = "Please pick an option")]
  23. public string UBPiece { get; set; }
  24. [Required(ErrorMessage = "Please pick an option")]
  25. public string NPSec { get; set; }
  26. [Required(ErrorMessage = "Please pick an option")]
  27. public string NPDmg { get; set; }
  28. [Required(ErrorMessage = "Please pick an option")]
  29. public string NPHardware { get; set; }
  30. public string TruckNum { get; set; }
  31. public string Images { get; set; }
  32. public int CompletedFlag { get; set; }
  33. //odd items for manipulating data
  34. public string curDate { get; set; }
  35. public string boxGUIDString { get; set; }
  36.  
  37. public BoxInfo[] getBox(int count)
  38. {
  39. string query = "select * from Box where CompletedFlag = '0'";
  40. BoxInfo[] boxInfo = new BoxInfo[count];
  41.  
  42. //create boxinfo array
  43. SqlCommand cmd = new SqlCommand(query, oConn);
  44. SqlDataReader rdr = cmd.ExecuteReader();
  45. while (rdr.Read())
  46. {
  47.  
  48.  
  49.  
  50. for (int i = 0; i < count; i++)
  51. {
  52. boxInfo[i] = new BoxInfo();
  53. // string test = rdr[0].ToString();
  54. boxInfo[i].BoxGUID = new Guid(rdr[0].ToString());
  55. boxInfo[i].BoxID = (int)rdr[1];
  56. boxInfo[i].Date = (DateTime)rdr[2];
  57. boxInfo[i].BCAppearance = rdr[3].ToString();
  58. boxInfo[i].BCTrash = rdr[4].ToString();
  59. boxInfo[i].BCPad = rdr[5].ToString();
  60. boxInfo[i].BCClean = rdr[6].ToString();
  61. boxInfo[i].BCStrap = rdr[7].ToString();
  62. boxInfo[i].BCDoc = rdr[8].ToString();
  63. boxInfo[i].BCMaint = rdr[9].ToString();
  64. boxInfo[i].BCMaintNote = rdr[10].ToString();
  65. boxInfo[i].UBWrap = rdr[11].ToString();
  66. boxInfo[i].UBPiece = rdr[12].ToString();
  67. boxInfo[i].NPSec = rdr[13].ToString();
  68. boxInfo[i].NPDmg = rdr[14].ToString();
  69. boxInfo[i].NPHardware = rdr[15].ToString();
  70. boxInfo[i].TruckNum = rdr[16].ToString();
  71. boxInfo[i].Images = rdr[17].ToString();
  72. boxInfo[i].CompletedFlag = 0;
  73. }
  74.  
  75. }
  76. return boxInfo;
  77. }
  78.  
  79. namespace BoxCheckInApp.Controllers
  80. {
  81. public class AddBoxController : Controller
  82. {
  83. //
  84. // GET: /AddBox/
  85. public CodeDB D = new CodeDB();
  86. public CodeODB O = new CodeODB();
  87. public BoxInfo box = new BoxInfo();
  88.  
  89.  
  90. public ActionResult Boxes()
  91. {
  92. D.Open();
  93. int count = D.getRows();
  94.  
  95. if (count != 0)
  96. {
  97. BoxInfo[] myBoxes = new BoxInfo[count];
  98. myBoxes = D.getBox(count);
  99. D.Close();
  100.  
  101.  
  102. return View();
  103. }
  104. else
  105. {
  106. String noBoxes = "There are no incomlete boxes to edit";
  107. D.Close();
  108. return View();
  109. }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement