Пример #1
0
        public void GetNav(string ID)
        {
            List <NavData> list = Serialize.DeSerializeNow <List <NavData> >(GTKey.File_Nav);
            NavData        nav  = Utils.TreeToList(list, "ChildrenList").Where(c => c.ID == ID).FirstOrDefault();

            Response.Write(Utils.ObjectToJson(nav));
        }
Пример #2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="nav"></param>
        /// <returns></returns>
        public ActionResult Edit(NavData nav)
        {
            List <NavData> list = Serialize.DeSerializeNow <List <NavData> >(GTKey.File_Nav);

            EditNav(list, nav.ID, nav);
            Serialize.ToSerialize(list, GTKey.File_Nav);
            return(Success(GTKey.Msg_Succes_Edit, "Index"));
        }
Пример #3
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="nav"></param>
        /// <returns></returns>
        public ActionResult Insert(NavData nav)
        {
            if (string.IsNullOrEmpty(nav.Title))
            {
                return(Error("请输入标题!", "Index"));
            }
            nav.Title = nav.Title.Trim();

            List <NavData> list = Serialize.DeSerializeNow <List <NavData> >(GTKey.File_Nav);

            if (list != null && list.Count > 0 && nav.ID != "0")
            {
                NavData parent = Utils.TreeToList(list, "ChildrenList").Where(c => c.ID == nav.ID).FirstOrDefault();

                if (parent != null)
                {
                    if (parent.ChildrenList == null)
                    {
                        parent.ChildrenList = new List <NavData>();
                    }
                    nav.Layer = parent.Layer + 1;
                    nav.ID    = Guid.NewGuid().ToString();
                    parent.ChildrenList.Add(nav);
                }
            }
            else
            {
                if (list == null || list.Count <= 0)
                {
                    list = new List <NavData>();
                }
                nav.ID    = Guid.NewGuid().ToString();
                nav.Layer = 1;
                list.Add(nav);
            }
            Serialize.ToSerialize(list, GTKey.File_Nav);

            return(Success(GTKey.Msg_Succes_Add, "Index"));
        }
Пример #4
0
        /// <summary>
        /// 父窗页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            LoginInfo info = Utils.GetLoginInfo();

            if (Session["Login"] == null)
            {
                LoginIPService bll_login = new LoginIPService();
                LoginIP        login     = bll_login.FindEntity(c =>
                                                                c.ipv4 == info.IPv4 && c.extranetIP == info.ExtranetIP &&
                                                                c.hostName == info.HostName && c.System == info.System && c.city == info.City);
                if (login == null)
                {
                    login            = new LoginIP();
                    login.ipv4       = info.IPv4;
                    login.extranetIP = info.ExtranetIP;
                    login.hostName   = info.HostName;
                    login.System     = info.System;
                    login.city       = info.City;
                    login.mac        = info.Mac;
                    login.@operator  = info.Operator;
                    login.counts     = 1;
                    login.loginTime  = DateTime.Now;
                    Session["Login"] = login;
                    bll_login.AddEntity(login);
                }
                else
                {
                    login.counts++;
                    login.loginTime = DateTime.Now;
                    bll_login.EditEntity(login);
                }
            }
            List <NavData> list = Serialize.DeSerializeNow <List <NavData> >("Nav.data");

            ViewBag.nav = GetNav(list);

            return(View());
        }
Пример #5
0
        public ActionResult Index()
        {
            List <NavData> list = Serialize.DeSerializeNow <List <NavData> >(GTKey.File_Nav);

            return(View(BindDrop(list)));
        }