protected void AccountCreate_click(object sender, EventArgs e)
        {
            try { 
                string[] arglist = new String[5];
                int argIndex = 0;

                arglist[argIndex++] = Mnemonics.TxnCodes.TX_CREATE_ACCOUNT;
                arglist[argIndex++] = AccountTypeDropDownList.Text;
                arglist[argIndex++] = Session["UserId"].ToString();
                arglist[argIndex++] = "0";
                arglist[argIndex++] = "0";

                var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("{0}|{1}|{2}|{3}|{4}", arglist));
                Master.ErrorMessage = "Account request created.  Email will be sent when administrator reviews.";
            }
            catch { }

            if (Session["Access"].ToString() == "1")
            {
                Response.Redirect("Home.aspx");
            }
            else if (Session["Access"].ToString() == "2")
            {
                Response.Redirect("MerchantHome.aspx");
            }

        }
        private void LoadAccounts(string externalUserId, bool byPass = false)
        {
            if (Session["Access"].ToString() == "1" || Session["Access"].ToString() == "2" || byPass)
            {
                var output = new Business.XSwitch(Global.ConnectionString, Session["Username"].ToString(), string.Format("009|{0}", externalUserId));
                if (output == null)
                    Response.Redirect("Error.aspx");

                if (output != null && output.resultSet != null && output.resultSet.Tables.Count > 0 && output.resultSet.Tables.Count > 0)
                {
                    if (output.resultSet.Tables[0].Rows.Count != 0)
                    {
                        ToDropdown.DataSource = output.resultSet.Tables[0];
                        ToDropdown.DataTextField = "ac_no";
                        ToDropdown.DataValueField = "ac_no";
                        ToDropdown.DataBind();
                        //AccountList.InnerHtml = GetAccountListHtml(output.resultSet);
                    }
                    else
                    {
                        ToDropdown.Items.Add(new ListItem { Text = "No Accounts Found", Value = "0" });
                    }
                }
                else
                {
                    ToDropdown.Items.Clear();
                    ToDropdown.Items.Add(new ListItem { Text = "No Accounts Found", Value = "0" });
                }
        }
        }
        protected void Transfer_Click(object sender, EventArgs e)
        {
            //Send the Message of successful or failure(reason for failure)
            if (FromDropDown.SelectedValue == null || FromDropDown.SelectedValue == "0")
            {
                Master.ErrorMessage = "Error: Select the sender Account.";
            }
            else if (ToDropDown.SelectedValue == null || ToDropDown.SelectedValue == "0")
            {
                Master.ErrorMessage = "Error: Select the recepient Account.";
            }
            else if (AmountTransfer.Text == "" || !UI.Validate.isAmountValid(AmountTransfer.Text))
            {
                Master.ErrorMessage = "Error: Amount cannot be empty, and amount accepts only decimal values.";
            }
            else if (ConfirmAmount.Text == "" || !UI.Validate.isAmountValid(ConfirmAmount.Text))
            {
                Master.ErrorMessage = "Error: Confirmation Amount cannot be empty, and Confirmation Amount accepts only decimal values.";
            }
            else if (ConfirmAmount.Text != AmountTransfer.Text)
            {
                Master.ErrorMessage = "Error: Amount and Confirmation Amount should be same.";
            }
            else
            {
                var transferAmount = Convert.ToDecimal(ConfirmAmount.Text);
                var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("014|{0}|{1}|{2}|{3}| ",FromDropDown.SelectedValue, ToDropDown.SelectedValue, transferAmount, Session["Access"]));

                Master.ErrorMessage = output.resultP;
                ResetPage();
            }
        }
        private void LoadPendingTransactions()
        {
            var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("008|{0}", Session["Access"].ToString()));
            if (output == null)
                Response.Redirect("UserLogin.aspx");

            if (output.resultSet.Tables[0].Rows.Count != 0)
            {
                GetPendingTransactionTableHtml(output.resultSet);
            }
        }
        private void LoadAccounts()
        {
            var output = new Business.XSwitch(Global.ConnectionString, Session["Username"].ToString(), string.Format("009|{0}", Session["UserId"].ToString()));
            if (output == null)
                Response.Redirect("UserLogin.aspx");

            if ((output.resultSet != null ) && (output.resultSet.Tables[0].Rows.Count != 0))
            {
                MerchantAccountlist.InnerHtml = GetAccountListHtml(output.resultSet);
            }
            else
            {
                MerchantAccountlist.InnerHtml = "<li class='list-group-item'>You have no accounts. <a href='CreateAccount.aspx'> Request for one?</a> </li>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] == null || Session["Access"] == null)
                Response.Redirect("UserLogin.aspx");
            if (Session["Access"].ToString() == "3" || Session["Access"].ToString() == "4")
                Response.Redirect("EmployeeHome.aspx");
            if (Session["Access"].ToString() == "5")
                Response.Redirect("AdminHome.aspx");

            try
            {
                if (IsPostBack)
                    return;

                FirstNameTextBox.BorderColor = System.Drawing.Color.Black;
                MiddleNameTextBox.BorderColor = System.Drawing.Color.Black;
                LastNameTextBox.BorderColor = System.Drawing.Color.Black;
                Addrs1TextBox.BorderColor = System.Drawing.Color.Black;
                Addrs2TextBox.BorderColor = System.Drawing.Color.Black;
                CityTextBox.BorderColor = System.Drawing.Color.Black;
                StateTextBox.BorderColor = System.Drawing.Color.Black;
                ZipTextBox.BorderColor = System.Drawing.Color.Black;
                PhNumTextBox.BorderColor = System.Drawing.Color.Black;
                EmailTextBox.BorderColor = System.Drawing.Color.Black;

                String[] argList = new String[2];
                argList[0] = Mnemonics.TxnCodes.TX_FETCH_CUSTOMER;
                argList[1] = Session["UserId"].ToString();

                var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(),
                    string.Format("{0}|{1}", argList));
                if (output == null)
                    return;

                String[] profileList = output.resultGet.Split('|');
                FirstNameTextBox.Text = profileList[2];
                MiddleNameTextBox.Text = profileList[3];
                LastNameTextBox.Text = profileList[4];
                Addrs1TextBox.Text = profileList[5];
                Addrs2TextBox.Text = profileList[6];
                CityTextBox.Text = profileList[7];
                StateTextBox.Text = profileList[8];
                ZipTextBox.Text = profileList[9];
                PhNumTextBox.Text = profileList[11];
                EmailTextBox.Text = profileList[12];
            }
            catch { }
        }
        protected void DeleteEmployee_Click(object sender, EventArgs e)
        {
            try { 
                string[] arglist = new String[24];
                int argIndex = 0;

                arglist[argIndex++] = Mnemonics.TxnCodes.TX_DELETE_USER_EMPLOYEE;
                arglist[argIndex++] = EmployeeDropDown.SelectedValue;

                var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(),
                    string.Format("{0}|{1}", arglist));

                Master.ErrorMessage = "Employee Account Disabled.";
            }
            catch { }
            Response.Redirect("AdminHome.aspx");
        }
        //private static String userId = "1234";

        protected void SendOTPBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string[] arglist = new String[2];

                Business.XSwitch xsw = new Business.XSwitch();
                if (!UI.Validate.isUserNameValid(UserNameTextBox.Text))
                {
                    MessageLabel.Text = "Error: The User Name that was entered was not found.";
                    return;
                }
                var employeeOutput = new Entity.Empm();
                var output = xsw.getExternalUserDataFromUserName(Global.ConnectionString, UserNameTextBox.Text);
                if (output == null)
                {
                    employeeOutput = xsw.getInternalUserDataFromUserName(Global.ConnectionString, UserNameTextBox.Text);

                    if (employeeOutput == null)
                    {
                        MessageLabel.Text = "Error: The User Name that was entered was not found.";
                        return;
                    }
                    
                }

                if (output != null)
                {
                    Session["TempUserId"] = output.cs_no;
                    String userName = output.cs_fname + " " + output.cs_lname;

                    _otpService = new OTPService(output.cs_uid + userName);
                    _otpService.GenerateOTP(userName, email: output.cs_email);
                }
                else if (employeeOutput != null)
                {
                    Session["TempUserId"] =  employeeOutput.emp_no;
                    String userName = employeeOutput.emp_fname + " " + employeeOutput.emp_lname;

                    _otpService = new OTPService(employeeOutput.emp_no + userName);
                    _otpService.GenerateOTP(userName, email: employeeOutput.emp_email);
                }
            }
            catch { }
        }
