Error executing template "Designs/PLC/Forms/Form/VIPActivationFormStep3.cshtml"
System.ArgumentNullException: String reference not set to an instance of a String.
Parameter name: s
at System.DateTime.ParseExact(String s, String format, IFormatProvider provider)
at CompiledRazorTemplates.Dynamic.RazorEngine_01be73b893704fab9c79512a03bd11ca.Execute() in E:\www\uat.petloverscentre.co.th\Solution\Files\Templates\Designs\PLC\Forms\Form\VIPActivationFormStep3.cshtml:line 479
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using DWAPAC.PLC.Services
2 @using System.Web
3 @using Dynamicweb.Security.UserManagement.Common.CustomFields
4 @using Dynamicweb.Security.UserManagement
5 @{
6 string generalPurposeString = string.Empty;
7 }
8 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
9 @*<script src="https://code.jquery.com/jquery-1.12.4.js"></script>*@ @* Closed, because of mobile menu colleption error *@
10 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
11 <script>
12 $( function() {
13 $( "#datepicker" ).datepicker({
14 dateFormat: 'dd-mm-yy',
15 changeYear: true,
16 maxDate : 'now',
17 yearRange: "-120:+0",
18
19 });
20 });
21 </script>
22 <style>
23 .form-control.resetbtn,.form-control.activate{
24 background-color: #662010;
25 color: #fff;
26 }
27
28 .form-control.resetbtn:hover,.form-control.activate:hover{
29 background-color: #ad2c13;
30 }
31
32 label{
33 padding-top: 12px;
34 }
35
36 .ui-dialog-titlebar, .ui-dialog-buttonset button{
37 background:#662010 !important;
38 color: #FFF;
39 }
40 .ui-dialog-titlebar-close{
41 background:#f6f6f6;
42 border: 1px solid #c5c5c5;
43 }
44 .ui-icon-closethick{
45 margin-bottom: 5px;
46 }
47 .ui-dialog-buttonset button:hover{
48 background:#AD2C413 !important;
49 color: #FFF;
50 }
51 .ui-dialog {
52 top: 350px !important;
53 }
54 .ui-dialog-buttonset {
55 width : 97%;
56 }
57 </style>
58 @{
59 string formCssClass = GetString("Form.CssClass");
60 string formSystemFields = GetString("Form.SystemFields");
61 bool formLabelBold = GetBoolean("Form.LabelBold");
62 bool formLabelOverField = GetBoolean("Form.LabelOverField");
63 string formId = GetString("Form.HtmlId");
64 string formOnSubmit = GetString("Form.OnSubmit");
65 string formSpamScript = GetString("Form.SpamScript");
66 string formAction = GetString("Form.Action");
67 int formColumnShiftFormFieldID = GetInteger("Form.ColumnShiftFormFieldID");
68 string formLabelRequired = GetString("Form.LabelRequired");
69
70 int formMaxSubmits = GetInteger("Form.MaxSubmits");
71 int formSubmitCount = GetInteger("Form.SubmitCount");
72 if (formMaxSubmits > 0 && formSubmitCount >= formMaxSubmits)
73 {
74 @GetString("Form.MaxSubmitsReachedText")
75 }
76
77 string dateOfBirth = GetString("Form.Field.DateofBirth.Name");
78 dateOfBirth = dateOfBirth.Replace("\r\n", "");
79
80 string save = Translate("Save");
81 string add = Translate("Add");
82 }
83
84 @{
85 var Firstname = "";
86 var Lastname = "";
87 var EmailAddress = "";
88 var Country = "";
89 var Gender = "";
90 var Marital = "";
91 var Address1 = "";
92 var Address2 = "";
93 var ZipCode = "";
94 var Phone = "";
95 var HouseNumber = "";
96 DateTime birthdate = DateTime.Now;
97 var birthday = "";
98 var Nric = "";
99 var UnitNo = "";
100 var status = "";
101 var userId = "";
102 int customerID = 0;
103 var dob = "";
104 var NRICOnlineUpdate = false;
105
106 string typeofpet = string.Empty;
107 string breed = string.Empty;
108 string petname = string.Empty;
109 string petID = string.Empty;
110 List<int> pId = new List<int>();
111 List<string> petNameList = new List<string>();
112 var regCode = System.Web.HttpContext.Current.Request["RegistrationCode"];
113
114 var vCard1 = System.Web.HttpContext.Current.Request["VIPCardNumber"];
115
116 var mobile = System.Web.HttpContext.Current.Request["Mobile"];
117
118 Firstname = System.Web.HttpContext.Current.Request["Firstname"];
119 Lastname = System.Web.HttpContext.Current.Request["Lastname"];
120 dob = System.Web.HttpContext.Current.Request["DOB"];
121 birthday = System.Web.HttpContext.Current.Request["DOB"];
122 Gender = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["Gender"]) ? "" : System.Web.HttpContext.Current.Request["Gender"];
123 Marital = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["MaritalStatus"]) ? "" : System.Web.HttpContext.Current.Request["MaritalStatus"];
124 EmailAddress = System.Web.HttpContext.Current.Request["Email"];
125 Nric = System.Web.HttpContext.Current.Request["NRIC"];
126 Country = System.Web.HttpContext.Current.Request["Country"];
127 ZipCode = System.Web.HttpContext.Current.Request["PostalCode"];
128 HouseNumber = System.Web.HttpContext.Current.Request["BlockHouseNO"];
129 UnitNo = System.Web.HttpContext.Current.Request["UnitNo"];
130 Address1 = System.Web.HttpContext.Current.Request["Address1"];
131 Address2 = System.Web.HttpContext.Current.Request["Address2"];
132 Phone = System.Web.HttpContext.Current.Request["HomePhoneNo"];
133
134 var submitValue = System.Web.HttpContext.Current.Request["SubmitValue"];
135
136 petID = System.Web.HttpContext.Current.Request["PetID"];
137 typeofpet = System.Web.HttpContext.Current.Request["TypeOfPet"];
138 breed = System.Web.HttpContext.Current.Request["Breed"];
139 petname = System.Web.HttpContext.Current.Request["PetName"];
140
141 List<CustomerPetsInfo> petInfos = new List<CustomerPetsInfo>();
142 if(HttpContext.Current.Session["CustomerPetsInfo"] != null)
143 {
144 petInfos = (List<CustomerPetsInfo>)HttpContext.Current.Session["CustomerPetsInfo"];
145 }
146
147 var soapResponse = "";
148
149 if((CustomerInfo)HttpContext.Current.Session["CustomerInfo"] != null)
150 {
151 CustomerInfo info = (CustomerInfo)HttpContext.Current.Session["CustomerInfo"];
152
153 userId = string.IsNullOrEmpty(info.UID) ? userId : info.UID;
154 customerID = string.IsNullOrEmpty(info.CustomerID.ToString()) ? customerID : info.CustomerID;
155 Firstname = string.IsNullOrEmpty(Firstname) ? info.CustomerFirstName : Firstname;
156 Lastname = string.IsNullOrEmpty(Lastname) ? info.CustomerLastName : Lastname;
157 dob = string.IsNullOrEmpty(dob) ? info.CustomerBirthdate.ToString("dd-MM-yyyy") : dob;
158 birthday = string.IsNullOrEmpty(birthday) ? info.CustomerBirthdate.ToString("dd-MM-yyyy") : birthday;
159 Gender = string.IsNullOrEmpty(Gender) ? (String.IsNullOrEmpty(info.CustomerGender) ? "" : info.CustomerGender) : Gender;
160 Marital = string.IsNullOrEmpty(Marital) ? (String.IsNullOrEmpty(info.CustomerMaritalStatus) ? "" : info.CustomerMaritalStatus) : Marital;
161 EmailAddress = string.IsNullOrEmpty(EmailAddress) ? info.CustomereMail : EmailAddress;
162 Nric = string.IsNullOrEmpty(Nric) ? info.CustomerNRIC : Nric;
163 Country = string.IsNullOrEmpty(Country) ? info.CustomerCountry : Country;
164 ZipCode = string.IsNullOrEmpty(ZipCode) ? info.CustomerPostalCode : ZipCode;
165 HouseNumber = string.IsNullOrEmpty(HouseNumber) ? info.BlockHouseNo : HouseNumber;
166 UnitNo = string.IsNullOrEmpty(UnitNo) ? info.UnitNo : UnitNo;
167 Address1 = string.IsNullOrEmpty(Address1) ? info.CustomerAddr1 : Address1;
168 Address2 = string.IsNullOrEmpty(Address2) ? info.CustomerAddr2 : Address2;
169 Phone = string.IsNullOrEmpty(Phone) ? info.CustomerPhone : Phone;
170 NRICOnlineUpdate = string.IsNullOrEmpty(info.IsNRICOnlineUpdate.ToString()) ? NRICOnlineUpdate : info.IsNRICOnlineUpdate;
171
172 List<CustomerPetsInfo> petInfo = (List<CustomerPetsInfo>)HttpContext.Current.Session["CustomerPetsInfo"];
173
174 if(petInfo != null)
175 {
176 foreach (var pet in petInfo)
177 {
178 petID += pet.ID + "|";
179 typeofpet += pet.TypeOfPet + "|";
180 breed += pet.Breed + "|";
181 petname += pet.Name + "|";
182 pId.Add(pet.ID);
183 petNameList.Add(pet.Name);
184
185 }
186 }
187 }
188 else
189 {
190 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")))
191 {
192
193 int i = Convert.ToInt32(GetGlobalValue("Global:Extranet.UserID"));
194
195 Dynamicweb.Security.UserManagement.User u = Dynamicweb.Security.UserManagement.User.GetUserByID(i);
196
197 Firstname = u.FirstName;
198 Lastname = u.LastName;
199 EmailAddress = u.Email;
200 Country = u.Country;
201 Address1 = u.Address;
202 Address2 = u.Address2;
203 ZipCode = u.Zip;
204 Phone = u.Phone;
205 HouseNumber = u.HouseNumber;
206 status = "readonly";
207 userId = u.ExternalID;
208 customerID = u.ID;
209
210 foreach (CustomFieldValue val in u.CustomFieldValues)
211 {
212 CustomField field = val.CustomField;
213
214 string fieldName = field.Name;
215
216 if(fieldName == "DOB")
217 {
218 birthdate = (DateTime)val.Value;
219 birthday = birthdate.ToString("dd-MM-yyyy");
220 }
221 if(fieldName == "NRIC/FIN")
222 {
223 Nric = (string)val.Value;
224 }
225 if(fieldName == "Floor/Unit No")
226 {
227 UnitNo = (string)val.Value;
228 }
229 }
230 }
231 }
232 List<CustomerPetsInfo> customerpetInfoList = new List<CustomerPetsInfo>();
233
234 if(Firstname != null && Lastname != null && dob != null && submitValue != null)
235 {
236 CustomerInfo customerInfo = new CustomerInfo();
237 customerInfo.CustomerID = customerID;
238 customerInfo.CustomerNRIC = Nric;
239 customerInfo.CustomerLastName = Lastname;
240 customerInfo.CustomerFirstName = Firstname;
241 //customerInfo.CustomerBirthdate = DateTime.Parse(dob);
242 customerInfo.CustomerBirthdate = DateTime.ParseExact(dob, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture);
243 customerInfo.CustomerGender = Gender;
244 customerInfo.CustomerMaritalStatus = Marital;
245 customerInfo.BlockHouseNo = HouseNumber;
246 customerInfo.UnitNo = UnitNo;
247 customerInfo.CustomerAddr1 = Address1;
248 customerInfo.CustomerAddr2 = Address2;
249 customerInfo.CustomerPostalCode = ZipCode;
250 customerInfo.CustomerCountry = Country;
251 customerInfo.CustomerPhone = Phone;
252 customerInfo.CustomereMail = EmailAddress;
253 customerInfo.IsNRICOnlineUpdate = false;
254 customerInfo.UID = userId;
255 customerInfo.CustomerMiddleName = "-";
256
257 petID = System.Web.HttpContext.Current.Request["PetID"];
258 typeofpet = System.Web.HttpContext.Current.Request["TypeOfPet"];
259 breed = System.Web.HttpContext.Current.Request["Breed"];
260 petname = System.Web.HttpContext.Current.Request["PetName"];
261
262 if(petID != null && typeofpet != null && breed != null && petname != null)
263 {
264 var petIdSplit = petID.Split('|');
265 var typeofpetSplit = typeofpet.Split('|');
266 var breedSplit = breed.Split('|');
267 var petnameSplit = petname.Split('|');
268
269 for(var i = 0; i < typeofpetSplit.Length - 1; i++)
270 {
271 CustomerPetsInfo customerPetInfo = new CustomerPetsInfo();
272 customerPetInfo.ID = 0;
273
274 customerPetInfo.CustomerID = customerID;
275 customerPetInfo.ID = Convert.ToInt32(petIdSplit[i]);
276 customerPetInfo.TypeOfPet = typeofpetSplit[i];
277 customerPetInfo.Breed = breedSplit[i];
278 customerPetInfo.Name = petnameSplit[i];
279
280 customerpetInfoList.Add(customerPetInfo);
281 }
282 }
283
284 soapResponse = WebServices.getVIPCardActivationServiceResponse(regCode,vCard1,mobile,customerInfo,customerpetInfoList);
285 <text><script>
286 console.log("@regCode");
287 console.log("@vCard1");
288 console.log("@mobile");
289 console.log("@customerInfo");
290 console.log("@customerpetInfoList");
291 </script></text>
292 }
293
294
295 if(!string.IsNullOrWhiteSpace(soapResponse))
296 {
297 var firstSplit = soapResponse.Split(';');
298
299 if(firstSplit[0].Contains("200"))
300 {
301 if(firstSplit[3].Contains("FAIL"))
302 {
303 <text><script>
304 //alert("@firstSplit[4].Split('=')[1]");
305 //alert("@Translate(firstSplit[4].Split('=')[1])");
306 //alert('@firstSplit[4]');
307 console.log('@firstSplit');
308
309 var NewDialog;
310 NewDialog = $('<div class="popup" title="@Translate("MESSAGE")"> @Translate(firstSplit[4].Split('=')[1]) </div>');
311 NewDialog.dialog({
312 resizable: false,
313 modal: true,
314 show: 'clip',
315 buttons: {
316 "@Translate("Ok")": function() {
317 $(this).dialog("close");
318 }
319 }
320 });
321 </script></text>
322 }
323 else
324 {
325 @*Login User*@
326 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")))
327 {
328 var soapResponse2="";
329 soapResponse2=WebServices.getCheckYourPointsServiceResponse(regCode,vCard1);
330
331 if(!string.IsNullOrWhiteSpace(soapResponse2))
332 {
333 var firstSplit2 = soapResponse2.Split(';');
334 if(firstSplit2[0].Contains("200"))
335 {
336 if(firstSplit2[3].Contains("FAIL"))
337 {
338 <text><script>
339 //alert("@firstSplit2[4].Split('=')[1]")
340 var NewDialog;
341 NewDialog = $('<div class="popup" title="@Translate("MESSAGE")"> @Translate(firstSplit[4].Split('=')[1]) </div>');
342 NewDialog.dialog({
343 resizable: false,
344 modal: true,
345 show: 'clip',
346 buttons: {
347 "@Translate("Ok")": function() {
348 $(this).dialog("close");
349 }
350 }
351 });
352 </script></text>
353 }
354 else
355 {
356 DateTime newVIPExpireDate = DateTime.Now.AddYears(1);
357 try{ newVIPExpireDate = Convert.ToDateTime(firstSplit2[7].Split('=')[1]); }
358 catch { newVIPExpireDate = DateTime.Now.AddYears(1); }
359 <text><script>window.location="/Default.aspx?ID=@GetPageIdByNavigationTag("UpdateVIPCard")&expireDate=@newVIPExpireDate.ToString("dd/MM/yyyy")&vipCard=@(vCard1)&RegCode=@regCode";</script></text>
360 }
361 }
362 else
363 {
364 <text><script>
365 //alert("Connection Error")
366 var NewDialog;
367 NewDialog = $('<div class="popup" title="@Translate("ERROR")"> @Translate("Connection Error.") </div>');
368 NewDialog.dialog({
369 resizable: false,
370 modal: true,
371 show: 'clip',
372 buttons: {
373 "@Translate("Ok")": function() {
374 $(this).dialog("close");
375 }
376 }
377 });
378 </script></text>
379 }
380 }
381 }@* Non Login User*@
382 else
383 {
384 <text><script>
385 //alert("@firstSplit[4].Split('=')[1]");
386 var NewDialog;
387 NewDialog = $('<div class="popup" title="@Translate("MESSAGE")"> @Translate(firstSplit[4].Split('=')[1]) </div>');
388 NewDialog.dialog({
389 resizable: false,
390 modal: true,
391 show: 'clip',
392 buttons: {
393 "@Translate("Register for an Online Account")": function() {
394 window.location='/Default.aspx?ID=@GetPageIdByNavigationTag("Register")';
395 }
396 }
397 });
398 //window.location="Default.aspx?ID=3";
399 </script></text>
400 }
401 }
402 }
403 else
404 {
405 <text><script>
406 //alert("@firstSplit[4].Split('=')[1]")
407 var NewDialog;
408 NewDialog = $('<div class="popup" title="@Translate("MESSAGE")"> @Translate("Connection Error") </div>');
409 NewDialog.dialog({
410 resizable: false,
411 modal: true,
412 show: 'clip',
413 buttons: {
414 "@Translate("Ok")": function() {
415 $(this).dialog("close");
416 }
417 }
418 });
419 </script></text>
420 }
421 }
422 string[] monthNames = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames;
423 string select="";
424 int CurrentYear = DateTime.Today.Year;
425 int NextYear=CurrentYear+50;
426 int PreYear=CurrentYear-100;
427 }
428
429 <div class="dottedBoxGrey form">
430 <form method="POST" class="@formCssClass" id="@formId" onsubmit="return validateForm()">
431 <h2 class="inner-title text-center">@Translate(GetString("Form.Name")) </h2>
432 <input type="text" hidden name="VIPCardNumber" value = '@vCard1'>
433 <input type="text" hidden name="Mobile" value = '@mobile'>
434 <input type="text" hidden name="RegistrationCode" value = '@regCode'>
435 <input type="text" hidden name="CustomField.AccessUser_AccessUser_VIPCardLinkDate" id="CustomField.AccessUser_AccessUser_VIPCardLinkDate" value = ''>
436 @if(Convert.ToInt32(GetGlobalValue("Global:Extranet.UserID")) > 0)
437 {
438 <text>
439 <script>
440 $(document).ready(function(){
441 $('#CustomField.AccessUser_AccessUser_VIPCardLinkDate').val('@DateTime.Now');
442 })
443 </script>
444 </text>
445 }
446 <div class="clearfix"></div>
447 <p>@Translate(GetString("Form.Field.name.Description"))</p>
448 <div class="form-group">
449 <div class="col-xs-4">
450 <label>
451 @Translate(GetString("Form.Field.name.Name"))
452 @if(GetBoolean("Form.Field.name.Required")){<span style="color:red">*</span>}
453 </label>
454 </div>
455 </div>
456 <div class="col-xs-8">
457 <input @status type="text" class="form-control" name="FirstName" id="name" value="@Firstname" required>
458 </div>
459 <div class="form-group">
460 <div class="col-xs-4">
461 <label>
462 @Translate(GetString("Form.Field.lname.Name"))
463 @if(GetBoolean("Form.Field.lname.Required")){<span style="color:red">*</span>}
464 </label>
465 </div>
466 </div>
467 <div class="col-xs-8">
468 <input @status type="text" class="form-control" name="LastName" id="lname" value="@Lastname" required>
469 </div>
470 <div class="form-group cus-dob">
471 <div class="col-xs-4">
472 <label>
473 @{
474 if(birthday == "01-01-001" || birthday == "01-Jan-0001")
475 {
476 birthday = "01-01-1900";
477 }
478 //DateTime dt = DateTime.Parse(birthday);
479 DateTime dt = DateTime.ParseExact(birthday, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture);
480 generalPurposeString = dt.ToString("dd-MM-yyy");
481 }
482 @Translate(dateOfBirth)
483 @if(GetBoolean("Form.Field.DateofBirth.Required")){<span style="color:red">*</span>}
484 </label>
485 </div>
486 <div class="col-xs-8">
487 <input @status type="text" class="form-control" name="DOB" id="datepicker" value="@generalPurposeString" required readonly style="background: #ffffff;">
488 <div class="dob-msg" style="display: none; color: red;">*Applicants must be at least 20 years old at the time of application</div>
489 </div>
490 <p class="help-block"> @Translate(GetString("Form.Field.lname.Description")) </p>
491 </div>
492
493 <div class="form-group" style="display:none;">
494 <div class="col-xs-4">
495 <label>
496 @Translate(GetString("Form.Field.VIPCardLinkDate.Name"))
497 </label>
498 </div>
499 <div class="col-xs-8">
500 <input type="text" class="form-control" name="VIPCardLinkDate" id="VIPCardLinkDate" value="">
501 </div>
502 <p class="help-block"> @Translate(GetString("Form.Field.VIPCardLinkDate.Description")) </p>
503 <div class="clearfix"></div>
504 </div>
505 @if(Convert.ToInt32(GetGlobalValue("Global:Extranet.UserID")) > 0)
506 {
507 <text>
508 <script>
509 $(document).ready(function(){
510 $("#VIPCardLinkDate").val('@DateTime.Now');
511 })
512 </script>
513 </text>
514 }
515 <div class="clearfix"></div>
516 <div class="form-group">
517 <div class="col-xs-4">
518 <label>
519 @Translate(GetString("Form.Field.Gender.Name"))
520 </label>
521 </div>
522 <div class="col-xs-8">
523 @{ generalPurposeString = Gender.ToLower() == "male" ? "checked" : string.Empty; }
524 <input type="radio" id="Gender35" name="Gender" value="Male" @generalPurposeString /> <label for="Gender35">@Translate("Male")</label><br>
525 @{ generalPurposeString = Gender.ToLower() == "female" ? "checked" : string.Empty; }
526 <input type="radio" id="Gender36" name="Gender" value="Female" @generalPurposeString /> <label for="Gender36">@Translate("Female")</label><br>
527 </div>
528 </div>
529 <div class="clearfix"></div>
530 @*<div class="form-group">
531 <div class="col-xs-4">
532 <label>
533 @Translate(GetString("Form.Field.MaritalStatus.Name"))
534 </label>
535 </div>
536 <div class="col-xs-8">
537 @{ generalPurposeString = Marital.ToLower() == "single" ? "checked" : string.Empty; }
538 <input type="radio" id="MaritalStatus37" name="MaritalStatus" value="Single" @generalPurposeString /> <label for="MaritalStatus37">@Translate("Single")</label><br>
539 @{ generalPurposeString = Marital.ToLower() == "married" ? "checked" : string.Empty; }
540 <input type="radio" id="MaritalStatus38" name="MaritalStatus" value="Married" @generalPurposeString /> <label for="MaritalStatus38">@Translate("Married")</label><br>
541 </div>
542 </div>*@
543 <div class="clearfix"></div>
544 <div class="form-group">
545 <div class="col-xs-4">
546 <label>
547 @Translate(GetString("Form.Field.EmailAddress.Name"))
548 </label>
549 </div>
550 <div class="col-xs-8">
551 <input @status type="text" class="form-control" name="Email" id="email" value="@EmailAddress">
552 </div>
553 <p class="help-block"> @Translate(GetString("Form.Field.EmailAddress.Description")) </p>
554 <div class="clearfix"></div>
555 </div>
556 <div class="form-group">
557 <div class="col-xs-4">
558 <label>
559 @Translate(GetString("Form.Field.NRICFIN.Name"))
560 </label>
561 </div>
562 <div class="col-xs-8">
563 <input type="text" class="form-control" name="NRIC" id="nric" value="@Nric">
564 </div>
565 <p class="help-block"> @Translate(GetString("Form.Field.NRICFIN.Description")) </p>
566 <div class="clearfix"></div>
567 </div>
568
569
570 <div class="form-group">
571 <div class="col-xs-4">
572 <label>
573 @Translate(GetString("Form.Field.Country.Name"))
574 </label>
575 </div>
576
577 <div class="col-xs-8">
578 <input @status type="text" class="form-control" name="Country" id="country" value="@Translate("Thailand")">
579 </div>
580 <div class="clearfix"></div>
581 </div>
582 <div class="form-group">
583 <div class="col-xs-4">
584 <label>
585 @Translate(GetString("Form.Field.PostalCode.Name"))
586 </label>
587 </div>
588
589 <div class="col-xs-8">
590 <input @status type="text" class="form-control" name="PostalCode" id="postalcode" value="@ZipCode">
591 </div>
592
593 </div>
594 <div class="clearfix"></div>
595 <div class="form-group">
596 <div class="col-xs-4">
597 <label>
598 @Translate(GetString("Form.Field.BlockHouseNo.Name"))
599 </label>
600 </div>
601
602 <div class="col-xs-8">
603 <input @status type="text" class="form-control" name="BlockHouseNO" id="blockhouse" value="@HouseNumber">
604 </div>
605
606 </div>
607 <div class="clearfix"></div>
608 <div class="form-group">
609 <div class="col-xs-4">
610 <label>
611 @Translate(GetString("Form.Field.UnitNo.Name"))
612 </label>
613 </div>
614
615 <div class="col-xs-8">
616 <input @status type="text" class="form-control" id="UnitNo" name="UnitNo" value="@UnitNo" />
617 </div>
618 <div class="clearfix"></div>
619 </div>
620 <div class="form-group">
621 <div class="col-xs-4">
622 <label>
623 @Translate(GetString("Form.Field.Address1.Name"))
624 </label>
625 </div>
626
627 <div class="col-xs-8">
628 <input @status type="text" class="form-control" id="Address1" name="Address1" value="@Address1"/>
629 </div>
630 <div class="clearfix"></div>
631 </div>
632 <div class="form-group">
633 <div class="col-xs-4">
634 <label>
635 @Translate(GetString("Form.Field.Address2.Name"))
636 </label>
637 </div>
638
639 <div class="col-xs-8">
640 <input @status type="text" class="form-control" id="Address2" name="Address2" value="@Address2"/>
641 </div>
642 <div class="clearfix"></div>
643 </div>
644 <div class="form-group">
645 <div class="col-xs-4">
646 <label>
647 @Translate(GetString("Form.Field.HomePhoneNo.Name"))
648 </label>
649 </div>
650
651 <div class="col-xs-8">
652 <input @status type="text" class="form-control" id="HomePhoneNo" name="HomePhoneNo" value="@Phone" />
653 <input type="text" style="display:none" class="form-control" id="SubmitValue" name="SubmitValue" value="true" />
654 </div>
655 <div class="clearfix"></div>
656 </div>
657
658 <div class="form-group">
659 <div class="col-xs-4">
660 <label>
661 @Translate(GetString("Form.Field.TypeOfPet.Name"))
662 </label>
663 </div>
664 <div class="col-xs-8">
665 <select id="TypeOfPet" name="TypeOfPetSelect" class="form-control">
666 <option value="">----@Translate("Please Select")-------</option>
667 <option value="@Translate("Dog")">@Translate("Dog")</option>
668 <option value="@Translate("Cat")">@Translate("Cat")</option>
669 <option value="@Translate("Fish")">@Translate("Fish")</option>
670 <option value="@Translate("Rabbit")">@Translate("Rabbit")</option>
671 <option value="@Translate("Hamster")">@Translate("Hamster")</option>
672 <option value="@Translate("Reptile")">@Translate("Reptile")</option>
673 <option value="@Translate("Bird")">@Translate("Bird")</option>
674 <option value="@Translate("Turtle")">@Translate("Turtle")</option>
675 <option value="@Translate("Chinchilla")">@Translate("Chinchilla")</option>
676 <option value="@Translate("Guinea Pig")">@Translate("Guinea Pig")</option>
677 <option value="@Translate("Other")">@Translate("Other")</option>
678 </select>
679 <input hidden type="text" name="TypeOfPet" id="typeOfPetText" value="@typeofpet"/>
680 </div>
681 <div class="clearfix"></div>
682 </div>
683 <div class="form-group">
684 <div class="col-xs-4">
685 <label>
686 @Translate(GetString("Form.Field.Breed.Name"))
687 </label>
688 </div>
689
690 <div class="col-xs-8">
691 <input type="text" class="form-control" id="Breed" />
692 <input style="display:none" type="text" class="form-control" id="BreedText" name="Breed" value="@breed"/>
693 <input style="display:none" type="text" class="form-control" id="PetIDText" name="PetID" value="@petID"/>
694 </div>
695 <div class="clearfix"></div>
696 </div>
697 <div class="form-group">
698 <div class="col-xs-4">
699 <label>
700 @Translate(GetString("Form.Field.PetName.Name"))
701 </label>
702 </div>
703 <div class="col-xs-8">
704 <input type="text" class="form-control" id="PetName" />
705 <input style="display:none" type="text" class="form-control" id="PetNameText" name="PetName" value="@petname" />
706 </div>
707 <div class="clearfix"></div>
708 </div>
709
710 <div class="form-group">
711 <div class="col-xs-4"></div>
712 <div class="col-xs-8">
713 <div class="col-xs-4"><input type="button" class="form-control submitbtn" id="SaveAdd" name="SaveAdd" value="@save & @add" /></div>
714 <div class="col-xs-4"><input type="reset" class="form-control resetbtn" id="Reset" name="Reset" value="@Translate("Reset")" /></div>
715 </div>
716 <div class="clearfix"></div>
717 </div>
718 <div>
719 </div>
720 @{ generalPurposeString = petInfos.Count > 0 ? "" : "hidden"; }
721 <div id="tablediv" class="@generalPurposeString">
722 <table id="myTableData" class="tblStyle1" cellspacing="0" cellpadding="4" width="100%">
723 <tr class="CustomerCenterMenu">
724 <th hidden>Pet ID</th>
725 <th>@Translate("Type of Pet")</th>
726 <th>@Translate("Breed")</th>
727 <th>@Translate("Pet Name")</th>
728 <th style="width: 120px;">@Translate("Remove")</th>
729 </tr>
730 @{
731 List<CustomerPetsInfo> showPetInfoList = customerpetInfoList.Count() > 0 ? customerpetInfoList : petInfos;
732 }
733
734 @if(petInfos.Count > 0)
735 {
736 foreach (var pet in showPetInfoList)
737 {
738 <tr>
739 <td style="display:none;" class="pet-id">@pet.ID</td>
740 <td class="pet-type">@pet.TypeOfPet</td>
741 <td class="pet-breed">@pet.Breed</td>
742 <td class="pet-name">@pet.Name</td>
743 <td class="pet-EditRemove"><span class="pet-edit" onclick='EditPet($(this));' style="float:left;">@Translate("Edit")</span> <span class="remove" onclick='RemovePet($(this));' style="float:right;">@Translate("Remove")</span></td>
744 </tr>
745 }
746 }
747 </table>
748 </div>
749 <div class="clearfix"></div>
750
751 <div class="clearfix"></div>
752 <div class="form-group">
753 <input type="checkbox" id="97" required />
754
755 @Translate("By submitting this application, I agree to be bound by Pet Lovers Centre's Privacy Policy.") @Translate("Please visit our website") (<a href="https://uat.petloverscentre.co.th/Forms/Index.aspx">uat.petloverscentre.co.th</a>) @Translate("for the full details of the Privacy Policy.")
756 <div class="clearfix"></div>
757 </div>
758
759 <div class="form-group">
760 <input type="submit" style="display:none;" class="form-control activate" style="width: auto;" id="submitandActivateVIPCard" name="submitandActivateVIPCard" value='@Translate("Submit and Activate VIP Card")' />
761 <input type="button" class="form-control activate" style="width: auto;" id="validateAndSubmit" name="validateAndSubmit" value='@Translate("Submit and Activate VIP Card")' />
762 </div>
763 <div class="clearfix"></div>
764 </form>
765 </div>
766 @{
767 var typeofpet2 = System.Web.HttpContext.Current.Request["TypeOfPet"];
768 var breed2 = System.Web.HttpContext.Current.Request["Breed"];
769 var petname2 = System.Web.HttpContext.Current.Request["PetName"];
770 if(!string.IsNullOrEmpty(typeofpet2))
771 {
772 <text><script>
773
774 var TPList='@typeofpet2';
775 var BList='@breed2';
776 var PList='@petname2';
777
778 var typeofPetList1 = TPList.split('|');
779 var breedList1 = BList.split('|');
780 var petNameList1 = PList.split('|');
781
782 $("#tablediv").removeClass("hidden");
783
784 var table = document.getElementById("myTableData");
785
786 for(var i = 0; i < typeofPetList1.length-1 ; i++)
787 {
788 //var rowCount = table.rows.length;
789 //var row = table.insertRow(rowCount);
790 //var removeRow = '<span onclick=\'$(this).parent().parent().remove();\'>Edit</span> <span onclick=\'$(this).parent().parent().remove();\'>Remove</span>';
791 //row.insertCell(0).innerHTML = AA;
792 //row.insertCell(1).innerHTML = typeofPetList1[i];
793 //row.insertCell(2).innerHTML = breedList1[i];
794 //row.insertCell(3).innerHTML = petNameList1[i];
795 //row.insertCell(4).innerHTML = removeRow;
796 }
797 </script></text>
798 }
799 }
800
801 <script>
802 var petIdEditBefore = "";
803 var petTypeEditBefore = "";
804 var petBreedEditBefore = "";
805 var petNameEditBefore = "";
806 var isNotInEditing = true;
807 $('document').ready(function(){
808 $('#validateAndSubmit').click(function(){
809
810 var dobInput = $("#datepicker").val().split("-");
811 var dob = new Date(dobInput[2], dobInput[1] - 1, dobInput[0]);
812 var dobYear = dob.getFullYear();
813 var currentDateTime = new Date();
814 var passedYear = currentDateTime.getFullYear() + -120;
815 let cusDobYear = dob.getFullYear() + 20;
816 let cusdob = new Date(cusDobYear, dobInput[1] - 1, dobInput[0]);
817
818 if(dobYear >= passedYear){
819 if(cusdob > currentDateTime){
820 $(".dob-msg").css("display", "block");
821 $(".cus-dob")[0].scrollIntoView();
822 return false;
823 }else{
824 $(".dob-msg").css("display", "none");
825 $('#submitandActivateVIPCard').click();
826 return true;
827 }
828 } else {
829 var NewDialog;
830 NewDialog = $('<div class="popup" title="@Translate("MESSAGE")">@Translate("Please choose valid date of birth.")</div>');
831 NewDialog.dialog({
832 resizable: false,
833 modal: true,
834 show: 'clip',
835 buttons: {
836 "@Translate("Ok")": function() {
837 $(this).dialog("close");
838 }
839 }
840 });
841 }
842 });
843 });
844
845 var petIdString = "";
846 var typeOfPetString = "";
847 var breedString = "";
848 var petNameString = "";
849 if('@petID' != "" || '@typeofpet' != "" || '@breed' !="" || '@petname' !="")
850 {
851 petIdString = '@petID';
852 typeOfPetString = '@typeofpet';
853 breedString = '@breed';
854 petNameString = '@petname';
855 }
856
857 /*-----------------------------------------------------------------------------------------------*/
858 $( "#Reset" ).click(function() {
859 petIdString = "";
860 typeOfPetString = "";
861 breedString = "";
862 petNameString = "";
863 });
864
865 $( "#TypeOfPet" ).change(function() {
866 document.getElementById("typeOfPetText").value = document.getElementById("TypeOfPet").value;
867 });
868
869 $( "#Breed" ).focusout(function() {
870 document.getElementById("BreedText").value = document.getElementById("Breed").value;
871 });
872
873 $( "#PetName" ).focusout(function() {
874 document.getElementById("PetNameText").value = document.getElementById("PetName").value;
875 });
876
877 $( "#SaveAdd" ).click(function()
878 {
879 var typeOfPet = document.getElementById("TypeOfPet");
880 var Breed = document.getElementById("Breed");
881 var PetName = document.getElementById("PetName");
882 if(PetName.value != null && Breed.value != null && typeOfPet.value != null && PetName.value != "" && Breed.value != "" && typeOfPet.value != "")
883 {
884 petIdString += 0 + "|";
885 typeOfPetString += typeOfPet.value + "|";
886 breedString += Breed.value + "|";
887 petNameString += PetName.value + "|";
888
889 document.getElementById("PetIDText").value = petIdString;
890 document.getElementById("BreedText").value = breedString;
891 document.getElementById("PetNameText").value = petNameString;
892 document.getElementById("typeOfPetText").value = typeOfPetString;
893
894 var petIdList = [];
895 var typeofPetList = [];
896 var breedList = [];
897 var petNameList = [];
898
899 $("#tablediv").removeClass("hidden");
900
901 petIdList.push(0);
902 typeofPetList.push(typeOfPet.value);
903 breedList.push(Breed.value);
904 petNameList.push(PetName.value);
905 for(var i=0; i < typeofPetList.length; i++) {
906 var formrow = '<tr>'
907 + '<td class="pet-id" hidden>' + '0' + '</td>'
908 + '<td class="pet-type">' + typeofPetList[i] + '</td>'
909 + '<td class="pet-breed">' + breedList[i] + '</td>'
910 + '<td class="pet-name">' + petNameList[i] + '</td>'
911 + '<td class="pet-EditRemove"><span class="remove" onclick=\'RemovePet($(this));\' style="float:right;">@Translate("Remove")</span></td>'
912 + '</tr>';
913 $('.tblStyle1').append(formrow);
914 }
915
916 typeOfPet.value = "";
917 Breed.value = "";
918 PetName.value = "";
919 NewDialog = $('<div class="popup" title="@Translate("MESSAGE")"> @Translate("Successfully added to your pet information!") </div>');
920 NewDialog.dialog({
921 resizable: false,
922 modal: true,
923 show: 'clip',
924 buttons: {
925 "@Translate("Ok")": function() {
926 $(this).dialog("close");
927 }
928 }
929 });
930 } else {
931 typeOfPet.value = typeOfPet.value;
932 Breed.value = Breed.value;
933 PetName.value = PetName.value;
934 NewDialog = $('<div class="popup" title="@Translate("MESSAGE")"> @Translate("Please fill in all required fields for pet information.") </div>');
935 NewDialog.dialog({
936 resizable: false,
937 modal: true,
938 show: 'clip',
939 buttons: {
940 "@Translate("Ok")": function() {
941 $(this).dialog("close");
942 }
943 }
944 });
945 }
946 });
947
948 /*--------------------------------- Remove Pet ---------------------------------*/
949 function RemovePet(thisObj) {
950 var thisRowObj = thisObj.parent().parent();
951
952 var petIdToRemove = thisRowObj.find('.pet-id').html() + "|";
953 var petTypeToRemove = thisRowObj.find('.pet-type').html() + "|";
954 var petBreedToRemove = thisRowObj.find('.pet-breed').html() + "|";
955 var petNameToRemove = thisRowObj.find('.pet-name').html() + "|";
956
957 petIdString = $("#PetIDText").val();
958 typeOfPetString = $("#typeOfPetText").val();
959 breedString = $("#BreedText").val();
960 petNameString = $("#PetNameText").val();
961
962 petIdString = petIdString.replace(petIdToRemove,"");
963 typeOfPetString = typeOfPetString.replace(petTypeToRemove,"");
964 breedString = breedString.replace(petBreedToRemove,"");
965 petNameString = petNameString.replace(petNameToRemove,"");
966
967 $("#PetIDText").val(petIdString);
968 $("#typeOfPetText").val(typeOfPetString);
969 $("#BreedText").val(breedString);
970 $("#PetNameText").val(petNameString);
971
972 thisRowObj.remove();
973 }
974
975 /*--------------------------------- Edit Pet ---------------------------------*/
976 function EditPet(thisObj) {
977 var thisRowObj = thisObj.parent().parent();
978
979 if(thisRowObj.find('.pet-edit').html().toLowerCase() == "edit") {
980 if(isNotInEditing) {
981 isNotInEditing = false;
982
983 petIdEditBefore = thisRowObj.find('.pet-id').html();
984 petTypeEditBefore = thisRowObj.find('.pet-type').html();
985 petBreedEditBefore = thisRowObj.find('.pet-breed').html();
986 petNameEditBefore = thisRowObj.find('.pet-name').html();
987
988 thisRowObj.find('.pet-type').html('<select id="PetTypeEdit" style="height:34px;">'
989 + '<option value="Cat">Cat</option>'
990 + '<option value="Dog">Dog</option>'
991 + '<option value="Fish">Fish</option>'
992 + '<option value="Birds">Birds</option>'
993 + '<option value="Reptiles">Reptiles</option>'
994 + '<option value="Small Pets">Small Pets</option></select>');
995 thisRowObj.find('.pet-breed').html('<input type="text" class="form-control" id="PetBreedEdit" value="' + petBreedEditBefore + '"/>');
996 thisRowObj.find('.pet-name').html('<input type="text" class="form-control" id="PetNameEdit" value="' + petNameEditBefore + '"/>');
997
998 $('#PetTypeEdit').val(petTypeEditBefore);
999
1000 thisRowObj.find('.pet-edit').html("Done");
1001 }
1002 } else {
1003 var petTypeEditAfter = thisRowObj.find('#PetTypeEdit').val();
1004 var petBreedEditAfter = thisRowObj.find('#PetBreedEdit').val();
1005 var petNameEditAfter = thisRowObj.find('#PetNameEdit').val();
1006
1007 petIdString = $("#PetIDText").val();
1008 typeOfPetString = $("#typeOfPetText").val();
1009 breedString = $("#BreedText").val();
1010 petNameString = $("#PetNameText").val();
1011
1012 var petIdStringSplit = petIdString.split('|');
1013 var typeOfPetStringSplit = typeOfPetString.split('|');
1014 var breedStringSplit = breedString.split('|');
1015 var petNameStringSplit = petNameString.split('|');
1016
1017 var petTypeReconstructedString = "";
1018 var petBreedReconstructedString = "";
1019 var petNameReconstructedString = "";
1020
1021 for (var i = 0; i < petIdStringSplit.length-1; i++) {
1022 if(petIdStringSplit[i] == petIdEditBefore) {
1023 petTypeReconstructedString += petTypeEditAfter + "|";
1024 petBreedReconstructedString += petBreedEditAfter + "|";
1025 petNameReconstructedString += petNameEditAfter + "|";
1026 } else {
1027 petTypeReconstructedString += typeOfPetStringSplit[i] + "|";
1028 petBreedReconstructedString += breedStringSplit[i] + "|";
1029 petNameReconstructedString += petNameStringSplit[i] + "|";
1030 }
1031 }
1032
1033 $("#typeOfPetText").val(petTypeReconstructedString);
1034 $("#BreedText").val(petBreedReconstructedString);
1035 $("#PetNameText").val(petNameReconstructedString);
1036
1037 thisRowObj.find('.pet-type').html(petTypeEditAfter);
1038 thisRowObj.find('.pet-breed').html(petBreedEditAfter);
1039 thisRowObj.find('.pet-name').html(petNameEditAfter);
1040
1041 thisRowObj.find('.pet-edit').html("Edit");
1042 isNotInEditing = true;
1043 }
1044 }
1045 </script>
1046