Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.87 KB | None | 0 0
  1. public class CustomPmScheduleGenerator
  2. {
  3. public bool Save { get; set; }
  4. public bool Search { get; set; }
  5. public DateTime? BegDueDate { get; set; }
  6. public DateTime? EndDateDate { get; set; }
  7. public string GenSn { get; set; }
  8. public string PmName { get; set; }
  9. public string Type { get; set; }
  10. public IList<stp_GetPmSchedulesGenerator_Result> Pms { get; set; }
  11. public IList<stp_GetRepairSchedulesGenerator_Result> Repairs { get; set; }
  12. }
  13.  
  14. [HttpGet]
  15. public ActionResult Index()
  16. {
  17. var model = new CustomPmScheduleGenerator();
  18.  
  19. var pms = _db.stp_GetPmSchedulesGenerator(null, null, Convert.ToInt32(Session["CustomerNumber"]), null, null).ToList();
  20. var repairs = _db.stp_GetRepairSchedulesGenerator(null, null, Convert.ToInt32(Session["CustomerNumber"]), null, null).ToList();
  21.  
  22. model.Pms = pms;
  23. model.Repairs = repairs;
  24.  
  25. return View(model);
  26. }
  27.  
  28. [HttpPost]
  29. public ActionResult Index(CustomPmScheduleGenerator model)
  30. {
  31. if (model.Save)
  32. {
  33. //Update the PMs
  34. foreach (var pm in model.Pms)
  35. {
  36. //TODO: Update the current PM
  37. }
  38.  
  39. //Update the Repairs
  40. foreach (var repair in model.Repairs)
  41. {
  42. //TODO: Update the Current Repair
  43. }
  44. }
  45. else if (model.Search)
  46. {
  47. var pms = _db.stp_GetPmSchedulesGenerator(model.BegDueDate, model.EndDateDate, Convert.ToInt32(Session["CustomerNumber"]),model.PmName, model.GenSn).ToList();
  48.  
  49. var repairs = _db.stp_GetRepairSchedulesGenerator(null, null, Convert.ToInt32(Session["CustomerNumber"]), null, null).ToList();
  50.  
  51. model.Pms = pms;
  52. model.Repairs = repairs;
  53.  
  54. return View(model);
  55. }
  56.  
  57. return View();
  58. }
  59.  
  60. @using (Html.BeginForm("Index", "PmScheduleGenerator", FormMethod.Post))
  61. {
  62. <div>
  63. <h1>
  64. <strong>PM Schedule</strong>
  65. @Html.ActionLink("Add Repair", "AddRepair", null, new { @class = "btn btn-warning", @style = "float:right;margin-left:5px;" })
  66. @Html.ActionLink("Save", "AddRepair", null, new { @class = "btn btn-success", @style = "float:right" })
  67. </h1>
  68. </div>
  69. <hr />
  70.  
  71.  
  72. <div class="row">
  73. <div class="col-lg-2 form-group">
  74. <div class="editor-label">
  75. @Html.Label("Due Beg. Date")
  76. </div>
  77. <div class="editor-field">
  78. <div class="input-group date">
  79. @Html.TextBoxFor(model => model.BegDueDate, null, new { @class = "form-control" })
  80. <span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="col-lg-2 form-group">
  85. <div class="editor-label">
  86. @Html.Label("Due End Date")
  87. </div>
  88. <div class="editor-field">
  89. <div class="input-group date">
  90. @Html.TextBoxFor(model => model.EndDateDate, null, new { @class = "form-control" })
  91. <span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="col-lg-2 form-group">
  96. <div class="editor-label">
  97. @Html.Label("Gen S/N")
  98. </div>
  99. <div class="editor-field">
  100. <div class="input-group">
  101. @Html.DropDownListFor(model => model.GenSn, DropdownLists.GetGenSns(Convert.ToInt32(Session["CustomerNumber"]), Session["PmType"].ToString(), Session["Whse"].ToString()), new { @class = "form-control" })
  102. </div>
  103. </div>
  104. </div>
  105. <div class="col-lg-2 form-group">
  106. <div class="editor-label">
  107. @Html.Label("PM Name")
  108. </div>
  109. <div class="editor-field">
  110. <div class="input-group">
  111. @Html.DropDownListFor(model => model.PmName, DropdownLists.GetPmNames(Convert.ToInt32(Session["CustomerNumber"]), Session["PmType"].ToString(), Session["Whse"].ToString()), new { @class = "form-control" })
  112. </div>
  113. </div>
  114. </div>
  115. <div class="col-lg-2 form-group">
  116. <div class="editor-label">
  117. @Html.Label("Type")
  118. </div>
  119. <div class="editor-field">
  120. <div class="input-group">
  121. @Html.DropDownListFor(model => model.Type, DropdownLists.GetTypes(), new { @class = "form-control" })
  122. </div>
  123. </div>
  124. </div>
  125. <div class="col-lg-2 form-group">
  126. <div class="editor-label">
  127. &nbsp;
  128. </div>
  129. <div class="editor-field">
  130. <input type="submit" value="Search" class="btn btn-success" />
  131. <input type="submit" value="Clear" class="btn btn-danger" />
  132. </div>
  133. </div>
  134. </div>
  135.  
  136. <table class="table table-striped table-bordered">
  137. <thead>
  138. <tr>
  139. <th>Gen S/N</th>
  140. <th>Loc ID</th>
  141. <th style="width: 140px;">PM Description</th>
  142. <th>City</th>
  143. <th>Next PM Due Dt.</th>
  144. <th>Sched Arrival Dt.</th>
  145. <th style="width: 160px;">Actions</th>
  146. </tr>
  147. </thead>
  148. <tbody>
  149. @for (var i = 0; i < Model.Pms.Count; i++)
  150. {
  151. <tr>
  152. <td>
  153. @Html.HiddenFor(x => x.Pms[i].FleetTruckNo)
  154. @Html.DisplayFor(x => x.Pms[i].FleetTruckNo)
  155. </td>
  156. <td>
  157. @Html.HiddenFor(x => x.Pms[i].LocationID)
  158. @Html.DisplayFor(x => x.Pms[i].LocationID)
  159. </td>
  160. <td>
  161. @Html.HiddenFor(x => x.Pms[i].Description)
  162. @Html.DisplayFor(x => x.Pms[i].Description)
  163. </td>
  164. <td>
  165. @Html.HiddenFor(x => x.Pms[i].City)
  166. @Html.DisplayFor(x => x.Pms[i].City)
  167. </td>
  168. <td>
  169. <div class="editor-field">
  170. <div class="input-group date">
  171. @Html.TextBoxFor(x => x.Pms[i].NextPMDueDt, "{0:MM/dd/yyyy}", new { @class = "form-control" })
  172. <span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
  173. </div>
  174. </div>
  175. </td>
  176. <td>
  177. <div class="editor-field">
  178. <div class="input-group date">
  179. @Html.TextBoxFor(x => x.Pms[i].EstArrivalDt, "{0:MM/dd/yyyy}", new { @class = "form-control" })
  180. <span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
  181. </div>
  182. </div>
  183. </td>
  184. <td>
  185. <input type="hidden" class="query" value="?customerNumber=@Model.Pms[i].CustNo&fleetTruckNo=@Model.Pms[i].FleetTruckNo&sro=@Model.Pms[i].RepairOrdNo&scheduleId=@Model.Pms[i].ScheduleID" />
  186. <input type="button" class="comments btn btn-primary" value="Comments" />
  187. <input type="button" class="btn btn-success" value="Process" />
  188. </td>
  189. </tr>
  190.  
  191. }
  192. @for (var i = 0; i < Model.Repairs.Count; i++)
  193. {
  194. <tr>
  195. <td>
  196. @Html.HiddenFor(x => x.Repairs[i].FleetTruckNo)
  197. @Html.DisplayFor(x => x.Repairs[i].FleetTruckNo)
  198. </td>
  199. <td>
  200. @Html.HiddenFor(x => x.Repairs[i].LocationID)
  201. @Html.DisplayFor(x => x.Repairs[i].LocationID)
  202. </td>
  203. <td>
  204. @Html.HiddenFor(x => x.Repairs[i].Description)
  205. @Html.DisplayFor(x => x.Repairs[i].Description)
  206. </td>
  207. <td>
  208. @Html.HiddenFor(x => x.Repairs[i].City)
  209. @Html.DisplayFor(x => x.Repairs[i].City)
  210. </td>
  211. <td>
  212. N/A
  213. </td>
  214. <td>
  215. <div class="editor-field">
  216. <div class="input-group date">
  217. @Html.TextBoxFor(x => x.Repairs[i].ScheduledDt, "{0:MM/dd/yyyy}", new { @class = "form-control" })
  218. <span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
  219. </div>
  220. </div>
  221. </td>
  222. <td>
  223. <input type="hidden" class="query" value="?customerNumber=@Model.Repairs[i].CustNo&fleetTruckNo=@Model.Repairs[i].FleetTruckNo&sro=@Model.Repairs[i].SRO&scheduleId=@Model.Repairs[i].ScheduleID&repair=true" />
  224. <input type="button" class="comments btn btn-primary" value="Comments" />
  225. <input type="button" class="btn btn-success" value="Process" />
  226. </td>
  227. </tr>
  228.  
  229. }
  230. </tbody>
  231. </table>
  232. }
  233.  
  234. public class CustomPmScheduleGenerator
  235. {
  236. public CustomPmScheduleGenerator()
  237. {
  238. Pms = new List<stp_GetPmSchedulesGenerator_Result>();
  239. Repairs = new List<stp_GetRepairSchedulesGenerator_Result>();
  240. }
  241.  
  242. public bool Save { get; set; }
  243. etc..
  244. public IList<stp_GetPmSchedulesGenerator_Result> Pms { get; set; }
  245. public IList<stp_GetRepairSchedulesGenerator_Result> Repairs { get; set; }
  246. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement