示例#1
0
        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;
            }
        }
 protected void btnCommissionOK_OnClick(object sender, EventArgs e)
 {
     UserAccountBLL accountBll = new UserAccountBLL();
     UserBLL userBll = new UserBLL();
     accountBll.Amount = txtbxCommissionAmount.Text.Trim();
     userBll.UserId = (string) LumexSessionManager.Get("ActiveUserId");
     if (userBll.varifypin(userBll.UserId,txtbxPinCommission.Text))
     {
         if (Convert.ToDecimal(accountBll.Amount) <= Convert.ToDecimal(lvlCommision.Text))
         {
             bool status =
                 accountBll.UpdateUserIncomeBalanceFromCommission(
                     (string) LumexSessionManager.Get("ActiveUserId"), accountBll.Amount);
             if (status)
             {
                 string message = " <span class='actionTopic'>" + " Income Balance Updated Successfully " +
                                  "</span>.";
                 MyAlertBox(
                     "var callbackOk = function () { window.location = \"/a/account/myaccount.aspx\"; }; SuccessAlert(\"" +
                     "Process Succeed" + "\", \"" + message + "\", callbackOk);");
             }
             else
             {
                 string message = " <span class='actionTopic'>" + " Transfer Failed " +
                                  "</span>.";
                 MyAlertBox(
                     "var callbackOk = function () { window.location = \"/\"; }; SuccessAlert(\"" +
                     "Process Succeed" + "\", \"" + message + "\", \"\");");
             }
         }
         else
         {
             string message = " <span class='actionTopic'>" + "Sorry You don't have sufficent Balance." +
                                  "</span>.";
             MyAlertBox(
                 "var callbackOk = function () { window.location = \"/\"; }; WarningAlert(\"" +
                 "Warning!!" + "\", \"" + message + "\", \"\");");
         }
     }
     else
     {
         string message = " <span class='actionTopic'>" + " Invalid Pin. " +
                                  "</span>.";
         MyAlertBox(
             "var callbackOk = function () { window.location = \"/\"; }; WarningAlert(\"" +
             "Warning!!" + "\", \"" + message + "\", \"\");");
     }
 }
        protected void btnActivation_Click(object sender, EventArgs e)
        {
            try
            {
                UserBLL user = new UserBLL();
                if (user.varifypin((string)LumexSessionManager.Get("ActiveUserId"), txtbxUserPin.Text))
                {
                    UserAccountBLL userAccount = new UserAccountBLL();
                    StakeInfoBLL stakeInfo = new StakeInfoBLL();
                    MailContactBLL mailContactBll = new MailContactBLL();
                    UserBLL userBll = new UserBLL();
                    bool status = userAccount.UpdateUserAccount((string)LumexSessionManager.Get("ActiveUserId"),
                        ddlStakeList.SelectedValue, txtbxStakeKey.Text.Trim());

                    if (status)
                    {
                        if (hdnfldRefActive.Value == "No")
                        {
                            ReceivePaymentWhenActive();
                            genologyBLL genology = new genologyBLL();
                            genology.GenerateBinaryNodeByChileId((string) LumexSessionManager.Get("ActiveUserId"),userAccount.Amount);
                        }
                        string message = " <span class='actionTopic'> Your Account is Activated successfully. Thanks" + "</span>.";
                        MyAlertBox(
                            "var callbackOk = function () { window.location = \"/a/initialdata/initialDataElement.aspx\"; }; SuccessAlert(\"" +
                            "Process Succeed" + "\", \"" + message + "\", \"\");");
                    }
                    else
                    {

                    }
                    DataTable dt = stakeInfo.GetStakeInfoById(ddlStakeList.SelectedValue);
                    string body = PopulateBody(dt);
                    dt = userBll.GetUserInfoById((string) LumexSessionManager.Get("ActiveUserId"));
                    mailContactBll.SendHtmlFormattedEmail(dt.Rows[0]["Email"].ToString(), "Money Receipt", body);

                }
            }
            catch (Exception)
            {

                //throw;
            }
        }
        protected void btnPurches_Click(object sender, EventArgs e)
        {
            try
            {

                UserAccountBLL userAccount = new UserAccountBLL();
                StakeInfoBLL stakeInfo = new StakeInfoBLL();
                UserBLL user = new UserBLL();
                if (user.varifypin((string)LumexSessionManager.Get("ActiveUserId"), txtbxUserPintoPurches.Text))
                {
                    DataTable dt = userAccount.getAccountSummaryById((string) LumexSessionManager.Get("ActiveUserId"));
                    Decimal WalletAmount = 0;
                    string totalcount = "";
                    if (ddlPaymentBy.SelectedValue == "1")
                    {
                        WalletAmount = Convert.ToDecimal(dt.Rows[0]["Income"].ToString());
                    }
                    else if (ddlPaymentBy.SelectedValue == "2")
                    {
                        WalletAmount = Convert.ToDecimal(dt.Rows[0]["FxFund"].ToString());
                    }
                    if (Convert.ToDecimal(lblTotalPrice.Text) <= WalletAmount)
                    {
                        ///NEW///

                        StakeInfoBLL stake = new StakeInfoBLL();
                        int TotalPin = Convert.ToInt16(txtbxNoStake.Text);
                        DataTable dtstake = new DataTable();
                        DataRow dr = null;
                        dtstake.Columns.Add(new DataColumn("StakeId"));
                        dtstake.Columns.Add(new DataColumn("StakePin"));
                        dtstake.Columns.Add(new DataColumn("IsActive"));

                        for (int i = 0; i < TotalPin;)
                        {
                            string pinserial = GetSerialNumber();

                            dr = dtstake.NewRow();
                            if (!stake.CheckDuplicateKey(pinserial))
                            {
                                dr["StakeId"] = ddlstakeList.SelectedValue;
                                dr["StakePin"] = pinserial;
                                dr["IsActive"] = "Yes";
                                dtstake.Rows.Add(dr);
                                i++;
                            }
                        }
                        if (dtstake.Rows.Count == TotalPin && TotalPin > 0)
                        {
                            bool status = stake.SaveGeneratedPin(dtstake);

                            if (status)
                            {
                                dt = stakeInfo.updateKeyWhenPurchase(lblQuntity.Text, lblUnitPrice.Text,
                                    ddlstakeList.SelectedValue, ddlPaymentBy.SelectedValue);
                                if (dt.Rows.Count > 0)
                                {
                                    totalcount = dt.Rows[0][0].ToString();
                                }
                                string message = " <span class='actionTopic'>" + totalcount +
                                                 "KEY purchase Successfully. Thanks" + "</span>.";
                                MyAlertBox(
                                    "var callbackOk = function () { window.location = \"/a/stake/stakekeymanage.aspx\"; }; SuccessAlert(\"" +
                                    "Process Success" + "\", \"" + message + "\",callbackOk);");
                                getStakeKeyList();
                            }
                        }
                    }
                    else
                    {
                        string message = " <span class='actionTopic'>" +
                                         "Sorry you don't have sufficent Amount to purchase KEY. Thanks" + "</span>.";
                        MyAlertBox(
                            "var callbackOk = function () { window.location = \"/a/initialdata/stakekeymanage.aspx\"; }; WarningAlert(\"" +
                            "Process Failed" + "\", \"" + message + "\", \"\");");
                    }
                }
                else
                {
                    string message = " <span class='actionTopic'>" +"Sorry Your PIN is not Correct. Input the correct one Thanks" + "</span>.";
                    MyAlertBox(
                        "var callbackOk = function () { window.location = \"/a/initialdata/stakekeymanage.aspx\"; }; WarningAlert(\"" +
                        "Process Failed" + "\", \"" + message + "\", \"\");");

                }
            }
            catch (Exception)
            {

                //throw;
            }
        }
        protected void btnSendTo_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();
                DataRow dr = null;
                UserBLL user = new UserBLL();
                StakeInfoBLL stake = new StakeInfoBLL();

                if (user.varifypin((string)LumexSessionManager.Get("ActiveUserId"), txtbxUserPin.Text.Trim()))
                {
                    dt.Columns.Add(new DataColumn("Serial"));
                    dt.Columns.Add(new DataColumn("StakePin"));
                    dt.Columns.Add(new DataColumn("StakeName"));

                    for (int i = 0; i < gridviewSendKeyList.Rows.Count; i++)
                    {
                        dr = dt.NewRow();

                        Label lblSerial = (Label)gridviewSendKeyList.Rows[i].FindControl("lblSerial");
                        dr["Serial"] = lblSerial.Text;
                        dr["StakeName"] = gridviewSendKeyList.Rows[i].Cells[1].Text.ToString();
                        dr["StakePin"] = gridviewSendKeyList.Rows[i].Cells[2].Text.ToString();
                        dt.Rows.Add(dr);

                    }

                    stake.sendto = txtbxTransferTo.Text;
                    stake.transferBy = (string)LumexSessionManager.Get("ActiveUserId");
                    stake.sendSms = txtbxSendSMS.Text;
                    if (stake.sendto != stake.transferBy)
                    {
                        bool status = stake.updateKeyonTransfer(dt);

                        if (status)
                        {
                            string message = " <span class='actionTopic'>" +
                                             " This Pin is transfered successfully. Thanks" + "</span>.";
                            MyAlertBox(
                                "var callbackOk = function () { window.location = \"/a/stake/stakekeymanage.aspx\"; }; SuccessAlert(\"" +
                                "Process Success" + "\", \"" + message + "\", callbackOk);");
                        }
                    }
                    else
                    {

                        string message = " <span class='actionTopic'>" +
                                         "Key Sender and Receiver will not Same. Thanks" + "</span>.";
                        MyAlertBox(
                            "var callbackOk = function () { window.location = \"/a/stake/stakekeymanage.aspx\"; }; WarningAlert(\"" +
                            "Process Failed" + "\", \"" + message + "\", \"\");");
                    }

                }
                else
                {
                    string message = " <span class='actionTopic'>" + " This Pin is already transfered, you can not Deactive this Pin. Thanks" + "</span>.";
                    MyAlertBox(
                        "var callbackOk = function () { window.location = \"/a/stake/stakekeymanage.aspx\"; }; WarningAlert(\"" +
                        "Process Failed" + "\", \"" + message + "\", \"\");");
                }

            }
            catch (Exception)
            {

                throw;
            }
        }
        public void btnRequestSend_Click(object sender, EventArgs e)
        {
            UserAccountBLL account = new UserAccountBLL();
            UserBLL userBll = new UserBLL();
            account.Type = ddlType.SelectedValue;
            account.BankAccountNo = ddlPaymentMethod.SelectedItem.Text;
            account.TransferTo = txtbxTransferTo.Text.Trim();
            account.SwiftCode = ddlPaymentMethod.SelectedValue;
            account.Pin = txtbxTransferPin.Text.Trim();
            account.TransferNote = txtbxTransferNote.Text.Trim();
            account.Amount = txtbxAmount.Text.Trim();
            account.transfarType = ddlType.SelectedValue;
            string message = "";
            if (account.checkUserIncomeAmounttoActin(30, (string)LumexSessionManager.Get("ActiveUserId")))
            {
                if (userBll.varifypin((string)LumexSessionManager.Get("ActiveUserId"), account.Pin))
                {
                    if (ddlType.SelectedValue == "1")
                    {
                        if (Convert.ToDecimal(account.Amount) < 4000)
                        {
                            if (account.TransferTo != (string)LumexSessionManager.Get("ActiveUserId") && userBll.CheckDuplicateUser(account.TransferTo))
                            {
                                account.Status = "A";
                                bool status = account.RequestToTransfer();
                                if (status)
                                {
                                    account.updateUserAccountforTransfer();
                                    account.updateWithdrawRequest(account.transfarId, "A");
                                    message =
                                        "Payment <span class='actionTopic'>Fund Transfer</span> Successfully Done. Thanks.";
                                    MyAlertBox(
                                        "var callbackOk = function () { MyOverlayStart(); window.location = \"/a/account/withdraw.aspx\"; }; SuccessAlert(\"" +
                                        "Process Succeed" + "\", \"" + message + "\", callbackOk);");

                                }

                            }
                            else
                            {
                                message =
                                    "Please Give   <span class='actionTopic'>Correct User Info </span> to Transfer.";
                                MyAlertBox(
                                    "var callbackOk = function () { MyOverlayStart(); window.location = \"/a/account/withdraw.aspx\"; }; WarningAlert(\"" +
                                    "Warning!!" + "\", \"" + message + "\", \"\");");
                            }
                        }
                        else
                        {
                            account.Status = "P";
                            bool status = account.RequestToTransfer();
                            if (status)
                            {
                                account.updateUserAccountforTransfer();
                                message =
                                    "Payment <span class='actionTopic'>Transfer Request</span> Successfully Done. Thanks.";
                                MyAlertBox(
                                    "var callbackOk = function () { MyOverlayStart(); window.location = \"/a/account/withdraw.aspx\"; }; SuccessAlert(\"" +
                                    "Process Succeed" + "\", \"" + message + "\", callbackOk);");

                            }
                        }

                    }
                    else if (ddlType.SelectedValue == "0")
                    {
                        if (Convert.ToDecimal(account.Amount) >= 30)
                        {

                            account.Status = "P";
                            bool status = account.RequestToTransfer();
                            if (status)
                            {
                                account.updateUserAccountforTransfer();
                                message =
                                    "Payment <span class='actionTopic'>Transfer Request</span> Successfully Done. Thanks.";
                                MyAlertBox(
                                    "var callbackOk = function () { MyOverlayStart(); window.location = \"/a/account/withdraw.aspx\"; }; SuccessAlert(\"" +
                                    "Process Succeed" + "\", \"" + message + "\", callbackOk);");

                            }
                        }
                        else
                        {
                            message = "You can not transfer less than <span class='actionTopic'>$30</span>, Thanks.";
                            MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/moneygerate.aspx\"; }; SuccessAlert(\"" + "Warning note!!" + "\", \"" + message + "\", \"\");");

                        }

                    }

                }
                else
                {
                    message = "Please Enter Your Correct <span class='actionTopic'>Pin</span> to Transfer.";
                    MyAlertBox(
                        "var callbackOk = function () { MyOverlayStart(); window.location = \"/a/account/withdraw.aspx\"; }; WarningAlert(\"" +
                        "Warning!!" + "\", \"" + message + "\", \"\");");
                }
            }

            else
            {
                message = "You have no sufficient  <span class='actionTopic'>Amount</span> to Transfer.";
                MyAlertBox(
                    "var callbackOk = function () { MyOverlayStart(); window.location = \"/a/account/withdraw.aspx\"; }; WarningAlert(\"" +
                    "Warning!!" + "\", \"" + message + "\", \"\");");

            }
        }