/// <summary>
        /// 添加和编辑关键字信息
        /// </summary>
        /// <returns></returns>
        public ActionResult OperateGuanJianZi(string id)
        {
            WeiXin.BO.GuanJianZiContract pc = new WeiXin.BO.GuanJianZiContract();
            var operateType = Request.QueryString["operateType"];
            var url = Request.QueryString["url"];

            #region 绑定关键字所属企业
            List<employeeInfo> list = new List<employeeInfo>();
            if ((Session["user"] as UsersContract).RoleID == 1)
            {
                #region 系统管理员 获取所有企业
                list = gs.GetAllEmp();
                #endregion
            }
            else
            {
                #region 获取自己的企业
                list.Add(es.GetEmployeeinfoByEId((Session["user"] as UsersContract).EId));
                #endregion
            }

            #endregion

            #region 绑定关键字类型
            List<GuanJianZiHuiFuTypeContract> gjzType = new List<GuanJianZiHuiFuTypeContract>();
            //获取所有的关键字类型
            List<GuanJianZiType> dsGJZType = gs.GetAllGJZType();

            foreach (var item in dsGJZType)
            {
                GuanJianZiHuiFuTypeContract tt = new GuanJianZiHuiFuTypeContract();
                tt.Id = Convert.ToInt32(item.Id);
                tt.name = item.name;
                gjzType.Add(tt);
            }
            ViewData["gjzType"] = new SelectList(gjzType, "Id", "name");
            #endregion

            switch (operateType)
            {
                case "add":
                    ViewBag.pTitle = "添加关键字";

                    ViewData["Emp"] = new SelectList(list, "Eid", "wxName");
                    return View(pc);
                default:
                    ViewBag.pTitle = "编辑关键字";

                    if (id != null)
                    {
                        //根据关键字编号查询关键字的方法
                        pc = gs.GetGuanJianZiByGJZId(int.Parse(id));
                    }

                    ViewData["Emp"] = new SelectList(list, "Eid", "wxName", pc.eId);
                    return View(pc);
            }
        }
 /// <summary>
 /// 添加关键字
 /// </summary>
 /// <param name="pc"></param>
 /// <returns></returns>
 public int AddGuanJianZi(GuanJianZiContract pc)
 {
     GuanJianZi gjz = pc.ToPO<GuanJianZi>();
     return gjzDAL.AddGuanJianZi(gjz);
 }
        public ActionResult OperateGuanJianZi(GuanJianZiContract pc, string id, string url)
        {
            pc.time = DateTime.Now.ToString("yyyy-MM-dd");

            #region 绑定关键字所属企业
            List<employeeInfo> list = new List<employeeInfo>();
            if ((Session["user"] as UsersContract).RoleID == 1)
            {
                #region 系统管理员 获取所有企业
                list = gs.GetAllEmp();
                #endregion
            }
            else
            {
                #region 获取自己的企业
                list.Add(es.GetEmployeeinfoByEId((Session["user"] as UsersContract).EId));
                #endregion
            }

            #endregion

            #region 绑定关键字类型
            List<GuanJianZiHuiFuTypeContract> gjzType = new List<GuanJianZiHuiFuTypeContract>();
            //获取所有的关键字类型
            List<GuanJianZiType> dsGJZType = gs.GetAllGJZType();

            foreach (var item in dsGJZType)
            {
                GuanJianZiHuiFuTypeContract tt = new GuanJianZiHuiFuTypeContract();
                tt.Id = Convert.ToInt32(item.Id);
                tt.name = item.name;
                gjzType.Add(tt);
            }
            ViewData["gjzType"] = new SelectList(gjzType, "Id", "name");
            #endregion

            //判断要添加的关键字是否已经存在
            if (gs.IsExists(pc.name, pc.eId.ToString(), id))
            {
                //执行失败信息
                ViewData["msg"] = "【" + pc.name + "】这个关键字已经存在,请先确认!";
                //失败视图
                return View("Error");
            }
            else
            {
                switch (ModelState.IsValid)
                {
                    case true:

                        //如果要修改的编号为null,则为添加关键字信息操作
                        if (id == null)
                        {

                            if (gs.AddGuanJianZi(pc) > 0)
                            {

                                //成功后要跳转的路径(如果无须跳转,直接留在当前页面,不写即可)
                                ViewData["url"] = new UrlHelper(Request.RequestContext).Action("GuanJianZiMain");

                                //执行成功信息
                                ViewData["msg"] = "添加关键字成功!";
                                //成功视图
                                return View("Success");
                            }
                            else
                            {
                                //执行成功信息
                                ViewData["msg"] = "添加关键字失败!";
                                return View("Error");
                            }
                        }
                        else
                        {
                            pc.gjzId = int.Parse(id);
                            if (gs.UpdateGuanJianZi(pc) > 0)
                            {
                                //执行成功信息
                                ViewData["msg"] = "修改关键字成功!";
                                //成功后要跳转的路径(如果无须跳转,直接留在当前页面,不写即可)
                                ViewData["url"] = new UrlHelper(Request.RequestContext).Action("GuanJianZiMain");
                                //成功视图
                                return View("Success");
                            }
                            else
                            {
                                ViewData["msg"] = "修改关键字失败!";
                                return View("Error");
                            }
                        }
                    default:
                        ViewBag.pTitle = "添加关键字信息";
                        return View(new GuanJianZiHuiFuContract());
                }
            }
        }
        /// <summary>
        /// 修改关键字
        /// </summary>
        /// <param name="pc"></param>
        /// <returns></returns>
        public int UpdateGuanJianZi(GuanJianZiContract pc)
        {
            GuanJianZi gjz = pc.ToPO<GuanJianZi>();

            return gjzDAL.UpdateGuanJianZi(gjz);
        }