// GET: TellerManagement
        public ActionResult Index()
        {
            List <UserTill> allInfo = tellerMgtLogic.ExtractAllTellerInfo();

            List <TillToUserViewModel> models = new List <TillToUserViewModel>();

            foreach (var info in allInfo)
            {
                TillToUserViewModel entry;

                if (info.GlAccountID == 0)
                {
                    entry = new TillToUserViewModel {
                        Username = db.Userrs.Find(info.UserId).UserName, GLAccountName = "NIL", AccountBalance = "NIL", HasDetails = false, IsDeletable = false
                    };
                }
                else
                {
                    var applicationUser = db.Userrs.Find(info.UserId);
                    // we want to be able to delete association if an associated user is no longer authorized to do teller postings.
                    entry          = new TillToUserViewModel();
                    entry.Id       = info.ID;
                    entry.Username = db.Userrs.Find(info.UserId).UserName;
                    var getAcct = db.GlAccounts.Find(info.GlAccountID);
                    entry.GLAccountName  = getAcct.AccountName;
                    entry.AccountBalance = info.GlAccount.AccountBalance.ToString();
                    //entry.IsDeletable = db.Userrs.Find(info.UserId).Role.RoleClaims.Any(rc => rc.Name.Equals("TellerPosting"));

                    //{ Id = info.ID, Username = applicationUser.UserName, GLAccountName = info.GlAccount.AccountName, AccountBalance = info.GlAccount.AccountBalance.ToString(), HasDetails = true, IsDeletable = applicationUser.Role.RoleClaims.Any(rc => rc.Name.Equals("TellerPosting")) };
                }

                models.Add(entry);
            }
            return(View(models));
        }
        // GET: TellerManagement/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserTill tillToUser = db.TillUsers.Find(id);

            if (tillToUser == null)
            {
                return(HttpNotFound());
            }
            TillToUserViewModel model = new TillToUserViewModel {
                GLAccountName = tillToUser.GlAccount.AccountName, AccountBalance = tillToUser.GlAccount.AccountBalance.ToString(), Username = db.Users.Find(tillToUser.UserId).UserName
            };

            return(View(model));
        }
Beispiel #3
0
        // GET: TellerManagement/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TillToUser tillToUser = db.TillToUsers.Find(id);

            if (tillToUser == null)
            {
                return(HttpNotFound());
            }
            TillToUserViewModel model = new TillToUserViewModel {
                GLAccountName = tillToUser.GlAccount.AccountName, Username = appdb.Users.Find(tillToUser.UserId).UserName
            };

            return(View(model));
        }