Example #1
0
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            string uname = (string)Session["Logged"];
            string pass  = (string)Session["lPwd"];
            int    aid   = (int)Session["accId"];

            AccountsBLL user = new AccountsBLL();
            AccountsDAL a    = user.retrieveUser(uname, pass);

            BuyerBLL buyer = new BuyerBLL();
            BuyerDAL b     = buyer.retrieveFinPlan(aid);

            string  mainName          = b.MainApplicantName;
            decimal mainSalary        = b.MainApplicantSalary;
            string  coName            = b.CoApplicantName;
            decimal coSalary          = b.CoApplicantSalary;
            decimal totSavings        = b.totalSavings;
            decimal upfrontPayment    = b.upfrontPaymentBudget;
            int     loanServicePeriod = b.loanServicingPeriod;
            string  useCpf            = b.userCpfToService;

            decimal ab1 = decimal.Parse(theTotalSavings.Text);
            decimal ac1 = decimal.Parse(theUpfrontPaymentBudget.Text.Trim());


            decimal asd  = ab1 + ac1;
            decimal asdf = asd - (asd * 0.8m) + (asd * 0.0275m);

            Label1.Text = "Recommended Bufget: S$ " + asdf;
        }
        //Membership and Roles management related functionality

        public static bool Validate(string userName, string password)
        {
            bool status = false;

            status = AccountsDAL.Validate(userName, password);
            return(status);
        }
Example #3
0
        public string retrieveAccType(string accType)
        {
            AccountsDAL p  = new AccountsDAL();
            AccountsDAL p2 = p.retrieveAccType(accType);

            return(p.accType);
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = (string)Session["Logged"];
            string pass     = (string)Session["lPwd"];
            int    aid      = (int)Session["accId"];

            AccountsBLL user = new AccountsBLL();
            AccountsDAL p    = user.retrieveUser(username, pass);


            string name = p.fullName;

            theName.Text = name;


            //Page lastPage = (Page)Context.Handler;
            //string asd = ((TextBox)lastPage.FindControl("loginTextbox")).Text;

            //SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MYDBConnection"].ConnectionString);
            //conn.Open();
            //SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Accounts WHERE userName ='******'", conn);
            //DataTable dt = new DataTable();
            //sda.Fill(dt);

            //name = dt.Rows[0][3].ToString();

            //theName.Text = name;
        }
Example #5
0
        public void CreateABL(Accounts newAccount)
        {
            // Call the DAL to create a new record.
            AccountsDAL accountDAL = new AccountsDAL();

            accountDAL.CreateADAL(newAccount);
        }
Example #6
0
        public AccountsDAL retrieveUser(string username, string password)
        {
            AccountsDAL p  = new AccountsDAL();
            AccountsDAL p2 = p.retrieveUser(username, password);

            return(p2);
        }
Example #7
0
        public static Accounts CloseAccount(int userID, int accID)
        {
            AccountsDAL dal     = new AccountsDAL();
            var         account = dal.CloseAccount(userID, accID);

            return(null);
        }
Example #8
0
        public static Accounts AddTransaction(int userID, int accID, string transaction)
        {
            AccountsDAL dal     = new AccountsDAL();
            var         account = dal.AddTransaction(userID, accID, transaction);

            return(account);
        }
Example #9
0
        public static Accounts UpdateBalance(int userID, int accID, double balance)
        {
            AccountsDAL dal     = new AccountsDAL();
            var         account = dal.UpdateBalance(userID, accID, balance);

            return(account);
        }
Example #10
0
        public static List <Accounts> GetAll(int userID)
        {
            AccountsDAL dal     = new AccountsDAL();
            var         account = dal.GetAll(userID);

            return(account);
        }
Example #11
0
        public static Accounts Get(int userID, int accID)
        {
            AccountsDAL dal     = new AccountsDAL();
            var         account = dal.Get(userID, accID);

            return(account);
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uname = (string)Session["Logged"];
            string pass  = (string)Session["lPwd"];
            int    aid   = (int)Session["accId"];

            AccountsBLL user = new AccountsBLL();
            AccountsDAL a    = user.retrieveUser(uname, pass);


            string fullname = a.fullName;
            string mobile   = a.mobile;
            string email    = a.email;
            string address  = a.address;


            BuyerBLL buyer = new BuyerBLL();
            BuyerDAL b     = buyer.retrieveFinPlan(aid);

            string  mainName          = b.MainApplicantName;
            decimal mainSalary        = b.MainApplicantSalary;
            string  coName            = b.CoApplicantName;
            decimal coSalary          = b.CoApplicantSalary;
            decimal totSavings        = b.totalSavings;
            decimal upfrontPayment    = b.upfrontPaymentBudget;
            int     loanServicePeriod = b.loanServicingPeriod;
            string  useCpf            = b.userCpfToService;


            UserName.Text = fullname;
            Mobile.Text   = mobile;
            Email.Text    = email;
            Address.Text  = address;

            theMainApplicantName.Text    = mainName;
            theMainApplicantSalary.Text  = mainSalary.ToString();
            theCoApplicantName.Text      = coName;
            theCoApplicantSalary.Text    = coSalary.ToString();
            theTotalSavings.Text         = totSavings.ToString();
            theUpfrontPaymentBudget.Text = upfrontPayment.ToString();
            theLoanServicePeriod.Text    = loanServicePeriod.ToString();



            //Page lastPage = (Page)Context.Handler;
            //string asd = ((TextBox)lastPage.FindControl("loginTextbox")).Text;

            //SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MYDBConnection"].ConnectionString);
            //conn.Open();
            //SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Accounts WHERE userName ='******'", conn);
            //DataTable dt = new DataTable();
            //sda.Fill(dt);

            //name1 = dt.Rows[0][3].ToString();
            //theName.Text = name1;
        }
