示例#1
0
        public ActionResult Edit(NavModel model, int id = -1)
        {
            NavInfo navInfo = AdminNavs.GetNavById(id);
            if (navInfo == null)
                return PromptView("导航不存在");

            if (model.Pid == navInfo.Id)
                ModelState.AddModelError("Pid", "不能将自己作为父导航");

            if (model.Pid != 0 && AdminNavs.GetNavById(model.Pid) == null)
                ModelState.AddModelError("Pid", "父导航不存在");

            if (model.Pid != 0 && AdminNavs.GetSubNavList(navInfo.Id).Exists(x => x.Id == model.Pid))
                ModelState.AddModelError("Pid", "不能将导航调整到自己子导航下");

            if (ModelState.IsValid)
            {
                int oldPid = navInfo.Pid;

                navInfo.Pid = model.Pid;
                navInfo.Name = model.NavName;
                navInfo.Title = model.NavTitle == null ? "" : model.NavTitle;
                navInfo.Url = model.NavUrl;
                navInfo.Target = model.Target;
                navInfo.DisplayOrder = model.DisplayOrder;

                AdminNavs.UpdateNav(navInfo, oldPid);
                AddAdminOperateLog("修改导航", "修改导航,导航ID为:" + id);
                return PromptView("导航修改成功");
            }

            Load();
            return View(model);
        }
示例#2
0
        public void ProcessRequest(HttpContext context)
        {
            NavInfoBll navBll = new NavInfoBll();

            context.Response.ContentType = "text/plain";
            if (context.Request.RequestType.ToUpper() == "GET")
            {
                int     id  = int.Parse(context.Request["Id"] ?? "0");
                NavInfo nav = navBll.GetModelById(id);                //根据Id 获取数据
                System.Web.Script.Serialization.JavaScriptSerializer javaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string jsonStr = javaScriptSerializer.Serialize(nav); //将对象序列化成json
                context.Response.Write(jsonStr);
            }
            else
            {
                NavInfo editNav = new NavInfo();
                //获取前端数据
                editNav.Id      = int.Parse(context.Request["EditId"] ?? "0");
                editNav.Oder    = int.Parse(context.Request["EditOder"] ?? "99");
                editNav.Text    = context.Request["EditText"];
                editNav.Address = context.Request["EditAddress"];
                editNav.Remark  = context.Request["EditRemark"];

                //更新数据
                if (navBll.Update(editNav))
                {
                    context.Response.Write("Ok");
                }
            }
        }
 public void Change_nav(NavInfo nav)
 {
     course_marker.Angle = nav.course;
     lb_lat.Content      = "Широта: " + nav.lat.ToString();
     lb_lon.Content      = "Долгота: " + nav.lon.ToString();
     lb_course.Content   = "Курс: " + nav.course;
 }
示例#4
0
        public ActionResult Add(NavModel model)
        {
            if (model.Pid != 0 && AdminNavs.GetNavById(model.Pid) == null)
            {
                ModelState.AddModelError("Pid", "父导航不存在");
            }

            if (ModelState.IsValid)
            {
                NavInfo navInfo = new NavInfo()
                {
                    Pid          = model.Pid,
                    Name         = model.NavName,
                    Title        = model.NavTitle == null ? "" : model.NavTitle,
                    Url          = model.NavUrl,
                    Target       = model.Target,
                    DisplayOrder = model.DisplayOrder
                };

                AdminNavs.CreateNav(navInfo);
                AddMallAdminLog("添加导航", "添加导航,导航为:" + model.NavName);
                return(PromptView("导航添加成功"));
            }
            Load();
            return(View(model));
        }
示例#5
0
        /// <summary>
        /// 交换位置
        /// </summary>
        /// <param name="list"></param>
        /// <param name="i"></param>
        /// <param name="j"></param>
        private void Swap(List <NavInfo> list, int i, int j)
        {
            NavInfo temp = list[i];

            list[i] = list[j];
            list[j] = temp;
        }
示例#6
0
        public List <NavInfo> GetNavInfo(string GuoJia, int ParentId, string BuWei)
        {
            List <NavInfo> list     = new List <NavInfo>();
            DataTable      dt       = new DataTable();
            NavInfo        NavModel = null;

            try
            {
                string           sql  = "select * from NavInfo where GuoJia=@GuoJia and NavParentID=@NavParentID and BuWei=@BuWei order by PaiXu";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@GuoJia",      GuoJia),
                    new MySqlParameter("@NavParentID", ParentId),
                    new MySqlParameter("@BuWei",       BuWei)
                };
                dt = MySqlDB.GetDataTable(sql, System.Data.CommandType.Text, para);
                foreach (DataRow dr in dt.Rows)
                {
                    NavModel               = new NavInfo();
                    NavModel.NavID         = Convert.ToInt32(dr["NavID"]);//NavID NavTitleOne  NavContentOne   NavParentID  NavTypeID  NavIsLevel    NavDate    NavCreateBy   NavHeat   NavTitleTwo   NavContentTwo  GuoJia  BuWei   PaiXu  depth   LinkFor
                    NavModel.NavTitleOne   = dr["NavTitleOne"].ToString();
                    NavModel.NavContentOne = dr["NavContentOne"].ToString();
                    NavModel.NavParentID   = Convert.ToInt32(dr["NavParentID"]);
                    NavModel.NavTypeID     = dr["NavTypeID"].ToString();
                    if (!string.IsNullOrEmpty(dr["NavIsLevel"].ToString()))
                    {
                        NavModel.NavIsLevel = Convert.ToInt32(dr["NavIsLevel"]);
                    }
                    if (!string.IsNullOrEmpty(dr["NavDate"].ToString()))
                    {
                        NavModel.NavDate = Convert.ToDateTime(dr["NavDate"]);
                    }
                    NavModel.NavCreateBy = dr["NavCreateBy"].ToString();
                    if (!string.IsNullOrEmpty(dr["NavHeat"].ToString()))
                    {
                        NavModel.NavHeat = Convert.ToInt32(dr["NavHeat"]);
                    }
                    NavModel.NavTitleTwo   = dr["NavTitleTwo"].ToString();
                    NavModel.NavContentTwo = dr["NavContentTwo"].ToString();
                    NavModel.GuoJia        = dr["GuoJia"].ToString();
                    NavModel.BuWei         = dr["BuWei"].ToString();
                    if (!string.IsNullOrEmpty(dr["PaiXu"].ToString()))
                    {
                        NavModel.PaiXu = Convert.ToInt32(dr["PaiXu"]);
                    }
                    if (!string.IsNullOrEmpty(dr["depth"].ToString()))
                    {
                        NavModel.depth = Convert.ToInt32(dr["depth"]);
                    }
                    NavModel.LinkFor = dr["LinkFor"].ToString();
                    NavModel.KeyWord = dr["KeyWord"].ToString();
                    list.Add(NavModel);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(list);
        }
示例#7
0
        /// <summary>
        /// 编辑一条记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool EditByModelContent(NavInfo model)
        {
            bool res = false;

            try
            {
                string           sql  = "update NavInfo set NavTitleOne=@NavTitleOne,NavCreateBy=@NavCreateBy,NavTitleTwo=@NavTitleTwo,NavContentTwo=@NavContentTwo,GuoJia=@GuoJia,BuWei=@BuWei,PaiXu=@PaiXu,depth=@depth,LinkFor=@LinkFor,KeyWord=@KeyWord   where NavID=@NavID";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@NavID",         model.NavID),
                    new MySqlParameter("@NavTitleOne",   model.NavTitleOne),
                    new MySqlParameter("@NavCreateBy",   model.NavCreateBy),
                    new MySqlParameter("@NavTitleTwo",   model.NavTitleTwo),
                    new MySqlParameter("@NavContentTwo", model.NavContentTwo),
                    new MySqlParameter("@GuoJia",        model.GuoJia),
                    new MySqlParameter("@BuWei",         model.BuWei),
                    new MySqlParameter("@PaiXu",         model.PaiXu),
                    new MySqlParameter("@depth",         model.depth),
                    new MySqlParameter("@LinkFor",       model.LinkFor),
                    new MySqlParameter("@KeyWord",       model.KeyWord)
                };
                int n = MySqlDB.nonquery(sql, CommandType.Text, para);
                if (n > 0)
                {
                    res = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(res);
        }
示例#8
0
        public static List <NavInfo> GetListByIsWeb()
        {
            List <NavInfo> list = new List <NavInfo>();

            foreach (ArticleClassInfo model in BonSite.Data.ArticleClass.GetList())
            {
                if (model.IsWeb.Equals(1))
                {
                    NavInfo info = new NavInfo();
                    info.Id           = model.ArticleClassID;
                    info.Pid          = model.ParentArticleClassID;
                    info.Name         = model.ClassName;
                    info.Target       = model.Target;
                    info.DisplayOrder = model.DisplayOrder;
                    info.WebUrl       = model.WebUrl;
                    if (model.ClassType > 0)
                    {
                        info.Url = string.Format("/List/{0}-1.html", model.ArticleClassID);
                    }
                    else
                    {
                        info.Url = model.WebUrl;
                    }
                    list.Add(info);
                }
            }
            return(list);
        }
示例#9
0
        /// <summary>
        /// 递归创建导航树
        /// </summary>
        protected static void CreateTotalNavTree(List <ArticleClassInfo> sourceList, List <NavInfo> resultList)
        {
            foreach (ArticleClassInfo Model in sourceList)
            {
                if (Model.ParentArticleClassID <= 0)
                {
                    NavInfo info = new NavInfo();
                    info.Id           = Model.ArticleClassID;
                    info.Pid          = Model.ParentArticleClassID;
                    info.Name         = Model.ClassName;
                    info.Target       = Model.Target;
                    info.DisplayOrder = Model.DisplayOrder;
                    info.WebUrl       = Model.WebUrl;
                    if (Model.WebUrl.Length > 1)
                    {
                        info.Url = Model.WebUrl;
                    }
                    else if (Model.ClassType > 0)
                    {
                        info.Url = string.Format("/List/{0}-1.html", Model.ArticleClassID);
                    }
                    else
                    {
                        info.Url = Model.WebUrl;
                    }

                    resultList.Add(info);
                    CreateNavTree(sourceList, resultList, Model.ArticleClassID);
                }
            }
        }
        protected void saveNav_Click(object sender, EventArgs e)
        {
            int row = 0;

            foreach (object o in DataGrid1.GetKeyIDArray())
            {
                int     id           = int.Parse(o.ToString());
                string  displayorder = DataGrid1.GetControlValue(row, "displayorder").Trim();
                string  url          = DataGrid1.GetControlValue(row, "url").Trim();
                NavInfo nav          = Navs.GetNavigation(id);
                if (nav == null)
                {
                    continue;
                }
                if (!Utils.IsNumeric(displayorder) || url == "")
                {
                    row++;
                    continue;
                }
                if (nav.Displayorder != int.Parse(displayorder) || nav.Url != url)
                {
                    nav.Displayorder = int.Parse(displayorder);
                    nav.Url          = url;
                    Navs.UpdateNavigation(nav);
                }
                row++;
            }
            Response.Redirect(Request.RawUrl, true);
        }
示例#11
0
 /// <summary>
 /// 递归更新导航及其子导航的级别
 /// </summary>
 /// <param name="navList">导航列表</param>
 /// <param name="navInfo">导航信息</param>
 /// <param name="changeLayer">变化的级别</param>
 private static void UpdateChildNavLayer(List <NavInfo> navList, NavInfo navInfo, int changeLayer)
 {
     navInfo.Layer = navInfo.Layer + changeLayer;
     BrnShop.Data.Navs.UpdateNav(navInfo);
     foreach (NavInfo info in navList.FindAll(x => x.Pid == navInfo.Id))
     {
         UpdateChildNavLayer(navList, info, changeLayer);
     }
 }
 private void GetFromData(NavInfo nav)
 {
     nav.Name         = GetMaxlengthString(DNTRequest.GetFormString("name"), 50);
     nav.Title        = GetMaxlengthString(DNTRequest.GetFormString("title"), 255);
     nav.Url          = GetMaxlengthString(DNTRequest.GetFormString("url"), 255);
     nav.Target       = DNTRequest.GetFormInt("target", 0);
     nav.Available    = DNTRequest.GetFormInt("available", 0);
     nav.Displayorder = DNTRequest.GetFormInt("displayorder", 0);
     nav.Level        = DNTRequest.GetFormInt("level", 0);
 }
示例#13
0
        /// <summary>
        /// 得到自定义菜单不重复的PARENTID
        /// </summary>
        /// <returns></returns>
        public static List <NavInfo> GetNavigationHasSub()
        {
            List <NavInfo> info   = new List <NavInfo>();
            IDataReader    reader = DatabaseProvider.GetInstance().GetNavigationHasSub();

            while (reader.Read())
            {
                NavInfo m = new NavInfo();
                m.Parentid = TypeConverter.ObjectToInt(reader["parentid"], 0);
                info.Add(m);
            }
            reader.Close();
            return(info);
        }
示例#14
0
 /// <summary>
 /// 创建导航栏
 /// </summary>
 public static void CreateNav(NavInfo navInfo)
 {
     if (navInfo.Pid > 0)
     {
         List <NavInfo> navList       = BrnShop.Data.Navs.GetNavList();
         NavInfo        parentNavInfo = navList.Find(x => x.Id == navInfo.Pid);//父导航
         navInfo.Layer = parentNavInfo.Layer + 1;
     }
     else
     {
         navInfo.Layer = 1;
     }
     BrnShop.Data.Navs.CreateNav(navInfo);
     BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_NAV_LIST);
     BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_NAV_MAINLIST);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            DataGrid1.DataKeyField = "id";
            string menuid = DNTRequest.GetString("menuid");
            string mode   = DNTRequest.GetString("mode");

            if (mode != "")
            {
                if (mode == "del")
                {
                    Navs.DeleteNavigation(DNTRequest.GetQueryInt("id", 0));
                    Response.Redirect(Request.Path + (DNTRequest.GetString("parentid") != "" ? "?parentid=" + DNTRequest.GetString("parentid") : ""), true);
                }
                else
                {
                    if (DNTRequest.GetFormString("name").Trim() == "" || DNTRequest.GetFormString("displayorder").Trim() == "" || DNTRequest.GetFormInt("displayorder", 0) > Int16.MaxValue)
                    {
                        this.RegisterStartupScript("", "<script type='text/javascript'>alert('名称或序号输入不合法。');window.location=window.location;</script>");
                        return;
                    }
                    if (menuid == "0")
                    {
                        NavInfo nav = new NavInfo();
                        nav.Parentid = DNTRequest.GetQueryInt("parentid", 0);
                        GetFromData(nav);
                        Navs.InsertNavigation(nav);
                    }
                    else
                    {
                        NavInfo nav = new NavInfo();
                        nav.Id = DNTRequest.GetFormInt("menuid", 0);
                        GetFromData(nav);
                        Navs.UpdateNavigation(nav);
                    }
                    Response.Redirect(Request.RawUrl, true);
                }
            }
            else
            {
                BindDataGrid(DNTRequest.GetQueryInt("parentid", 0));
                if (DNTRequest.GetString("parentid") == "")
                {
                    returnbutton.Visible = false;
                }
            }
        }
