コード例 #1
0
        /*
         * @param void, @return redirect
         * Method to get Menu o
         * to Menu on Index view method
         */
        public bool getMenu(int id = 0)
        {
            String preId;

            if (id == 0)
            {
                if (Request.QueryString["id"] != null)
                {
                    preId = Request.QueryString["id"].ToString();
                    if (User.IsInRole(preId))
                    {
                        id = Int32.Parse(preId);
                    }
                    else
                    {
                        return(false);//RedirectToAction("Login", "Account");
                    }
                }
                else
                {
                    if ((Int32.TryParse(Session["id"].ToString(), out id)) == true)
                    {
                        //out int id = int id
                    }
                    else
                    {
                        return(true);//RedirectToAction("Index", "Home");
                    }
                }
            }


            XMLController XC          = new XMLController();
            List <String> values      = XC.readXML("plc", id);
            List <String> items       = XC.readNodesNameXML("plc", id, 3);
            List <String> plc         = XC.readNodesNameXML("plc", id, 1);
            List <String> names       = XC.readNodesNameXML("plc", id, 2);
            List <String> types       = XC.XMLgetTypes("plc", id);
            string        ProjectName = XC.readNodeXML("name", id);
            int           i           = 0;

            foreach (String value in values)
            {
                //String name = names[i] + items[i];
                Session.Add(items[i], value);
                i++;
            }
            Session.Add("values", values);

            Session.Add("id", id);
            Session.Add("names", names);
            Session.Add("plc", plc);
            Session.Add("types", types);
            Session.Add("ProjectName", ProjectName);

            return(true);//return RedirectToAction("Index", "Menu");
        }
コード例 #2
0
        public ActionResult Index(int id)
        {
            bool bMenu = getMenu(id);

            if (!bMenu)
            {
                return(RedirectToAction("Login", "Account"));
            }
            //NotificationDataContext db = new NotificationDataContext();
            //List<Notification> data = db.Notifications.Where(p => p.Owner.Contains(User.Identity.Name) && p.BakeryID == id).ToList();
            XMLController XC    = new XMLController();
            List <string> plc   = XC.readNodesNameXML("plc", id, 1);
            List <string> names = XC.readNodesNameXML("plc", id, 2);
            List <string> types = XC.XMLgetTypes("plc", id);
            string        url   = "/" + types[1] + "?name=" + names[0] + "&plc=" + plc[0];

            return(Redirect(url));
            //return View(data);
        }
コード例 #3
0
        public ActionResult Index()
        {
            try
            {
                string        name = User.Identity.Name;
                XMLController XC   = new XMLController();
                string[]      existingRolesForUser = Roles.GetRolesForUser();
                List <int>    Numbers = XC.GetAllConfigsProjectNumbers(existingRolesForUser);
                ViewBag.Numbers = Numbers;
                ViewBag.Count   = Numbers.Count;
                List <string> Texts = XC.GetAllConfigsNames(existingRolesForUser);
                ViewBag.Text        = Texts;
                ViewBag.menuDisable = true;

                return(View());
            }
            catch (Exception e)
            {
                Error.toFile(e.Message + "\n" + e.StackTrace, this.GetType().FullName);
                return(View());
            }
        }