Esempio n. 1
0
        public List <BusinessUserExceptionalRoleViewModel> getAllBusinessCashierWithExceptionalRoleByBN(int BN, string srvcTCD)
        {
            List <BusinessUserExceptionalRoleViewModel> items = new List <BusinessUserExceptionalRoleViewModel>();
            var busUsrCashierList = db.TBUS_USR_EXCP_ROL.Where(x => x.BN == BN && x.TRANS_TRSF_CRDT_DBT_TCD == srvcTCD).ToList();

            if (busUsrCashierList.Count() == 0)
            {
                return(items);
            }

            foreach (var itemCashier in busUsrCashierList)
            {
                var excpAuthModel = new BusinessUserExceptionalRoleViewModel();
                excpAuthModel.busUsrExcpRole = itemCashier;

                var busAgcy = new BusinessAgency();
                var agcy    = busAgcy.getOneBusinessAgencyByAgcyNbr(itemCashier.BN, itemCashier.BUS_AGCY_NBR);
                if (agcy != null)
                {
                    excpAuthModel.BUS_USR_AGCY_NM = agcy.BUS_AGCY_NM;
                }

                var busUsr = db.TBUS_USR.Find(itemCashier.BUS_USR_NBR);
                if (busUsr != null)
                {
                    var usr = db.TUSR.Find(busUsr.BUS_EMPE_USR_NBR);
                    if (usr != null)
                    {
                        excpAuthModel.BUS_USR_FUL_NM = usr.USR_FUL_NM;
                    }
                }
                items.Add(excpAuthModel);
            }
            return(items);
        }
Esempio n. 2
0
        public List <SelectListItem> getAllBusinessUserByBN(int BN, int selectedValue)
        {
            List <SelectListItem> items = new List <SelectListItem>();
            var busUsrList = db.TBUS_USR.Where(x => x.BN == BN && x.BUS_USR_SCD == "1").ToList();

            foreach (var item in busUsrList)
            {
                var usr = usrObj.getUserByUsrNbr(item.BUS_EMPE_USR_NBR);
                if (usr != null)
                {
                    string text;
                    if (item.BUS_USR_TCD == "04")
                    {
                        text = usr.USR_FUL_NM + " - Manager";
                    }
                    else if (item.BUS_USR_TCD == "03")
                    {
                        var busAgcy = new BusinessAgency();
                        var obj     = busAgcy.getOneBusinessAgencyByAgcyNbr(item.BN, item.BUS_AGCY_NBR);
                        if (obj == null)
                        {
                            text = usr.USR_FUL_NM + " - Director";
                        }
                        else
                        {
                            text = usr.USR_FUL_NM + " - Director - " + obj.BUS_AGCY_NM;
                        }
                    }
                    else if (item.BUS_USR_TCD == "02")
                    {
                        var busAgcy = new BusinessAgency();
                        var obj     = busAgcy.getOneBusinessAgencyByAgcyNbr(item.BN, item.BUS_AGCY_NBR);
                        if (obj == null)
                        {
                            text = usr.USR_FUL_NM + " - Cashier";
                        }
                        else
                        {
                            text = usr.USR_FUL_NM + " - Cashier" + obj.BUS_AGCY_NM;
                        }
                    }
                    else
                    {
                        text = usr.USR_FUL_NM;
                    }

                    if (item.BUS_USR_NBR == selectedValue)
                    {
                        items.Add(new SelectListItem {
                            Text = text, Value = Convert.ToString(item.BUS_USR_NBR), Selected = true
                        });
                    }
                    else
                    {
                        items.Add(new SelectListItem {
                            Text = text, Value = Convert.ToString(item.BUS_USR_NBR), Selected = false
                        });
                    }
                }
            }
            return(items);
        }