示例#16
0
        public ActionResult Edit(int id = -1)
        {
            NavInfo navInfo = AdminNavs.GetNavById(id);
            if (navInfo == null)
                return PromptView("导航不存在");

            NavModel model = new NavModel();
            model.Pid = navInfo.Pid;
            model.NavName = navInfo.Name;
            model.NavTitle = navInfo.Title;
            model.NavUrl = navInfo.Url;
            model.Target = navInfo.Target;
            model.DisplayOrder = navInfo.DisplayOrder;
            Load();

            return View(model);
        }
示例#17
0
        private int Partition(List <NavInfo> list, int left, int right) // 划分函数
        {
            NavInfo pivot = list[right];                                // 这里每次都选择最后一个元素作为基准
            int     tail  = left - 1;                                   // tail为小于基准的子数组最后一个元素的索引

            for (int i = left; i < right; i++)                          // 遍历基准以外的其他元素
            {
                if (list[i].Oder <= pivot.Oder)                         // 把小于等于基准的元素放到前一个子数组末尾
                {
                    Swap(list, ++tail, i);
                }
            }
            Swap(list, tail + 1, right);
            // 最后把基准放到前一个子数组的后边,剩下的子数组既是大于基准的子数组
            // 该操作很有可能把后面元素的稳定性打乱,所以快速排序是不稳定的排序算法
            return(tail + 1);    // 返回基准的索引
        }
