Ejemplo n.º 1
0
 public bool Permission(String Code, String Sid = "")
 {
     if (!string.IsNullOrEmpty(Code))
     {
         var rlt = com.Get <Boolean>("app", "permission"
                                     , new KeyValuePair <string, string>("sid", string.IsNullOrEmpty(Sid) ? wsession.sid : Sid)
                                     , new KeyValuePair <string, string>("code", Code));
         if (rlt.data)
         {
             return(rlt.data);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 用户登录
 /// </summary>
 /// <param name="icommon"></param>
 /// <param name="mobile"></param>
 /// <param name="pwdcode"></param>
 /// <param name="wxopenid"></param>
 /// <returns></returns>
 public static Wlniao.ApiResult <String> Login(xCommon icommon, String mobile, String pwdcode, String wxopenid = "")
 {
     return(icommon.Get <String>("app", "login"
                                 , new KeyValuePair <string, string>("mobile", mobile)
                                 , new KeyValuePair <string, string>("pwdcode", pwdcode)
                                 , new KeyValuePair <string, string>("wxopenid", wxopenid)));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取钉钉AccessToken
 /// </summary>
 /// <param name="com"></param>
 /// <returns></returns>
 public static Wlniao.ApiResult <String> GetToken(xCommon com)
 {
     if (com == null)
     {
         return(null);
     }
     return(com.Get <String>("app", "dingtalk_token"));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据用户权限获取机构列表
        /// </summary>
        /// <param name="icommon"></param>
        /// <param name="sid"></param>
        /// <returns></returns>
        public static List <Organ> GetList(xCommon icommon, String sid)
        {
            var rlt = icommon.Get <List <Organ> >("app", "getorganlist", new KeyValuePair <string, string>("sid", sid));

            if (rlt.success && rlt.data != null)
            {
                return(rlt.data);
            }
            return(new List <Organ>());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取机构列表
        /// </summary>
        /// <param name="icommon"></param>
        /// <returns></returns>
        public static List <Organ> GetList(xCommon icommon)
        {
            var rlt = icommon.Get <List <Organ> >("app", "getorganlist");

            if (rlt.success && rlt.data != null)
            {
                return(rlt.data);
            }
            return(new List <Organ>());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据类型获取枚举列表
        /// </summary>
        /// <param name="icommon"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static List <Enum> GetList(xCommon icommon, String parent)
        {
            var rlt = icommon.Get <List <Enum> >("app", "getenumlist", new KeyValuePair <string, string>("parent", parent));

            if (rlt.success && rlt.data != null)
            {
                return(rlt.data);
            }
            return(new List <Enum>());
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取一个机构信息
        /// </summary>
        /// <param name="icommon"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static String GetName(xCommon icommon, String id)
        {
            if (string.IsNullOrEmpty(id) || icommon == null)
            {
                return("");
            }
            var rlt = icommon.Get <Organ>("app", "getorgan", new KeyValuePair <string, string>("id", id));

            if (rlt.success)
            {
                return(rlt.data.name);
            }
            return("");
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取一个账号信息
        /// </summary>
        /// <param name="com"></param>
        /// <param name="key"></param>
        /// <param name="by"></param>
        /// <returns></returns>
        public static Account Get(xCommon com, String key, String by = "sid")
        {
            if (string.IsNullOrEmpty(key) || com == null)
            {
                return(null);
            }
            var rlt = com.Get <Account>("app", "getaccount", new KeyValuePair <string, string>(by, key));

            if (rlt.success)
            {
                return(rlt.data);
            }
            return(null);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取一个用户信息
        /// </summary>
        /// <param name="xcommon"></param>
        /// <param name="key"></param>
        /// <param name="by"></param>
        /// <returns></returns>
        public static User Get(xCommon xcommon, String key, String by = "sid")
        {
            if (string.IsNullOrEmpty(key) || xcommon == null)
            {
                return(null);
            }
            var rlt = xcommon.Get <User>("app", "getaccount", new KeyValuePair <string, string>(by, key));

            if (rlt.success)
            {
                return(rlt.data);
            }
            return(null);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取一个枚举类型
        /// </summary>
        /// <param name="icommon"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static Enum Get(xCommon icommon, String key)
        {
            if (string.IsNullOrEmpty(key) || icommon == null)
            {
                return(null);
            }
            var rlt = icommon.Get <Enum>("app", "getenum", new KeyValuePair <string, string>("key", key));

            if (rlt.success)
            {
                return(rlt.data);
            }
            return(null);
        }
Ejemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="com"></param>
 /// <param name="key"></param>
 public WSession(xCommon com, String key)
 {
     this.key = key;
     if (com != null && !string.IsNullOrEmpty(key))
     {
         var jsonStr = com.Get("app", "wsession", new KeyValuePair <string, string>("key", key));
         var jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(jsonStr);
         if (jsonObj.success.ToString().ToLower() == "true")
         {
             this.sid        = jsonObj.sid;
             this.wkey       = jsonObj.wkey;
             this.name       = jsonObj.name;
             this.account    = jsonObj.account;
             this.platform   = jsonObj.platform;
             this.platformId = jsonObj.platformId;
             this.login      = true;
         }
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取一个账号信息
        /// </summary>
        /// <param name="com"></param>
        /// <param name="sid"></param>
        /// <returns></returns>
        public static String GetName(xCommon com, String sid)
        {
            if (string.IsNullOrEmpty(sid) || com == null)
            {
                return("");
            }
            var val = Wlniao.Cache.Get("sidname-" + com.Host + "-" + sid);

            if (string.IsNullOrEmpty(val))
            {
                var rlt = com.Get <Account>("app", "getaccount", new KeyValuePair <string, string>("sid", sid));
                if (rlt.success && !string.IsNullOrEmpty(rlt.data.name))
                {
                    val = rlt.data.name;
                    Wlniao.Cache.Set("sidname-" + com.Host + "-" + sid, val, 3600);
                }
                else
                {
                    val = "";
                }
            }
            return(val);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取一个枚举类型
        /// </summary>
        /// <param name="icommon"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static String GetName(xCommon icommon, String key)
        {
            if (string.IsNullOrEmpty(key) || icommon == null)
            {
                return("");
            }
            var val = Wlniao.Cache.Get("enumname-" + icommon.Host + "-" + key);

            if (string.IsNullOrEmpty(val))
            {
                var rlt = icommon.Get <Enum>("app", "getenum", new KeyValuePair <string, string>("key", key));
                if (rlt.success && !string.IsNullOrEmpty(rlt.data.label))
                {
                    val = rlt.data.label;
                    Wlniao.Cache.Set("enumname-" + icommon.Host + "-" + key, val, 3600);
                }
                else
                {
                    val = key;
                }
            }
            return(val);
        }