protected void SaveCustomerInfosClick(object sender, EventArgs e) { ErrorLabel.Visible = false; //string password = PasswordText.Text.Trim(); //if (string.IsNullOrEmpty(password)) //{ // ErrorLabel.Text = ErrorMessage.PasswordCanNotEmpty; // ErrorLabel.Visible = true; // return; //} //if (password.Contains(" ")) //{ // ErrorLabel.Text = ErrorMessage.PasswordCanNotContainSpace; // ErrorLabel.Visible = true; // return; //} //if (password.Length < 7) //{ // ErrorLabel.Text = ErrorMessage.PasswordNotValid; // ErrorLabel.Visible = true; // return; //} if (string.IsNullOrEmpty(FirstNameText.Text) || string.IsNullOrEmpty(LastNameText.Text)) { ErrorLabel.Text = ErrorMessage.FirstLastNameCanNotEmpty; ErrorLabel.Visible = true; return; } if (string.IsNullOrEmpty(EmailText.Text) || !Helper.IsValidEmail(EmailText.Text.Trim())) { ErrorLabel.Text = ErrorMessage.EmailIsInvalid; ErrorLabel.Visible = true; return; } CustomerInfosDetails.FirstName = FirstNameText.Text; CustomerInfosDetails.LastName = LastNameText.Text; CustomerInfosDetails.EmailAddress = EmailText.Text.Trim().Replace(" ", ""); CustomerInfosDetails.ZipCode = ZipCodeText.Text; //CustomerInfosDetails.Password = PasswordText.Text; _customerInfoRepository.Update(CustomerInfosDetails); try { var stripeUpdate = UpdateStripeCustomer(CustomerInfosDetails); var log = new CustomerInfoLogs { FirstName = FirstNameText.Text, LastName = LastNameText.Text, CustomerEmail = EmailText.Text, ChangedDate = DateTime.UtcNow, CustomerId = CustomerInfosDetails.CustomerId, UpdatedBy = PublicCustomerInfos.CustomerId, Result = stripeUpdate.StripeResponse.ResponseJson }; _helper.AddCustomerInfoLogs(log); } catch (Exception ex) { var logError = new Logs { LogKey = "UpdateCustomerError", UpdatedBy = PublicCustomerInfos.CustomerId, UpdatedContent = string.Format("{0} - {1}", ex.Message, ex.StackTrace), UpdatedDate = DateTime.UtcNow }; _customerInfoRepository.AddLog(logError); } _customerInfoRepository.ResetCache(); ErrorLabel.Text = ErrorMessage.UpdateSuccess; ErrorLabel.Visible = true; }
protected void HtmlAnchor_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(ValueText.Text)) { giftValueDiv.Attributes["class"] = "input-group errorborder"; ErrorMessageGiftCard.Text = Message.EnterGiftCardAmount; return; } if (string.IsNullOrEmpty(ToText.Text)) { ToText.Attributes["class"] = "form-control errorborder"; ErrorMessageGiftCard.Text = Message.EnterEmailOfRecipient; return; } if (!Helper.IsValidEmail(ToText.Text.Trim())) { ToText.Attributes["class"] = "form-control errorborder"; ErrorMessageGiftCard.Text = Message.EnterValidEmailOfRecipient; return; } if (string.IsNullOrEmpty(NameText.Text)) { NameText.Attributes["class"] = "form-control errorborder"; ErrorMessageGiftCard.Text = Message.EnterNameOfRecipient; return; } if (string.IsNullOrEmpty(DeliveryDateText.Text)) { DeliveryDateText.Attributes["class"] = "form-control errorborder"; ErrorMessageGiftCard.Text = Message.EnterDeliveryDate; return; } if ((Session["UserSession"] == null || PublicCustomerInfos == null || string.IsNullOrEmpty(PublicCustomerInfos.EmailAddress)) && string.IsNullOrEmpty(email.Text.Trim()) && !Helper.IsValidEmail(email.Text.Trim())) { email.CssClass = "form-control errorborder"; return; } if (string.IsNullOrEmpty(FirstName.Text.Trim())) { FirstName.CssClass = "form-control errorborder"; return; } if (string.IsNullOrEmpty(LastName.Text.Trim())) { LastName.CssClass = "form-control errorborder"; return; } try { bool isSuccess; int bookingId = PurchaseGiftCard(out isSuccess); if (isSuccess) { Session["BookingSuccess"] = true; Response.Redirect(string.Format(Constant.GiftCardConfirmPage, bookingId), false); } } catch (Exception ex) { ErrorMessageLit.Text = ex.Message; var logs = new Logs { LogKey = "eGiftCard-Booking-Error-On-Submit", UpdatedDate = DateTime.UtcNow, UpdatedContent = string.Format("eGiftCard Booking Error - {0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source), UpdatedBy = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0 }; _customerInfoRepository.AddLog(logs); } }