Esempio n. 1
0
        public virtual async Task RenderFormAsync(IModel r)
        {
            if (r == null)
            {
                throw new BaseEngineException("پارامتر نال است");
            }


            var parameters = Request?.Params;

            IDropDownParameter    dropdownparam          = GetDropDownParams(parameters);
            ITreeParameter        _ITreeParameter        = GetTreeParams(parameters);
            IMultiSelectParameter _IMultiSelectParameter = GetMultiSelectParams(parameters);
            IDataTableParameter   _IDataTableParameter   = GetDataTableParams(parameters);

            Dictionary <string, DropDownAttribute>      dropdowns    = _engineService.GetModelDropdownAttributes <T>();
            Dictionary <string, DataTableAttribute>     datatables   = _engineService.GetModelTableAttributes <T>();
            Dictionary <string, TreeAttribute>          trees        = _engineService.GetModelTreeAttributes <T>();
            Dictionary <string, MultiSelectAttribute>   multiselects = _engineService.GetModelMultiSelectAttributes <T>();
            Dictionary <string, List <SelectListItem> > enums        = _engineService.GetEnumsAttributes <T>(r);

            Dictionary <string, List <IDropDownOption> > dropdownData =
                await _engineService.GetDropdownDataAsync(dropdowns, dropdownparam);

            Dictionary <string, IQueryable <IDataTable> > dataTableData =
                await _engineService.GetDataTableDataAsync(datatables, _IDataTableParameter);

            Dictionary <string, ITreeNode> treeData = await _engineService.GetTreeDataAsync(trees, _ITreeParameter);

            Dictionary <string, List <IDropDownOption> > multiSelectData =
                await _engineService.GetMultiSelectDataAsync(multiselects, _IMultiSelectParameter);

            _engineService.SetData(dropdownData.Keys.ToArray(), dropdownData.Values.ToArray(), ViewData);
            _engineService.SetData(dataTableData.Keys.ToArray(), datatables.Values.ToArray(), ViewData);
            _engineService.SetData(treeData.Keys.ToArray(), treeData.Values.ToArray(), ViewData);
            _engineService.SetData(multiSelectData.Keys.ToArray(), multiSelectData.Values.ToArray(), ViewData);
            _engineService.SetData(enums.Keys.ToArray(), enums.Values.ToArray(), ViewData);
        }
 /// <summary>
 /// دیتای های مربوط به DataTable را بر میگرداند
 /// </summary>
 /// <typeparam name="B"></typeparam>
 /// <returns></returns>
 public virtual async Task <Dictionary <string, IQueryable <IDataTable> > > GetDataTableDataAsync
     (Dictionary <string, DataTableAttribute> datatables, IDataTableParameter @params)
 {
     return(await GetDataAsync <IQueryable <IDataTable>, DataTableAttribute>(datatables, @params));
 }