Example #13
0
        public IActionResult Get(string phonenumber, string token)
        {
            if (!UserAuthDAL.VerifyToken(phonenumber, token))
            {
                return(Unauthorized());
            }
            var transactions = AccountsDAL.GetAccounts(phonenumber);

            return(Ok(transactions));
        }
Example #14
0
        public bool retrieveUserByLogin(string username, string password)
        {
            bool result = false;

            AccountsDAL p  = new AccountsDAL();
            AccountsDAL p2 = p.retrieveUser(username, password);

            if (p2 != null)
            {
                result = true;
            }



            return(result);
        }
Example #15
0
        public bool createUser(int accId, string uName, string pwd, string fullNm, string mobileNo, string emailAdd, string add, string accountType)
        {
            bool result = false;
            // string passwordHash = generatePasswordHash(password, salt);

            AccountsDAL user = new AccountsDAL();

            if (user.createUser(accId, uName, pwd, fullNm, mobileNo, emailAdd, add, accountType) == 1)
            {
                result = true;
            }
            else
            {
                result = false;
            }

            return(result);
        }
Example #16
0
        /// <summary>
        /// Method to Update Payments
        /// </summary>
        /// <param name="arglist">List of Accounts Entity is the Input.ChequeNo,ChequeDate,Updateby and UpdatedTime are Input Properties</param>
        /// <returns>Returns Boolean.</returns>
        public bool UpdatePayments(List <AccountsEn> arglist)
        {
            AccountsDAL lods  = new AccountsDAL();
            bool        lbRes = false;
            string      sqlCmd;

            try
            {
                int j = 0;
                for (j = 0; j < arglist.Count; j++)
                {
                    sqlCmd = "UPDATE SAS_Accounts SET ChequeNo = @ChequeNo,ChequeDate = @ChequeDate, UpdatedBy = @UpdatedBy, UpdatedTime = @UpdatedTime WHERE TransCode = '" + arglist[j].TransactionCode + "'";

                    if (!FormHelp.IsBlank(sqlCmd))
                    {
                        DbCommand cmd = _DatabaseFactory.GetDbCommand(Helper.GetDataBaseType, sqlCmd, DataBaseConnectionString);
                        _DatabaseFactory.AddInParameter(ref cmd, "@ChequeNo", DbType.String, arglist[j].ChequeNo);
                        _DatabaseFactory.AddInParameter(ref cmd, "@ChequeDate", DbType.DateTime, arglist[j].ChequeDate);
                        _DatabaseFactory.AddInParameter(ref cmd, "@UpdatedBy", DbType.String, arglist[j].UpdatedBy);
                        _DatabaseFactory.AddInParameter(ref cmd, "@UpdatedTime", DbType.DateTime, arglist[j].UpdatedTime);
                        _DbParameterCollection = cmd.Parameters;


                        int liRowAffected = _DatabaseFactory.ExecuteNonQuery(Helper.GetDataBaseType, cmd,
                                                                             DataBaseConnectionString, sqlCmd, _DbParameterCollection);

                        if (liRowAffected > -1)
                        {
                            lbRes = true;
                        }
                        else
                        {
                            throw new Exception("Update Failed! No Row has been updated...");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lbRes);
        }
Example #17
0
 public IActionResult Post([FromBody] Account account)
 {
     AccountsDAL.AddAccount(account);
     return(Ok());
 }
Example #18
0
        protected void SignInBtn_Click(object sender, EventArgs e)
        {
            string username = loginTextbox.Text.Trim();
            string password = passwordTextBox.Text.Trim();


            AccountsBLL user = new AccountsBLL();
            AccountsDAL p    = user.retrieveUser(username, password);

            string accType = p.accType;
            int    accId   = p.AccountID;


            if (user.retrieveUserByLogin(username, password) == true)
            {
                Session["Logged"] = username;
                Session["lPwd"]   = password;
                Session["accId"]  = accId;

                if (accType.Equals("Buyer"))
                {
                    Response.Redirect("index.aspx");
                }
                else if (accType.Equals("Reseller"))
                {
                    Response.Redirect("reseller.aspx");
                }
                else if (accType.Equals("Banker"))
                {
                    Response.Redirect("bankerIndex.aspx");
                }
            }
            else
            {
                Response.Write("<script>alert('Please enter valid Username and Password')</script>");
            }



            //SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MYDBConnection"].ConnectionString);
            //conn.Open();
            //SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Accounts WHERE userName ='******' AND password = '******'" , conn);
            //SqlDataAdapter sdaa = new SqlDataAdapter("SELECT * FROM Accounts WHERE accType ='Buyer'", conn);
            //DataTable dt = new System.Data.DataTable();
            //sda.Fill(dt);
            //if(dt.Rows.Count == 1 )
            //{
            //    utype = dt.Rows[0][7].ToString();
            //    if (utype == "Buyer")
            //    {
            //        Server.Transfer("index.aspx");
            //    }
            //    else if (utype == "Reseller")
            //    {
            //        Server.Transfer("reseller.aspx");
            //    }
            //    else if (utype == "Banker")
            //    {
            //        Server.Transfer("bankerIndex.aspx");
            //    }

            //}
            //else
            //{
            //    Response.Write("<script>alert('Please enter valid Username and Password')</script>");
            //}
            //conn.Close();
        }