Beispiel #1
0
 /// <summary>
 /// 创建管理员组
 /// </summary>
 /// <param name="adminGroupInfo">管理员组信息</param>
 public static void CreateAdminGroup(AdminGroupInfo adminGroupInfo)
 {
     adminGroupInfo.ActionList = adminGroupInfo.ActionList.ToLower();
     int adminGid = BrnShop.Data.AdminGroups.CreateAdminGroup(adminGroupInfo);
     if (adminGid > 0)
     {
         BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_ADMINGROUP_LIST);
         adminGroupInfo.AdminGid = adminGid;
         WriteAdminNavMenuCache(adminGroupInfo);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 获得管理员组列表
 /// </summary>
 /// <returns></returns>
 public static AdminGroupInfo[] GetAdminGroupList()
 {
     DataTable dt = BrnShop.Core.BSPData.RDBS.GetAdminGroupList();
     AdminGroupInfo[] adminGroupList = new AdminGroupInfo[dt.Rows.Count];
     int index = 0;
     foreach (DataRow dr in dt.Rows)
     {
         AdminGroupInfo adminGroupInfo = new AdminGroupInfo();
         adminGroupInfo.AdminGid = TypeHelper.ObjectToInt(dr["admingid"]);
         adminGroupInfo.Title = dr["title"].ToString();
         adminGroupInfo.ActionList = dr["actionlist"].ToString();
         adminGroupList[index] = adminGroupInfo;
         index++;
     }
     return adminGroupList;
 }
        public ActionResult Add(AdminGroupModel model)
        {
            if (AdminGroups.GetAdminGroupIdByTitle(model.AdminGroupTitle) > 0)
                ModelState.AddModelError("AdminGroupTitle", "名称已经存在");

            if (ModelState.IsValid)
            {
                AdminGroupInfo adminGroupInfo = new AdminGroupInfo()
                {
                    Title = model.AdminGroupTitle,
                    ActionList = CommonHelper.StringArrayToString(model.ActionList).ToLower()
                };

                AdminGroups.CreateAdminGroup(adminGroupInfo);
                AddAdminOperateLog("添加管理员组", "添加管理员组,管理员组为:" + model.AdminGroupTitle);
                return PromptView("管理员组添加成功");
            }
            Load();
            return View(model);
        }
Beispiel #4
0
 /// <summary>
 /// 更新管理员组
 /// </summary>
 public static void UpdateAdminGroup(AdminGroupInfo adminGroupInfo)
 {
     BrnShop.Core.BSPData.RDBS.UpdateAdminGroup(adminGroupInfo);
 }
Beispiel #5
0
 /// <summary>
 /// 创建管理员组
 /// </summary>
 /// <param name="adminGroupInfo">管理员组信息</param>
 /// <returns></returns>
 public static int CreateAdminGroup(AdminGroupInfo adminGroupInfo)
 {
     return BrnShop.Core.BSPData.RDBS.CreateAdminGroup(adminGroupInfo);
 }
Beispiel #6
0
        /// <summary>
        /// 将管理员组的导航菜单栏缓存写入到文件中
        /// </summary>
        private static void WriteAdminNavMenuCache(AdminGroupInfo adminGroupInfo)
        {
            HashSet<string> adminGroupActionHashSet = new HashSet<string>();
            string[] actionList = StringHelper.SplitString(adminGroupInfo.ActionList);//将后台操作列表字符串分隔成后台操作列表
            foreach (string action in actionList)
            {
                adminGroupActionHashSet.Add(action);
            }

            bool flag = false;
            StringBuilder menu = new StringBuilder();
            StringBuilder menuList = new StringBuilder("var menuList = [");

            #region 商品管理

            menu.AppendFormat("{0}\"title\":\"商品管理\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("product"))
            {
                menu.AppendFormat("{0}\"title\":\"添加商品\",\"url\":\"/admin/product/addproduct\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"添加SKU\",\"url\":\"/admin/product/addsku\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"在售商品\",\"url\":\"/admin/product/onsaleproductlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"下架商品\",\"url\":\"/admin/product/outsaleproductlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"签名商品\",\"url\":\"/admin/product/signproductlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"定时商品\",\"url\":\"/admin/product/timeproductlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"回收站\",\"url\":\"/admin/product/recyclebinproductlist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 促销活动

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"促销活动\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("promotion"))
            {
                menu.AppendFormat("{0}\"title\":\"单品促销\",\"url\":\"/admin/promotion/singlepromotionlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"买送促销\",\"url\":\"/admin/promotion/buysendpromotionlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"赠品促销\",\"url\":\"/admin/promotion/giftpromotionlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"套装促销\",\"url\":\"/admin/promotion/suitpromotionlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"满赠促销\",\"url\":\"/admin/promotion/fullsendpromotionlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"满减促销\",\"url\":\"/admin/promotion/fullcutpromotionlist\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("topic"))
            {
                menu.AppendFormat("{0}\"title\":\"活动专题\",\"url\":\"/admin/topic/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("coupon"))
            {
                menu.AppendFormat("{0}\"title\":\"优惠劵\",\"url\":\"/admin/coupon/coupontypelist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 订单管理

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"订单管理\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("order"))
            {
                menu.AppendFormat("{0}\"title\":\"订单列表\",\"url\":\"/admin/order/orderlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"退款列表\",\"url\":\"/admin/order/refundlist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 咨询评价

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"咨询评价\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("productreview"))
            {
                menu.AppendFormat("{0}\"title\":\"商品评价\",\"url\":\"/admin/productreview/productreviewlist\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("productconsult"))
            {
                menu.AppendFormat("{0}\"title\":\"商品咨询\",\"url\":\"/admin/productconsult/productconsultlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"咨询类型\",\"url\":\"/admin/productconsult/productconsulttypelist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 用户管理

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"用户管理\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("user"))
            {
                menu.AppendFormat("{0}\"title\":\"用户列表\",\"url\":\"/admin/user/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("userrank"))
            {
                menu.AppendFormat("{0}\"title\":\"会员等级\",\"url\":\"/admin/userrank/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("admingroup"))
            {
                menu.AppendFormat("{0}\"title\":\"管理员组\",\"url\":\"/admin/admingroup/list\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 新闻管理

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"新闻管理\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("news"))
            {
                menu.AppendFormat("{0}\"title\":\"新闻类型\",\"url\":\"/admin/news/newstypelist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"新闻列表\",\"url\":\"/admin/news/newslist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 广告管理

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"广告管理\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("advert"))
            {
                menu.AppendFormat("{0}\"title\":\"广告位置\",\"url\":\"/admin/advert/advertpositionlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"广告列表\",\"url\":\"/admin/advert/advertlist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 商城内容

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"商城内容\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("nav"))
            {
                menu.AppendFormat("{0}\"title\":\"导航菜单\",\"url\":\"/admin/nav/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("help"))
            {
                menu.AppendFormat("{0}\"title\":\"商城帮助\",\"url\":\"/admin/help/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("friendlink"))
            {
                menu.AppendFormat("{0}\"title\":\"友情链接\",\"url\":\"/admin/friendlink/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("banner"))
            {
                menu.AppendFormat("{0}\"title\":\"Banner\",\"url\":\"/admin/banner/list\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 商品性质

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"商品性质\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("brand"))
            {
                menu.AppendFormat("{0}\"title\":\"商品品牌\",\"url\":\"/admin/brand/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("category"))
            {
                menu.AppendFormat("{0}\"title\":\"分类管理\",\"url\":\"/admin/category/categorylist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 报表统计

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"报表统计\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("stat"))
            {
                menu.AppendFormat("{0}\"title\":\"在线用户\",\"url\":\"/admin/stat/onlineuserlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"搜索分析\",\"url\":\"/admin/stat/searchwordstatlist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"商品统计\",\"url\":\"/admin/stat/productstat\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"销售明细\",\"url\":\"/admin/stat/salelist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"销售趋势\",\"url\":\"/admin/stat/saletrend\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"地区统计\",\"url\":\"/admin/stat/regionstat\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"客户端统计\",\"url\":\"/admin/stat/clientstat\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 系统设置

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"系统设置\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("brand"))
            {
                menu.AppendFormat("{0}\"title\":\"站点信息\",\"url\":\"/admin/set/site\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"商城设置\",\"url\":\"/admin/set/shop\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"主题管理\",\"url\":\"/admin/set/theme\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"账号设置\",\"url\":\"/admin/set/account\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"上传设置\",\"url\":\"/admin/set/upload\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"性能设置\",\"url\":\"/admin/set/performance\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"访问控制\",\"url\":\"/admin/set/access\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"邮箱设置\",\"url\":\"/admin/set/email\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"短信设置\",\"url\":\"/admin/set/sms\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"积分设置\",\"url\":\"/admin/set/credit\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"打印订单\",\"url\":\"/admin/set/printorder\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("bannedip"))
            {
                menu.AppendFormat("{0}\"title\":\"禁止IP\",\"url\":\"/admin/bannedip/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("filterword"))
            {
                menu.AppendFormat("{0}\"title\":\"筛选词\",\"url\":\"/admin/filterword/list\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 商城插件

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"商城插件\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("plugin"))
            {
                menu.AppendFormat("{0}\"title\":\"授权插件\",\"url\":\"/admin/plugin/list?type=0\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"支付插件\",\"url\":\"/admin/plugin/list?type=1\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"配送插件\",\"url\":\"/admin/plugin/list?type=2\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 日志管理

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"日志管理\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("log"))
            {
                menu.AppendFormat("{0}\"title\":\"后台日志\",\"url\":\"/admin/log/adminoperateloglist\"{1},", "{", "}");
                menu.AppendFormat("{0}\"title\":\"积分日志\",\"url\":\"/admin/log/creditloglist\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            #region 开发人员

            flag = false;
            menu = menu.Clear();
            menu.AppendFormat("{0}\"title\":\"开发人员\",\"subMenuList\":[", "{");
            if (adminGroupActionHashSet.Contains("event"))
            {
                menu.AppendFormat("{0}\"title\":\"事件管理\",\"url\":\"/admin/event/list\"{1},", "{", "}");
                flag = true;
            }
            if (adminGroupActionHashSet.Contains("database"))
            {
                menu.AppendFormat("{0}\"title\":\"数据库管理\",\"url\":\"/admin/database/manage\"{1},", "{", "}");
                flag = true;
            }
            if (flag)
            {
                menu.Remove(menu.Length - 1, 1);
                menu.Append("]},");
                menuList.Append(menu.ToString());
            }

            #endregion

            if (menuList.Length > 16)
                menuList.Remove(menuList.Length - 1, 1);
            menuList.Append("]");

            try
            {
                string fileName = IOHelper.GetMapPath(AdminNavMeunCacheFolder + "/" + adminGroupInfo.AdminGid + ".js");
                using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
                {
                    Byte[] info = System.Text.Encoding.UTF8.GetBytes(menuList.ToString());
                    fs.Write(info, 0, info.Length);
                    fs.Flush();
                    fs.Close();
                }
            }
            catch
            { }
        }
Beispiel #7
0
 /// <summary>
 /// 更新管理员组
 /// </summary>
 public static void UpdateAdminGroup(AdminGroupInfo adminGroupInfo)
 {
     adminGroupInfo.ActionList = adminGroupInfo.ActionList.ToLower();
     BrnShop.Data.AdminGroups.UpdateAdminGroup(adminGroupInfo);
     BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_ADMINGROUP_ACTIONHASHSET + adminGroupInfo.AdminGid);
     BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_ADMINGROUP_LIST);
     WriteAdminNavMenuCache(adminGroupInfo);
 }
Beispiel #8
0
        /// <summary>
        /// 获得用户级管理员组列表
        /// </summary>
        /// <returns></returns>
        public static AdminGroupInfo[] GetCustomerAdminGroupList()
        {
            AdminGroupInfo[] adminGroupList = GetAdminGroupList();
            AdminGroupInfo[] customerAdminGroupList = new AdminGroupInfo[adminGroupList.Length - 2];

            int i = 0;
            foreach (AdminGroupInfo adminGroupInfo in adminGroupList)
            {
                if (adminGroupInfo.AdminGid > 2)
                {
                    customerAdminGroupList[i] = adminGroupInfo;
                    i++;
                }
            }

            return customerAdminGroupList;
        }
Beispiel #9
0
 /// <summary>
 /// 更新管理员组
 /// </summary>
 public void UpdateAdminGroup(AdminGroupInfo adminGroupInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@title", SqlDbType.NChar,50,adminGroupInfo.Title),
                                 GenerateInParam("@actionlist", SqlDbType.Text, 0, adminGroupInfo.ActionList),
                                 GenerateInParam("@admingid", SqlDbType.SmallInt, 2, adminGroupInfo.AdminGid)
                             };
     string commandText = string.Format("UPDATE [{0}admingroups] SET [title]=@title,[actionlist]=@actionlist WHERE [admingid]=@admingid",
                                         RdbsHelper.RdbsTablePre);
     RdbsHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Beispiel #10
0
 /// <summary>
 /// 创建管理员组
 /// </summary>
 /// <param name="adminGroupInfo">管理员组信息</param>
 /// <returns></returns>
 public int CreateAdminGroup(AdminGroupInfo adminGroupInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@title", SqlDbType.NChar,50,adminGroupInfo.Title),
                                 GenerateInParam("@actionlist", SqlDbType.Text, 0, adminGroupInfo.ActionList)
                             };
     string commandText = string.Format("INSERT INTO [{0}admingroups]([title],[actionlist]) VALUES(@title,@actionlist);SELECT SCOPE_IDENTITY();",
                                         RdbsHelper.RdbsTablePre);
     return TypeHelper.ObjectToInt(RdbsHelper.ExecuteScalar(CommandType.Text, commandText, parms));
 }