示例#18
0
        public NavInfo GetModelById(int NavID)
        {
            NavInfo model = new NavInfo();

            try
            {
                string           sql  = "select * from NavInfo where NavID=@NavID";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@NavID", NavID)
                };
                DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, para);
                model.NavID         = NavID;
                model.NavTitleOne   = dt.Rows[0]["NavTitleOne"].ToString();
                model.NavContentOne = dt.Rows[0]["NavContentOne"].ToString();
                model.NavParentID   = Convert.ToInt32(dt.Rows[0]["NavParentID"]);
                model.NavTypeID     = dt.Rows[0]["NavTypeID"].ToString();
                model.NavIsLevel    = Convert.ToInt32(dt.Rows[0]["NavIsLevel"]);
                if (!string.IsNullOrEmpty(dt.Rows[0]["NavDate"].ToString()))
                {
                    model.NavDate = Convert.ToDateTime(dt.Rows[0]["NavDate"]);
                }
                model.NavCreateBy = dt.Rows[0]["NavCreateBy"].ToString();
                if (!string.IsNullOrEmpty(dt.Rows[0]["NavHeat"].ToString()))
                {
                    model.NavHeat = Convert.ToInt32(dt.Rows[0]["NavHeat"]);
                }
                model.NavTitleTwo   = dt.Rows[0]["NavTitleTwo"].ToString();
                model.NavContentTwo = dt.Rows[0]["NavContentTwo"].ToString();
                model.GuoJia        = dt.Rows[0]["GuoJia"].ToString();
                model.BuWei         = dt.Rows[0]["BuWei"].ToString();
                model.PaiXu         = Convert.ToInt32(dt.Rows[0]["PaiXu"].ToString());
                model.depth         = Convert.ToInt32(dt.Rows[0]["depth"]);
                model.LinkFor       = dt.Rows[0]["LinkFor"].ToString();
                model.KeyWord       = dt.Rows[0]["KeyWord"].ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(model);
        }
示例#19
0
文件: Navs.cs 项目: nuet/OWZXAPP
        /// <summary>
        /// 获得导航栏列表
        /// </summary>
        /// <returns></returns>
        public static List <NavInfo> GetNavList()
        {
            List <NavInfo> navList = new List <NavInfo>();
            IDataReader    reader  = OWZX.Core.BSPData.RDBS.GetNavList();

            while (reader.Read())
            {
                NavInfo navInfo = new NavInfo();
                navInfo.Id           = TypeHelper.ObjectToInt(reader["id"]);
                navInfo.Pid          = TypeHelper.ObjectToInt(reader["pid"]);
                navInfo.Layer        = TypeHelper.ObjectToInt(reader["layer"]);
                navInfo.Name         = reader["name"].ToString();
                navInfo.Title        = reader["title"].ToString();
                navInfo.Url          = reader["url"].ToString();
                navInfo.Target       = TypeHelper.ObjectToInt(reader["target"]);
                navInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]);
                navList.Add(navInfo);
            }
            reader.Close();
            return(navList);
        }
示例#20
0
        public IndexModule() : base(RouteDictionary.BaseStat)
        {
            Get[RouteDictionary.Add] = p =>
            {
                UserIdentity user = (UserIdentity)Context.CurrentUser;
                NavManager   mgr  = new NavManager();
                NavInfo      nav  = mgr.CreateNav(Request.Path, user.Menus);
                return(View[ViewDictionary.GroupAdd, nav]);
            };

            Get[RouteDictionary.StatOrder] = p =>
            {
                UserIdentity user = (UserIdentity)Context.CurrentUser;
                NavManager   mgr  = new NavManager();
                NavInfo      nav  = mgr.CreateNav(Request.Path, user.Menus);
                return(View[ViewDictionary.StatOrderList, nav]);
            };

            Get[RouteDictionary.StatOrderGet] = p =>
            {
                string per       = Request.Query["limit"];  //显示数量
                string offset    = Request.Query["offset"]; //当前记录条数
                int    pageSize  = 10;                      //每页显示条数
                int    offsetNum = 0;                       //当前记录偏移量
                if (!Int32.TryParse(offset, out offsetNum))
                {
                    offsetNum = 0;
                }
                if (!Int32.TryParse(per, out pageSize))
                {
                    pageSize = 10;
                }
                int pageNum = (offsetNum / pageSize) + 1;//当前页码

                GroupSource source = new GroupSource();
                var         list   = source.GetPageGroups("1=1", "GroupID desc", pageSize * (pageNum - 1) + 1, pageSize * pageNum);
                return(Response.AsJson(list));
            };
        }
示例#21
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddByModel(NavInfo model)
        {
            bool res = false;

            try
            {
                string           sql  = "insert into NavInfo (NavTitleOne,NavContentOne,NavParentID,NavTypeID,NavIsLevel,NavDate,NavCreateBy,NavHeat ,NavTitleTwo,NavContentTwo,GuoJia,BuWei,PaiXu,depth,LinkFor,KeyWord) Values (@NavTitleOne,@NavContentOne,@NavParentID,@NavTypeID,@NavIsLevel,@NavDate,@NavCreateBy,@NavHeat,@NavTitleTwo,@NavContentTwo,@GuoJia,@BuWei,@PaiXu,@depth,@LinkFor,@KeyWord)";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@NavTitleOne",   model.NavTitleOne),
                    new MySqlParameter("@NavContentOne", model.NavContentOne),
                    new MySqlParameter("@NavParentID",   model.NavParentID),
                    new MySqlParameter("@NavTypeID",     model.NavTypeID),
                    new MySqlParameter("@NavIsLevel",    model.NavIsLevel),
                    new MySqlParameter("@NavDate",       model.NavDate),
                    new MySqlParameter("@NavCreateBy",   model.NavCreateBy),
                    new MySqlParameter("@NavHeat",       model.NavHeat),
                    new MySqlParameter("@NavTitleTwo",   model.NavTitleTwo),
                    new MySqlParameter("@NavContentTwo", model.NavContentTwo),
                    new MySqlParameter("@GuoJia",        model.GuoJia),
                    new MySqlParameter("@BuWei",         model.BuWei),
                    new MySqlParameter("@PaiXu",         model.PaiXu),
                    new MySqlParameter("@depth",         model.depth),
                    new MySqlParameter("@LinkFor",       model.LinkFor),
                    new MySqlParameter("@KeyWord",       model.KeyWord)
                };
                int n = MySqlDB.nonquery(sql, CommandType.Text, para);
                if (n > 0)
                {
                    res = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(res);
        }
示例#22
0
        /// <summary>
        /// 控件行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.Equals("del"))
            {
                int     id   = Convert.ToInt32(e.CommandArgument);
                NavInfo item = NavInfoService.GetModel(id);
                if (item != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(item.indexImg)))
                    {
                        System.IO.File.Delete(Server.MapPath(item.indexImg));
                    }
                }
                IndexProductService.Delete(id);
                LoadData();
            }
            if (e.CommandName.Equals("mod"))
            {
                int          id   = Convert.ToInt32(e.CommandArgument);
                IndexProduct item = IndexProductService.GetModel(id);
                if (item != null)
                {
                    ddlCate.SelectedValue = item.typeId.ToString();
                    txtTitle.Text         = item.proName;

                    txtTitle2.Text = item.proDesc;
                    txtPrice.Text  = item.priceStr;

                    lblURL1.Text    = item.imgUrl;
                    txtLinkUrl.Text = item.remark;

                    txtUnit.Text        = item.unitDesc;
                    lblId.Text          = item.id.ToString();
                    this.pnlAdd.Visible = true;
                    pnlList.Visible     = false;
                }
            }
        }
示例#23
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NavInfo nav = new NavInfo();

            //采集数据
            nav.Oder    = int.Parse(context.Request["Oder"] ?? "99");
            nav.Text    = context.Request["Text"];
            nav.Address = context.Request["Address"];
            nav.Remark  = context.Request["Remark"];

            NavInfoBll navBll = new NavInfoBll();

            //调用业务逻辑层方法保存到数据库
            if (navBll.Add(nav))
            {
                context.Response.Write("Ok");
            }
            else
            {
                context.Response.Write("No");
            }
        }
示例#24
0
        /// <summary>
        /// 删除一条记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool DeleteByModel(NavInfo model)
        {
            bool res = false;

            try
            {
                string           sql  = "delete from NavInfo where NavID=@NavID";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@NavID", model.NavID)
                };
                int n = MySqlDB.nonquery(sql, CommandType.Text, para);
                if (n > 0)
                {
                    res = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(res);
        }
示例#25
0
        /// <summary>
        /// 得到自定义菜单信息
        /// </summary>
        /// <param name="getAll">是否获取全部导航菜单</param>
        /// <returns></returns>
        public static List <NavInfo> GetNavigation(bool getAll)
        {
            List <NavInfo> info   = new List <NavInfo>();
            IDataReader    reader = GetNavigationData(getAll);

            while (reader.Read())
            {
                NavInfo m = new NavInfo();
                m.Id           = TypeConverter.ObjectToInt(reader["id"], 0);
                m.Level        = TypeConverter.ObjectToInt(reader["level"], 0);
                m.Name         = reader["name"].ToString().Trim();
                m.Parentid     = TypeConverter.ObjectToInt(reader["parentid"], 0);
                m.Target       = TypeConverter.ObjectToInt(reader["target"], 0);
                m.Title        = reader["title"].ToString().Trim();
                m.Type         = TypeConverter.ObjectToInt(reader["type"], 0);
                m.Url          = reader["url"].ToString().Trim();
                m.Available    = TypeConverter.ObjectToInt(reader["available"], 0);
                m.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"], 0);
                info.Add(m);
            }
            reader.Close();
            return(info);
        }
示例#26
0
        /// <summary>
        /// 控件行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.Equals("del"))
            {
                int     id   = Convert.ToInt32(e.CommandArgument);
                NavInfo item = NavInfoService.GetModel(id);
                if (item != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(item.indexImg)))
                    {
                        System.IO.File.Delete(Server.MapPath(item.indexImg));
                    }
                }
                NavInfoService.Delete(id);
                LoadData();
            }
            if (e.CommandName.Equals("mod"))
            {
                int     id   = Convert.ToInt32(e.CommandArgument);
                NavInfo item = NavInfoService.GetModel(id);
                if (item != null)
                {
                    txtTitle.Text = item.indexTitle;

                    txtContentTitle.Text = item.title;
                    txtTitle2.Text       = item.indexTitle2;

                    lblURL1.Text        = item.indexImg;
                    txtLinkUrl.Text     = item.linkurl;
                    this.content1.Value = item.infoDesc;

                    lblId.Text          = item.id.ToString();
                    this.pnlAdd.Visible = true;
                    pnlList.Visible     = false;
                }
            }
        }
示例#27
0
        /// <summary>
        /// 更新导航栏
        /// </summary>
        public static void UpdateNav(NavInfo navInfo, int oldPid)
        {
            if (navInfo.Pid != oldPid)
            {
                int            changeLayer      = 0;
                List <NavInfo> navList          = BrnShop.Data.Navs.GetNavList();
                NavInfo        oldParentNavInfo = navList.Find(x => x.Id == oldPid);
                if (navInfo.Pid > 0)
                {
                    NavInfo newParentNavInfo = navList.Find(x => x.Id == navInfo.Pid);//新的父导航
                    if (oldParentNavInfo == null)
                    {
                        changeLayer = newParentNavInfo.Layer - 1;
                    }
                    else
                    {
                        changeLayer = newParentNavInfo.Layer - oldParentNavInfo.Layer;
                    }
                    navInfo.Layer = newParentNavInfo.Layer + 1;
                }
                else
                {
                    changeLayer   = 1 - oldParentNavInfo.Layer;
                    navInfo.Layer = 1;
                }

                foreach (NavInfo info in navList.FindAll(x => x.Pid == navInfo.Id))
                {
                    UpdateChildNavLayer(navList, info, changeLayer);
                }
            }

            BrnShop.Data.Navs.UpdateNav(navInfo);

            BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_NAV_LIST);
            BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_NAV_MAINLIST);
        }