Exemplo n.º 9
0
        protected void VerifyButton_Click(object sender, EventArgs e)
        {
            if (_otpService.VerifyOTP(OTPTextBox.Text))
            {
                UserDetails.Visible = true;
                try
                {
                    FirstNamebox.ForeColor = System.Drawing.Color.Black;
                    MiddleNamebox.ForeColor = System.Drawing.Color.Black;
                    LastNamebox.ForeColor = System.Drawing.Color.Black;
                    Address1box.ForeColor = System.Drawing.Color.Black;
                    Address2box.ForeColor = System.Drawing.Color.Black;
                    Citybox.ForeColor = System.Drawing.Color.Black;
                    Statebox.ForeColor = System.Drawing.Color.Black;
                    Zipbox.ForeColor = System.Drawing.Color.Black;
                    Phnobox.ForeColor = System.Drawing.Color.Black;
                    Mailidbox.ForeColor = System.Drawing.Color.Black;

                    String[] argList = new String[2];
                    argList[0] = Mnemonics.TxnCodes.TX_FETCH_CUSTOMER;
                    argList[1] = Userlist.SelectedItem.Value;

                    var output = new Business.XSwitch(Global.ConnectionString, Userlist.SelectedItem.Value,
                        string.Format("{0}|{1}", argList));
                    if (output == null)
                        return;

                    String[] profileList = output.resultGet.Split('|');
                    FirstNamebox.Text = profileList[2];
                    MiddleNamebox.Text = profileList[3];
                    LastNamebox.Text = profileList[4];
                    Address1box.Text = profileList[5];
                    Address2box.Text = profileList[6];
                    Citybox.Text = profileList[7];
                    Statebox.Text = profileList[8];
                    Zipbox.Text = profileList[9];
                    Phnobox.Text = profileList[11];
                    Mailidbox.Text = profileList[12];
                    OTPDiv.Visible = false;
                }
                catch { }

            }
        }
Exemplo n.º 10
0
        private void LoadCustomers(string internalUserId)
        {
            var xSwitchObject = new Business.XSwitch();

            var output = xSwitchObject.getEmployeeAccessibleCustomerData(Global.ConnectionString, Session["UserId"].ToString());
            if (output.Tables[0].Rows.Count != 0)
            {
                CustomerDropDown.DataSource = output.Tables[0];
                CustomerDropDown.DataTextField = "cs_uname";
                CustomerDropDown.DataValueField = "cs_no";
                CustomerDropDown.DataBind();
                //AccountList.InnerHtml = GetAccountListHtml(output.resultSet);
                LoadAccounts(CustomerDropDown.SelectedValue, byPass: true);
            }
            else
            {
                CustomerDropDown.Items.Add(new ListItem { Text= "You have access to no customers", Value="0"});
            }
        }
        private void LoadAccounts()
        {
            var output = new Business.XSwitch(Global.ConnectionString, Session["Username"].ToString(), string.Format("009|{0}", Session["UserId"].ToString()));
            if (output == null)
                Response.Redirect("Error.aspx");


            if (output != null && output.resultSet != null && output.resultSet.Tables.Count > 0 && output.resultSet.Tables[0].Rows.Count != 0)
            {
                FromDropDown.DataSource = output.resultSet.Tables[0];
                FromDropDown.DataTextField = "ac_no";
                FromDropDown.DataValueField = "ac_no";
                FromDropDown.DataBind();
                //AccountList.InnerHtml = GetAccountListHtml(output.resultSet);
            }
            else
            {
                FromDropDown.Items.Add(new ListItem { Text = "No Accounts Found", Value = "0" });
            }
        }
        private void LoadCustomers(string internalUserId)
        {
            var xSwitchObject = new Business.XSwitch();

            try
            {
                var output = xSwitchObject.getMerchantAccessibleCustomerData(Global.ConnectionString, Session["UserId"].ToString());
                if ((output == null) || (output.Tables[0].Rows.Count != 0))
                {
                    CustomerDropDown.DataSource = output.Tables[0];
                    CustomerDropDown.DataTextField = "cs_uname";
                    CustomerDropDown.DataValueField = "cs_no";
                    CustomerDropDown.DataBind();
                }
                else
                {
                    CustomerDropDown.Items.Add(new ListItem { Text = "No customers found.", Value = "0" });
                }
            }
            catch { }
        }
        private void LoadEmployees(string internalUserId)
        {
            var xSwitchObject = new Business.XSwitch();

            try
            {
                var output = xSwitchObject.GetInternalUserList(Global.ConnectionString);
                if ((output == null) || (output.Tables[0].Rows.Count != 0))
                {
                    EmployeeDropDown.DataSource = output.Tables[0];
                    EmployeeDropDown.DataTextField = "emp_uname";
                    EmployeeDropDown.DataValueField = "emp_id";
                    EmployeeDropDown.DataBind();
                }
                else
                {
                    EmployeeDropDown.Items.Add(new ListItem { Text = "No Employees found.", Value = "0" });
                }
            }
            catch { }
        }
Exemplo n.º 14
0
 protected void CreditButton_Click(object sender, EventArgs e)
 {
     if (Session["Access"].ToString() == "1" || Session["Access"].ToString() == "2")
     {
         if (ToDropdown.SelectedValue == "0")
         {
             Master.ErrorMessage = "Error: Select the Account from which an amount has to be credited";
         }
         else if (Amount.Text == "" || !UI.Validate.isAmountValid(Amount.Text))
         {
             Master.ErrorMessage = "Error: Amount cannot be empty, and amount accepts only decimal values.";
         }
         else
         {
             var amount = Convert.ToDouble(Amount.Text);
             var transactionCode = "012";
             if (amount > 1000) transactionCode = "013";
             var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("{3}|{0}| |{1}|{2}| ", ToDropdown.SelectedValue, amount, Session["Access"].ToString(), transactionCode));
             Master.ErrorMessage = output.resultP;
             ResetPage();
         }
     }
     else
     {
         var amount = Convert.ToDouble(Amount.Text);
         var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("012|{0}| |{1}|{2}| ", ToDropdown.SelectedValue, amount, Session["Access"].ToString()));
         Master.ErrorMessage = output.resultP;
         ResetPage();
     }
 }
Exemplo n.º 15
0
  private void LoadSystemLog()
   {
    var xSwitch = new Business.XSwitch();
    NonFinHistoryGridView.DataSource = xSwitch.getNonFinHistory(Global.ConnectionString,"1");
    NonFinHistoryGridView.DataBind();
 }
        protected void CreateBtn_Click(object sender, EventArgs e)
        {
            try
            {
                bool errorFound = false;

                if (!(UI.Validate.isUserNameValid(FirstNameTextBox.Text)))
                {
                    errorFound = true;
                    FirstNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else FirstNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isUserNameValid(MiddleNameTextBox.Text)))
                {
                    errorFound = true;
                    MiddleNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else MiddleNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isUserNameValid(LastNameTextBox.Text)))
                {
                    errorFound = true;
                    LastNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else LastNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isAddressValid(Addrs1TextBox.Text)))
                {
                    errorFound = true;
                    Addrs1TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Addrs1TextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isAddressValid(Addrs2TextBox.Text)))
                {
                    errorFound = true;
                    Addrs2TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Addrs2TextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isCityValid(CityTextBox.Text)))
                {
                    errorFound = true;
                    CityTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else CityTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isStateValid(StateTextBox.Text)))
                {
                    errorFound = true;
                    StateTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else StateTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isZipCodeValid(ZipTextBox.Text)))
                {
                    errorFound = true;
                    ZipTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else ZipTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isPhoneNumberValid(PhNumTextBox.Text)))
                {
                    errorFound = true;
                    PhNumTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else PhNumTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isEmailAddressValid(EmailTextBox.Text)))
                {
                    errorFound = true;
                    EmailTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else EmailTextBox.BorderColor = System.Drawing.Color.Black;

                if (!(UI.Validate.isBranchValid(BranchTextBox.Text)))
                {
                    errorFound = true;
                    BranchTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else BranchTextBox.BorderColor = System.Drawing.Color.Black;

                if (!UI.Validate.isPasswordValid(pwdTextBox.Text) ||
                    UI.Global.hashCode(pwdTextBox.Text) != UI.Global.hashCode(cpwdTextBox.Text))
                {
                    errorFound = true;
                    pwdTextBox.BorderColor = System.Drawing.Color.Red;
                    cpwdTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else
                {
                    pwdTextBox.BorderColor = System.Drawing.Color.Black;
                    cpwdTextBox.BorderColor = System.Drawing.Color.Black;
                }


                if (errorFound)
                {
                    Master.ErrorMessage = "Error: Invalid data entered!  Please correct and resubmit.";
                    return;
                }

                string[] arglist = new String[21];
                int argIndex = 0;
                arglist[argIndex++] = Mnemonics.TxnCodes.TX_CREATE_EMPLOYEE;
                arglist[argIndex++] = " ";
                arglist[argIndex++] = FirstNameTextBox.Text;
                arglist[argIndex++] = MiddleNameTextBox.Text;
                arglist[argIndex++] = LastNameTextBox.Text;
                arglist[argIndex++] = Addrs1TextBox.Text;
                arglist[argIndex++] = Addrs2TextBox.Text;
                arglist[argIndex++] = ZipTextBox.Text;
                arglist[argIndex++] = CityTextBox.Text;
                arglist[argIndex++] = StateTextBox.Text;
                arglist[argIndex++] = BranchTextBox.Text;
                arglist[argIndex++] = PhNumTextBox.Text;
                arglist[argIndex++] = EmailTextBox.Text;
                arglist[argIndex++] = EmpTypeDropList.SelectedValue.Equals("4") ? "Y" : "N";
                arglist[argIndex++] = EmpTypeDropList.SelectedValue;
                arglist[argIndex++] = Question1TextBox.Text;
                arglist[argIndex++] = Answer1TextBox.Text;
                arglist[argIndex++] = Question2TextBox.Text;
                arglist[argIndex++] = Answer2TextBox.Text;
                arglist[argIndex++] = " ";
                arglist[argIndex++] = UI.Global.hashCode(pwdTextBox.Text).ToString();

                var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(),
                    string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}", arglist));

                Master.ErrorMessage ="New employee created";
            }
            catch { }
            Response.Redirect("AdminHome.aspx");
        }
        private void LoadCurrentUserAccounts()
        {
            try
            {
                if (Session["Access"].ToString() == "2")
                {
                    var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("009|{0}", Session["UserId"].ToString()));
                    if (output == null)
                        Response.Redirect("Error.aspx");

                    if (output.resultSet.Tables.Count > 0)
                    {
                        if (output.resultSet.Tables[0].Rows.Count != 0)
                        {
                            ToDropdown.Items.Clear();
                            ToDropdown.DataSource = output.resultSet.Tables[0];
                            ToDropdown.DataTextField = "ac_no";
                            ToDropdown.DataValueField = "ac_no";
                            ToDropdown.DataBind();
                            //AccountList.InnerHtml = GetAccountListHtml(output.resultSet);
                        }
                        else
                        {
                            FromDropdown.Items.Add(new ListItem { Text = "No Accounts Found", Value = "0" });
                        }
                    }
                    else
                    {
                        FromDropdown.Items.Clear();
                        FromDropdown.Items.Add(new ListItem { Text = "No Accounts Found", Value = "0" });
                    }

                }
            }
            catch
            {

            }
        }
Exemplo n.º 18
0
 public static string ReadBankPublicKey()
 {
     var xSwitchObject = new Business.XSwitch();
     return xSwitchObject.getBankPublicKey(Global.ConnectionString);
 }
 public void ProcessTransaction(string referenceNumber, bool approved)
 {
     var xSwitchObject = new Business.XSwitch();
     if (approved)
     {
         var data = xSwitchObject.geTranDataFromRefNumber(Global.ConnectionString, referenceNumber);
         var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("{0}|{1}|{2}", data, Session["Access"].ToString(), referenceNumber));
         Master.ErrorMessage = "Transaction was processed.";
     }
     else
     {
         if (xSwitchObject.deletePendingTransaction(Global.ConnectionString, referenceNumber))
         {
             Master.ErrorMessage = "Transaction was deleted.";
         }
     }
     Response.Redirect(Request.RawUrl);
 }
Exemplo n.º 20
0
 public static string ReadCustomerPrivateKey()
 {
     var userId = HttpContext.Current.Session["UserId"].ToString();
     var xSwitchObject = new Business.XSwitch();
     return xSwitchObject.getCustomerPrivateKey(Global.ConnectionString, userId);
 }
Exemplo n.º 21
0
        private void LoadCustomers(string internalUserId)
        {
            var xSwitchObject = new Business.XSwitch();

            try
            {
                var output = xSwitchObject.getEmployeeAccessibleCustomerData(Global.ConnectionString, Session["UserId"].ToString());
                if ((output == null) || (output.Tables[0].Rows.Count != 0))
                {
                    Userlist.DataSource = output.Tables[0];
                    Userlist.DataTextField = "cs_uname";
                    Userlist.DataValueField = "cs_no";
                    Userlist.DataBind();

                    Userlist.Items.Insert(0, new ListItem { Text="-- Select --", Value= "0"});
                    //AccountList.InnerHtml = GetAccountListHtml(output.resultSet);
                }
                else
                {
                    Userlist.Items.Add(new ListItem { Text = "You have access to no customers", Value = "0" });
                }
            }
            catch { }
        }
 protected void ResendOTPLink_Click(object sender, EventArgs e)
 {
     var amount = Convert.ToDecimal(Amount.Text);
     var xsw = new Business.XSwitch();
     var customer = new Entity.Cstm();
     customer = xsw.getExternalUserDataFromUserName(Global.ConnectionString, CustomerDropDown.SelectedValue.ToString());
     var customeremail = customer.cs_email;
     var customername = customer.cs_fname + " " + customer.cs_lname;
     _otpService = new OTPService(Session["UserId"].ToString() + Session["UserName"].ToString());
     generatedotp = _otpService.GenerateOTP(Session["UserName"].ToString(), email: Session["UserEmail"].ToString(), notifyByEmail: false);
     const string subject = "Your OTP from the most secure bank, SBS, ";
     string body = string.Format("Hello {0}, <br /> <br />Your <b>OTP</b> from the most secure bank: <br /> {1} <br /><br /> Regards, <br /> SBS Team.", "", generatedotp);
     OTPUtility.SendMail("Group 2", "*****@*****.**", customername, customeremail, subject, body);
 }
 private void ProcessTransaction(decimal amount)
 {
     try
     {
         //TODO:
         //var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("011|{0}| |{1}|{2}| ", FromDropdown.SelectedValue, amount, Session["Access"]));
         var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(), string.Format("021|{0}|{1}|{2}|{3}| ", FromDropdown.SelectedValue, ToDropdown.SelectedValue, amount, Session["Access"].ToString()));
         Master.ErrorMessage =  output.resultP;
         ResetPage();
     }
     catch { }
 }
        protected void MakePayment_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["Access"].ToString() == "2")
                {
                    if (FromDropdown.SelectedValue == "0")
                    {
                        Master.ErrorMessage = "Error: Select the Account from which an amount has to be Debited";
                    }

                    if (ToDropdown.SelectedValue == "0")
                    {
                        Master.ErrorMessage = "Error: Select the Account to which the amount has to be Debited";
                    }
                    else if (Amount.Text == "" || !UI.Validate.isAmountValid(Amount.Text))
                    {
                        Master.ErrorMessage = "Error: Amount cannot be empty, and amount accepts only decimal values.";
                    }
                    else
                    {
                        var amount = Convert.ToDecimal(Amount.Text);
                        var xsw = new Business.XSwitch();
                        var customer = new Entity.Cstm();
                        customer = xsw.getExternalUserDataFromUserName(Global.ConnectionString, CustomerDropDown.SelectedValue.ToString());
                        var customeremail = customer.cs_email;
                        var customername = customer.cs_fname + " " + customer.cs_lname;
                        _otpService = new OTPService(Session["UserId"].ToString() + Session["UserName"].ToString());
                        generatedotp = _otpService.GenerateOTP(Session["UserName"].ToString(), email: Session["UserEmail"].ToString(), notifyByEmail: false);
                        const string subject = "Your OTP from the most secure bank, SBS, ";
                        string body = string.Format("Hello {0}, <br /> <br />Your <b>OTP</b> from the most secure bank: <br /> {1} <br /><br /> Regards, <br /> SBS Team.", "", generatedotp);
                        OTPUtility.SendMail("Group 2", "*****@*****.**", customername, customeremail, subject, body);
                        OTPDiv.Visible = true;
                        MakePaymentButton.Visible = false;

                   }
                }

                else
                {
                   
                }
            }
            catch { }

        }
        protected void CustCreate_Click(object sender, EventArgs e)
        {
            try
            {
                bool errorFound = false;

                if (!(UI.Validate.isUserNameValid(FirstNameTextBox.Text)))
                {
                    errorFound = true;
                    FirstNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else FirstNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isUserNameValid(MiddleNameTextBox.Text)))
                {
                    errorFound = true;
                    MiddleNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else MiddleNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isUserNameValid(LastNameTextBox.Text)))
                {
                    errorFound = true;
                    LastNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else LastNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isAddressValid(Addrs1TextBox.Text)))
                {
                    errorFound = true;
                    Addrs1TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Addrs1TextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isAddressValid(Addrs2TextBox.Text)))
                {
                    errorFound = true;
                    Addrs2TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Addrs2TextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isCityValid(CityTextBox.Text)))
                {
                    errorFound = true;
                    CityTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else CityTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isStateValid(StateTextBox.Text)))
                {
                    errorFound = true;
                    StateTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else StateTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isZipCodeValid(ZipTextBox.Text)))
                {
                    errorFound = true;
                    ZipTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else ZipTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isPhoneNumberValid(PhNumTextBox.Text)))
                {
                    errorFound = true;
                    PhNumTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else PhNumTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isEmailAddressValid(EmailTextBox.Text)))
                {
                    errorFound = true;
                    EmailTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else EmailTextBox.BorderColor = System.Drawing.Color.Black;

                if (!UI.Validate.isPasswordValid(pwdTextBox.Text) ||
                    hashPwdHiddenField.Value.Equals("0") ||
                    !hashPwdHiddenField.Value.Equals(hashCpwdHiddenField.Value))
                {
                    errorFound = true;
                    pwdTextBox.BorderColor = System.Drawing.Color.Red;
                    cpwdTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else
                {
                    pwdTextBox.BorderColor = System.Drawing.Color.Black;
                    cpwdTextBox.BorderColor = System.Drawing.Color.Black;
                }

                if (!UI.Validate.isSecurityQuestionValid(Question1TextBox.Text))
                {
                    errorFound = true;
                    Question1TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Question1TextBox.BorderColor = System.Drawing.Color.Black;
                if (!UI.Validate.isSecurityAnswerValid(Answer1TextBox.Text))
                {
                    errorFound = true;
                    Answer1TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Answer1TextBox.BorderColor = System.Drawing.Color.Black;

                if (!UI.Validate.isSecurityQuestionValid(Question2TextBox.Text))
                {
                    errorFound = true;
                    Question2TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Question2TextBox.BorderColor = System.Drawing.Color.Black;
                if (!UI.Validate.isSecurityAnswerValid(Answer2TextBox.Text))
                {
                    errorFound = true;
                    Answer2TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Answer2TextBox.BorderColor = System.Drawing.Color.Black;

                if (!UI.Validate.isSecurityQuestionValid(Question3TextBox.Text))
                {
                    errorFound = true;
                    Question3TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Question3TextBox.BorderColor = System.Drawing.Color.Black;
                if (!UI.Validate.isSecurityAnswerValid(Answer3TextBox.Text))
                {
                    errorFound = true;
                    Answer3TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Answer3TextBox.BorderColor = System.Drawing.Color.Black;

                if (errorFound)
                {
                    MessageLabel.Text = "Invalid data entered!  Please correct and resubmit.";
                    return;
                }

                string[] arglist = new String[26];
                int argIndex = 0;

                arglist[argIndex++] = Mnemonics.TxnCodes.TX_REGISTER_CUSTOMER;
                arglist[argIndex++] = " ";
                arglist[argIndex++] = MerchantCheckBox.Checked ? "2" : "1";
                arglist[argIndex++] = FirstNameTextBox.Text;
                arglist[argIndex++] = MiddleNameTextBox.Text;
                arglist[argIndex++] = LastNameTextBox.Text;
                arglist[argIndex++] = Addrs1TextBox.Text;
                arglist[argIndex++] = Addrs2TextBox.Text;
                arglist[argIndex++] = ZipTextBox.Text;
                arglist[argIndex++] = CityTextBox.Text;
                arglist[argIndex++] = StateTextBox.Text;
                arglist[argIndex++] = PhNumTextBox.Text;
                arglist[argIndex++] = EmailTextBox.Text;
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = Question1TextBox.Text;
                arglist[argIndex++] = Answer1TextBox.Text;
                arglist[argIndex++] = Question2TextBox.Text;
                arglist[argIndex++] = Answer2TextBox.Text;
                arglist[argIndex++] = Question3TextBox.Text;
                arglist[argIndex++] = Answer3TextBox.Text;
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = UI.Global.hashCode(pwdTextBox.Text).ToString();
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";

                var output = new Business.XSwitch(Global.ConnectionString, "0", string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}|{21}|{22}|{23}|{24}|{25}", arglist));
                if (output.resultP.ToLower().Contains("invalid data !"))
                {
                    MessageLabel.Text = output.resultP;
                }
                else
                {
                    MessageLabel.Text = "Request for new user login created.  Email will be sent when administrator reviews.";
                    System.Threading.Thread.Sleep(6000);
                    Response.Redirect("Home.aspx");
                    MessageLabel.Text = "";
                }
            }
            catch { }
            //MessageLabel.Text = "";
            //Response.Redirect("Home.aspx");
        }
Exemplo n.º 26
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            var userName = UserNameTextBox.Text.ToString();
            try
            {
                if (UserNameTextBox.Text == string.Empty || hashPasswordHiddenField.Value == string.Empty)
                {
                    MessageLabel.Text = "Error: Invalid login credentials.";
                }
                else
                {
                    var password = hashPasswordHiddenField.Value;
                    if (UI.Validate.isUserNameValid(userName))
                    { 

                        //if (Global.LoggedInUsers.Contains(userName) || Global.LoggedInUsers.Count>50)
                        //{
                        //    MessageLabel.Text = "Error: User is already logged in.";
                        //    return;
                        //}
                        var xSwitch = new Business.XSwitch();
                        //var encryptedConnectionString = Security.PKIService.EncryptData(Global.ConnectionString, xSwitch.getBankPublicKey(Global.ConnectionString));
                        var encryptedUserName = Security.PKIService.EncryptData(userName, xSwitch.getBankPublicKey(Global.ConnectionString));
                        var encryptedData = Security.PKIService.EncryptData(string.Format("{0}|{1}", userName, password), xSwitch.getBankPublicKey(Global.ConnectionString));

                        Session["Username"] = userName.Trim();
                        //var xSwitchObject = new Business.XSwitch(Global.ConnectionString, userName, string.Format("001|{0}|{1}", userName, password));
                        var xSwitchObject = new Business.XSwitch(Global.ConnectionString, encryptedUserName, "001|" + encryptedData);
                        
                        var encrytedOutput = xSwitchObject.resultP;
                        var output = (string)Security.PKIService.DecryptData(encrytedOutput, xSwitchObject.getCustomerPrivateKey(Global.ConnectionString, userName.ToString()));
                        if (output.Contains("|"))
                        {
                            //Global.LoggedInUsers.Add(userName);
                            var dataRecieved = output.Split('|');
                            Session["UserId"] = dataRecieved[0];
                            Session["UserName"] = dataRecieved[1].Trim() + " " + dataRecieved[2].Trim();
                            Session["Access"] = dataRecieved[3];
                            Session["UserEmail"] = dataRecieved[4];
                            MessageLabel.Text = "";
                            switch (dataRecieved[3])
                            {
                                case "1":
                                    Response.Redirect("Home.aspx", false);
                                    break;
                                case "2":
                                    Response.Redirect("MerchantHome.aspx", false);
                                    break;
                                case "3":
                                case "4":
                                    Response.Redirect("EmployeeHome.aspx", false);
                                    break;
                                case "5":
                                    Response.Redirect("AdminHome.aspx", false);
                                    break;
                                default:
                                    MessageLabel.Text = "Error: Invalid login credentials.";
                                    //Global.LoggedInUsers.Remove(userName);

                                    break;
                            }
                        }
                        else
                        {
                            MessageLabel.Text = "Error: Invalid login credentials.";
                        }
                    }
                    else
                    {
                        MessageLabel.Text = "Error: Invalid login credentials.";
                    }
                }
            }
            catch (Exception ex)
            {
                //Global.LoggedInUsers.Remove(userName);
                MessageLabel.Text = "Error: Invalid login credentials.";
            }
        }
Exemplo n.º 27
0
        public static void SaveCustomerPrivateKey()
        {
            try {
                var userId = HttpContext.Current.Session["UserId"].ToString();
                var xSwitchObject = new Business.XSwitch();
                var keyXml = xSwitchObject.getCustomerPrivateKey(Global.ConnectionString, userId);
                byte[] bytes = Encoding.ASCII.GetBytes(keyXml);

                HttpContext.Current.Response.ContentType = "application/octet-stream";
                HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment;filename= {0}-key.pem", userId));
                HttpContext.Current.Response.Buffer = true;
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.OutputStream.Write(bytes, 0, bytes.Length);
                HttpContext.Current.Response.OutputStream.Flush();
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
 protected void CreatePdfButton_Click(object sender, EventArgs e)
 {
     var xSwitch = new Business.XSwitch();
     var table = xSwitch.getFinHistory(Global.ConnectionString, Session["UserId"].ToString()).Tables[0];
     var bytes = ExportToPdf(table);
     
     HttpContext.Current.Response.ContentType = "application/octet-stream";
     HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment;filename= {0}-{1}.pdf", Session["UserId"], DateTime.Now));
     HttpContext.Current.Response.Buffer = true;
     HttpContext.Current.Response.Clear();
     HttpContext.Current.Response.OutputStream.Write(bytes, 0, bytes.Length);
     HttpContext.Current.Response.OutputStream.Flush();
 }
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            try
            {
                bool errorFound = false;

                if (!(UI.Validate.isUserNameValid(FirstNameTextBox.Text)))
                {
                    errorFound = true;
                    FirstNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else FirstNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isUserNameValid(MiddleNameTextBox.Text)))
                {
                    errorFound = true;
                    MiddleNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else MiddleNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isUserNameValid(LastNameTextBox.Text)))
                {
                    errorFound = true;
                    LastNameTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else LastNameTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isAddressValid(Addrs1TextBox.Text)))
                {
                    errorFound = true;
                    Addrs1TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Addrs1TextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isAddressValid(Addrs2TextBox.Text)))
                {
                    errorFound = true;
                    Addrs2TextBox.BorderColor = System.Drawing.Color.Red;
                }
                else Addrs2TextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isCityValid(CityTextBox.Text)))
                {
                    errorFound = true;
                    CityTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else CityTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isStateValid(StateTextBox.Text)))
                {
                    errorFound = true;
                    StateTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else StateTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isZipCodeValid(ZipTextBox.Text)))
                {
                    errorFound = true;
                    ZipTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else ZipTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isPhoneNumberValid(PhNumTextBox.Text)))
                {
                    errorFound = true;
                    PhNumTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else PhNumTextBox.BorderColor = System.Drawing.Color.Black;
                if (!(UI.Validate.isEmailAddressValid(EmailTextBox.Text)))
                {
                    errorFound = true;
                    EmailTextBox.BorderColor = System.Drawing.Color.Red;
                }
                else EmailTextBox.BorderColor = System.Drawing.Color.Black;

                if (errorFound)
                {
                    Master.ErrorMessage = "Error: Invalid data entered!  Please correct and resubmit.";
                    return;
                }

                string[] arglist = new String[24];
                int argIndex = 0;

                arglist[argIndex++] = Mnemonics.TxnCodes.TX_UPDATE_PROFILE;
                arglist[argIndex++] = Session["UserId"].ToString();
                arglist[argIndex++] = " ";
                arglist[argIndex++] = FirstNameTextBox.Text;
                arglist[argIndex++] = MiddleNameTextBox.Text;
                arglist[argIndex++] = LastNameTextBox.Text;
                arglist[argIndex++] = Addrs1TextBox.Text;
                arglist[argIndex++] = Addrs2TextBox.Text;
                arglist[argIndex++] = ZipTextBox.Text;
                arglist[argIndex++] = CityTextBox.Text;
                arglist[argIndex++] = StateTextBox.Text;
                arglist[argIndex++] = PhNumTextBox.Text;
                arglist[argIndex++] = EmailTextBox.Text;
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";
                arglist[argIndex++] = " ";

                var output = new Business.XSwitch(Global.ConnectionString, Session["UserId"].ToString(),
                    string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{17}|{18}{19}|{20}|{21}|{22}|{23}", arglist));

                Master.ErrorMessage = output.resultP;
            }
            catch { }
            Response.Redirect("Home.aspx");
        }
 private void LoadFinancialAccountStatement()
 {
     var xSwitch = new Business.XSwitch();
     FinHistoryGridView.DataSource= xSwitch.getFinHistory(Global.ConnectionString, Session["UserId"].ToString());
     FinHistoryGridView.DataBind();
 }