Esempio n. 1
0
        // GET: /Manage/ChangePassword
        public ActionResult ChangePassword()
        {
            MyMenu menu = (MyMenu)Session["Menu"];

            menu.ChangeSelected(1, 2);
            Session["Menu"] = menu;
            return(View());
        }
Esempio n. 2
0
        public ActionResult Index(int SelectedCustId = 0, int SelectedContractId = -1)
        {
            //Определить контрагента и договор
            string qq  = User.Identity.Name;
            string cst = GetCookie("Cust");
            string dog = GetCookie("Dog");

            if (!String.IsNullOrWhiteSpace(cst) && !String.IsNullOrWhiteSpace(dog))
            {
                //Назначаем и быбираем контрагента и договор
                CustID     = Convert.ToInt32(cst);
                ContractID = Convert.ToInt32(dog);
            }
            else
            {
                //Получить данные по юзеру
                string usr = GetCookie("MyAuth");

                //cust = await db.Custs.FindAsync(user.CustID);
            }


            MyMenu menu = (MyMenu)Session["Menu"];

            if (SelectedContractId > 0 && menu.ContractId != SelectedContractId)
            {
                menu = ChangeControl(menu, SelectedCustId, SelectedContractId);
                ViewData["Contract"] = new SelectList(contracts, "ContractID", "Num", ContractID);
            }
            else
            {
                if (SelectedCustId > 0 && SelectedCustId != menu.CustId)
                {
                    menu = ChangeControl(menu, SelectedCustId, 0);
                }
                else
                {
                    menu = ChangeControl(menu, menu.CustId, 0);
                }

                if (ContractID > 0)
                {
                    ViewData["Contract"] = new SelectList(contracts, "ContractID", "Num", ContractID);
                }
                else
                {
                    ViewData["Contract"] = null;
                }
            }
            BalanceRepository bl = new BalanceRepository();

            menu.sm = bl.GetBalance(CustID, ContractID);

            menu.ChangeSelected(1, 1);
            Session["Menu"] = menu;

            //не верно для админа, однако работает?
            IEnumerable <OrgView> orgView = repo.GetCust(menu.UserId);

            ViewData["Cust"] = new SelectList(orgView, "ID", "Txt", CustID);

            return(View("Index", cust));
        }