Esempio n. 1
0
        /// <summary>
        /// 平台更新
        /// </summary>
        /// <param name="PlatformNo"></param>
        /// <returns></returns>
        public int PlatformUpdate(PsPlatform platform)
        {
            PsPlatform current = this.GetModelByKey(platform.id.ToString());

            if (current == null)
            {
                return(0);
            }
            PsPlatform ParentInfo = this.GetPlatformInfo(platform.ParentNo);

            if (platform.ParentNo != ConstantsData.DEFAULT_ID && ParentInfo == null)
            {
                throw new ArgumentException("父节点不存在");
            }
            string treeLevelNo = TreeLevelUtil.GetTreeLevelNo(ParentInfo, platform.ParentNo);
            bool   isChange    = current.TreeLevelNo != treeLevelNo;

            current.TreeLevelNo     = treeLevelNo;
            current.UpdateTime      = DateTime.Now;
            current.Name            = platform.Name;
            current.Value           = platform.Value;
            current.ParentNo        = platform.ParentNo;
            current.DefaultUserName = platform.DefaultUserName;
            int result = this.Update(current);

            if (result > 0 && isChange)
            {
                this.RefreshChildTreeLevelNo(current);
            }
            return(result);
        }
Esempio n. 2
0
        public ActionResult <JsonResponses> GetInfo(long id)
        {
            PsPlatform Info = new PsPlatform();

            Info = DataHandleManager.Instance().PsPlatformHandle.GetModelByKey(id.ToString());
            return(new JsonResponses(Info));
        }
