コード例 #1
0
        public async Task <dynamic> GetUserInfosAsync(string mail, string mdp)
        {
            try
            {
                //Récupération des données en filtrant.
                // LoginUtilisateur uInfos = loginDataAccessLayer.GetUserLoginInfos(mail, mdp);
                //LoginUtilisateur _logInfos = new LoginUtilisateur();
                //ApiHelper.ApiHelper _apiHelper = new ApiHelper.ApiHelper();
                //HttpClient client = _apiHelper.Initial();
                //HttpResponseMessage res = await client.GetAsync($"api/Login/GetUserInfos?mail={mail}&mdp={mdp}");
                //if(res.IsSuccessStatusCode)
                //{
                //    var returnResult = res.Content.ReadAsStringAsync().Result;
                //    _logInfos = JsonConvert.DeserializeObject<LoginUtilisateur>(returnResult);
                //}

                //Récupération des données en filtrant.
                dynamic             _logInfos;
                ApiHelper.ApiHelper apiHelper = new ApiHelper.ApiHelper();
                _logInfos = await apiHelper.GetApiAsync <dynamic>($"api/Login/GetUserInfos?mail={mail}&mdp={mdp}");

                return(_logInfos);
            }
            catch (Exception ex)
            {
                _logLC.LogInformation("LoginController FO: InnerException = {0} - Message {1}", ex.InnerException, ex.Message);
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// 把当前程序集中的表单接口名和参数保存下来,供客户端拉取表单字段属性
        /// </summary>
        /// <param name="ass">ass</param>
        public static void Initlize()
        {
            if (apiArgs == null)
            {
                lock (root)
                {
                    if (apiArgs == null)
                    {
                        apiArgs = new Dictionary <string, List <EditFormApiResult> >();

                        // var runtimeId = RuntimeEnvironment.GetRuntimeIdentifier();
                        // var assemblies = DependencyContext.Default.GetRuntimeAssemblyNames(runtimeId);
                        // var assArrary = assemblies.ToArray(); // 找到所有依赖的程序集
                        // var GrantAss = assArrary.Where(a => a.FullName.ToLower().StartsWith("grant")).ToArray();

                        // List<Type> allTypes = new List<Type>();
                        // foreach (var qt in GrantAss)
                        // {
                        //    Assembly asb = AssemblyLoadContext.Default.LoadFromAssemblyName(qt);
                        //    allTypes.AddRange(asb.GetTypes());
                        // }
                        ApiHelper.ApiHelper helper = new ApiHelper.ApiHelper(Assembly.GetEntryAssembly());
                        var list = helper.GetAllInterface(); // 找到所有的app
                        foreach (var t in list)
                        {
                            var param = helper.GetInterfaceParam(t); // 找每个app的args

                            // 看args是否标记为EditForm
                            var editAttr = EditFormHelper.GetEditForm(param.args);
                            if (editAttr != null)
                            {
                                // List<Type> dbList = new List<Type>();
                                // foreach (var edit in editAttr.DbContextFullName)
                                // {
                                //   var dbType = allTypes.Where(a => a.FullName.ToLower().EndsWith(edit.ToLower())).ToArray();
                                //   dbList.AddRange(dbType);
                                // }
                                List <EditFormApiResult> apiList = new List <EditFormApiResult>();
                                EditFormHelper.GetEditFormField(param.args, ref apiList);
                                var key = t.Name.ToLower();
                                if (apiArgs.ContainsKey(key))
                                {
                                    apiArgs[key] = apiList;
                                }
                                else
                                {
                                    apiArgs.Add(key, apiList);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        public async Task <bool> AjoutDonneesDITAsync([FromBody] List <dynamic> srcDonnee)
        {
            if (srcDonnee.Count == 0)
            {
                return(false);
            }

            try
            {
                ApiHelper.ApiHelper apiHelper = new ApiHelper.ApiHelper();
                return(await apiHelper.PostApiAsync <Boolean, List <dynamic> >($"api/DonneeDestination/AjoutDonneesDIT", srcDonnee));
            }
            catch (Exception ex)
            {
                _logDDC.LogInformation("DonneeDestinationController : InnerException = {0} - Message {1}", ex.InnerException, ex.Message);
                return(false);
            }
        }
コード例 #4
0
        public async Task <List <dynamic> > SelectionDonneesDITAsync(string premierDateCom, string derniereDateCom, string premierFactureDateCom, string dernierFactureDateCom, string nom, string prenom, string secteur)
        {
            try
            {
                bool datePreComBl      = DateTime.TryParse(premierDateCom, out DateTime datePreCom);
                bool dateDerComBl      = DateTime.TryParse(derniereDateCom, out DateTime dateDerCom);
                bool datePremFactComBl = DateTime.TryParse(premierFactureDateCom, out DateTime datePremFactCom);
                bool dateDernFactComBl = DateTime.TryParse(dernierFactureDateCom, out DateTime dateDernFactCom);

                //Récupération des données en filtrant.
                ApiHelper.ApiHelper apiHelper = new ApiHelper.ApiHelper();
                return(await apiHelper.GetApiAsync <List <dynamic> >($"api/DonneeDestination/SelectionDonneesDIT?premierDateCom={premierDateCom}&derniereDateCom={derniereDateCom}&premierFactureDateCom={premierFactureDateCom}&dernierFactureDateCom={dernierFactureDateCom}&nom={nom}&prenom={prenom}&secteur={secteur}"));
            }
            catch (Exception ex)
            {
                _logDDC.LogInformation("DonneeDestinationController : InnerException = {0} - Message {1}", ex.InnerException, ex.Message);
                return(null);
            }
        }