/// <summary>
        /// 登录验证
        /// </summary>
        /// <returns></returns>
        public ActionResult UserLogin()
        {
            //验证码获取
            string validateCode = null;
            if (Session["ValidateCode"] != null)
            {
                validateCode = Session["ValidateCode"].ToString();
            }
            if (string.IsNullOrEmpty(validateCode))
            {
                return Content("no:验证码不能为空!!!");
            }
            Session["ValidateCode"] = null;
            //获取用户输入数据
            string ddldept = Request.Form["department"];
            string ddluser = Request.Form["ddluser"];
            string txtPassword = Request.Form["txtPassword"];
            string txtCheckCode = Request.Form["txtCheckCode"];
            //验证码对比
            if (!validateCode.Equals(txtCheckCode, StringComparison.InvariantCultureIgnoreCase))
            {
                return Content("no:验证码错误!!!");
            }
            //用户名密码比对
            Sys_OperatorBLL operatorBLL = new Sys_OperatorBLL();
            StringBuilder sb = new StringBuilder();
            sb.Append(" usercode='"+ddluser+"'");
            sb.Append(" and password='******'");
            DataSet ds = operatorBLL.GetList(sb.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["IsForbid"].ToString() == "1")
                {
                    return Content("no:该用户已经被禁用!!!");
                }

                Session["uid"] = ds.Tables[0].Rows[0]["UserCode"].ToString();
                Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString();
                //所属部门
                Session["orgID"] = ds.Tables[0].Rows[0]["OrgCode"].ToString();
                //所属于部门下的职位,一个人只属于一个部门,但可有多个职位,Session["PostionID"]保存的数据格式为数字
                //和逗号组成的字符串。(该用户下的所有职位)
                Session["PositionCode"]=operatorBLL.GetPosition(Convert.ToInt32(ddluser));
                
                //登录日志
                string strIP = System.Net.Dns.Resolve(System.Net.Dns.GetHostName()).AddressList[0].ToString();
                StringBuilder sbSql = new StringBuilder("");
                sbSql.Append("insert into Sys_OperateLog (LogType,OperateTable,Operator,OperateDate,OperateIP,Remark,SysCode,RelationID)");
                sbSql.Append(" values('登录','Sys_Operator','" + ds.Tables[0].Rows[0]["UserName"].ToString() + "',getdate(),'" + strIP + "','登录调运BS系统','s1000','')");
                DbHelperSQL.ExecuteSql(sbSql.ToString());

                return Content("ok:登录成功!!!");
            }
            else
            {
                return Content("no:用户名或密码错误!!!");
            }
        }
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <returns></returns>
        public ActionResult Delete()
        {
            string UserCode = "";
            if (Request["UserCode"] != null)
            {
                UserCode = Request["UserCode"].ToString();
                Model.Sys_Operator p = new TDTK.PlatForm.MVC4.Model.Sys_Operator();
                BLL.Sys_OperatorBLL pb = new Sys_OperatorBLL();
                p.UserCode = UserCode;
                if (pb.Delete(p))
                {
                    return Content("ok");
                }
                else
                {
                    return Content("no");
                }

            }
            else
            {
                return Content("no");
            }

        }
        /// <summary>
        /// 获取一条数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetDemoByID()
        {
            string UserCode = "";
            if (Request["UserCode"] != null)
            {
                UserCode = Request["UserCode"].ToString();
            }
            BLL.Sys_OperatorBLL pb = new Sys_OperatorBLL();
            Model.Sys_Operator p = new TDTK.PlatForm.MVC4.Model.Sys_Operator();
            p.UserCode = UserCode;
            Model.Sys_Operator pp = new TDTK.PlatForm.MVC4.Model.Sys_Operator();
            if (!string.IsNullOrEmpty(UserCode))
            {
                pp = pb.GetModel(p);
            }
            return Json(pp, JsonRequestBehavior.AllowGet);

        }
        public ActionResult IsForbid()
        {
            //IsForbid PositionCode
            string UserCode = "";
            if (Request["UserCode"] != null)
            {
                UserCode = Request["UserCode"].ToString();
            }
            else
            {
                return Content("no:数据异常!");
            }
            #region 数据禁用、启用
            if (!string.IsNullOrEmpty(UserCode))
            {
                BLL.Sys_OperatorBLL pbl = new Sys_OperatorBLL();
                Model.Sys_Operator p = new TDTK.PlatForm.MVC4.Model.Sys_Operator();
                p.UserCode = UserCode;
                p = pbl.GetModel(p);
                string IsForbid = p.IsForbid;
                if (IsForbid == "1")
                {
                    p.IsForbid = "0";
                }
                else
                {
                    p.IsForbid = "1";
                }
                if (pbl.Update(p))
                {
                    if (IsForbid == "0")
                    {
                        return Content("ok:禁用成功!");
                    }
                    else
                    {
                        return Content("ok:启用成功!");
                    }
                }
                else
                {
                    return Content("no:操作失败!");
                }

            }
            #endregion
            else
            {
                return Content("no:操作有误!");
            }
        }