コード例 #1
0
 public virtual List <IDropDownOption> GetDropDown(IDropDownParameter p)
 {
     using (var EngineContext = new EngineContext())
     {
         var _entities = EngineContext.Set <T>();
         return(_entities.Select(d =>
                                 new IDropDownOption {
             Id = d.Id.ToString(), Value = d.Name
         }).ToList());
     }
 }
コード例 #2
0
ファイル: Personnel.cs プロジェクト: Mohammadjafariyan/Engine
 public override List <IDropDownOption> GetDropDown(IDropDownParameter param)
 {
     using (var db = new EngineContext())
     {
         return(db.Personnels.Select(p => new IDropDownOption
         {
             Id = p.Id.ToString(),
             Value = p.Name + " " + p.LastName
         }).ToList());
     }
 }
コード例 #3
0
 public override async Task <List <IDropDownOption> > GetDropDownAsync(IDropDownParameter p)
 {
     using (var EngineContext = new EngineContext())
     {
         var dt = EngineContext.Set <DefineControllerMethod>();
         return(await dt.Select(f =>
                                new IDropDownOption {
             Id = f.Id.ToString(), Value = f.DefineController.Name + "(" + f.Name + ")"
         }).ToListAsync());
     }
 }
コード例 #4
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);
        }
コード例 #5
0
 public virtual ActionResult GetDropDown(IDropDownParameter p)
 {
     return(Json(_engineService.GetDropDown(p), JsonRequestBehavior.AllowGet));
 }
コード例 #6
0
 public virtual async Task <List <IDropDownOption> > GetDropDownAsync(IDropDownParameter p)
 {
     return(await Task.FromResult <List <IDropDownOption> >(new List <IDropDownOption>()));
 }
コード例 #7
0
 public virtual List <IDropDownOption> GetMultiSelect(IDropDownParameter p)
 {
     return(this.GetDropDown(p));
 }
コード例 #8
0
 /// <summary>
 /// دیتای های مربوط به Dropdown را بر میگرداند
 /// </summary>
 /// <typeparam name="B"></typeparam>
 /// <returns></returns>
 public virtual async Task <Dictionary <string, List <IDropDownOption> > > GetDropdownDataAsync(
     Dictionary <string, DropDownAttribute> dropdowns, IDropDownParameter @params)
 {
     return(await GetDataAsync <List <IDropDownOption>, DropDownAttribute>(dropdowns, @params));
 }
コード例 #9
0
 public virtual List <IDropDownOption> GetDropDown(IDropDownParameter p)
 {
     return(_engineService.GetDropDown(p));
 }