Esempio n. 3
0
        /// <summary>
        /// 刷新子节点编号路径
        /// </summary>
        /// <param name="current"></param>
        public void RefreshChildTreeLevelNo(PsPlatform current)
        {
            long PlatformNo = current.PlatformNo;
            List <PsPlatform> childMenuList = this.GetChildPlatformList(PlatformNo);

            if (CollectionUtils.IsEmpty(childMenuList))
            {
                return;
            }
            foreach (PsPlatform item in childMenuList)
            {
                string treeLevelNo = "-1";
                if (item.ParentNo.Equals(PlatformNo))
                {
                    treeLevelNo = TreeLevelUtil.GetTreeLevelNo(current, item.ParentNo);
                }
                else
                {
                    PsPlatform parent = childMenuList.Find(o => o.PlatformNo == item.ParentNo);
                    treeLevelNo = TreeLevelUtil.GetTreeLevelNo(parent, item.ParentNo);
                }
                item.TreeLevelNo = treeLevelNo;
                this.UpdateTreeLevelNo(PlatformNo, treeLevelNo);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 删除平台
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeletePlatform(int id)
        {
            PsPlatform platform = this.GetModelByKey(id.ToString());

            if (platform == null)
            {
                throw new ArgumentException("平台不存在");
            }
            JsonResponses jsonResponses = userSDK.CancelPlatform(platform.DefaultUserNo);

            if (!jsonResponses.ValidateResponses())
            {
                throw new ArgumentException(jsonResponses.msg);
            }
            long PlatformNo = platform.PlatformNo;
            long count      = DataHandleManager.Instance().PsManagementHandle.CountByPlatformNo(PlatformNo);

            if (count > 0)
            {
                throw new ArgumentException("当前平台信息不为空,暂不支持删除");
            }
            //检查编号是否有子节点
            this.CheckNoHasChild(PlatformNo);
            return(this.Delete(id));
        }
Esempio n. 5
0
 /// <summary>
 /// 新增菜单
 /// </summary>
 /// <param name="menu"></param>
 /// <returns></returns>
 public JsonResponses PlatformUpdate(PsPlatform platform)
 {
     try
     {
         RequestBase request = new RequestBase();
         request.SetValue("id", platform.id);
         request.SetValue("PlatformNo", platform.PlatformNo);
         request.SetValue("Name", platform.Name);
         request.SetValue("Value", platform.Value);
         request.SetValue("DefaultUserName", platform.DefaultUserName);
         request.SetValue("DefaultUserNo", platform.DefaultUserNo);
         request.Url = UpdatePlatformUrl;
         string result = HttpHelper.Example.GetWebData(new BrowserPara()
         {
             Uri      = request.Url,
             PostData = request.GetRequestData(),
             Method   = RequestTypeEnums.POST_FORM
         });
         return(JsonConvert.DeserializeObject <JsonResponses>(result));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(JsonResponses.Failed);
 }
        /// <summary>
        /// 获取分组权限关系列表
        /// </summary>
        /// <param name="managementNo"></param>
        /// <returns></returns>
        public ManagmentGroupAssignVo GetGroupManagmentsAssign(long managementNo)
        {
            ManagmentGroupAssignVo assignVo = new ManagmentGroupAssignVo();

            assignVo.management = DataHandleManager.Instance().PsManagementHandle.GetManagementInfo(managementNo);
            if (assignVo.management == null)
            {
                return(null);
            }
            PsPlatform platform = DataHandleManager.Instance().PsPlatformHandle.GetPlatformInfo(assignVo.management.PlatformNo);
            List <PsMenuManagement> menuManagements = this.GetMenuManagements(managementNo);

            if (platform == null)
            {
                return(null);
            }
            string UserNo = platform.DefaultUserNo;
            List <ManagementOptionValue> optionValues = DataHandleManager.Instance().PsManagementHandle.GetUserManagementList(UserNo);

            assignVo.optionValues = new List <CheckOptionValue>();
            foreach (var item in optionValues)
            {
                bool isCheck = menuManagements.Where(o => o.ManagementNo == item.Value).FirstOrDefault() != null;
                assignVo.optionValues.Add(new CheckOptionValue()
                {
                    isCheck = isCheck,
                    Name    = item.Name,
                    Value   = item.Value
                });
            }
            return(assignVo);
        }
Esempio n. 7
0
        public JsonResult PsPlatformAdd(PsPlatform model)
        {
            model.InputUser = AppBusiness.loginModel.UserNo;
            JsonResponses responses = platformSdk.PlatformAdd(model);

            return(Json(responses, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        /// <summary>
        /// 获取上级父平台节点编号
        /// </summary>
        /// <param name="PlatformNo"></param>
        /// <returns></returns>
        public List <long> GetParentPlatformNos(long PlatformNo)
        {
            PsPlatform platform = this.GetPlatformInfo(PlatformNo);

            if (platform == null)
            {
                return(new List <long>());
            }
            return(TreeLevelUtil.GetParentNos(platform.TreeLevelNo));
        }
Esempio n. 9
0
        public JsonResult GetPsPlatformInfo(int id)
        {
            PsPlatform    Info      = new PsPlatform();
            JsonResponses responses = platformSdk.GetPsPlatformInfo(id);

            if (responses.code == JsonResponses.SuccessCode)
            {
                Info = responses.data as PsPlatform;
            }
            return(Json(Info, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
        public JsonResult PsPlatformDelete(int id)
        {
            JsonResponses responses = platformSdk.GetPsPlatformInfo(id);

            if (responses.ValidateResponses())
            {
                PsPlatform platform = responses.data as PsPlatform;
                responses = userSDK.CancelPlatform(platform.DefaultUserNo);
                if (responses.ValidateResponses())
                {
                    responses = platformSdk.PlatformDelete(id);
                }
            }
            return(Json(responses, JsonRequestBehavior.AllowGet));
        }
Esempio n. 11
0
 public ActionResult <JsonResponses> Update([FromForm] PsPlatform platform)
 {
     try
     {
         int result = DataHandleManager.Instance().PsPlatformHandle.PlatformUpdate(platform);
         if (result > 0)
         {
             return(JsonResponses.Success);
         }
         return(JsonResponses.Failed);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(JsonResponses.Failed);
 }
Esempio n. 12
0
 /// <summary>
 /// 新增菜单
 /// </summary>
 /// <param name="menu"></param>
 /// <returns></returns>
 public JsonResponses PlatformUpdate(PsPlatform platform)
 {
     try
     {
         RequestBase request = RequestBase.PostForm.Clone() as RequestBase;
         request.SetValue("id", platform.id);
         request.SetValue("name", platform.Name);
         request.SetValue("value", platform.Value);
         request.SetValue("defaultUserName", platform.DefaultUserName);
         request.SetValue("parentNo", platform.ParentNo);
         request.SetValue("inputUser", platform.InputUser);
         request.Url = UpdatePlatformUrl;
         return(sdkUtil.PostForVo(request));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(JsonResponses.Failed);
 }
Esempio n. 13
0
        public ActionResult <JsonResponses> Create([FromForm] PsPlatform platform)
        {
            try
            {
                //bool checkResult = true;
                platform.InputTime  = DateTime.Now;
                platform.PlatformNo = AutoIDWorker.Example.GetAutoSequence();
                PsPlatform ParentInfo = DataHandleManager.Instance().PsPlatformHandle.GetModelByKey(platform.ParentNo.ToString());
                platform.TreeLevelNo = TreeLevelUtil.GetTreeLevelNo <PsPlatform>(ParentInfo, platform.ParentNo);
                UcUsers users = this.userSDK.GetUserInfo(Convert.ToInt32(platform.DefaultUserNo));
                if (users != null)
                {
                    return(new JsonResponses("用户已存在"));
                }
                RegisterPlatformForm registerPlatformForm = new RegisterPlatformForm();
                registerPlatformForm.UserNo     = platform.DefaultUserNo;
                registerPlatformForm.UserName   = platform.DefaultUserName;
                registerPlatformForm.PlatformNo = platform.PlatformNo;
                registerPlatformForm.Password   = ConstData.DEFAULT_PASSWORD;
                registerPlatformForm.Phone      = "";
                registerPlatformForm.Email      = "";
                registerPlatformForm.InputUser  = platform.InputUser;
                JsonResponses jsonResponses = userSDK.RegisterPlatfrom(registerPlatformForm);
                if (!jsonResponses.ValidateResponses())
                {
                    return(jsonResponses);
                }
                int result = DataHandleManager.Instance().PsPlatformHandle.Insert(platform);
                if (result > 0)
                {
                    return(JsonResponses.Success);
                }

                return(JsonResponses.Failed);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(JsonResponses.Failed);
        }
Esempio n. 14
0
 public ActionResult <JsonResponses> Update([FromForm] PsPlatform platform)
 {
     try
     {
         //bool checkResult = true;
         platform.UpdateTime = DateTime.Now;
         PsPlatform ParentInfo = DataHandleManager.Instance().PsPlatformHandle.GetModelByKey(platform.ParentNo.ToString());
         platform.TreeLevelNo = TreeLevelUtil.GetTreeLevelNo <PsPlatform>(ParentInfo, platform.ParentNo);
         int result = DataHandleManager.Instance().PsPlatformHandle.Update(platform);
         if (result > 0)
         {
             return(JsonResponses.Success);
         }
         return(JsonResponses.Failed);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(JsonResponses.Failed);
 }
Esempio n. 15
0
        public JsonResult PsPlatformAdd(PsPlatform model)
        {
            model.InputUser = AppBusiness.loginModel.UserNo;
            RegisterPlatformForm registerPlatform = new RegisterPlatformForm()
            {
                UserName   = model.DefaultUserName,
                UserNo     = model.DefaultUserNo,
                InputUser  = model.InputUser,
                Email      = "",
                Phone      = "",
                Password   = "******",
                PlatformNo = model.PlatformNo
            };
            JsonResponses jsonResponses = userSDK.RegisterPlatfrom(registerPlatform);

            if (jsonResponses.code == JsonResponses.SuccessCode)
            {
                RegisterPlatformForm registerResult = JsonConvert.DeserializeObject <RegisterPlatformForm>(JsonConvert.SerializeObject(jsonResponses.data));
                model.DefaultUserNo = registerResult.UserNo;
                JsonResponses responses = platformSdk.PlatformAdd(model);
                return(Json(responses, JsonRequestBehavior.AllowGet));
            }
            return(Json(jsonResponses, JsonRequestBehavior.AllowGet));
        }
Esempio n. 16
0
        public JsonResult PsPlatformUpdate(PsPlatform model)
        {
            JsonResponses responses = platformSdk.PlatformUpdate(model);

            return(Json(responses, JsonRequestBehavior.AllowGet));
        }