Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.79 KB | None | 0 0
  1. //////////////////////////////////////////////////////////BundleConfig.cs
  2. using System.Web;
  3. using System.Web.Optimization;
  4.  
  5. namespace ResourcesApp1Web
  6. {
  7. public class BundleConfig
  8. {
  9. // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
  10. public static void RegisterBundles(BundleCollection bundles)
  11. {
  12. bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
  13. "~/Scripts/jquery-{version}.js"));
  14.  
  15. bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
  16. "~/Scripts/jquery.validate*"));
  17.  
  18. // Use the development version of Modernizr to develop with and learn from. Then, when you're
  19. // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
  20. bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
  21. "~/Scripts/modernizr-*"));
  22.  
  23. /* bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
  24. "~/Scripts/bootstrap.js",
  25. "~/Scripts/respond.js"));*/
  26.  
  27. bundles.Add(new ScriptBundle("~/bundles/spcontext").Include(
  28. "~/Scripts/spcontext.js"));
  29.  
  30. bundles.Add(new ScriptBundle("~/bundles/dataTables").Include(
  31. "~/Scripts/jquery.dataTables.min.js"));
  32.  
  33. bundles.Add(new ScriptBundle("~/bundles/metrojs").Include(
  34. "~/Scripts/metro.min.js"));
  35.  
  36. bundles.Add(new StyleBundle("~/Content/css").Include(
  37. //"~/Content/bootstrap.css",
  38. "~/Content/site.css",
  39. "~/Content/metro-icons.min.css",
  40. "~/Content/metro.css"));
  41. }
  42. }
  43. }
  44.  
  45.  
  46. //////////////////////////////////////////////////////////CarListItems.cs
  47. using Microsoft.SharePoint.Client;
  48. using System;
  49. using System.Collections.Generic;
  50. using System.Linq;
  51. using System.Web;
  52.  
  53. namespace ResourcesApp1Web.Models
  54. {
  55. public class CarListItems
  56. {
  57. public List<Car> GetAllItems(ClientContext clientContext)
  58. {
  59. clientContext.Load(clientContext.Web, l => l.Lists);
  60. clientContext.ExecuteQuery();
  61. List list = clientContext.Web.Lists.GetByTitle("CarsList");
  62. clientContext.Load(list);
  63. clientContext.ExecuteQuery();
  64. var items = list.GetItems(CamlQuery.CreateAllItemsQuery());
  65. clientContext.Load(items);
  66. clientContext.ExecuteQuery();
  67.  
  68. List<Car> carItems = new List<Car>();
  69. foreach (var item in items)
  70. {
  71. carItems.Add(Car.GetCarItem(item.FieldValues));
  72. }
  73. return carItems;
  74. }
  75. }
  76. }
  77.  
  78. //////////////////////////////////////////////////////////Car.cs
  79. using System;
  80. using System.Collections.Generic;
  81. using System.Linq;
  82. using System.Web;
  83.  
  84. namespace ResourcesApp1Web.Models
  85. {
  86. public class Car
  87. {
  88. public int ID { get; set; }
  89. public string Brand { get; set; }
  90. public string Model { get; set; }
  91. public int passagerMaxNumber { get; set; }
  92. public string description { get; set; }
  93. public static Car GetCarItem(IDictionary<string, object> field){
  94. return new Car()
  95. {
  96. Brand = field["Title"].ToString(),
  97. ID = int.Parse(field["ID"].ToString()),
  98. Model = field["Model"].ToString(),
  99. passagerMaxNumber = int.Parse(field["PassengersMaxNumber"].ToString()),
  100. description = field["Description1"].ToString()
  101. };
  102. }
  103. }
  104. }
  105.  
  106. /////////////////////////////////////////////////////////_Layout.cshtml
  107. <!DOCTYPE html>
  108. <html>
  109. <head>
  110. <meta charset="utf-8" />
  111. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  112. <title>@ViewBag.Title - My ASP.NET Application</title>
  113. @Styles.Render("~/Content/css")
  114. @Scripts.Render("~/bundles/modernizr")
  115. </head>
  116. <body style="background-color:#ABE8FF;">
  117. <div class="flex-grid">
  118. <div class="row cells12">
  119. <div>
  120. <header class="app-bar fixed-top" data-role="appbar">
  121. <div class="container">
  122. <a href="https://scontent-fra3-1.xx.fbcdn.net/hphotos-xtf1/v/t1.0-9/p480x480/11402957_838547119571653_5763978918322691416_n.jpg?oh=9029987001af28205f0a2d024110b04e&oe=55E67D43" class="app-bar-element branding">
  123. <img src="~/Content/Images/icon-resources.png" style="height: 37px; display: inline-block; margin-right: 10px; margin-left:30px">
  124. Resources Manager
  125. </a>
  126. <ul class="app-bar-menu">
  127. <li style="margin-left:40px">@Html.ActionLink("Home", "Index", "Home")</li>
  128. <li>@Html.ActionLink("Users", "About", "Home")</li>
  129. <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
  130. </ul>
  131. </div>
  132. </header>
  133. </div>
  134. </div>
  135. <div class="row cells12">
  136. <div style="width:100%; overflow:hidden;background-size:cover;">
  137. <div class="baner-image"></div>
  138. <div class="page-content" style="width:80%;background-color:white; margin-left:10%;">
  139. @RenderBody()
  140. </div>
  141. <div class="bottom-menu-wrapper">
  142. <footer style="margin:auto;clear:both">
  143. <p style="margin-left:50px;">&copy; @DateTime.Now.Year - Krzysztof Kiryłowicz Resource Management App</p>
  144. </footer>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. @Scripts.Render("~/bundles/jquery")
  150. @Scripts.Render("~/bundles/spcontext")
  151. @Scripts.Render("~/bundles/metrojs")
  152. @Scripts.Render("~/bundles/dataTables")
  153. @RenderSection("scripts", required: false)
  154.  
  155. </body>
  156. </html>
  157.  
  158. ////////////////////////////////////////////////////Index.cshtml
  159. @{
  160. ViewBag.Title = "Home Page";
  161. }
  162. <div style="width:100%;">
  163. <div style=" width:90%;margin-left:5%;margin-right:5%;">
  164. <div style="width:100%;height:95px">
  165. <div class="tile" style="width:40%;height:95px;margin-right:4%;margin-left:5%">
  166. <div class=" tile-content zooming">
  167. <div class="slide">
  168. <img src="~/Content/Images/auto-banner.png" />
  169. </div>
  170. </div>
  171. </div>
  172. <div class="tile" style="width:40%;height:95px;margin-right:5%;margin-left:4%">
  173. <div class=" tile-content zooming">
  174. <div class="slide">
  175. <img src="~/Content/Images/room-banner.png"/>
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. <div style="width:100%;height:545px">
  181. <div style="width:40%;height:545px;display:inline-block;margin-right:4%;margin-left:5%">
  182. <table class="dataTable" data-role="datatable" data-searching="true">
  183. <thead>
  184. <tr>
  185. <th>Marka</th>
  186. <th>Model</th>
  187. <th>IlePas</th>
  188. </tr>
  189. </thead>
  190. <tbody class="events" style="height:10px;overflow-y:scroll;">
  191. @foreach (var item in Model.carsList)
  192. {
  193. <tr class="info">
  194. <td>
  195. @item.Brand
  196. </td>
  197. <td>
  198. @item.Model
  199. </td>
  200. <td>
  201. @item.passagerMaxNumber
  202. </td>
  203. </tr>
  204. }
  205. </tbody>
  206. </table>
  207. </div>
  208. <div style="width:40%;height:545px;display:inline-block;margin-right:5%;margin-left:4%">
  209. <table class="datatable" data-role="datatable" data-searching="true">
  210. <thead>
  211. <tr>
  212. <th>Numer</th>
  213. <th>Opis</th>
  214. </tr>
  215. </thead>
  216. <tbody>
  217. @foreach (var item in Model.roomsList)
  218. {
  219. <tr class="info">
  220. <td>
  221. @item.Number;
  222. </td>
  223. <td>
  224. @item.Description;
  225. </td>
  226. </tr>
  227. }
  228. </tbody>
  229. </table>
  230. </div>
  231. </div>
  232. <div style="width:100%;height:95px;margin-top:50px">
  233. <div class="tile" style="width:40%;height:95px;margin-right:4%;margin-left:5%">
  234. <div class=" tile-content zooming">
  235. <div class="slide">
  236. <img src="http://i.imgur.com/EcVppuU.png" />
  237. </div>
  238. </div>
  239. </div>
  240. <div class="tile" style="width:40%;height:95px;margin-right:5%;margin-left:4%">
  241. <div class=" tile-content zooming">
  242. <div class="slide">
  243. <img src="http://i.imgur.com/EcVppuU.png" />
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. <div style="width:100%;height:545px">
  249. <div style="width:40%;height:545px;display:inline-block;margin-right:4%;margin-left:5%">
  250. <table class="dataTable" data-role="datatable" data-searching="true">
  251. <thead>
  252. <tr>
  253. <th>Numer</th>
  254. <th>Wielkość</th>
  255. <th>Rodzaj</th>
  256. </tr>
  257. </thead>
  258. <tbody class="events" style="height:10px;overflow-y:scroll;">
  259. @foreach (var item in ViewBag.tablesList)
  260. {
  261. <tr class="info">
  262. <td>
  263. @item["Number"]
  264. </td>
  265. <td>
  266. @item["Size"]
  267. </td>
  268. <td>
  269. @try
  270. {
  271. foreach (Microsoft.SharePoint.Client.FieldLookupValue items in item["Type"] as Microsoft.SharePoint.Client.FieldLookupValue[])
  272. {
  273. @items.LookupValue
  274. }
  275. }
  276. catch (Exception)
  277. {
  278. }
  279.  
  280. </td>
  281. </tr>
  282. }
  283. </tbody>
  284. </table>
  285. </div>
  286. <div style="width:40%;height:545px;display:inline-block;margin-right:5%;margin-left:4%">
  287. <table class="datatable" data-role="datatable" data-searching="true">
  288. <thead>
  289. <tr>
  290. <th>Numer</th>
  291. <th>Opis</th>
  292. </tr>
  293. </thead>
  294. <tbody>
  295. @foreach (var item in Model.roomsList)
  296. {
  297. <tr class="info">
  298. <td>
  299. @item.Number;
  300. </td>
  301. <td>
  302. @item.Description;
  303. </td>
  304. </tr>
  305. }
  306. </tbody>
  307. </table>
  308. </div>
  309. </div>
  310. </div>
  311. </div>
  312. @ViewBag.url
  313. <br/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement