Advertisement
Guest User

Untitled

a guest
Jul 5th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.74 KB | None | 0 0
  1. @model IEnumerable<WebApplication1.Models.Producto>
  2. @{
  3. ViewBag.Title = "GenerarCatalogo";
  4. Layout = "~/Views/Shared/_Layout3.cshtml";
  5. }
  6.  
  7. <style>
  8. .images {
  9. float: left;
  10. background-color: rgba(137, 177, 135, 0.23);
  11. border-width: 3px;
  12. padding: 0;
  13. margin: 5px;
  14. overflow: hidden;
  15. text-align: center;
  16. }
  17.  
  18. .imgAjust {
  19. position: absolute;
  20. margin: auto;
  21. top: 0;
  22. left: 0;
  23. right: 0;
  24. bottom: 0;
  25. }
  26. .clearfix {
  27. clear: both;
  28. }
  29. </style>
  30.  
  31. <div style="width:100%; height:180px; padding:15px; text-align:center">
  32. <img style="max-height:180px; max-width:90%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  33. </div>
  34. <div style="display: table; width:100%; height: 200px; overflow: hidden;">
  35.  
  36. </div>
  37. <div style="display: table; width:100%; height: 730px; overflow: hidden;">
  38. <div style="display: table-cell; width:100%; text-align:center;">
  39. <label style="font-size:30px">CATÁLOGO DE PRODUCTOS Y SERVICIOS <br /><br /> COTIZACIÓN CÓDIGO: <strong>@ViewBag.Codigo</strong></label>
  40. </div>
  41. </div>
  42. <div style="display: table; width:100%; height: 200px; overflow: hidden;">
  43. <div style="display: table-cell; width:100%; padding-top:110px; text-align:left;">
  44. <label style="font-size:20px; text-align:center">Las imágenes a continuación son solamente para fines referenciales. Pueden sufrir modificaciones según cada proyecto y modelo.</label>
  45. </div>
  46. </div>
  47.  
  48. <div class="page-breaker">.</div>
  49.  
  50. @{
  51. int MediaPaginaCont = 0;
  52.  
  53. int paginaRegularContGlobal = 0;
  54. int paginaRegularContGlobalLocal = 0;
  55. int paginaMediaContGlobal = 0;
  56. int paginaRegularContadorPrev = 0;
  57. int RegularPaginaCont = 0;
  58.  
  59. bool panelesRegular1MediaEspecial = false;
  60. bool pasarSiguientePagina = false;
  61. bool verificacionPagina = false;
  62. bool regularPaginaDespues = false;
  63. bool habilitarMedia = false;
  64. bool ultimaPaginaRegular = true;
  65.  
  66. bool paginaEnteraAnterior = false;
  67. bool paginaMediaAnterior = false;
  68. bool paginaRegularAnterior = false;
  69.  
  70. bool saltoLineaMedia = false;
  71.  
  72. bool segundaPagina = true;
  73. bool ultimaPagina = false;
  74.  
  75. foreach (WebApplication1.Models.Producto producto in Model)
  76. {
  77. if (segundaPagina == true)
  78. {
  79. segundaPagina = false;
  80. <div style="width:97%; padding:15px; text-align:right">
  81. <img style="max-height:60px; max-width:100%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  82. </div>
  83. }
  84. foreach (var imagenes in producto.Imagenes)
  85. {
  86.  
  87. if (imagenes.DimensionImagen == WebApplication1.Models.Imagen.ImagenSize.PaginaEntera)
  88. {
  89. if (MediaPaginaCont == 1)
  90. {
  91. MediaPaginaCont = 0;
  92. }
  93. if (paginaRegularAnterior == true && paginaRegularContGlobal != 0)
  94. {
  95.  
  96. if (paginaRegularContGlobal >= 3)
  97. {
  98. if (ultimaPagina == true)
  99. {
  100. ultimaPagina = false;
  101. <div class="page-breaker">.</div>
  102. <div style="width:97%; padding:15px; text-align:right">
  103. <img style="max-height:60px; max-width:100%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  104. </div>
  105. }
  106. <div class="images" style="position: relative; width: 99%; height: 1056px;">
  107. <figure>
  108. <img class="imgAjust" style="max-height:1000px; max-width:90%;" src="@Url.Content("~/img/ImagenesProductos/" + producto.Empresa.Id + "/" + System.IO.Path.GetFileName(imagenes.DireccionImagen))" />
  109. </figure>
  110. <div style="width:100%; height:30px; position:absolute; bottom: 0; text-align:center; background-color:#71d869">
  111. <strong style="font-size:18px; line-height: 27px;">@producto.NombreProducto</strong>
  112. </div>
  113. </div>
  114. paginaEnteraAnterior = true;
  115. paginaRegularAnterior = false;
  116. ultimaPagina = true;
  117. }
  118. else
  119. {
  120.  
  121. <div class="images" style="position: relative; width: 99%; height: 792px;">
  122. <figure>
  123. <img class="imgAjust" style="max-height:750px; max-width:90%;" src="@Url.Content("~/img/ImagenesProductos/" + producto.Empresa.Id + "/" + System.IO.Path.GetFileName(imagenes.DireccionImagen))" />
  124. </figure>
  125. <div style="width:100%; height:30px; position:absolute; bottom: 0; text-align:center; background-color:#71d869">
  126. <strong style="font-size:18px; line-height: 27px;">@producto.NombreProducto</strong>
  127. </div>
  128. </div>
  129. paginaEnteraAnterior = true;
  130. paginaRegularAnterior = false;
  131. ultimaPagina = true;
  132. }
  133. }
  134. else
  135. {
  136. if (paginaMediaAnterior == true)
  137. {
  138.  
  139. <div class="page-breaker">.</div>
  140. <div style="width:97%; padding:15px; text-align:right">
  141. <img style="max-height:60px; max-width:100%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  142. </div>
  143.  
  144. <div class="images" style="position: relative; width: 99%; height: 1056px;">
  145. <figure>
  146. <img class="imgAjust" style="max-height:1000px; max-width:90%;" src="@Url.Content("~/img/ImagenesProductos/" + producto.Empresa.Id + "/" + System.IO.Path.GetFileName(imagenes.DireccionImagen))" />
  147. </figure>
  148. <div style="width:100%; height:30px; position:absolute; bottom: 0; text-align:center; background-color:#71d869">
  149. <strong style="font-size:18px; line-height: 27px;">@producto.NombreProducto</strong>
  150. </div>
  151. </div>
  152. paginaEnteraAnterior = true;
  153. paginaRegularAnterior = false;
  154. paginaMediaAnterior = false;
  155. ultimaPagina = true;
  156. }
  157. else
  158. {
  159. if (ultimaPagina == true)
  160. {
  161. ultimaPagina = false;
  162. <div class="page-breaker">.</div>
  163. <div style="width:97%; padding:15px; text-align:right">
  164. <img style="max-height:60px; max-width:100%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  165. </div>
  166. }
  167.  
  168. <div class="images" style="position: relative; width: 99%; height: 1056px;">
  169. <figure>
  170. <img class="imgAjust" style="max-height:1000px; max-width:90%;" src="@Url.Content("~/img/ImagenesProductos/" + producto.Empresa.Id + "/" + System.IO.Path.GetFileName(imagenes.DireccionImagen))" />
  171. </figure>
  172. <div style="width:100%; height:30px; position:absolute; bottom: 0; text-align:center; background-color:#71d869">
  173. <strong style="font-size:18px; line-height: 27px;">@producto.NombreProducto</strong>
  174. </div>
  175. </div>
  176.  
  177. ultimaPagina = true;
  178. paginaEnteraAnterior = true;
  179. paginaRegularAnterior = false;
  180. paginaMediaAnterior = false;
  181.  
  182. }
  183. }
  184.  
  185. //Verifica que pasó por este tamaño de página.
  186. verificacionPagina = true;
  187.  
  188. }
  189.  
  190. }
  191.  
  192. if (verificacionPagina == true)
  193. {
  194. verificacionPagina = false;
  195. regularPaginaDespues = false;
  196. RegularPaginaCont = 0;
  197.  
  198. paginaRegularAnterior = false;
  199. paginaMediaAnterior = false;
  200. paginaEnteraAnterior = true;
  201. }
  202.  
  203.  
  204.  
  205. foreach (var imagenes in producto.Imagenes)
  206. {
  207.  
  208. if (imagenes.DimensionImagen == WebApplication1.Models.Imagen.ImagenSize.MediaPagina)
  209. {
  210.  
  211. if (ultimaPagina == true)
  212. {
  213. if (paginaRegularAnterior == true && paginaRegularContGlobal <= 4)
  214. {
  215. if (regularPaginaDespues == true)
  216. {
  217. regularPaginaDespues = false;
  218. ultimaPagina = false;
  219. <div class="page-breaker">.</div>
  220. <div style="width:97%; padding:15px; text-align:right">
  221. <img style="max-height:60px; max-width:100%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  222. </div>
  223. }
  224.  
  225. RegularPaginaCont = 0;
  226. }
  227. else
  228. {
  229. ultimaPagina = false;
  230. <div class="page-breaker">.</div>
  231. <div style="width:97%; padding:15px; text-align:right">
  232. <img style="max-height:60px; max-width:100%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  233. </div>
  234. }
  235.  
  236. }
  237.  
  238. MediaPaginaCont++;
  239. <div class="images" style="position:relative; width: 99%; height: 528px;">
  240. <figure>
  241. <img class="imgAjust" style="max-height:500px; max-width:90%; padding-top:30px" src="@Url.Content("~/img/ImagenesProductos/" + producto.Empresa.Id + "/" + System.IO.Path.GetFileName(imagenes.DireccionImagen))" />
  242. </figure>
  243. <div style="width:100%; height:30px; position:absolute; bottom: 0; text-align:center; background-color:#71d869">
  244. <strong style="font-size:18px; line-height: 27px;">@producto.NombreProducto</strong>
  245. </div>
  246. </div>
  247.  
  248. if (paginaRegularAnterior == true && MediaPaginaCont == 1 && regularPaginaDespues == false) //Si la página ya contiene 4 o menos regulares.
  249. {
  250. if (paginaRegularContGlobal != 0 && paginaRegularContGlobal <= 4)
  251. {
  252. paginaRegularContGlobal = 0;
  253. paginaRegularAnterior = false;
  254.  
  255. MediaPaginaCont = 0;
  256. regularPaginaDespues = true;
  257. ultimaPagina = true;
  258. paginaMediaAnterior = true;
  259. }
  260.  
  261. }
  262.  
  263. if (MediaPaginaCont == 2)
  264. {
  265. ultimaPagina = true;
  266. paginaMediaAnterior = true;
  267. MediaPaginaCont = 0;
  268. }
  269. else if(MediaPaginaCont == 1)
  270. {
  271. ultimaPagina = false;
  272. }
  273.  
  274. //Verifica que pasó por este tamaño de página.
  275. verificacionPagina = true;
  276.  
  277. }
  278. }
  279.  
  280.  
  281. if (verificacionPagina == true)
  282. {
  283.  
  284. //Almacena la cantidad de Medias restantes para la próxima página.
  285. paginaMediaContGlobal = MediaPaginaCont;
  286.  
  287. verificacionPagina = false;
  288. regularPaginaDespues = false;
  289. RegularPaginaCont = 0;
  290.  
  291. paginaRegularAnterior = false;
  292. paginaMediaAnterior = true;
  293. paginaEnteraAnterior = false;
  294. }
  295.  
  296. //---------------------------------------------------------------------
  297.  
  298. if (paginaRegularAnterior == true)
  299. {
  300. regularPaginaDespues = false;
  301. }
  302.  
  303. foreach (var imagenes in producto.Imagenes)
  304. {
  305. if (imagenes.DimensionImagen == WebApplication1.Models.Imagen.ImagenSize.Regular)
  306. {
  307. paginaRegularContadorPrev++;
  308. }
  309. }
  310.  
  311.  
  312. foreach (var imagenes in producto.Imagenes)
  313. {
  314. if (imagenes.DimensionImagen == WebApplication1.Models.Imagen.ImagenSize.Regular)
  315. {
  316. if(paginaEnteraAnterior == true || paginaMediaAnterior == true)
  317. {
  318. ultimaPaginaRegular = false;
  319. paginaEnteraAnterior = false;
  320. //paginaMediaAnterior = false;
  321. }
  322.  
  323. if (ultimaPagina == true && ultimaPaginaRegular == false)
  324. {
  325. ultimaPaginaRegular = true;
  326. ultimaPagina = false;
  327.  
  328. if(paginaMediaAnterior == true)
  329. {
  330. saltoLineaMedia = true;
  331. }
  332. <div class="page-breaker">.</div>
  333. <div style="width:97%; padding:15px; text-align:right">
  334. <img style="max-height:60px; max-width:100%;" src="@Url.Content("~/img/LogosEmpresas/" + ViewBag.EmpresaId + "/" + System.IO.Path.GetFileName(ViewBag.EmpresaLogo))" />
  335. </div>
  336. }
  337.  
  338. RegularPaginaCont++;
  339. <div class="images" style="position:relative; width: 48.5%; height: 264px;">
  340. <figure>
  341. <img style="max-height:205px; max-width:90%" src="@Url.Content("~/img/ImagenesProductos/" + producto.Empresa.Id + "/" + System.IO.Path.GetFileName(imagenes.DireccionImagen))" />
  342. </figure>
  343. <div style="width:100%; height:30px; position:absolute; bottom: 0; text-align:center; background-color:#71d869">
  344. <strong style="font-size:18px; line-height: 27px;">@producto.NombreProducto</strong>
  345. </div>
  346. </div>
  347.  
  348. if (paginaMediaAnterior == true && paginaRegularContadorPrev <= 4) //Si la página ya contiene una Media.
  349. {
  350. if (paginaMediaContGlobal == 1 && RegularPaginaCont == paginaRegularContadorPrev)
  351. {
  352. //Especial
  353. habilitarMedia = true;
  354.  
  355. paginaRegularAnterior = true;
  356. paginaMediaAnterior = false;
  357. ultimaPaginaRegular = false;
  358. //RegularPaginaCont = 0;
  359. regularPaginaDespues = true;
  360. ultimaPagina = true;
  361. }
  362. }
  363. else
  364. {
  365. if (paginaMediaAnterior == true && paginaRegularContadorPrev >= 5)
  366. {
  367. if(saltoLineaMedia == true)
  368. {
  369. saltoLineaMedia = false;
  370. paginaRegularAnterior = true;
  371. paginaMediaAnterior = false;
  372. }
  373. else if (RegularPaginaCont == 4)
  374. {
  375. paginaRegularAnterior = true;
  376. ultimaPaginaRegular = false;
  377. paginaMediaAnterior = false;
  378. panelesRegular1MediaEspecial = true;
  379.  
  380. paginaRegularContadorPrev = 0;
  381. ultimaPagina = true;
  382.  
  383. RegularPaginaCont = 0;
  384. }
  385. }
  386. }
  387.  
  388. bool tiene8 = false;
  389. if (paginaRegularContadorPrev >= 5)
  390. {
  391. if(paginaRegularContadorPrev <= 8)
  392. {
  393. if(RegularPaginaCont >= 3)
  394. {
  395. if (RegularPaginaCont == 8)
  396. {
  397. ultimaPaginaRegular = false;
  398. ultimaPagina = true;
  399. paginaRegularAnterior = true;
  400. RegularPaginaCont = 0;
  401. tiene8 = true;
  402. pasarSiguientePagina = false;
  403. }
  404. else
  405. {
  406. pasarSiguientePagina = true;
  407. }
  408. }
  409.  
  410. if(pasarSiguientePagina == true)
  411. {
  412. if (RegularPaginaCont >= 5 && paginaRegularContadorPrev >= 8)
  413. {
  414. if(RegularPaginaCont == 8)
  415. {
  416. ultimaPaginaRegular = false;
  417. ultimaPagina = true;
  418. paginaRegularAnterior = true;
  419. RegularPaginaCont = 0;
  420. tiene8 = true;
  421. pasarSiguientePagina = false;
  422. }
  423. else
  424. {
  425. ultimaPagina = true;
  426. paginaRegularAnterior = true;
  427. }
  428. }
  429. else
  430. {
  431. //Por el problema de que dejaba 3 imagenes con una mediana
  432. if (paginaMediaAnterior == false)
  433. {
  434. ultimaPagina = true;
  435. paginaRegularAnterior = true;
  436. }
  437.  
  438. if (panelesRegular1MediaEspecial == true)
  439. {
  440. ultimaPagina = true;
  441. paginaRegularAnterior = false;
  442. panelesRegular1MediaEspecial = false;
  443. ultimaPaginaRegular = false;
  444. }
  445. }
  446. }
  447.  
  448. if (tiene8 == false && RegularPaginaCont == 8)
  449. {
  450. ultimaPaginaRegular = false;
  451. ultimaPagina = true;
  452. paginaRegularAnterior = true;
  453. RegularPaginaCont = 0;
  454. }
  455. }
  456. else
  457. {
  458. if (RegularPaginaCont == 8)
  459. {
  460. ultimaPaginaRegular = false;
  461. ultimaPagina = true;
  462. paginaRegularAnterior = true;
  463. RegularPaginaCont = 0;
  464. }
  465. }
  466. }
  467. else
  468. {
  469. ultimaPaginaRegular = true;
  470. //Por el problema de que dejaba 3 imagenes con una mediana
  471. if (paginaMediaAnterior == false)
  472. {
  473. ultimaPagina = true;
  474. paginaRegularAnterior = true;
  475. }
  476.  
  477. if (panelesRegular1MediaEspecial == true)
  478. {
  479. ultimaPagina = true;
  480. paginaRegularAnterior = false;
  481. panelesRegular1MediaEspecial = false;
  482. ultimaPaginaRegular = false;
  483. }
  484.  
  485. if (RegularPaginaCont == 8)
  486. {
  487. RegularPaginaCont = 0;
  488. ultimaPaginaRegular = false;
  489. }
  490. }
  491.  
  492. //Verifica que pasó por este tamaño de página.
  493. verificacionPagina = true;
  494.  
  495. }
  496. }
  497.  
  498. if (verificacionPagina == true)
  499. {
  500. verificacionPagina = false;
  501.  
  502. paginaRegularAnterior = true;
  503. paginaMediaAnterior = false;
  504. paginaEnteraAnterior = false;
  505. }
  506. //Almacena la cantidad de Regulares restantes para la próxima página.
  507. paginaRegularContGlobal = RegularPaginaCont;
  508. paginaRegularContadorPrev = 0;
  509. }
  510.  
  511. }
  512.  
  513. <style>
  514. .page-breaker {
  515. page-break-after: always;
  516. }
  517. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement