예제 #1
0
        public async Task <ActionResult> Get(string moduleName)
        {
            var outPut     = new RestOutput <ModuleInfoViewModel>();
            var moduleInfo = new ModuleInfoViewModel();

            try
            {
                var modulesInfo      = new List <ModuleInfo>();
                var fieldsInfo       = new List <ModuleFieldInfo>();
                var buttonsInfo      = new List <ButtonInfo>();
                var buttonParamsInfo = new List <ButtonParamInfo>();
                var languageInfo     = new List <LanguageInfo>();
                var oracleParamsInfo = new List <OracleParam>();
                var m_Client         = new CoreController(_configuration);
                m_Client.ForceLoadModule(out modulesInfo, out fieldsInfo, out buttonsInfo, out buttonParamsInfo, out languageInfo, out oracleParamsInfo, moduleName);
                var fields    = fieldsInfo.Where(x => String.IsNullOrEmpty(x.ParentId)).ToList();
                var parentIds = fieldsInfo.Where(x => !String.IsNullOrEmpty(x.ParentId)).Select(x => x.ParentId).Distinct().ToList();
                if (parentIds != null)
                {
                    foreach (var parentId in parentIds)
                    {
                        var field = fields.Where(x => x.FieldID == parentId);
                        if (field != null && field.Any())
                        {
                            field.First().FieldChilds = fieldsInfo.Where(x => x.ParentId == parentId).ToList();
                        }
                    }
                }
                //var dicFieldInfo = new Dictionary<ModuleFieldInfo, string>();
                moduleInfo = new ModuleInfoViewModel
                {
                    ButtonParamsInfo = buttonParamsInfo,
                    ButtonsInfo      = buttonsInfo,
                    FieldsInfo       = fields,
                    LanguageInfo     = languageInfo,
                    ModulesInfo      = modulesInfo,
                    OracleParamsInfo = oracleParamsInfo
                };
                outPut.Data = moduleInfo;
                return(Ok(outPut));
            }
            catch (Exception ex)
            {
                outPut.ResultCode = -1;
                outPut.Message    = ex.ToString();
                return(Ok(outPut));
            }
            return(Ok(outPut));
        }
예제 #2
0
파일: HomeBus.cs 프로젝트: TuanCruise/Code
        public ModuleInfoModel ConvertFromViewModel(ModuleInfoViewModel viewModel)
        {
            if (viewModel == null)
            {
                return(new ModuleInfoModel());
            }
            var module = new ModuleInfoModel();
            var check  = viewModel.ModulesInfo.Where(x => x.SubModule == "MMN");

            if (check.Any())
            {
                module.ModulesInfo = check.First();
            }
            else
            {
                if (viewModel.ModulesInfo != null && viewModel.ModulesInfo.Any())
                {
                    module.ModulesInfo = viewModel.ModulesInfo.First();
                }
            }
            module.FieldsInfo       = viewModel.FieldsInfo.Where(x => x.ModuleID == module.ModulesInfo.ModuleID).ToList();
            module.ButtonsInfo      = viewModel.ButtonsInfo;
            module.ButtonParamsInfo = viewModel.ButtonParamsInfo;
            var lstLanguage = Task.Run(() => LoadAllBtnLanguage()).Result;

            if (lstLanguage != null)
            {
                viewModel.LanguageInfo.AddRange(lstLanguage);
            }
            module.LanguageInfo = viewModel.LanguageInfo;
            var btnLang = Task.Run(() => LoadAllBtnLanguage()).Result;

            if (btnLang != null)
            {
                module.LanguageInfo.AddRange(btnLang);
            }

            return(module);
        }
예제 #3
0
        public ModuleInfoViewModel GetModuleInfo(string imei)
        {
            var data = _iotApp.GetFormByImei(imei);

            if (data != null)
            {
                ModuleInfoViewModel moduleInfo = new ModuleInfoViewModel
                {
                    SN              = data.M_SN,
                    Batch           = data.M_Batch,
                    ICCID           = data.M_ICCID,
                    IMEI            = data.M_IMEI,
                    IMSI            = data.M_IMSI,
                    MeterTypeName   = data.M_MeterTypeName,
                    OpenAccountTime = data.M_OpenAccountTime
                };
                return(moduleInfo);
            }
            else
            {
                throw new Exception("模组不存在!");
            }
        }
예제 #4
0
        public virtual async Task <IActionResult> OnGetAsync()
        {
            ModuleInfo = new ModuleInfoViewModel();

            return(Page());
        }
예제 #5
0
 public RowGridModMaintainModel()
 {
     Fields     = new List <ModuleFieldInfo>();
     ModuleInfo = new ModuleInfoViewModel();
 }