PageRenderTime 61ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/edit_tickets.php

https://bitbucket.org/yourphppro/phpscratchandwin
PHP | 882 lines | 730 code | 78 blank | 74 comment | 173 complexity | ed36d36dfb795c9ea530e0be1efda02b MD5 | raw file
Possible License(s): GPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /*
  3. ##############################################################################
  4. # PHP Scratch And Win Version 4.04 #
  5. # Copyright 2012 www.YourPHPPro.com #
  6. # #
  7. # For questions concerning licensing, please read license.txt #
  8. ##############################################################################
  9. */
  10. //Include Common Files @1-23DF6421
  11. define("RelativePath", "..");
  12. define("PathToCurrentPage", "/admin/");
  13. define("FileName", "edit_tickets.php");
  14. include_once(RelativePath . "/Common.php");
  15. include_once(RelativePath . "/Template.php");
  16. include_once(RelativePath . "/Sorter.php");
  17. include_once(RelativePath . "/Navigator.php");
  18. //End Include Common Files
  19. //Include Page implementation @28-47CFCC1A
  20. include_once(RelativePath . "/admin/header.php");
  21. //End Include Page implementation
  22. class clsRecordEditTickets { //EditTickets Class @2-20E58353
  23. //Variables @2-9E315808
  24. // Public variables
  25. public $ComponentType = "Record";
  26. public $ComponentName;
  27. public $Parent;
  28. public $HTMLFormAction;
  29. public $PressedButton;
  30. public $Errors;
  31. public $ErrorBlock;
  32. public $FormSubmitted;
  33. public $FormEnctype;
  34. public $Visible;
  35. public $IsEmpty;
  36. public $CCSEvents = "";
  37. public $CCSEventResult;
  38. public $RelativePath = "";
  39. public $InsertAllowed = false;
  40. public $UpdateAllowed = false;
  41. public $DeleteAllowed = false;
  42. public $ReadAllowed = false;
  43. public $EditMode = false;
  44. public $ds;
  45. public $DataSource;
  46. public $ValidatingControls;
  47. public $Controls;
  48. public $Attributes;
  49. // Class variables
  50. //End Variables
  51. //Class_Initialize Event @2-01C1789F
  52. function clsRecordEditTickets($RelativePath, & $Parent)
  53. {
  54. global $FileName;
  55. global $CCSLocales;
  56. global $DefaultDateFormat;
  57. $this->Visible = true;
  58. $this->Parent = & $Parent;
  59. $this->RelativePath = $RelativePath;
  60. $this->Errors = new clsErrors();
  61. $this->ErrorBlock = "Record EditTickets/Error";
  62. $this->DataSource = new clsEditTicketsDataSource($this);
  63. $this->ds = & $this->DataSource;
  64. $this->InsertAllowed = true;
  65. $this->UpdateAllowed = true;
  66. $this->DeleteAllowed = true;
  67. $this->ReadAllowed = true;
  68. if($this->Visible)
  69. {
  70. $this->ComponentName = "EditTickets";
  71. $this->Attributes = new clsAttributes($this->ComponentName . ":");
  72. $CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
  73. if(sizeof($CCSForm) == 1)
  74. $CCSForm[1] = "";
  75. list($FormName, $FormMethod) = $CCSForm;
  76. $this->EditMode = ($FormMethod == "Edit");
  77. $this->FormEnctype = "application/x-www-form-urlencoded";
  78. $this->FormSubmitted = ($FormName == $this->ComponentName);
  79. $Method = $this->FormSubmitted ? ccsPost : ccsGet;
  80. $this->Ticket_Email_Address = new clsControl(ccsTextBox, "Ticket_Email_Address", "Email Address", ccsText, "", CCGetRequestParam("Ticket_Email_Address", $Method, NULL), $this);
  81. $this->Ticket_Email_Address->Required = true;
  82. $this->Ticket_DrawDate = new clsControl(ccsTextBox, "Ticket_DrawDate", "Draw Date", ccsDate, array("GeneralDate"), CCGetRequestParam("Ticket_DrawDate", $Method, NULL), $this);
  83. $this->Ticket_DrawDate->Required = true;
  84. $this->DatePicker_Ticket_DrawDate = new clsDatePicker("DatePicker_Ticket_DrawDate", "EditTickets", "Ticket_DrawDate", $this);
  85. $this->Ticket_Number_1 = new clsControl(ccsTextBox, "Ticket_Number_1", "Number 1", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), CCGetRequestParam("Ticket_Number_1", $Method, NULL), $this);
  86. $this->Ticket_Number_1->Required = true;
  87. $this->Ticket_Number_2 = new clsControl(ccsTextBox, "Ticket_Number_2", "Number 2", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), CCGetRequestParam("Ticket_Number_2", $Method, NULL), $this);
  88. $this->Ticket_Number_2->Required = true;
  89. $this->Ticket_Pick_1 = new clsControl(ccsTextBox, "Ticket_Pick_1", "Pick 1", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), CCGetRequestParam("Ticket_Pick_1", $Method, NULL), $this);
  90. $this->Ticket_Pick_1->Required = true;
  91. $this->Ticket_Pick_2 = new clsControl(ccsTextBox, "Ticket_Pick_2", "Pick 2", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), CCGetRequestParam("Ticket_Pick_2", $Method, NULL), $this);
  92. $this->Ticket_Pick_2->Required = true;
  93. $this->Ticket_Pick_3 = new clsControl(ccsTextBox, "Ticket_Pick_3", "Pick 3", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), CCGetRequestParam("Ticket_Pick_3", $Method, NULL), $this);
  94. $this->Ticket_Pick_3->Required = true;
  95. $this->Ticket_Pick_4 = new clsControl(ccsTextBox, "Ticket_Pick_4", "Pick 4", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), CCGetRequestParam("Ticket_Pick_4", $Method, NULL), $this);
  96. $this->Ticket_Pick_4->Required = true;
  97. $this->Ticket_Show_1 = new clsControl(ccsRadioButton, "Ticket_Show_1", "Show 1", ccsText, "", CCGetRequestParam("Ticket_Show_1", $Method, NULL), $this);
  98. $this->Ticket_Show_1->DSType = dsListOfValues;
  99. $this->Ticket_Show_1->Values = array(array("Yes", "Yes"), array("No", "No"));
  100. $this->Ticket_Show_1->HTML = true;
  101. $this->Ticket_Show_1->Required = true;
  102. $this->Ticket_Show_2 = new clsControl(ccsRadioButton, "Ticket_Show_2", "Show 2", ccsText, "", CCGetRequestParam("Ticket_Show_2", $Method, NULL), $this);
  103. $this->Ticket_Show_2->DSType = dsListOfValues;
  104. $this->Ticket_Show_2->Values = array(array("Yes", "Yes"), array("No", "No"));
  105. $this->Ticket_Show_2->HTML = true;
  106. $this->Ticket_Show_2->Required = true;
  107. $this->Ticket_Show_3 = new clsControl(ccsRadioButton, "Ticket_Show_3", "Show 3", ccsText, "", CCGetRequestParam("Ticket_Show_3", $Method, NULL), $this);
  108. $this->Ticket_Show_3->DSType = dsListOfValues;
  109. $this->Ticket_Show_3->Values = array(array("Yes", "Yes"), array("No", "No"));
  110. $this->Ticket_Show_3->HTML = true;
  111. $this->Ticket_Show_3->Required = true;
  112. $this->Ticket_Show_4 = new clsControl(ccsRadioButton, "Ticket_Show_4", "Show 4", ccsText, "", CCGetRequestParam("Ticket_Show_4", $Method, NULL), $this);
  113. $this->Ticket_Show_4->DSType = dsListOfValues;
  114. $this->Ticket_Show_4->Values = array(array("Yes", "Yes"), array("No", "No"));
  115. $this->Ticket_Show_4->HTML = true;
  116. $this->Ticket_Show_4->Required = true;
  117. $this->Button_Insert = new clsButton("Button_Insert", $Method, $this);
  118. $this->Button_Update = new clsButton("Button_Update", $Method, $this);
  119. $this->Button_Delete = new clsButton("Button_Delete", $Method, $this);
  120. $this->Ticket_SerialNumber = new clsControl(ccsTextBox, "Ticket_SerialNumber", "Ticket Serial Number", ccsText, "", CCGetRequestParam("Ticket_SerialNumber", $Method, NULL), $this);
  121. $this->Ticket_Played = new clsControl(ccsRadioButton, "Ticket_Played", "Played", ccsText, "", CCGetRequestParam("Ticket_Played", $Method, NULL), $this);
  122. $this->Ticket_Played->DSType = dsListOfValues;
  123. $this->Ticket_Played->Values = array(array("Yes", "Yes"), array("No", "No"));
  124. $this->Ticket_Played->HTML = true;
  125. $this->Ticket_Played->Required = true;
  126. $this->Ticket_Winner = new clsControl(ccsRadioButton, "Ticket_Winner", "Winner", ccsText, "", CCGetRequestParam("Ticket_Winner", $Method, NULL), $this);
  127. $this->Ticket_Winner->DSType = dsListOfValues;
  128. $this->Ticket_Winner->Values = array(array("Yes", "Yes"), array("No", "No"));
  129. $this->Ticket_Winner->HTML = true;
  130. $this->Ticket_Winner->Required = true;
  131. $this->Ticket_IPAddress = new clsControl(ccsTextBox, "Ticket_IPAddress", "IP Address", ccsText, "", CCGetRequestParam("Ticket_IPAddress", $Method, NULL), $this);
  132. $this->Ticket_IPAddress->Required = true;
  133. if(!$this->FormSubmitted) {
  134. if(!is_array($this->Ticket_DrawDate->Value) && !strlen($this->Ticket_DrawDate->Value) && $this->Ticket_DrawDate->Value !== false)
  135. $this->Ticket_DrawDate->SetValue(time());
  136. }
  137. }
  138. }
  139. //End Class_Initialize Event
  140. //Initialize Method @2-E39BA32D
  141. function Initialize()
  142. {
  143. if(!$this->Visible)
  144. return;
  145. $this->DataSource->Parameters["urlTicket_ID"] = CCGetFromGet("Ticket_ID", NULL);
  146. }
  147. //End Initialize Method
  148. //Validate Method @2-D20DC42B
  149. function Validate()
  150. {
  151. global $CCSLocales;
  152. $Validation = true;
  153. $Where = "";
  154. $Validation = ($this->Ticket_Email_Address->Validate() && $Validation);
  155. $Validation = ($this->Ticket_DrawDate->Validate() && $Validation);
  156. $Validation = ($this->Ticket_Number_1->Validate() && $Validation);
  157. $Validation = ($this->Ticket_Number_2->Validate() && $Validation);
  158. $Validation = ($this->Ticket_Pick_1->Validate() && $Validation);
  159. $Validation = ($this->Ticket_Pick_2->Validate() && $Validation);
  160. $Validation = ($this->Ticket_Pick_3->Validate() && $Validation);
  161. $Validation = ($this->Ticket_Pick_4->Validate() && $Validation);
  162. $Validation = ($this->Ticket_Show_1->Validate() && $Validation);
  163. $Validation = ($this->Ticket_Show_2->Validate() && $Validation);
  164. $Validation = ($this->Ticket_Show_3->Validate() && $Validation);
  165. $Validation = ($this->Ticket_Show_4->Validate() && $Validation);
  166. $Validation = ($this->Ticket_SerialNumber->Validate() && $Validation);
  167. $Validation = ($this->Ticket_Played->Validate() && $Validation);
  168. $Validation = ($this->Ticket_Winner->Validate() && $Validation);
  169. $Validation = ($this->Ticket_IPAddress->Validate() && $Validation);
  170. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
  171. $Validation = $Validation && ($this->Ticket_Email_Address->Errors->Count() == 0);
  172. $Validation = $Validation && ($this->Ticket_DrawDate->Errors->Count() == 0);
  173. $Validation = $Validation && ($this->Ticket_Number_1->Errors->Count() == 0);
  174. $Validation = $Validation && ($this->Ticket_Number_2->Errors->Count() == 0);
  175. $Validation = $Validation && ($this->Ticket_Pick_1->Errors->Count() == 0);
  176. $Validation = $Validation && ($this->Ticket_Pick_2->Errors->Count() == 0);
  177. $Validation = $Validation && ($this->Ticket_Pick_3->Errors->Count() == 0);
  178. $Validation = $Validation && ($this->Ticket_Pick_4->Errors->Count() == 0);
  179. $Validation = $Validation && ($this->Ticket_Show_1->Errors->Count() == 0);
  180. $Validation = $Validation && ($this->Ticket_Show_2->Errors->Count() == 0);
  181. $Validation = $Validation && ($this->Ticket_Show_3->Errors->Count() == 0);
  182. $Validation = $Validation && ($this->Ticket_Show_4->Errors->Count() == 0);
  183. $Validation = $Validation && ($this->Ticket_SerialNumber->Errors->Count() == 0);
  184. $Validation = $Validation && ($this->Ticket_Played->Errors->Count() == 0);
  185. $Validation = $Validation && ($this->Ticket_Winner->Errors->Count() == 0);
  186. $Validation = $Validation && ($this->Ticket_IPAddress->Errors->Count() == 0);
  187. return (($this->Errors->Count() == 0) && $Validation);
  188. }
  189. //End Validate Method
  190. //CheckErrors Method @2-0CE4A6F3
  191. function CheckErrors()
  192. {
  193. $errors = false;
  194. $errors = ($errors || $this->Ticket_Email_Address->Errors->Count());
  195. $errors = ($errors || $this->Ticket_DrawDate->Errors->Count());
  196. $errors = ($errors || $this->DatePicker_Ticket_DrawDate->Errors->Count());
  197. $errors = ($errors || $this->Ticket_Number_1->Errors->Count());
  198. $errors = ($errors || $this->Ticket_Number_2->Errors->Count());
  199. $errors = ($errors || $this->Ticket_Pick_1->Errors->Count());
  200. $errors = ($errors || $this->Ticket_Pick_2->Errors->Count());
  201. $errors = ($errors || $this->Ticket_Pick_3->Errors->Count());
  202. $errors = ($errors || $this->Ticket_Pick_4->Errors->Count());
  203. $errors = ($errors || $this->Ticket_Show_1->Errors->Count());
  204. $errors = ($errors || $this->Ticket_Show_2->Errors->Count());
  205. $errors = ($errors || $this->Ticket_Show_3->Errors->Count());
  206. $errors = ($errors || $this->Ticket_Show_4->Errors->Count());
  207. $errors = ($errors || $this->Ticket_SerialNumber->Errors->Count());
  208. $errors = ($errors || $this->Ticket_Played->Errors->Count());
  209. $errors = ($errors || $this->Ticket_Winner->Errors->Count());
  210. $errors = ($errors || $this->Ticket_IPAddress->Errors->Count());
  211. $errors = ($errors || $this->Errors->Count());
  212. $errors = ($errors || $this->DataSource->Errors->Count());
  213. return $errors;
  214. }
  215. //End CheckErrors Method
  216. //Operation Method @2-475C577F
  217. function Operation()
  218. {
  219. if(!$this->Visible)
  220. return;
  221. global $Redirect;
  222. global $FileName;
  223. $this->DataSource->Prepare();
  224. if(!$this->FormSubmitted) {
  225. $this->EditMode = $this->DataSource->AllParametersSet;
  226. return;
  227. }
  228. if($this->FormSubmitted) {
  229. $this->PressedButton = $this->EditMode ? "Button_Update" : "Button_Insert";
  230. if($this->Button_Insert->Pressed) {
  231. $this->PressedButton = "Button_Insert";
  232. } else if($this->Button_Update->Pressed) {
  233. $this->PressedButton = "Button_Update";
  234. } else if($this->Button_Delete->Pressed) {
  235. $this->PressedButton = "Button_Delete";
  236. }
  237. }
  238. $Redirect = "list_tickets.php" . "?" . CCGetQueryString("QueryString", array("ccsForm"));
  239. if($this->PressedButton == "Button_Delete") {
  240. if(!CCGetEvent($this->Button_Delete->CCSEvents, "OnClick", $this->Button_Delete) || !$this->DeleteRow()) {
  241. $Redirect = "";
  242. }
  243. } else if($this->Validate()) {
  244. if($this->PressedButton == "Button_Insert") {
  245. if(!CCGetEvent($this->Button_Insert->CCSEvents, "OnClick", $this->Button_Insert) || !$this->InsertRow()) {
  246. $Redirect = "";
  247. }
  248. } else if($this->PressedButton == "Button_Update") {
  249. if(!CCGetEvent($this->Button_Update->CCSEvents, "OnClick", $this->Button_Update) || !$this->UpdateRow()) {
  250. $Redirect = "";
  251. }
  252. }
  253. } else {
  254. $Redirect = "";
  255. }
  256. if ($Redirect)
  257. $this->DataSource->close();
  258. }
  259. //End Operation Method
  260. //InsertRow Method @2-256545D2
  261. function InsertRow()
  262. {
  263. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this);
  264. if(!$this->InsertAllowed) return false;
  265. $this->DataSource->Ticket_Email_Address->SetValue($this->Ticket_Email_Address->GetValue(true));
  266. $this->DataSource->Ticket_DrawDate->SetValue($this->Ticket_DrawDate->GetValue(true));
  267. $this->DataSource->Ticket_Number_1->SetValue($this->Ticket_Number_1->GetValue(true));
  268. $this->DataSource->Ticket_Number_2->SetValue($this->Ticket_Number_2->GetValue(true));
  269. $this->DataSource->Ticket_Pick_1->SetValue($this->Ticket_Pick_1->GetValue(true));
  270. $this->DataSource->Ticket_Pick_2->SetValue($this->Ticket_Pick_2->GetValue(true));
  271. $this->DataSource->Ticket_Pick_3->SetValue($this->Ticket_Pick_3->GetValue(true));
  272. $this->DataSource->Ticket_Pick_4->SetValue($this->Ticket_Pick_4->GetValue(true));
  273. $this->DataSource->Ticket_Show_1->SetValue($this->Ticket_Show_1->GetValue(true));
  274. $this->DataSource->Ticket_Show_2->SetValue($this->Ticket_Show_2->GetValue(true));
  275. $this->DataSource->Ticket_Show_3->SetValue($this->Ticket_Show_3->GetValue(true));
  276. $this->DataSource->Ticket_Show_4->SetValue($this->Ticket_Show_4->GetValue(true));
  277. $this->DataSource->Ticket_SerialNumber->SetValue($this->Ticket_SerialNumber->GetValue(true));
  278. $this->DataSource->Ticket_Played->SetValue($this->Ticket_Played->GetValue(true));
  279. $this->DataSource->Ticket_Winner->SetValue($this->Ticket_Winner->GetValue(true));
  280. $this->DataSource->Ticket_IPAddress->SetValue($this->Ticket_IPAddress->GetValue(true));
  281. $this->DataSource->Insert();
  282. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this);
  283. return (!$this->CheckErrors());
  284. }
  285. //End InsertRow Method
  286. //UpdateRow Method @2-C1AB2A1C
  287. function UpdateRow()
  288. {
  289. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this);
  290. if(!$this->UpdateAllowed) return false;
  291. $this->DataSource->Ticket_Email_Address->SetValue($this->Ticket_Email_Address->GetValue(true));
  292. $this->DataSource->Ticket_DrawDate->SetValue($this->Ticket_DrawDate->GetValue(true));
  293. $this->DataSource->Ticket_Number_1->SetValue($this->Ticket_Number_1->GetValue(true));
  294. $this->DataSource->Ticket_Number_2->SetValue($this->Ticket_Number_2->GetValue(true));
  295. $this->DataSource->Ticket_Pick_1->SetValue($this->Ticket_Pick_1->GetValue(true));
  296. $this->DataSource->Ticket_Pick_2->SetValue($this->Ticket_Pick_2->GetValue(true));
  297. $this->DataSource->Ticket_Pick_3->SetValue($this->Ticket_Pick_3->GetValue(true));
  298. $this->DataSource->Ticket_Pick_4->SetValue($this->Ticket_Pick_4->GetValue(true));
  299. $this->DataSource->Ticket_Show_1->SetValue($this->Ticket_Show_1->GetValue(true));
  300. $this->DataSource->Ticket_Show_2->SetValue($this->Ticket_Show_2->GetValue(true));
  301. $this->DataSource->Ticket_Show_3->SetValue($this->Ticket_Show_3->GetValue(true));
  302. $this->DataSource->Ticket_Show_4->SetValue($this->Ticket_Show_4->GetValue(true));
  303. $this->DataSource->Ticket_SerialNumber->SetValue($this->Ticket_SerialNumber->GetValue(true));
  304. $this->DataSource->Ticket_Played->SetValue($this->Ticket_Played->GetValue(true));
  305. $this->DataSource->Ticket_Winner->SetValue($this->Ticket_Winner->GetValue(true));
  306. $this->DataSource->Ticket_IPAddress->SetValue($this->Ticket_IPAddress->GetValue(true));
  307. $this->DataSource->Update();
  308. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate", $this);
  309. return (!$this->CheckErrors());
  310. }
  311. //End UpdateRow Method
  312. //DeleteRow Method @2-299D98C3
  313. function DeleteRow()
  314. {
  315. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeDelete", $this);
  316. if(!$this->DeleteAllowed) return false;
  317. $this->DataSource->Delete();
  318. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterDelete", $this);
  319. return (!$this->CheckErrors());
  320. }
  321. //End DeleteRow Method
  322. //Show Method @2-BC12677D
  323. function Show()
  324. {
  325. global $CCSUseAmp;
  326. $Tpl = & CCGetTemplate($this);
  327. global $FileName;
  328. global $CCSLocales;
  329. $Error = "";
  330. if(!$this->Visible)
  331. return;
  332. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
  333. $this->Ticket_Show_1->Prepare();
  334. $this->Ticket_Show_2->Prepare();
  335. $this->Ticket_Show_3->Prepare();
  336. $this->Ticket_Show_4->Prepare();
  337. $this->Ticket_Played->Prepare();
  338. $this->Ticket_Winner->Prepare();
  339. $RecordBlock = "Record " . $this->ComponentName;
  340. $ParentPath = $Tpl->block_path;
  341. $Tpl->block_path = $ParentPath . "/" . $RecordBlock;
  342. $this->EditMode = $this->EditMode && $this->ReadAllowed;
  343. if($this->EditMode) {
  344. if($this->DataSource->Errors->Count()){
  345. $this->Errors->AddErrors($this->DataSource->Errors);
  346. $this->DataSource->Errors->clear();
  347. }
  348. $this->DataSource->Open();
  349. if($this->DataSource->Errors->Count() == 0 && $this->DataSource->next_record()) {
  350. $this->DataSource->SetValues();
  351. if(!$this->FormSubmitted){
  352. $this->Ticket_Email_Address->SetValue($this->DataSource->Ticket_Email_Address->GetValue());
  353. $this->Ticket_DrawDate->SetValue($this->DataSource->Ticket_DrawDate->GetValue());
  354. $this->Ticket_Number_1->SetValue($this->DataSource->Ticket_Number_1->GetValue());
  355. $this->Ticket_Number_2->SetValue($this->DataSource->Ticket_Number_2->GetValue());
  356. $this->Ticket_Pick_1->SetValue($this->DataSource->Ticket_Pick_1->GetValue());
  357. $this->Ticket_Pick_2->SetValue($this->DataSource->Ticket_Pick_2->GetValue());
  358. $this->Ticket_Pick_3->SetValue($this->DataSource->Ticket_Pick_3->GetValue());
  359. $this->Ticket_Pick_4->SetValue($this->DataSource->Ticket_Pick_4->GetValue());
  360. $this->Ticket_Show_1->SetValue($this->DataSource->Ticket_Show_1->GetValue());
  361. $this->Ticket_Show_2->SetValue($this->DataSource->Ticket_Show_2->GetValue());
  362. $this->Ticket_Show_3->SetValue($this->DataSource->Ticket_Show_3->GetValue());
  363. $this->Ticket_Show_4->SetValue($this->DataSource->Ticket_Show_4->GetValue());
  364. $this->Ticket_SerialNumber->SetValue($this->DataSource->Ticket_SerialNumber->GetValue());
  365. $this->Ticket_Played->SetValue($this->DataSource->Ticket_Played->GetValue());
  366. $this->Ticket_Winner->SetValue($this->DataSource->Ticket_Winner->GetValue());
  367. $this->Ticket_IPAddress->SetValue($this->DataSource->Ticket_IPAddress->GetValue());
  368. }
  369. } else {
  370. $this->EditMode = false;
  371. }
  372. }
  373. if($this->FormSubmitted || $this->CheckErrors()) {
  374. $Error = "";
  375. $Error = ComposeStrings($Error, $this->Ticket_Email_Address->Errors->ToString());
  376. $Error = ComposeStrings($Error, $this->Ticket_DrawDate->Errors->ToString());
  377. $Error = ComposeStrings($Error, $this->DatePicker_Ticket_DrawDate->Errors->ToString());
  378. $Error = ComposeStrings($Error, $this->Ticket_Number_1->Errors->ToString());
  379. $Error = ComposeStrings($Error, $this->Ticket_Number_2->Errors->ToString());
  380. $Error = ComposeStrings($Error, $this->Ticket_Pick_1->Errors->ToString());
  381. $Error = ComposeStrings($Error, $this->Ticket_Pick_2->Errors->ToString());
  382. $Error = ComposeStrings($Error, $this->Ticket_Pick_3->Errors->ToString());
  383. $Error = ComposeStrings($Error, $this->Ticket_Pick_4->Errors->ToString());
  384. $Error = ComposeStrings($Error, $this->Ticket_Show_1->Errors->ToString());
  385. $Error = ComposeStrings($Error, $this->Ticket_Show_2->Errors->ToString());
  386. $Error = ComposeStrings($Error, $this->Ticket_Show_3->Errors->ToString());
  387. $Error = ComposeStrings($Error, $this->Ticket_Show_4->Errors->ToString());
  388. $Error = ComposeStrings($Error, $this->Ticket_SerialNumber->Errors->ToString());
  389. $Error = ComposeStrings($Error, $this->Ticket_Played->Errors->ToString());
  390. $Error = ComposeStrings($Error, $this->Ticket_Winner->Errors->ToString());
  391. $Error = ComposeStrings($Error, $this->Ticket_IPAddress->Errors->ToString());
  392. $Error = ComposeStrings($Error, $this->Errors->ToString());
  393. $Error = ComposeStrings($Error, $this->DataSource->Errors->ToString());
  394. $Tpl->SetVar("Error", $Error);
  395. $Tpl->Parse("Error", false);
  396. }
  397. $CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
  398. $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
  399. $Tpl->SetVar("Action", !$CCSUseAmp ? $this->HTMLFormAction : str_replace("&", "&amp;", $this->HTMLFormAction));
  400. $Tpl->SetVar("HTMLFormName", $this->ComponentName);
  401. $Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
  402. $this->Button_Insert->Visible = !$this->EditMode && $this->InsertAllowed;
  403. $this->Button_Update->Visible = $this->EditMode && $this->UpdateAllowed;
  404. $this->Button_Delete->Visible = $this->EditMode && $this->DeleteAllowed;
  405. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
  406. $this->Attributes->Show();
  407. if(!$this->Visible) {
  408. $Tpl->block_path = $ParentPath;
  409. return;
  410. }
  411. $this->Ticket_Email_Address->Show();
  412. $this->Ticket_DrawDate->Show();
  413. $this->DatePicker_Ticket_DrawDate->Show();
  414. $this->Ticket_Number_1->Show();
  415. $this->Ticket_Number_2->Show();
  416. $this->Ticket_Pick_1->Show();
  417. $this->Ticket_Pick_2->Show();
  418. $this->Ticket_Pick_3->Show();
  419. $this->Ticket_Pick_4->Show();
  420. $this->Ticket_Show_1->Show();
  421. $this->Ticket_Show_2->Show();
  422. $this->Ticket_Show_3->Show();
  423. $this->Ticket_Show_4->Show();
  424. $this->Button_Insert->Show();
  425. $this->Button_Update->Show();
  426. $this->Button_Delete->Show();
  427. $this->Ticket_SerialNumber->Show();
  428. $this->Ticket_Played->Show();
  429. $this->Ticket_Winner->Show();
  430. $this->Ticket_IPAddress->Show();
  431. $Tpl->parse();
  432. $Tpl->block_path = $ParentPath;
  433. $this->DataSource->close();
  434. }
  435. //End Show Method
  436. } //End EditTickets Class @2-FCB6E20C
  437. class clsEditTicketsDataSource extends clsDBConnection { //EditTicketsDataSource Class @2-E9D4C3E8
  438. //DataSource Variables @2-42E038EB
  439. public $Parent = "";
  440. public $CCSEvents = "";
  441. public $CCSEventResult;
  442. public $ErrorBlock;
  443. public $CmdExecution;
  444. public $InsertParameters;
  445. public $UpdateParameters;
  446. public $DeleteParameters;
  447. public $wp;
  448. public $AllParametersSet;
  449. // Datasource fields
  450. public $Ticket_Email_Address;
  451. public $Ticket_DrawDate;
  452. public $Ticket_Number_1;
  453. public $Ticket_Number_2;
  454. public $Ticket_Pick_1;
  455. public $Ticket_Pick_2;
  456. public $Ticket_Pick_3;
  457. public $Ticket_Pick_4;
  458. public $Ticket_Show_1;
  459. public $Ticket_Show_2;
  460. public $Ticket_Show_3;
  461. public $Ticket_Show_4;
  462. public $Ticket_SerialNumber;
  463. public $Ticket_Played;
  464. public $Ticket_Winner;
  465. public $Ticket_IPAddress;
  466. //End DataSource Variables
  467. //DataSourceClass_Initialize Event @2-D798E3AA
  468. function clsEditTicketsDataSource(& $Parent)
  469. {
  470. $this->Parent = & $Parent;
  471. $this->ErrorBlock = "Record EditTickets/Error";
  472. $this->Initialize();
  473. $this->Ticket_Email_Address = new clsField("Ticket_Email_Address", ccsText, "");
  474. $this->Ticket_DrawDate = new clsField("Ticket_DrawDate", ccsDate, array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
  475. $this->Ticket_Number_1 = new clsField("Ticket_Number_1", ccsInteger, "");
  476. $this->Ticket_Number_2 = new clsField("Ticket_Number_2", ccsInteger, "");
  477. $this->Ticket_Pick_1 = new clsField("Ticket_Pick_1", ccsInteger, "");
  478. $this->Ticket_Pick_2 = new clsField("Ticket_Pick_2", ccsInteger, "");
  479. $this->Ticket_Pick_3 = new clsField("Ticket_Pick_3", ccsInteger, "");
  480. $this->Ticket_Pick_4 = new clsField("Ticket_Pick_4", ccsInteger, "");
  481. $this->Ticket_Show_1 = new clsField("Ticket_Show_1", ccsText, "");
  482. $this->Ticket_Show_2 = new clsField("Ticket_Show_2", ccsText, "");
  483. $this->Ticket_Show_3 = new clsField("Ticket_Show_3", ccsText, "");
  484. $this->Ticket_Show_4 = new clsField("Ticket_Show_4", ccsText, "");
  485. $this->Ticket_SerialNumber = new clsField("Ticket_SerialNumber", ccsText, "");
  486. $this->Ticket_Played = new clsField("Ticket_Played", ccsText, "");
  487. $this->Ticket_Winner = new clsField("Ticket_Winner", ccsText, "");
  488. $this->Ticket_IPAddress = new clsField("Ticket_IPAddress", ccsText, "");
  489. }
  490. //End DataSourceClass_Initialize Event
  491. //Prepare Method @2-32E90A35
  492. function Prepare()
  493. {
  494. global $CCSLocales;
  495. global $DefaultDateFormat;
  496. $this->wp = new clsSQLParameters($this->ErrorBlock);
  497. $this->wp->AddParameter("1", "urlTicket_ID", ccsInteger, "", "", $this->Parameters["urlTicket_ID"], "", false);
  498. $this->AllParametersSet = $this->wp->AllParamsSet();
  499. $this->wp->Criterion[1] = $this->wp->Operation(opEqual, "Ticket_ID", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
  500. $this->Where =
  501. $this->wp->Criterion[1];
  502. }
  503. //End Prepare Method
  504. //Open Method @2-04C42337
  505. function Open()
  506. {
  507. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
  508. $this->SQL = "SELECT INET_NTOA(Ticket_IPAddress) AS Display_Ticket_IPAddress, Ticket_ID, Ticket_SerialNumber, Ticket_Email_Address, Ticket_IPAddress,\n\n" .
  509. "Ticket_DrawDate, Ticket_Number_1, Ticket_Number_2, Ticket_Pick_1, Ticket_Pick_2, Ticket_Pick_3, Ticket_Pick_4, Ticket_Show_1,\n\n" .
  510. "Ticket_Show_2, Ticket_Show_3, Ticket_Show_4, Ticket_Played, Ticket_Winner, Ticket_Archived \n\n" .
  511. "FROM Tickets {SQL_Where} {SQL_OrderBy}";
  512. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
  513. $this->PageSize = 1;
  514. $this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
  515. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
  516. }
  517. //End Open Method
  518. //SetValues Method @2-B1817024
  519. function SetValues()
  520. {
  521. $this->Ticket_Email_Address->SetDBValue($this->f("Ticket_Email_Address"));
  522. $this->Ticket_DrawDate->SetDBValue(trim($this->f("Ticket_DrawDate")));
  523. $this->Ticket_Number_1->SetDBValue(trim($this->f("Ticket_Number_1")));
  524. $this->Ticket_Number_2->SetDBValue(trim($this->f("Ticket_Number_2")));
  525. $this->Ticket_Pick_1->SetDBValue(trim($this->f("Ticket_Pick_1")));
  526. $this->Ticket_Pick_2->SetDBValue(trim($this->f("Ticket_Pick_2")));
  527. $this->Ticket_Pick_3->SetDBValue(trim($this->f("Ticket_Pick_3")));
  528. $this->Ticket_Pick_4->SetDBValue(trim($this->f("Ticket_Pick_4")));
  529. $this->Ticket_Show_1->SetDBValue($this->f("Ticket_Show_1"));
  530. $this->Ticket_Show_2->SetDBValue($this->f("Ticket_Show_2"));
  531. $this->Ticket_Show_3->SetDBValue($this->f("Ticket_Show_3"));
  532. $this->Ticket_Show_4->SetDBValue($this->f("Ticket_Show_4"));
  533. $this->Ticket_SerialNumber->SetDBValue($this->f("Ticket_SerialNumber"));
  534. $this->Ticket_Played->SetDBValue($this->f("Ticket_Played"));
  535. $this->Ticket_Winner->SetDBValue($this->f("Ticket_Winner"));
  536. $this->Ticket_IPAddress->SetDBValue($this->f("Display_Ticket_IPAddress"));
  537. }
  538. //End SetValues Method
  539. //Insert Method @2-0DB85A9D
  540. function Insert()
  541. {
  542. global $CCSLocales;
  543. global $DefaultDateFormat;
  544. $this->CmdExecution = true;
  545. $this->cp["Ticket_Email_Address"] = new clsSQLParameter("ctrlTicket_Email_Address", ccsText, "", "", $this->Ticket_Email_Address->GetValue(true), "", false, $this->ErrorBlock);
  546. $this->cp["Ticket_DrawDate"] = new clsSQLParameter("ctrlTicket_DrawDate", ccsDate, array("GeneralDate"), array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"), $this->Ticket_DrawDate->GetValue(true), "", false, $this->ErrorBlock);
  547. $this->cp["Ticket_Number_1"] = new clsSQLParameter("ctrlTicket_Number_1", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Number_1->GetValue(true), "", false, $this->ErrorBlock);
  548. $this->cp["Ticket_Number_2"] = new clsSQLParameter("ctrlTicket_Number_2", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Number_2->GetValue(true), "", false, $this->ErrorBlock);
  549. $this->cp["Ticket_Pick_1"] = new clsSQLParameter("ctrlTicket_Pick_1", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_1->GetValue(true), "", false, $this->ErrorBlock);
  550. $this->cp["Ticket_Pick_2"] = new clsSQLParameter("ctrlTicket_Pick_2", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_2->GetValue(true), "", false, $this->ErrorBlock);
  551. $this->cp["Ticket_Pick_3"] = new clsSQLParameter("ctrlTicket_Pick_3", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_3->GetValue(true), "", false, $this->ErrorBlock);
  552. $this->cp["Ticket_Pick_4"] = new clsSQLParameter("ctrlTicket_Pick_4", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_4->GetValue(true), "", false, $this->ErrorBlock);
  553. $this->cp["Ticket_Show_1"] = new clsSQLParameter("ctrlTicket_Show_1", ccsText, "", "", $this->Ticket_Show_1->GetValue(true), "", false, $this->ErrorBlock);
  554. $this->cp["Ticket_Show_2"] = new clsSQLParameter("ctrlTicket_Show_2", ccsText, "", "", $this->Ticket_Show_2->GetValue(true), "", false, $this->ErrorBlock);
  555. $this->cp["Ticket_Show_3"] = new clsSQLParameter("ctrlTicket_Show_3", ccsText, "", "", $this->Ticket_Show_3->GetValue(true), "", false, $this->ErrorBlock);
  556. $this->cp["Ticket_Show_4"] = new clsSQLParameter("ctrlTicket_Show_4", ccsText, "", "", $this->Ticket_Show_4->GetValue(true), "", false, $this->ErrorBlock);
  557. $this->cp["Ticket_SerialNumber"] = new clsSQLParameter("ctrlTicket_SerialNumber", ccsText, "", "", $this->Ticket_SerialNumber->GetValue(true), "", false, $this->ErrorBlock);
  558. $this->cp["Ticket_Played"] = new clsSQLParameter("ctrlTicket_Played", ccsText, "", "", $this->Ticket_Played->GetValue(true), "", false, $this->ErrorBlock);
  559. $this->cp["Ticket_Winner"] = new clsSQLParameter("ctrlTicket_Winner", ccsText, "", "", $this->Ticket_Winner->GetValue(true), "", false, $this->ErrorBlock);
  560. $this->cp["Ticket_IPAddress"] = new clsSQLParameter("ctrlTicket_IPAddress", ccsText, "", "", $this->Ticket_IPAddress->GetValue(true), "", false, $this->ErrorBlock);
  561. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent);
  562. if (!is_null($this->cp["Ticket_Email_Address"]->GetValue()) and !strlen($this->cp["Ticket_Email_Address"]->GetText()) and !is_bool($this->cp["Ticket_Email_Address"]->GetValue()))
  563. $this->cp["Ticket_Email_Address"]->SetValue($this->Ticket_Email_Address->GetValue(true));
  564. if (!is_null($this->cp["Ticket_DrawDate"]->GetValue()) and !strlen($this->cp["Ticket_DrawDate"]->GetText()) and !is_bool($this->cp["Ticket_DrawDate"]->GetValue()))
  565. $this->cp["Ticket_DrawDate"]->SetValue($this->Ticket_DrawDate->GetValue(true));
  566. if (!is_null($this->cp["Ticket_Number_1"]->GetValue()) and !strlen($this->cp["Ticket_Number_1"]->GetText()) and !is_bool($this->cp["Ticket_Number_1"]->GetValue()))
  567. $this->cp["Ticket_Number_1"]->SetValue($this->Ticket_Number_1->GetValue(true));
  568. if (!is_null($this->cp["Ticket_Number_2"]->GetValue()) and !strlen($this->cp["Ticket_Number_2"]->GetText()) and !is_bool($this->cp["Ticket_Number_2"]->GetValue()))
  569. $this->cp["Ticket_Number_2"]->SetValue($this->Ticket_Number_2->GetValue(true));
  570. if (!is_null($this->cp["Ticket_Pick_1"]->GetValue()) and !strlen($this->cp["Ticket_Pick_1"]->GetText()) and !is_bool($this->cp["Ticket_Pick_1"]->GetValue()))
  571. $this->cp["Ticket_Pick_1"]->SetValue($this->Ticket_Pick_1->GetValue(true));
  572. if (!is_null($this->cp["Ticket_Pick_2"]->GetValue()) and !strlen($this->cp["Ticket_Pick_2"]->GetText()) and !is_bool($this->cp["Ticket_Pick_2"]->GetValue()))
  573. $this->cp["Ticket_Pick_2"]->SetValue($this->Ticket_Pick_2->GetValue(true));
  574. if (!is_null($this->cp["Ticket_Pick_3"]->GetValue()) and !strlen($this->cp["Ticket_Pick_3"]->GetText()) and !is_bool($this->cp["Ticket_Pick_3"]->GetValue()))
  575. $this->cp["Ticket_Pick_3"]->SetValue($this->Ticket_Pick_3->GetValue(true));
  576. if (!is_null($this->cp["Ticket_Pick_4"]->GetValue()) and !strlen($this->cp["Ticket_Pick_4"]->GetText()) and !is_bool($this->cp["Ticket_Pick_4"]->GetValue()))
  577. $this->cp["Ticket_Pick_4"]->SetValue($this->Ticket_Pick_4->GetValue(true));
  578. if (!is_null($this->cp["Ticket_Show_1"]->GetValue()) and !strlen($this->cp["Ticket_Show_1"]->GetText()) and !is_bool($this->cp["Ticket_Show_1"]->GetValue()))
  579. $this->cp["Ticket_Show_1"]->SetValue($this->Ticket_Show_1->GetValue(true));
  580. if (!is_null($this->cp["Ticket_Show_2"]->GetValue()) and !strlen($this->cp["Ticket_Show_2"]->GetText()) and !is_bool($this->cp["Ticket_Show_2"]->GetValue()))
  581. $this->cp["Ticket_Show_2"]->SetValue($this->Ticket_Show_2->GetValue(true));
  582. if (!is_null($this->cp["Ticket_Show_3"]->GetValue()) and !strlen($this->cp["Ticket_Show_3"]->GetText()) and !is_bool($this->cp["Ticket_Show_3"]->GetValue()))
  583. $this->cp["Ticket_Show_3"]->SetValue($this->Ticket_Show_3->GetValue(true));
  584. if (!is_null($this->cp["Ticket_Show_4"]->GetValue()) and !strlen($this->cp["Ticket_Show_4"]->GetText()) and !is_bool($this->cp["Ticket_Show_4"]->GetValue()))
  585. $this->cp["Ticket_Show_4"]->SetValue($this->Ticket_Show_4->GetValue(true));
  586. if (!is_null($this->cp["Ticket_SerialNumber"]->GetValue()) and !strlen($this->cp["Ticket_SerialNumber"]->GetText()) and !is_bool($this->cp["Ticket_SerialNumber"]->GetValue()))
  587. $this->cp["Ticket_SerialNumber"]->SetValue($this->Ticket_SerialNumber->GetValue(true));
  588. if (!is_null($this->cp["Ticket_Played"]->GetValue()) and !strlen($this->cp["Ticket_Played"]->GetText()) and !is_bool($this->cp["Ticket_Played"]->GetValue()))
  589. $this->cp["Ticket_Played"]->SetValue($this->Ticket_Played->GetValue(true));
  590. if (!is_null($this->cp["Ticket_Winner"]->GetValue()) and !strlen($this->cp["Ticket_Winner"]->GetText()) and !is_bool($this->cp["Ticket_Winner"]->GetValue()))
  591. $this->cp["Ticket_Winner"]->SetValue($this->Ticket_Winner->GetValue(true));
  592. if (!is_null($this->cp["Ticket_IPAddress"]->GetValue()) and !strlen($this->cp["Ticket_IPAddress"]->GetText()) and !is_bool($this->cp["Ticket_IPAddress"]->GetValue()))
  593. $this->cp["Ticket_IPAddress"]->SetValue($this->Ticket_IPAddress->GetValue(true));
  594. $this->SQL = "INSERT INTO Tickets(Ticket_Email_Address, Ticket_DrawDate, Ticket_Number_1, Ticket_Number_2, Ticket_Pick_1, Ticket_Pick_2, Ticket_Pick_3, Ticket_Pick_4, Ticket_Show_1, Ticket_Show_2, Ticket_Show_3, Ticket_Show_4, Ticket_SerialNumber, Ticket_Played, Ticket_Winner, Ticket_IPAddress) VALUES('" . $this->SQLValue($this->cp["Ticket_Email_Address"]->GetDBValue(), ccsText) . "', '" . $this->SQLValue($this->cp["Ticket_DrawDate"]->GetDBValue(), ccsDate) . "', " . $this->SQLValue($this->cp["Ticket_Number_1"]->GetDBValue(), ccsInteger) . ", " . $this->SQLValue($this->cp["Ticket_Number_2"]->GetDBValue(), ccsInteger) . ", " . $this->SQLValue($this->cp["Ticket_Pick_1"]->GetDBValue(), ccsInteger) . ", " . $this->SQLValue($this->cp["Ticket_Pick_2"]->GetDBValue(), ccsInteger) . ", " . $this->SQLValue($this->cp["Ticket_Pick_3"]->GetDBValue(), ccsInteger) . ", " . $this->SQLValue($this->cp["Ticket_Pick_4"]->GetDBValue(), ccsInteger) . ", '" . $this->SQLValue($this->cp["Ticket_Show_1"]->GetDBValue(), ccsText) . "', '" . $this->SQLValue($this->cp["Ticket_Show_2"]->GetDBValue(), ccsText) . "', '" . $this->SQLValue($this->cp["Ticket_Show_3"]->GetDBValue(), ccsText) . "', '" . $this->SQLValue($this->cp["Ticket_Show_4"]->GetDBValue(), ccsText) . "', '" . $this->SQLValue($this->cp["Ticket_SerialNumber"]->GetDBValue(), ccsText) . "', '" . $this->SQLValue($this->cp["Ticket_Played"]->GetDBValue(), ccsText) . "', '" . $this->SQLValue($this->cp["Ticket_Winner"]->GetDBValue(), ccsText) . "', INET_ATON(" . $this->SQLValue($this->cp["Ticket_IPAddress"]->GetDBValue(), ccsText) . "))";
  595. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert", $this->Parent);
  596. if($this->Errors->Count() == 0 && $this->CmdExecution) {
  597. $this->query($this->SQL);
  598. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert", $this->Parent);
  599. }
  600. }
  601. //End Insert Method
  602. //Update Method @2-D0213EDC
  603. function Update()
  604. {
  605. global $CCSLocales;
  606. global $DefaultDateFormat;
  607. $this->CmdExecution = true;
  608. $Where = "";
  609. $this->cp["Ticket_Email_Address"] = new clsSQLParameter("ctrlTicket_Email_Address", ccsText, "", "", $this->Ticket_Email_Address->GetValue(true), "", false, $this->ErrorBlock);
  610. $this->cp["Ticket_DrawDate"] = new clsSQLParameter("ctrlTicket_DrawDate", ccsDate, array("GeneralDate"), array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"), $this->Ticket_DrawDate->GetValue(true), "", false, $this->ErrorBlock);
  611. $this->cp["Ticket_Number_1"] = new clsSQLParameter("ctrlTicket_Number_1", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Number_1->GetValue(true), "", false, $this->ErrorBlock);
  612. $this->cp["Ticket_Number_2"] = new clsSQLParameter("ctrlTicket_Number_2", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Number_2->GetValue(true), "", false, $this->ErrorBlock);
  613. $this->cp["Ticket_Pick_1"] = new clsSQLParameter("ctrlTicket_Pick_1", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_1->GetValue(true), "", false, $this->ErrorBlock);
  614. $this->cp["Ticket_Pick_2"] = new clsSQLParameter("ctrlTicket_Pick_2", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_2->GetValue(true), "", false, $this->ErrorBlock);
  615. $this->cp["Ticket_Pick_3"] = new clsSQLParameter("ctrlTicket_Pick_3", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_3->GetValue(true), "", false, $this->ErrorBlock);
  616. $this->cp["Ticket_Pick_4"] = new clsSQLParameter("ctrlTicket_Pick_4", ccsInteger, array(False, 0, Null, Null, False, "", "", 1, True, ""), "", $this->Ticket_Pick_4->GetValue(true), "", false, $this->ErrorBlock);
  617. $this->cp["Ticket_Show_1"] = new clsSQLParameter("ctrlTicket_Show_1", ccsText, "", "", $this->Ticket_Show_1->GetValue(true), "", false, $this->ErrorBlock);
  618. $this->cp["Ticket_Show_2"] = new clsSQLParameter("ctrlTicket_Show_2", ccsText, "", "", $this->Ticket_Show_2->GetValue(true), "", false, $this->ErrorBlock);
  619. $this->cp["Ticket_Show_3"] = new clsSQLParameter("ctrlTicket_Show_3", ccsText, "", "", $this->Ticket_Show_3->GetValue(true), "", false, $this->ErrorBlock);
  620. $this->cp["Ticket_Show_4"] = new clsSQLParameter("ctrlTicket_Show_4", ccsText, "", "", $this->Ticket_Show_4->GetValue(true), "", false, $this->ErrorBlock);
  621. $this->cp["Ticket_SerialNumber"] = new clsSQLParameter("ctrlTicket_SerialNumber", ccsText, "", "", $this->Ticket_SerialNumber->GetValue(true), "", false, $this->ErrorBlock);
  622. $this->cp["Ticket_Played"] = new clsSQLParameter("ctrlTicket_Played", ccsText, "", "", $this->Ticket_Played->GetValue(true), "", false, $this->ErrorBlock);
  623. $this->cp["Ticket_Winner"] = new clsSQLParameter("ctrlTicket_Winner", ccsText, "", "", $this->Ticket_Winner->GetValue(true), "", false, $this->ErrorBlock);
  624. $this->cp["Ticket_IPAddress"] = new clsSQLParameter("ctrlTicket_IPAddress", ccsText, "", "", $this->Ticket_IPAddress->GetValue(true), "", false, $this->ErrorBlock);
  625. $this->cp["Ticket_ID"] = new clsSQLParameter("urlTicket_ID", ccsInteger, "", "", CCGetFromGet("Ticket_ID", NULL), 0, false, $this->ErrorBlock);
  626. $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent);
  627. if (!is_null($this->cp["Ticket_Email_Address"]->GetValue()) and !strlen($this->cp["Ticket_Email_Address"]->GetText()) and !is_bool($this->cp["Ticket_Email_Address"]->GetValue()))
  628. $this->cp["Ticket_Email_Address"]->SetValue($this->Ticket_Email_Address->GetValue(true));
  629. if (!is_null($this->cp["Ticket_DrawDate"]->GetValue()) and !strlen($this->cp["Ticket_DrawDate"]->GetText()) and !is_bool($this->cp["Ticket_DrawDate"]->GetValue()))
  630. $this->cp["Ticket_DrawDate"]->SetValue($this->Ticket_DrawDate->GetValue(true));
  631. if (!is_null($this->cp["Ticket_Number_1"]->GetValue()) and !strlen($this->cp["Ticket_Number_1"]->GetText()) and !is_bool($this->cp["Ticket_Number_1"]->GetValue()))
  632. $this->cp["Ticket_Number_1"]->SetValue($this->Ticket_Number_1->GetValue(true));
  633. if (!is_null($this->cp["Ticket_Number_2"]->GetValue()) and !strlen($this->cp["Ticket_Number_2"]->GetText()) and !is_bool($this->cp["Ticket_Number_2"]->GetValue()))
  634. $this->cp["Ticket_Number_2"]->SetValue($this->Ticket_Number_2->GetValue(true));
  635. if (!is_null($this->cp["Ticket_Pick_1"]->GetValue()) and !strlen($this->cp["Ticket_Pick_1"]->GetText()) and !is_bool($this->cp["Ticket_Pick_1"]->GetValue()))
  636. $this->cp["Ticket_Pick_1"]->SetValue($this->Ticket_Pick_1->GetValue(true));
  637. if (!is_null($this->cp["Ticket_Pick_2"]->GetValue()) and !strlen($this->cp["Ticket_Pick_2"]->GetText()) and !is_bool($this->cp["Ticket_Pick_2"]->GetValue()))
  638. $this->cp["Ticket_Pick_2"]->SetValue($this->Ticket_Pick_2->GetValue(true));
  639. if (!is_null($this->cp["Ticket_Pick_3"]->GetValue()) and !strlen($this->cp["Ticket_Pick_3"]->GetText()) and !is_bool($this->cp["Ticket_Pick_3"]->GetValue()))
  640. $this->cp["Ticket_Pick_3"]->SetValue($this->Ticket_Pick_3->GetValue(true));
  641. if (!is_null($this->cp["Ticket_Pick_4"]->GetValue()) and !strlen($this->cp["Ticket_Pick_4"]->GetText()) and !is_bool($this->cp["Ticket_Pick_4"]->GetValue()))
  642. $this->cp["Ticket_Pick_4"]->SetValue($this->Ticket_Pick_4->GetValue(true));
  643. if (!is_null($this->cp["Ticket_Show_1"]->GetValue()) and !strlen($this->cp["Ticket_Show_1"]->GetText()) and !is_bool($this->cp["Ticket_Show_1"]->GetValue()))
  644. $this->cp["Ticket_Show_1"]->SetValue($this->Ticket_Show_1->GetValue(true));
  645. if (!is_null($this->cp["Ticket_Show_2"]->GetValue()) and !strlen($this->cp["Ticket_Show_2"]->GetText()) and !is_bool($this->cp["Ticket_Show_2"]->GetValue()))
  646. $this->cp["Ticket_Show_2"]->SetValue($this->Ticket_Show_2->GetValue(true));
  647. if (!is_null($this->cp["Ticket_Show_3"]->GetValue()) and !strlen($this->cp["Ticket_Show_3"]->GetText()) and !is_bool($this->cp["Ticket_Show_3"]->GetValue()))
  648. $this->cp["Ticket_Show_3"]->SetValue($this->Ticket_Show_3->GetValue(true));
  649. if (!is_null($this->cp["Ticket_Show_4"]->GetValue()) and !strlen($this->cp["Ticket_Show_4"]->GetText()) and !is_bool($this->cp["Ticket_Show_4"]->GetValue()))
  650. $this->cp["Ticket_Show_4"]->SetValue($this->Ticket_Show_4->GetValue(true));
  651. if (!is_null($this->cp["Ticket_SerialNumber"]->GetValue()) and !strlen($this->cp["Ticket_SerialNumber"]->GetText()) and !is_bool($this->cp["Ticket_SerialNumber"]->GetValue()))
  652. $this->cp["Ticket_SerialNumber"]->SetValue($this->Ticket_SerialNumber->GetValue(true));
  653. if (!is_null($this->cp["Ticket_Played"]->GetValue()) and !strlen($this->cp["Ticket_Played"]->GetText()) and !is_bool($this->cp["Ticket_Played"]->GetValue()))
  654. $this->cp["Ticket_Played"]->SetValue($this->Ticket_Played->GetValue(true));
  655. if (!is_null($this->cp["Ticket_Winner"]->GetValue()) and !strlen($this->cp["Ticket_Winner"]->GetText()) and !is_bool($this->cp["Ticket_Winner"]->GetValue()))
  656. $this->cp["Ticket_Winner"]->SetValue($this->Ticket_Winner->GetValue(true));
  657. if (!is_null($this->cp["Ticket_IPAddress"]->GetValue()) and !strlen($this->cp["Ticket_IPAddress"]->GetText()) and !is_bool($this->cp["Ticket_IPAddress"]->GetValue()))
  658. $this->cp["Ticket_IPAddress"]->SetValue($this->Ticket_IPAddress->GetValue(true));
  659. if (!is_null($this->cp["Ticket_ID"]->GetValue()) and !strlen($this->cp["Ticket_ID"]->GetText()) and !is_bool($this->cp["Ticket_ID"]->GetValue()))
  660. $this->cp["Ticket_ID"]->SetText(CCGetFromGet("Ticket_ID", NULL));
  661. if (!strlen($this->cp["Ticket_ID"]->GetText()) and !is_bool($this->cp["Ticket_ID"]->GetValue(true)))
  662. $this->cp["Ticket_ID"]->SetText(0);
  663. $this->SQL = "UPDATE Tickets SET Ticket_Email_Address='" . $this->SQLValue($this->cp["Ticket_Email_Address"]->GetDBValue(), ccsText) . "', Ticket_DrawDate='" . $t

Large files files are truncated, but you can click here to view the full file