示例#28
0
 /// <summary>
 /// 更新导航菜单
 /// </summary>
 /// <param name="nav">导航菜单类</param>
 public static void UpdateNavigation(NavInfo nav)
 {
     Data.Navs.UpdateNavigation(nav);
     ClearNavigation();
     InitNavigation();
 }
示例#29
0
文件: Navs.cs 项目: nuet/OWZXAPP
 /// <summary>
 /// 更新导航栏
 /// </summary>
 public static void UpdateNav(NavInfo navInfo)
 {
     OWZX.Core.BSPData.RDBS.UpdateNav(navInfo);
 }
        protected override int CreateNavInfo(SYMBOL_DESCRIPTION_NODE[] rgSymbolNodes, uint ulcNodes, out IVsNavInfo ppNavInfo)
        {
            Debug.Assert(rgSymbolNodes != null || ulcNodes > 0, "Invalid input parameters into CreateNavInfo");

            ppNavInfo = null;

            var count               = 0;
            var libraryName         = string.Empty;
            var metadataProjectItem = string.Empty;

            if (rgSymbolNodes[0].dwType != (uint)_LIB_LISTTYPE.LLT_PACKAGE)
            {
                Debug.Fail("Symbol description should always contain LLT_PACKAGE node as first node");
                return(VSConstants.E_INVALIDARG);
            }
            else
            {
                count++;

                // If second node is also a package node, the below is the inference Node for
                // which NavInfo is generated is a 'referenced' node in CV
                // First package node ---> project item under which referenced node is displayed
                // Second package node ---> actual lib item node i.e., referenced assembly
                if (ulcNodes > 1 && rgSymbolNodes[1].dwType == (uint)_LIB_LISTTYPE.LLT_PACKAGE)
                {
                    count++;

                    metadataProjectItem = rgSymbolNodes[0].pszName;
                    libraryName         = rgSymbolNodes[1].pszName;
                }
                else
                {
                    libraryName = rgSymbolNodes[0].pszName;
                }
            }

            var namespaceName = new StringBuilder();
            var className     = new StringBuilder();
            var memberName    = string.Empty;

            // Populate namespace, class and member names
            // Generate flattened names for nested namespaces and classes
            for (; count < ulcNodes; count++)
            {
                switch (rgSymbolNodes[count].dwType)
                {
                case (uint)_LIB_LISTTYPE.LLT_NAMESPACES:
                    if (namespaceName.Length > 0)
                    {
                        namespaceName.Append(".");
                    }

                    namespaceName.Append(rgSymbolNodes[count].pszName);
                    break;

                case (uint)_LIB_LISTTYPE.LLT_CLASSES:
                    if (className.Length > 0)
                    {
                        className.Append(".");
                    }

                    className.Append(rgSymbolNodes[count].pszName);
                    break;

                case (uint)_LIB_LISTTYPE.LLT_MEMBERS:
                    if (memberName.Length > 0)
                    {
                        Debug.Fail("Symbol description cannot contain more than one LLT_MEMBERS node.");
                    }

                    memberName = rgSymbolNodes[count].pszName;
                    break;
                }
            }

            // TODO: Make sure we pass the right value for Visual Basic.
            ppNavInfo = new NavInfo(
                this.LibraryGuid,
                this.SymbolToolLanguage,
                libraryName,
                metadataProjectItem,
                namespaceName.ToString(),
                className.ToString(),
                memberName);

            return(VSConstants.S_OK);
        }