Exemplo n.º 1
0
        public JsonResult ListOperateStatus()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            int[] iRangeButton       = { (int)EButtonType.Delete, (int)EButtonType.Enable, (int)EButtonType.Disable };
            int   iCurrentButtonId   = RequestParameters.Pint("oButtonId");
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iRangeButton, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            //string _ids = RequestParameters.Pstring("ids");
            //if (string.IsNullOrEmpty(_ids))
            //{
            //    var sRetrunModel = new ResultMessage();
            //    sRetrunModel.ErrorType = 0;
            //    sRetrunModel.MessageContent = "参数错误.";
            //    return Json(sRetrunModel);
            //}
            //string[] strids = _ids.Split(',');
            //System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            //for (int i = 0; i < strids.Length; i++)
            //{
            //    if (RegexValidate.IsGuid(strids[i]))
            //    {
            //        arrayList.Add(strids[i]);
            //    }
            //}
            //string[] ids = (string[])arrayList.ToArray(typeof(string));
            //if (!ids.Any())
            //{
            //    var sRetrunModel = new ResultMessage();
            //    sRetrunModel.ErrorType = 0;
            //    sRetrunModel.MessageContent = "参数错误.";
            //    return Json(sRetrunModel);
            //}
            Guid ID = RequestParameters.PGuid("ids");
            if (ID == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var  cBll   = new UsersBll();
            bool isFlag = false;
            switch (iCurrentButtonId)
            {
            case (int)EButtonType.Delete:    //删除
                ParamState = "3";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Deleted);
                break;

            case (int)EButtonType.Enable:    //启用
                ParamState = "5";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Valid);
                break;

            case (int)EButtonType.Disable:    //禁用
                ParamState = "6";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Forbidden);
                break;
            }
            if (isFlag)
            {
                ParamID = ID.ToString();
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }