예제 #1
0
        public ActionResult RegisterAccountBank(AccountDataModel model)
        {
            bool createAccount = false;
            CreateAccount(model.Account_Id, model.Account_Number, model.Account_Name, model.Bank_Name, model.Other_Info, out createAccount);

            if (createAccount)
            {
                return RedirectToAction("Index", "Home");
            }
            else
            {
                return View(model);
                //ModelState.AddModelError("", ErrorCodeToString(createStatus));
                //return RedirectToAction("Register", "Account");
            }
        }
예제 #2
0
        //Get Current Account Online
        public void GetAccountUser(int AccountId)
        {
            if (Session["userOnline"] == null) return;

            AccountModel user = (AccountModel)Session["userOnline"];
            AccountDataModel accUser = null;
            using (SGFEntitiess acc = new SGFEntitiess())
            {
                var result = from a in acc.SGF_T_ACCOUNT
                                join au in acc.SGF_T_ACCOUNT_USER on a.ACCOUNT_ID equals au.ACCOUNT_ID
                                where a.ACCOUNT_ID == AccountId && au.USER_ID == user.UserId
                                select a;

                var accResult = result.SingleOrDefault();

                //Asign account
                accUser = new AccountDataModel();
                accUser.Account_Id = accResult.ACCOUNT_ID;
                accUser.Account_Name = accResult.ACCOUNT_NAME;
                accUser.Account_Number = accResult.ACCOUNT_NUMBER;
                accUser.Balance = (double)accResult.BALANCE;
                accUser.Bank_Name = accResult.BANK_NAME;
                accUser.Other_Info = accResult.OTHER_INFO;
            }
            Session["accountOnline"] = accUser;
        }
예제 #3
0
        //public ActionResult RegisterAccountBank()
        //{
        //    AccountDashBoardModel dashboardmodel = null;
        //    AccountDataModel model = new AccountDataModel();
        //    if (Session["accountDashboard"] != null)
        //    {
        //        int AccountId = 0;
        //        dashboardmodel = (AccountDashBoardModel)Session["accountDashboard"];
        //        AccountId = dashboardmodel.dashboard.Account_Id;
        //        using (SGFEntitiess accountData = new SGFEntitiess())
        //        {
        //            var result = from n in accountData.SGF_T_ACCOUNT
        //                         where n.ACCOUNT_ID == AccountId
        //                         select n;
        //            var acc = result.ToList().SingleOrDefault();
        //            model.Account_Id = acc.ACCOUNT_ID;
        //            model.Account_Name = acc.ACCOUNT_NAME;
        //            model.Account_Number = acc.ACCOUNT_NUMBER;
        //            model.Balance = (double)acc.BALANCE;
        //            model.Bank_Name = acc.BANK_NAME;
        //            model.Other_Info = acc.OTHER_INFO;
        //            Session["accountOnline"] = model;
        //        }
        //    }
        //    return View(model);
        //}//END RegisterAccountBank
        //// POST: /Home/RegisterAccountBank
        //[HttpPost]
        //public ActionResult RegisterAccountBank(AccountDataModel model)
        //{
        //    bool createAccount = false;
        //    CreateAccount(model.Account_Id, model.Account_Number, model.Account_Name, model.Bank_Name, model.Other_Info, out createAccount);
        //    if (createAccount)
        //    {
        //        return RedirectToAction("Index", "Home");
        //    }
        //    else
        //    {
        //        return View(model);
        //        //ModelState.AddModelError("", ErrorCodeToString(createStatus));
        //        //return RedirectToAction("Register", "Account");
        //    }
        //    // If we got this far, something failed, redisplay form
        //    return View(model);
        //}
        public ActionResult RegisterAccountBank(int Id = 0)
        {
            /*
            AccountDashBoardModel dashboardmodel = null;
            AccountDataModel model = new AccountDataModel();

            if (Session["accountDashboard"] != null)
            {
                int AccountId = 0;
                dashboardmodel = (AccountDashBoardModel)Session["accountDashboard"];
                AccountId = dashboardmodel.dashboard.Account_Id;

                using (SGFEntitiess accountData = new SGFEntitiess())
                {
                    var result = from n in accountData.SGF_T_ACCOUNT
                                 where n.ACCOUNT_ID == AccountId
                                 select n;

                    var acc = result.ToList().SingleOrDefault();
                    model.Account_Id = acc.ACCOUNT_ID;
                    model.Account_Name = acc.ACCOUNT_NAME;
                    model.Account_Number = acc.ACCOUNT_NUMBER;
                    model.Balance = (double)acc.BALANCE;
                    model.Bank_Name = acc.BANK_NAME;
                    model.Other_Info = acc.OTHER_INFO;

                    Session["accountOnline"] = model;

                }
            }
            */

            AccountDataModel model = new AccountDataModel();

            if (Id == 0)
            {
                return View(model);
            }
            int AccountId = Id;

            using (SGFEntitiess accountData = new SGFEntitiess())
            {
                var result = from n in accountData.SGF_T_ACCOUNT
                             where n.ACCOUNT_ID == AccountId
                             select n;

                var acc = result.ToList().SingleOrDefault();
                model.Account_Id = acc.ACCOUNT_ID;
                model.Account_Name = acc.ACCOUNT_NAME;
                model.Account_Number = acc.ACCOUNT_NUMBER;
                model.Balance = (double)acc.BALANCE;
                model.Bank_Name = acc.BANK_NAME;
                model.Other_Info = acc.OTHER_INFO;

                Session["accountOnline"] = model;
            }

            return View(model);
        }