| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /* ==============================================================================
- * 功能描述:用户加载的菜单权限
- * 创 建 者:Garrett
- * 创建日期:2018/9/18 10:28:07
- * ==============================================================================*/
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Newtonsoft.Json.Linq;
- using SAGA.DotNetUtils.MBI;
- using SAGA.DotNetUtils.Others;
- using SAGA.MBI.Common;
- using SAGA.MBI.RequestData;
- using SAGA.MBI.Tools;
- namespace SAGA.MBI.DataArrange
- {
- /// <summary>
- /// DalUserMenuMession
- /// </summary>
- class DalUserMenuPermission
- {
- /// <summary>
- /// 获取当前用户的可用的Revit命令列表
- /// </summary>
- /// <returns></returns>
- private static List<string> GetPermissionList()
- {
- List<string> list=new List<string>();
- string phone = MBIControl.ManageInfo.Phone_Num;
- string projectId = MBIControl.ProjectCur.Id;
- string str = LoginRequest.QueryPermission(phone, projectId);
- string msg = "";
- if (str.IsSuccessRequest2(ref msg))
- {
- JObject jobject = JObject.Parse(str);
- foreach (JToken jToken in jobject["content"])
- {
- list.Add(jToken.ToString());
- }
- }
- else
- {
- MessageShowBase.Infomation(msg);
- }
- return list;
- }
- /// <summary>
- /// 保存当前用户的权限数据
- /// </summary>
- public static void SavePermissionData()
- {
- var list = GetPermissionList();
- string dictionPath = OutReachConst.MBITempSettingPath;
- string fileName = OutReachConst.UserMenuPermission;
- string path =
- Path.Combine(Path.Combine(dictionPath, fileName));
- //先清空数据
- if (File.Exists(path))
- {
- File.Delete(path);
- }
- if (!Directory.Exists(dictionPath))
- Directory.CreateDirectory(dictionPath);
- foreach (var str in list) {
- var context = $"{str}\r\n";
- File.AppendAllText(path, context);
- }
- }
- }
- }
|