protected void btnLogin_Click(object sender, EventArgs e) { if (txtbxUserName.Text != "" && txtbxPassword.Text != "") { try { LoginBll loginbll = new LoginBll(); loginbll.UserId = txtbxUserName.Text.ToString(); loginbll.UserPass = txtbxPassword.Text.ToString(); if (loginbll.VerifyPassword()) { loginbll = loginbll.GetUserById(loginbll.UserId); if (loginbll.IsVarified == "Yes") { LumexSessionManager.Add("UserGroupId", loginbll.UserGroup); LumexSessionManager.Add("ActiveUserId", loginbll.UserId); LumexSessionManager.Add("ActiveUserName", loginbll.UserName); LumexSessionManager.Add("UserLastName", loginbll.LastName); LumexSessionManager.Add("UserAvater", loginbll.PerPhoto); LumexSessionManager.Add("isMenu", "N"); LumexSessionManager.Add("ActiveMenuFor", "globalapp"); //LumexSessionManager.Add("UserIdForView",""); Response.Redirect("~/default.aspx", false); } else { string message = " <span class='actionTopic'>" +" Your account is not Varified. Please Check your Email. Thanks"+ "</span>."; MyAlertBox("var callbackOk = function () { window.location = \"/login.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } } else { lblmsg.Visible = true; lblmsg.Text = "User ID or Password is invalid."; } } catch (Exception ex) { // lblmsg.Visible = true; // lblmsg.Text = ex.ToString(); } } else { lblmsg.Visible = true; lblmsg.Text = "UserName or Password field is Empty."; } }
protected void btnGenerate_Click(object sender, EventArgs e) { try { LoginBll loginbll = new LoginBll(); loginbll.UserId = (string)LumexSessionManager.Get("ActiveUserId"); loginbll.UserPass = txtbxPassword.Text.Trim(); if (loginbll.VerifyPassword()) { StakeInfoBLL stake = new StakeInfoBLL(); int TotalPin = Convert.ToInt16(txtbxTotalPin.Text); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("StakeId")); dt.Columns.Add(new DataColumn("StakePin")); dt.Columns.Add(new DataColumn("IsActive")); for (int i = 0; i < TotalPin; ) { Random random = new Random(); string pinserial = GetSerialNumber(); dr = dt.NewRow(); if (!stake.CheckDuplicateKey(pinserial)) { dr["StakeId"] = ddlStakeList.SelectedValue; dr["StakePin"] = pinserial; dr["IsActive"] = "Yes"; dt.Rows.Add(dr); i++; } } if (dt.Rows.Count == TotalPin && TotalPin > 0) { bool status = stake.SaveGeneratedPin(dt); if (status) { UserAccountBLL accountBll = new UserAccountBLL(); accountBll.TotalAmount = Convert.ToDecimal(txtbxTotalPin.Text)* stake.getstakeAmountByStakeId(ddlStakeList.SelectedValue); accountBll.Particular = "Generate PIN Amount-" + accountBll.TotalAmount.ToString() + " of Stake" + ddlStakeList.SelectedItem.Text; accountBll.RPType = "CR"; accountBll.AffectforId = ""; accountBll.Affectfor = "PIN Generate"; accountBll.InsertReceivePaymentWhenAffectIncome(); GetGeneratedPinList(); string message = " <span class='actionTopic'> The" + TotalPin.ToString() + " is Generated successfully. Thanks" + "</span>."; MyAlertBox( "var callbackOk = function () { window.location = \"/a/initialdata/initialDataElement.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } } } else { msgbox.Visible = true; msgTitleLabel.Text = "Password Miss Match!!"; msgDetailLabel.Text = "Sorry your given password don't Match. Try Correct one."; msgbox.Attributes.Add("Class", "alert alert-warning"); } } catch (Exception) { throw; } }