protected void btnChangePin_Click(object sender, EventArgs e) { UserBLL user = new UserBLL(); try { if (string.IsNullOrEmpty(currentPinTextBox.Text.Trim())) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Current Pin field is required."; msgbox.Attributes.Add("Class", "alert alert-warning"); } else if (string.IsNullOrEmpty(newPinTextBox.Text.Trim())) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "New Pin field is required."; msgbox.Attributes.Add("Class", "alert alert-warning"); } else if (string.IsNullOrEmpty(confirmNewPinTextBox.Text.Trim())) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Confirm New Pin field is required."; msgbox.Attributes.Add("Class", "alert alert-warning"); } else if (newPinTextBox.Text.Trim() != confirmNewPinTextBox.Text.Trim()) { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "New Pin & Confirm New Pin do not match."; msgbox.Attributes.Add("Class", "alert alert-warning"); } else { // user.UserId = LumexSessionManager.Get("ActiveLoginId").ToString(); /*need to modify this validateUser. */ if (user.varifypin((string)LumexSessionManager.Get("ActiveUserId"), currentPinTextBox.Text.Trim())) { user.UpdateUserPin((string)LumexSessionManager.Get("ActiveUserId"), confirmNewPinTextBox.Text.Trim()); string message = "Pin <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/setting/User/pinset.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "<span class='actionTopic'>Invalid</span> Current Pin. You can't change your pin."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { user = null; } }