public ActionResult OperatePosition(PositionInfoContract pc, string id, string url)
        {
            //判断要添加的职位是否已经存在
            if (!ps.IsExists(pc.PositionName, pc.PositionId.ToString()))
            {
                //执行失败信息
                ViewData["msg"] = "【" + pc.PositionName + "】这个职位已经存在,请先确认!";
                //失败视图
                return View("Error");
            }
            else
            {
                switch (ModelState.IsValid)
                {
                    case true:

                        //如果要修改的职位编号为null,则为添加职位信息操作
                        if (id == null)
                        {
                            if (ps.AddPosition(pc) > 0)
                            {
                                if (!string.IsNullOrEmpty(url))
                                {
                                    return RedirectToAction("BranchMain", "BranchManage");
                                }
                                else
                                {
                                    //成功后要跳转的路径(如果无须跳转,直接留在当前页面,不写即可)
                                    ViewData["url"] = new UrlHelper(Request.RequestContext).Action("PositionMain");
                                }
                                //执行成功信息
                                ViewData["msg"] = "添加职位成功!";
                                //成功视图
                                return View("Success");
                            }
                            else
                            {
                                //执行成功信息
                                ViewData["msg"] = "添加职位失败!";
                                return View("Error");
                            }
                        }
                        else
                        {
                            pc.PositionId = int.Parse(id);
                            if (ps.UpdatePosition(pc) > 0)
                            {
                                //执行成功信息
                                ViewData["msg"] = "修改职位成功!";
                                //成功后要跳转的路径(如果无须跳转,直接留在当前页面,不写即可)
                                ViewData["url"] = new UrlHelper(Request.RequestContext).Action("PositionMain");
                                //成功视图
                                return View("Success");
                            }
                            else
                            {
                                ViewData["msg"] = "修改职位失败!";
                                return View("Error");
                            }
                        }
                    default:
                        ViewBag.pTitle = "添加职位信息";
                        return View(new PositionInfoContract());
                }
            }
        }
 /// <summary>
 /// 添加职位的方法
 /// </summary>
 /// <param name="positionInfo">职位实体</param>
 /// <returns>受影响的行数</returns>
 public int AddPosition(PositionInfoContract positionInfo)
 {
     positionInfo position = positionInfo.ToPO<positionInfo>();
     return pDAL.AddPosition(position);
 }
        /// <summary>
        /// 添加和编辑部门信息
        /// </summary>
        /// <returns></returns>
        public ActionResult OperatePosition(string id)
        {
            PositionInfoContract pc = new PositionInfoContract();
            var operateType = Request.QueryString["operateType"];
            var url = Request.QueryString["url"];

            switch (operateType)
            {
                case "add":
                    ViewBag.pTitle = "添加职位信息";

                    return View(pc);
                default:
                    ViewBag.pTitle = "编辑职位信息";

                    if (id != null)
                    {
                        //根据职位编号查询职位信息的方法
                        pc = ps.GetPositionByPositionID(int.Parse(id));
                    }
                    return View(pc);
            }
        }