PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/development/GapCCSolution/GapCC/BritishGas/Habits.cs

http://acms.codeplex.com
C# | 348 lines | 306 code | 42 blank | 0 comment | 8 complexity | b8aae2769c70c51332ad6c1869983968 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.HtmlControls;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Xml.Linq;
  12. namespace GapCC.BritishGas
  13. {
  14. public class Habits
  15. {
  16. public Habits() { }
  17. private string _SchoolId;
  18. public string SchoolId
  19. {
  20. get { return _SchoolId; }
  21. set { _SchoolId = value; }
  22. }
  23. private string _ClassName;
  24. public string ClassName
  25. {
  26. get { return _ClassName; }
  27. set { _ClassName = value; }
  28. }
  29. private DateTime _Start;
  30. public DateTime Start
  31. {
  32. get { return _Start; }
  33. set { _Start = value; }
  34. }
  35. private DateTime _End;
  36. public DateTime End
  37. {
  38. get { return _End; }
  39. set { _End = value; }
  40. }
  41. private int? _LightBulbsTotal;
  42. public int? LightBulbsTotal
  43. {
  44. get { return _LightBulbsTotal; }
  45. set { _LightBulbsTotal = value; }
  46. }
  47. private int? _LightBulbsLeftOn;
  48. public int? LightBulbsLeftOn
  49. {
  50. get { return _LightBulbsLeftOn; }
  51. set { _LightBulbsLeftOn = value; }
  52. }
  53. private int? _MonitorsTotal;
  54. public int? MonitorsTotal
  55. {
  56. get { return _MonitorsTotal; }
  57. set { _MonitorsTotal = value; }
  58. }
  59. private int? _MonitorsLeftOn;
  60. public int? MonitorsLeftOn
  61. {
  62. get { return _MonitorsLeftOn; }
  63. set { _MonitorsLeftOn = value; }
  64. }
  65. private int? _ComputersTotal;
  66. public int? ComputersTotal
  67. {
  68. get { return _ComputersTotal; }
  69. set { _ComputersTotal = value; }
  70. }
  71. private int? _ComputersLeftOn;
  72. public int? ComputersLeftOn
  73. {
  74. get { return _ComputersLeftOn; }
  75. set { _ComputersLeftOn = value; }
  76. }
  77. private int? _PrintersTotal;
  78. public int? PrintersTotal
  79. {
  80. get { return _PrintersTotal; }
  81. set { _PrintersTotal = value; }
  82. }
  83. private int? _PrintersLeftOn;
  84. public int? PrintersLeftOn
  85. {
  86. get { return _PrintersLeftOn; }
  87. set { _PrintersLeftOn = value; }
  88. }
  89. private int? _WhiteBoardsTotal;
  90. public int? WhiteBoardsTotal
  91. {
  92. get { return _WhiteBoardsTotal; }
  93. set { _WhiteBoardsTotal = value; }
  94. }
  95. private int? _WhiteBoardsLeftOn;
  96. public int? WhiteBoardsLeftOn
  97. {
  98. get { return _WhiteBoardsLeftOn; }
  99. set { _WhiteBoardsLeftOn = value; }
  100. }
  101. private int? _DeskLampsTotal;
  102. public int? DeskLampsTotal
  103. {
  104. get { return _DeskLampsTotal; }
  105. set { _DeskLampsTotal = value; }
  106. }
  107. private int? _DeskLampsLeftOn;
  108. public int? DeskLampsLeftOn
  109. {
  110. get { return _DeskLampsLeftOn; }
  111. set { _DeskLampsLeftOn = value; }
  112. }
  113. private int? _TelevisionsTotal;
  114. public int? TelevisionsTotal
  115. {
  116. get { return _TelevisionsTotal; }
  117. set { _TelevisionsTotal = value; }
  118. }
  119. private int? _TelevisionsLeftOn;
  120. public int? TelevisionsLeftOn
  121. {
  122. get { return _TelevisionsLeftOn; }
  123. set { _TelevisionsLeftOn = value; }
  124. }
  125. private int? _DVDsTotal;
  126. public int? DVDsTotal
  127. {
  128. get { return _DVDsTotal; }
  129. set { _DVDsTotal = value; }
  130. }
  131. private int? _DVDsLeftOn;
  132. public int? DVDsLeftOn
  133. {
  134. get { return _DVDsLeftOn; }
  135. set { _DVDsLeftOn = value; }
  136. }
  137. private float? _SickRoomAverage;
  138. public float? SickRoomAverage
  139. {
  140. get { return _SickRoomAverage; }
  141. set { _SickRoomAverage = value; }
  142. }
  143. private float? _ClassRoomAverage;
  144. public float? ClassRoomAverage
  145. {
  146. get { return _ClassRoomAverage; }
  147. set { _ClassRoomAverage = value; }
  148. }
  149. private float? _HallsAverage;
  150. public float? HallsAverage
  151. {
  152. get { return _HallsAverage; }
  153. set { _HallsAverage = value; }
  154. }
  155. private float? _WaterAverage;
  156. public float? WaterAverage
  157. {
  158. get { return _WaterAverage; }
  159. set { _WaterAverage = value; }
  160. }
  161. private bool _HeatingOn;
  162. public bool HeatingOn
  163. {
  164. get { return _HeatingOn; }
  165. set { _HeatingOn = value; }
  166. }
  167. private int? _WindowsTotal;
  168. public int? WindowsTotal
  169. {
  170. get { return _WindowsTotal; }
  171. set { _WindowsTotal = value; }
  172. }
  173. private int? _WindowsOpen;
  174. public int? WindowsOpen
  175. {
  176. get { return _WindowsOpen; }
  177. set { _WindowsOpen = value; }
  178. }
  179. private int? _InternalDoorsTotal;
  180. public int? InternalDoorsTotal
  181. {
  182. get { return _InternalDoorsTotal; }
  183. set { _InternalDoorsTotal = value; }
  184. }
  185. private int? _InternalDoorsOpen;
  186. public int? InternalDoorsOpen
  187. {
  188. get { return _InternalDoorsOpen; }
  189. set { _InternalDoorsOpen = value; }
  190. }
  191. private int? _ExternalDoorsTotal;
  192. public int? ExternalDoorsTotal
  193. {
  194. get { return _ExternalDoorsTotal; }
  195. set { _ExternalDoorsTotal = value; }
  196. }
  197. private int? _ExternalDoorsOpen;
  198. public int? ExternalDoorsOpen
  199. {
  200. get { return _ExternalDoorsOpen; }
  201. set { _ExternalDoorsOpen = value; }
  202. }
  203. private int? _RadiatorsTotal;
  204. public int? RadiatorsTotal
  205. {
  206. get { return _RadiatorsTotal; }
  207. set { _RadiatorsTotal = value; }
  208. }
  209. private int? _RadiatorsObstructed;
  210. public int? RadiatorsObstructed
  211. {
  212. get { return _RadiatorsObstructed; }
  213. set { _RadiatorsObstructed = value; }
  214. }
  215. internal bool Process()
  216. {
  217. Gap.Bll.BritishGas.Habits tmp = Gap.Bll.BritishGas.Habits.Get(this.SchoolId, this.ClassName, this.Start, this.End);
  218. if (tmp == null)
  219. {
  220. tmp = Gap.Bll.BritishGas.Habits.CreateInstance(this.SchoolId, this.ClassName, this.Start, this.End);
  221. }
  222. tmp.LightBulbsTotal = this.LightBulbsTotal;
  223. tmp.LightBulbsLeftOn = this.LightBulbsLeftOn;
  224. tmp.MonitorsTotal = this.MonitorsTotal;
  225. tmp.MonitorsLeftOn = this.MonitorsLeftOn;
  226. tmp.ComputersTotal = this.ComputersTotal;
  227. tmp.ComputersLeftOn = this.ComputersLeftOn;
  228. tmp.PrintersTotal = this.PrintersTotal;
  229. tmp.PrintersLeftOn = this.PrintersLeftOn;
  230. tmp.WhiteBoardsTotal = this.WhiteBoardsTotal;
  231. tmp.WhiteBoardsLeftOn = this.WhiteBoardsLeftOn;
  232. tmp.DeskLampsTotal = this.DeskLampsTotal;
  233. tmp.DeskLampsLeftOn = this.DeskLampsLeftOn;
  234. tmp.TelevisionsTotal = this.TelevisionsTotal;
  235. tmp.TelevisionsLeftOn = this.TelevisionsLeftOn;
  236. tmp.DVDsTotal = this.DVDsTotal;
  237. tmp.DVDsLeftOn = this.DVDsLeftOn;
  238. tmp.SickRoomAverage = this.SickRoomAverage;
  239. tmp.ClassRoomAverage = this.ClassRoomAverage;
  240. tmp.HallsAverage = this.HallsAverage;
  241. tmp.WaterAverage = this.WaterAverage;
  242. tmp.HeatingOn = this.HeatingOn;
  243. tmp.WindowsTotal = this.WindowsTotal;
  244. tmp.WindowsOpen = this.WindowsOpen;
  245. tmp.InternalDoorsTotal = this.InternalDoorsTotal;
  246. tmp.InternalDoorsOpen = this.InternalDoorsOpen;
  247. tmp.ExternalDoorsTotal = this.ExternalDoorsTotal;
  248. tmp.ExternalDoorsOpen = this.ExternalDoorsOpen;
  249. tmp.RadiatorsTotal = this.RadiatorsTotal;
  250. tmp.RadiatorsObstructed = this.RadiatorsObstructed;
  251. if (ConfigurationSettings.AppSettings["UseDB"] != "false")
  252. {
  253. tmp.Update();
  254. }
  255. return true;
  256. }
  257. public static Habits Load(string schoolId, string className, DateTime start, DateTime end)
  258. {
  259. Gap.Bll.BritishGas.Habits habits = null;
  260. if(ConfigurationSettings.AppSettings["UseDB"] != "false")
  261. habits = Gap.Bll.BritishGas.Habits.Get(schoolId, className, start, end);
  262. if (habits != null)
  263. {
  264. Habits tmp = new Habits();
  265. tmp.SchoolId = habits.SchoolId;
  266. tmp.ClassName = habits.ClassName;
  267. tmp.Start = habits.Start;
  268. tmp.End = habits.End;
  269. tmp.LightBulbsTotal = habits.LightBulbsTotal;
  270. tmp.LightBulbsLeftOn = habits.LightBulbsLeftOn;
  271. tmp.MonitorsTotal = habits.MonitorsTotal;
  272. tmp.MonitorsLeftOn = habits.MonitorsLeftOn;
  273. tmp.ComputersTotal = habits.ComputersTotal;
  274. tmp.ComputersLeftOn = habits.ComputersLeftOn;
  275. tmp.PrintersTotal = habits.PrintersTotal;
  276. tmp.PrintersLeftOn = habits.PrintersLeftOn;
  277. tmp.WhiteBoardsTotal = habits.WhiteBoardsTotal;
  278. tmp.WhiteBoardsLeftOn = habits.WhiteBoardsLeftOn;
  279. tmp.DeskLampsTotal = habits.DeskLampsTotal;
  280. tmp.DeskLampsLeftOn = habits.DeskLampsLeftOn;
  281. tmp.TelevisionsTotal = habits.TelevisionsTotal;
  282. tmp.TelevisionsLeftOn = habits.TelevisionsLeftOn;
  283. tmp.DVDsTotal = habits.DVDsTotal;
  284. tmp.DVDsLeftOn = habits.DVDsLeftOn;
  285. tmp.SickRoomAverage = habits.SickRoomAverage;
  286. tmp.ClassRoomAverage = habits.ClassRoomAverage;
  287. tmp.HallsAverage = habits.HallsAverage;
  288. tmp.WaterAverage = habits.WaterAverage;
  289. tmp.HeatingOn = habits.HeatingOn;
  290. tmp.WindowsTotal = habits.WindowsTotal;
  291. tmp.WindowsOpen = habits.WindowsOpen;
  292. tmp.InternalDoorsTotal = habits.InternalDoorsTotal;
  293. tmp.InternalDoorsOpen = habits.InternalDoorsOpen;
  294. tmp.ExternalDoorsTotal = habits.ExternalDoorsTotal;
  295. tmp.ExternalDoorsOpen = habits.ExternalDoorsOpen;
  296. tmp.RadiatorsTotal = habits.RadiatorsTotal;
  297. tmp.RadiatorsObstructed = habits.RadiatorsObstructed;
  298. return tmp;
  299. }
  300. else
  301. {
  302. return null;
  303. }
  304. }
  305. }
  306. }