Guest User

Untitled

a guest
Feb 7th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.31 KB | None | 0 0
  1. public class WTPBuilder
  2. {
  3. public IList<WTP_block> WTPblocks { get; set; }
  4. public IList<Contamination> contams { get; set; }
  5. public IList<FilterMaterial> filtermaterials { get; set; }
  6. //public List<Price> prices { get; set; }
  7. public IList<Effort> efforts { get; set; }
  8. public PriceList priceList { get; set; }
  9. public double flow { get; set; }
  10. public double price { get; set; }
  11. public int longestList { get; set; }
  12. public string typeofdew { get; set; }
  13. public string wtp_luxury { get; set; }
  14. public double pipe_size { get; set; }
  15. public string pipe_type { get; set; }
  16. public double overcapacity { get; set; }
  17. public int duration_days { get; set; }
  18. public double distance { get; set; }
  19. public string discharge_point { get; set; }
  20. public bool prov1 { get; set; } // these will go in a list at some point.
  21. public bool prov2 { get; set; }
  22. public bool prov3 { get; set; }
  23. public bool prov4 { get; set; }
  24. public bool prov5 { get; set; }
  25. public bool prov6 { get; set; }
  26. public bool prov7 { get; set; }
  27. public bool prov8 { get; set; }
  28. public bool prov9 { get; set; }
  29. public bool prov10 { get; set; }
  30. public bool prov11 { get; set; }
  31. public bool prov12 { get; set; }
  32. public WTPBuilder()
  33. {
  34. //WTPblocks = new IList<WTP_block>();
  35. //filtermaterials = new List<FilterMaterial>();
  36. //contams = new List<Contamination>();
  37. }
  38.  
  39. public WTPBuilder(List<Contamination> conta, double flow, string typeofdew, int duration_days, string dischargeto, string wtp_luxurity)
  40. {
  41. this.flow = flow;
  42. this.contams = conta;
  43. this.typeofdew = typeofdew;
  44. this.duration_days = duration_days;
  45. this.discharge_point = dischargeto;
  46. this.wtp_luxurity = wtp_luxurity;
  47. }
  48. }
  49.  
  50. namespace App2.Models
  51. {
  52. public class WTP_block
  53. {
  54. [Key]
  55. public int id { get; set; }
  56. [Required]
  57.  
  58. public string name { get; set; }
  59. [Required]
  60. public double size { get; set; }
  61. public double? length { get; set; }
  62. public double? width { get; set; }
  63. public double? height { get; set; }
  64. public double? weight { get; set; }
  65. public bool necessity { get; set; }
  66.  
  67. public string uniquename()
  68. {
  69. string[] s = { this.name, this.size.ToString() };
  70. return string.Join("_",s);
  71. }
  72. }
  73. }
  74.  
  75. [HttpPost]
  76. public IActionResult remove_wtp_part(int? id, WTPBuilder model)
  77. {
  78. if (ModelState.IsValid)
  79. {
  80. var wtpblock = model.WTPblocks.SingleOrDefault(b => b.id == id); //here model.WTPblocks.Count = 0 or null if this list is not initialized in the constructor WTPBuilder()
  81. model.WTPblocks.Remove(wtpblock);
  82. return RedirectToAction("CreateOldWTP", "WTPBuilder", new { wtp = model });
  83. }
  84.  
  85. return View("Index"); //random never reaches it as model.state is true...
  86. }
  87.  
  88. @model App2.Models.WTP_block
  89. @Html.HiddenFor(x => x.id)
  90. @Html.EditorFor(x => x.name)
  91. @Html.EditorFor(x => x.size)
  92. @Html.EditorFor(x => x.length)
  93. @Html.EditorFor(x => x.width)
  94. @Html.EditorFor(x => x.height)
  95. @Html.EditorFor(x => x.weight)
  96. @Html.CheckBoxFor(x => x.necessity)
  97.  
  98. @model App2.Models.WTPBuilder
  99. @{
  100. ViewData["Title"] = "InputUse";
  101. }
  102.  
  103. <h2>WTP WAS BUILT</h2>
  104.  
  105. <h1>The WTP contains</h1>
  106. <h3>Flow: @Model.flow</h3>
  107. <h3>Type: @Model.typeofdew </h3>
  108. <h3>Blocks: @Model.longestList</h3>
  109. <h3>WTP Luxury status: @Model.wtp_luxury</h3>
  110. <h3>WTP pipe type: @Model.pipe_type</h3>
  111. <h3>WTP pipe size: @Model.pipe_size</h3>
  112.  
  113. <h3>WTP parts</h3>
  114. <table class="table">
  115. <thead>
  116. <tr>
  117. <th>
  118. @Html.DisplayNameFor(model => model.contams)
  119. </th>
  120. <th>
  121. @Html.DisplayNameFor(model => model.filtermaterials)
  122. </th>
  123. <th>
  124. @Html.DisplayNameFor(model => model.WTPblocks)
  125. </th>
  126. <th>
  127. @Html.DisplayNameFor(model => model.WTPblocks[0].size)
  128. </th>
  129. </tr>
  130. </thead>
  131.  
  132. <tbody>
  133.  
  134. @for (int i = 0; i < Model.longestList; i++)
  135. {
  136. <tr>
  137. @if (i < Model.contams.Count)
  138. {
  139. <td>@Html.DisplayFor(modelItem => Model.contams[i].Name)</td>
  140. }
  141. else
  142. {
  143. <td></td>
  144.  
  145. }
  146. @if (i < Model.filtermaterials.Count)
  147. {
  148. <td>@Html.DisplayFor(modelItem => Model.filtermaterials[i].Name)</td>
  149. }
  150. else
  151. {
  152. <td></td>
  153.  
  154. }
  155. @if (i < Model.WTPblocks.Count)
  156. {
  157. <td>@Html.DisplayFor(modelItem => Model.WTPblocks[i].name)</td>
  158. <td>@Html.DisplayFor(modelItem => Model.WTPblocks[i].size)</td>
  159. <td><a asp-action="getEfforts" asp-route-id="@Model.WTPblocks[i].id">show Efforts</a>|</td>
  160. <td>
  161. @using (Html.BeginForm("remove_wtp_part", "WTPBuilder", new { id = Model.WTPblocks[i].id }))
  162. {
  163. @Html.HiddenFor(m=>m.WTPblocks[i].id)
  164. <input type="submit" value="Remove"/>
  165. }
  166. </td>
  167. }
  168. else
  169. {
  170. < td ></ td >
  171. }
  172. </tr>
  173. }
  174. </tbody>
  175. </table>
  176. HERE ENDS THE INTERESTING PART, I ASSUME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  177. <h3>Efforts to install</h3>
  178. <table class="table">
  179. <thead>
  180. <tr>
  181. <th>
  182. @Html.DisplayNameFor(modelItem => Model.efforts[0].WTP_block_name)
  183. </th>
  184. <th>
  185. @Html.DisplayNameFor(modelItem => Model.efforts[0].Name)
  186. </th>
  187. <th>
  188. @Html.DisplayNameFor(modelItem => Model.efforts[0].category)
  189. </th>
  190. <th>
  191. @Html.DisplayNameFor(modelItem => Model.efforts[0].effort)
  192. </th>
  193. <th>
  194. @Html.DisplayNameFor(modelItem => Model.efforts[0].unit)
  195. </th>
  196. <th>
  197. @Html.DisplayNameFor(modelItem => Model.efforts[0].temp_section)
  198. </th>
  199. <th>
  200. @Html.DisplayNameFor(modelItem => Model.efforts[0].wtp_luxurity)
  201. </th>
  202. </tr>
  203. </thead>
  204.  
  205. <tbody>
  206. @for (int i = 0; i < Model.efforts.Count; i++)
  207. {
  208. <tr>
  209. <td>@Html.DisplayFor(modelItem => Model.efforts[i].WTP_block_name)</td>
  210. <td>@Html.DisplayFor(modelItem => Model.efforts[i].Name)</td>
  211. <td>@Html.DisplayFor(modelItem => Model.efforts[i].category)</td>
  212. <td>@Html.DisplayFor(modelItem => Model.efforts[i].effort)</td>
  213. <td>@Html.DisplayFor(modelItem => Model.efforts[i].unit)</td>
  214. <td>@Html.DisplayFor(modelItem => Model.efforts[i].temp_section)</td>
  215. <td>@Html.DisplayFor(modelItem => Model.efforts[i].wtp_luxurity)</td>
  216. <td><a asp-action="EditEffort" asp-route-id="@Model.efforts[i].id">Edit</a></td>
  217. </tr>
  218. }
  219. </tbody>
  220. </table>
  221.  
  222. Mobilisation ( total = @Html.DisplayFor(Model => Model.priceList.total_price_mob) )
  223. <table class="table">
  224. <thead>
  225. <tr>
  226. <th>
  227. Name
  228. </th>
  229. <th>
  230. Amount
  231. </th>
  232. <th>
  233. Price
  234. </th>
  235.  
  236. </tr>
  237. </thead>
  238.  
  239. <tbody>
  240. @foreach (var item in Model.priceList.prices_mob)
  241. {
  242. <tr>
  243. <td>@Html.DisplayFor(modelItem => item.Key)</td>
  244. <td>@Html.DisplayFor(modelItem => Model.priceList.quantities_mob[item.Key])</td>
  245. <td>@Html.DisplayFor(modelItem => item.Value)</td>
  246.  
  247. </tr>
  248. }
  249. </tbody>
  250. </table>
  251.  
  252. De-Mobilisation ( total = @Html.DisplayFor(Model => Model.priceList.total_price_demob) )
  253. <table class="table">
  254. <thead>
  255. <tr>
  256. <th>
  257. Name
  258. </th>
  259. <th>
  260. Amount
  261. </th>
  262. <th>
  263. Price
  264. </th>
  265.  
  266. </tr>
  267. </thead>
  268.  
  269. <tbody>
  270. @foreach (var item in Model.priceList.prices_demob)
  271. {
  272. <tr>
  273. <td>@Html.DisplayFor(modelItem => item.Key)</td>
  274. <td>@Html.DisplayFor(modelItem => Model.priceList.quantities_demob[item.Key])</td>
  275. <td>@Html.DisplayFor(modelItem => item.Value)</td>
  276.  
  277. </tr>
  278. }
  279. </tbody>
  280. </table>
  281.  
  282. Operation and Maintenance ( total = @Html.DisplayFor(Model => Model.priceList.total_price_operation) )
  283. <table class="table">
  284. <thead>
  285. <tr>
  286. <th>
  287. Name
  288. </th>
  289. <th>
  290. Amount
  291. </th>
  292. <th>
  293. Price
  294. </th>
  295.  
  296. </tr>
  297. </thead>
  298.  
  299. <tbody>
  300. @foreach (var item in Model.priceList.prices_operation)
  301. {
  302. <tr>
  303. <td>@Html.DisplayFor(modelItem => item.Key)</td>
  304. <td>@Html.DisplayFor(modelItem => Model.priceList.quantities_operation[item.Key])</td>
  305. <td>@Html.DisplayFor(modelItem => item.Value)</td>
  306.  
  307. </tr>
  308. }
  309. </tbody>
  310. </table>
  311.  
  312. Rent ( total = @Html.DisplayFor(Model => Model.priceList.total_price_rent) )
  313. <table class="table">
  314. <thead>
  315. <tr>
  316. <th>
  317. Name
  318. </th>
  319. <th>
  320. Amount
  321. </th>
  322. <th>
  323. Price
  324. </th>
  325.  
  326. </tr>
  327. </thead>
  328.  
  329. <tbody>
  330. @foreach (var item in Model.priceList.prices_rent)
  331. {
  332. <tr>
  333. <td>@Html.DisplayFor(modelItem => item.Key)</td>
  334. <td>@Html.DisplayFor(modelItem => Model.priceList.quantities_rent[item.Key])</td>
  335. <td>@Html.DisplayFor(modelItem => item.Value)</td>
  336. </tr>
  337. }
  338. </tbody>
  339. </table>
  340.  
  341. <h3>Complete Price List</h3>
  342. <table class="table">
  343. <thead>
  344. <tr>
  345. <th>
  346. @Html.LabelFor(m=>m.priceList.prices_all[0].id)
  347. </th>
  348. <th>
  349. @Html.LabelFor(m => m.priceList.prices_all[0].id)
  350. </th>
  351. <th>
  352. @Html.LabelFor(m => m.priceList.prices_all[0].EkdT)
  353. </th>
  354. <th>
  355. @Html.LabelFor(m => m.priceList.prices_all[0].size)
  356. </th>
  357. <th>
  358. @Html.LabelFor(m => m.priceList.prices_all[0].unit)
  359. </th>
  360. <th>
  361. @Html.LabelFor(m => m.priceList.prices_all[0].price)
  362. </th>
  363. <th>
  364. @Html.LabelFor(m => m.priceList.prices_all[0].unit_p)
  365. </th>
  366. <th>
  367. @Html.LabelFor(m => m.priceList.prices_all[0].rent)
  368. </th>
  369. <th>
  370. @Html.LabelFor(m => m.priceList.prices_all[0].unit_r)
  371. </th>
  372. </tr>
  373. </thead>
  374.  
  375. <tbody>
  376. @for (int i = 0; i < Model.priceList.prices_all.Count; i++)
  377. {
  378. <tr>
  379. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].id)</td>
  380. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].name)</td>
  381. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].EkdT)</td>
  382. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].size)</td>
  383. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].unit)</td>
  384. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].price)</td>
  385. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].unit_p)</td>
  386. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].rent)</td>
  387. <td>@Html.DisplayFor(modelItem => Model.priceList.prices_all[i].unit_r)</td>
  388. <td><a asp-action="editThePrice" asp-route-id="@Model.priceList.prices_all[i].id">Edit Price</a></td>
  389.  
  390.  
  391. </tr>
  392. }
  393. </tbody>
  394. </table>
  395.  
  396. <div class="row">
  397. <div class="col-sm-8">
  398. <div class="form-inline">
  399. <div class="form-group">
  400. @Html.DisplayFor(m => m.prov1)
  401. </div>
  402. </div>
  403. <div class="form-inline">
  404. <div class="form-group">
  405. @Html.DisplayFor(m => m.prov2)
  406. </div>
  407. </div>
  408. <div class="form-inline">
  409. <div class="form-group">
  410. @Html.DisplayFor(m => m.prov3)
  411. </div>
  412. </div>
  413. <div class="form-inline">
  414. <div class="form-group">
  415. @Html.DisplayFor(m => m.prov4)
  416. </div>
  417. </div>
  418. <div class="form-inline">
  419. <div class="form-group">
  420. @Html.DisplayFor(m => m.prov5)
  421. </div>
  422. <div class="form-inline">
  423. <div class="form-group">
  424. @Html.DisplayFor(m => m.prov6)
  425. </div>
  426. </div>
  427. <div class="form-inline">
  428. <div class="form-group">
  429. @Html.DisplayFor(m => m.prov7)
  430. </div>
  431. </div>
  432. <div class="form-inline">
  433. <div class="form-group">
  434. @Html.DisplayFor(m => m.prov8)
  435. </div>
  436. </div>
  437. <div class="form-inline">
  438. <div class="form-group">
  439. @Html.DisplayFor(m => m.prov9)
  440. </div>
  441. </div>
  442. <div class="form-inline">
  443. <div class="form-group">
  444. @Html.DisplayFor(m => m.prov10)
  445. </div>
  446. </div>
  447. <div class="form-inline">
  448. <div class="form-group">
  449. @Html.DisplayFor(m => m.prov11)
  450. </div>
  451. </div>
  452. <div class="form-inline">
  453. <div class="form-group">
  454. @Html.DisplayFor(m => m.prov12)
  455. </div>
  456. </div>
  457. </div>
  458. </div>
  459. </div>
  460.  
  461. @using (Html.BeginForm("remove_wtp_part", "WTPBuilder", new { id = Model.WTPblocks[i].id }))
  462. {
  463. @Html.HiddenFor(m=>m.WTPblocks[i].id)
  464. <input type="submit" value="Remove"/>
  465. }
Add Comment
Please, Sign In to add comment