public static List <byte> Generate(ref TASKMessage msg)
        {
            Reg         reg       = null;
            byte        baddress  = 0;
            List <byte> OpReglist = new List <byte>();

            ParamContainer demparameterlist = msg.task_parameterlist;

            if (demparameterlist == null)
            {
                return(null);
            }

            foreach (Parameter p in demparameterlist.parameterlist)
            {
                if ((p.guid & ElementDefine.SectionMask) == ElementDefine.VirtualElement)    //略过虚拟参数
                {
                    continue;
                }
                if (p == null)
                {
                    break;
                }
                foreach (KeyValuePair <string, Reg> dic in p.reglist)
                {
                    reg      = dic.Value;
                    baddress = (byte)reg.address;
                    if (OpReglist.Contains(baddress) == false)
                    {
                        OpReglist.Add(baddress);
                    }
                }
            }
            return(OpReglist);
        }
Example #2
0
        internal void Exec(JObject cronJob)
        {
            try
            {
                IActionExecuter actionExecuter = new ActionExecuter(_logger);
                ParamContainer  pamamContainer = CreateParamContainer(_logger, actionExecuter);
                pamamContainer.AddKey(CommonConst.CommonValue.PARAM_CRON_JOB_OBJ, () => { return(cronJob); });
                IDBService dbProxy = pamamContainer.GetKey(CommonConst.CommonValue.PARAM_DBPROXY);

                var filter = new JObject();
                filter[CommonConst.CommonField.DISPLAY_ID]      = cronJob[CommonConst.CommonField.DISPLAY_ID];
                cronJob[CommonConst.CommonField.STATUS]         = CommonConst.CommonValue.INPROGRESS;
                cronJob[CommonConst.CommonField.TRANSACTION_ID] = _logger.TransactionId;
                var startDatetime = DateTime.Now;
                cronJob[CommonConst.CommonField.LAST_EXEC_ON] = startDatetime.ToString();
                cronJob[CommonConst.CommonField.ERR_MESSAGE]  = string.Empty;
                if (cronJob[CommonConst.CommonField.HISTORY] == null)
                {
                    cronJob[CommonConst.CommonField.HISTORY] = new JArray();
                }
                else
                {
                    while ((cronJob[CommonConst.CommonField.HISTORY] as JArray).Count >= 10)
                    {
                        (cronJob[CommonConst.CommonField.HISTORY] as JArray).Remove((cronJob[CommonConst.CommonField.HISTORY] as JArray)[0]);
                    }
                }
                dbProxy.Update(CommonConst.Collection.CRON_JOB, filter.ToString(), cronJob, false, MergeArrayHandling.Replace);
                try
                {
                    object resonse = actionExecuter.Exec(cronJob[CommonConst.CommonField.EXECULT_ASSEMBLY].ToString(), cronJob[CommonConst.CommonField.EXECUTE_TYPE].ToString(), cronJob[CommonConst.CommonField.EXECUTE_METHOD].ToString(), pamamContainer);
                    cronJob[CommonConst.CommonField.STATUS] = CommonConst.CommonValue.FINISH;
                }
                catch (Exception ex)
                {
                    cronJob[CommonConst.CommonField.ERR_MESSAGE] = ex.Message;
                    cronJob[CommonConst.CommonField.STATUS]      = CommonConst.CommonValue.FINISH_WITH_ERROR;
                }
                finally
                {
                    cronJob[CommonConst.CommonField.DURATION] = (DateTime.Now - startDatetime).TotalMilliseconds;
                    JObject history = new JObject();
                    history[CommonConst.CommonField.START_ON] = startDatetime.ToString();
                    history[CommonConst.CommonField.DURATION] = cronJob[CommonConst.CommonField.DURATION];
                    history[CommonConst.CommonField.STATUS]   = cronJob[CommonConst.CommonField.STATUS];
                    if (cronJob[CommonConst.CommonField.ERR_MESSAGE] != null)
                    {
                        history[CommonConst.CommonField.ERR_MESSAGE] = cronJob[CommonConst.CommonField.ERR_MESSAGE];
                    }
                    history[CommonConst.CommonField.TRANSACTION_ID] = _logger.TransactionId;
                    (cronJob[CommonConst.CommonField.HISTORY] as JArray).Add(history);
                }

                dbProxy.Update(CommonConst.Collection.CRON_JOB, filter.ToString(), cronJob, false, MergeArrayHandling.Replace);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
            }
        }
Example #3
0
        private void InitParameters()
        {
            ParamContainer pc = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.EFUSEElement);

            pECOT   = pc.GetParameterByGuid(ElementDefine.ECOT);
            pEDOT   = pc.GetParameterByGuid(ElementDefine.EDOT);
            pECUT   = pc.GetParameterByGuid(ElementDefine.ECUT);
            pEDUT   = pc.GetParameterByGuid(ElementDefine.EDUT);
            pECTO   = pc.GetParameterByGuid(ElementDefine.ECTO);
            pEEOC   = pc.GetParameterByGuid(ElementDefine.EEOC);
            pc      = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.OperationElement);
            pOCOT   = pc.GetParameterByGuid(ElementDefine.OCOT);
            pODOT   = pc.GetParameterByGuid(ElementDefine.ODOT);
            pOCUT   = pc.GetParameterByGuid(ElementDefine.OCUT);
            pODUT   = pc.GetParameterByGuid(ElementDefine.ODUT);
            pOCTO   = pc.GetParameterByGuid(ElementDefine.OCTO);
            pOEOC   = pc.GetParameterByGuid(ElementDefine.OEOC);
            pc      = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.VirtualElement);
            pECTO_E = pc.GetParameterByGuid(ElementDefine.ECTO_E);
            pECUT_E = pc.GetParameterByGuid(ElementDefine.ECUT_E);
            pEEOC_E = pc.GetParameterByGuid(ElementDefine.EEOC_E);
            pEDUT_E = pc.GetParameterByGuid(ElementDefine.EDUT_E);
            pOCTO_E = pc.GetParameterByGuid(ElementDefine.OCTO_E);
            pOCUT_E = pc.GetParameterByGuid(ElementDefine.OCUT_E);
            pOEOC_E = pc.GetParameterByGuid(ElementDefine.OEOC_E);
            pODUT_E = pc.GetParameterByGuid(ElementDefine.ODUT_E);
            CellNum = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.OperationElement).GetParameterByGuid(ElementDefine.CellNum);
            for (int i = 0; i < 8; i++)
            {
                Cell[i] = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.OperationElement).GetParameterByGuid(ElementDefine.CellBase + (UInt32)(i * 0x100));
            }
        }
Example #4
0
        public object Exec(RoutingModel route, ParamContainer helper)
        {
            if (route.auth_users.FirstOrDefault(f => f.Trim() == "*") == null)
            {
                ISessionProvider  sessionProvider = (ISessionProvider)helper.GetKey(CommonConst.CommonValue.PARAM_SESSION_PROVIDER);
                IHttpContextProxy httpProxy       = (IHttpContextProxy)helper.GetKey(CommonConst.CommonValue.PARAM_HTTPREQUESTPROXY);
                if (sessionProvider == null || httpProxy == null)
                {
                    string error = "ActionExecuter.Exec sessionProvider is null or HttpContextProxy is null on ParamContainer";
                    _logger.Error(error);
                    throw new UnauthorizedAccessException(error);
                }

                var authToken   = httpProxy.GetHeaders().FirstOrDefault(f => f.Key.ToLower() == "");
                var sessionUser = sessionProvider.GetValue <UserModel>(CommonConst.CommonValue.SESSION_USER_KEY);
                // add auth here.
                if (sessionUser == null)
                {
                    throw new UnauthorizedAccessException("No session user found");
                }

                if (!route.auth_users.Where(i => sessionUser.claims.Where(f => f.Value == i).Any()).Any())
                {
                    throw new UnauthorizedAccessException("Unauthorized");
                }

                return(Exec(route.ExecultAssembly, route.ExecuteType, route.ExecuteMethod, helper));
            }
            else
            {
                return(Exec(route.ExecultAssembly, route.ExecuteType, route.ExecuteMethod, helper));
            }
        }
        public static List <Parameter> Generate(ref TASKMessage msg)
        {
            List <Parameter> OpParamList = new List <Parameter>();

            ParamContainer demparameterlist = msg.task_parameterlist;

            if (demparameterlist == null)
            {
                return(null);
            }

            foreach (Parameter p in demparameterlist.parameterlist)
            {
                if ((p.guid & ElementDefine.SectionMask) == ElementDefine.VirtualElement)    //略过虚拟参数
                {
                    continue;
                }
                if (p == null)
                {
                    break;
                }
                OpParamList.Add(p);
            }
            OpParamList = OpParamList.Distinct().ToList();
            return(OpParamList);
        }
Example #6
0
 public ApiBaseService(ParamContainer paramContainer)
     : base(paramContainer)
 {
     HttpProxy       = paramContainer.GetKey(CommonConst.CommonValue.PARAM_HTTPREQUESTPROXY);
     Route           = paramContainer.GetKey(CommonConst.CommonValue.PARAM_ROUTE);
     SessionProvider = paramContainer.GetKey(CommonConst.CommonValue.PARAM_SESSION_PROVIDER);
 }
 private void SectionParameterListInit(ref ParamListContainer devicedescriptionlist)
 {
     OPParamlist = devicedescriptionlist.GetParameterListByGuid(ElementDefine.OperationElement);
     if (OPParamlist == null)
     {
         return;
     }
 }
Example #8
0
        private ParamContainer CreateParamContainer(ILogger loggerController, IActionExecuter actionExecuter)
        {
            ParamContainer  paramContainer  = ActionExecuterHelper.CreateParamContainer(_logger, actionExecuter);
            IRoutings       routings        = Routings.Routings.GetRoutings();
            ILogReader      logReader       = Logger.GetLogReader();
            ResponseBuilder responseBuilder = new ResponseBuilder(loggerController, logReader, new CronJobInitData(loggerController.TransactionId));

            paramContainer.AddKey(CommonConst.CommonValue.PARAM_RESPONBUILDER, () => { return(responseBuilder); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_ROUTING_OBJECT, () => { return(routings); });
            return(paramContainer);
        }
        public UInt32 BitOperation(ref TASKMessage msg)
        {
            Reg    reg      = null;
            byte   baddress = 0;
            UInt32 ret      = LibErrorCode.IDS_ERR_SUCCESSFUL;

            List <byte> OpReglist = new List <byte>();

            ParamContainer demparameterlist = msg.task_parameterlist;

            if (demparameterlist == null)
            {
                return(ret);
            }

            foreach (Parameter p in demparameterlist.parameterlist)
            {
                if ((p.guid & ElementDefine.SectionMask) == ElementDefine.VirtualElement)    //略过虚拟参数
                {
                    continue;
                }
                switch (p.guid & ElementDefine.SectionMask)
                {
                case ElementDefine.OperationElement:
                {
                    if (p == null)
                    {
                        break;
                    }
                    foreach (KeyValuePair <string, Reg> dic in p.reglist)
                    {
                        reg      = dic.Value;
                        baddress = (byte)reg.address;

                        parent.m_OpRegImg[baddress].val = 0x00;
                        dem_dm.WriteToRegImg(p, 1);
                        OpReglist.Add(baddress);
                    }
                    break;
                }
                }
            }

            OpReglist = OpReglist.Distinct().ToList();

            //Write
            foreach (byte badd in OpReglist)
            {
                ret = WriteWord(badd, parent.m_OpRegImg[badd].val);
                parent.m_OpRegImg[badd].err = ret;
            }

            return(ret);
        }
        private void InitParameters()
        {
            ParamContainer pc = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.OperationElement);

            pE_BAT_TYPE = pc.GetParameterByGuid(ElementDefine.E_BAT_TYPE);
            pO_BAT_TYPE = pc.GetParameterByGuid(ElementDefine.O_BAT_TYPE);
            pE_OVP_TH   = pc.GetParameterByGuid(ElementDefine.E_OVP_TH);
            pO_OVP_TH   = pc.GetParameterByGuid(ElementDefine.O_OVP_TH);
            pE_UVP_TH   = pc.GetParameterByGuid(ElementDefine.E_UVP_TH);
            pO_UVP_TH   = pc.GetParameterByGuid(ElementDefine.O_UVP_TH);
            pc          = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.VirtualElement);
        }
Example #11
0
 public EmailService(ILogger logger,
                     IDBService dbService,
                     IActionExecuter actionExecuter,
                     IViewEngine viewEngine,
                     ParamContainer paramContainer)
 {
     _logger         = logger;
     _actionExecuter = actionExecuter;
     _dbService      = dbService;
     _viewEngine     = viewEngine;
     _paramContainer = paramContainer;
 }
Example #12
0
 public BaseService(ParamContainer paramContainer)
 {
     DBProxy           = (IDBService)paramContainer.GetKey(CommonConst.CommonValue.PARAM_DBPROXY);
     Logger            = (ILogger)paramContainer.GetKey(CommonConst.CommonValue.PARAM_LOGGER);
     ActionExecuter    = (IActionExecuter)paramContainer.GetKey(CommonConst.CommonValue.PARAM_ACTIONEXECUTER);
     PingService       = (IPingService)paramContainer.GetKey(CommonConst.CommonValue.PARAM_PING_SERVICE);
     ResponseBuilder   = (IResponseBuilder)paramContainer.GetKey(CommonConst.CommonValue.PARAM_RESPONBUILDER);
     ViewEngine        = (IViewEngine)paramContainer.GetKey(CommonConst.CommonValue.PARAM_VIEW_ENGINE);
     AppSettingService = (IAppSettingService)paramContainer.GetKey(CommonConst.CommonValue.PARAM_APP_SETTING);
     OTPService        = (IOTPService)paramContainer.GetKey(CommonConst.CommonValue.PARAM_OTP_SERVICE);
     SMSService        = (ISMSService)paramContainer.GetKey(CommonConst.CommonValue.PARAM_SMS_SERVICE);
     EmailService      = (IEmailService)paramContainer.GetKey(CommonConst.CommonValue.PARAM_EMAIL_SERVICE);
     EncryptionService = (IEncryption)paramContainer.GetKey(CommonConst.CommonValue.PARAM_ENCRYPTION_SERVICE);
     KeyValueStorage   = (IKeyValueStorage)paramContainer.GetKey(CommonConst.CommonValue.PARAM_KEY_VALUE_STORAGE);
 }
Example #13
0
        public IEnumerable <ContainerData> getContainerAvailableData(ParamContainer paramContainer)
        {
            IEnumerable <ContainerData> result = null;

            using (IDbConnection connection = Extension.GetConnection(1))
            {
                try
                {
                    string paramKodeRegional = "";
                    if (!string.IsNullOrEmpty(paramContainer.kd_region) && paramContainer.kd_region != "string")
                    {
                        paramKodeRegional = " WHERE KD_REGION ='" + paramContainer.kd_region + "'";
                    }

                    string paramKodeCabang = "";
                    if (!string.IsNullOrEmpty(paramContainer.kd_cabang) && paramContainer.kd_cabang != "string")
                    {
                        paramKodeCabang = " AND KD_CABANG ='" + paramContainer.kd_cabang + "'";
                    }

                    string paramKodeTerminal = "";
                    if (!string.IsNullOrEmpty(paramContainer.kd_terminal) && paramContainer.kd_terminal != "string")
                    {
                        paramKodeTerminal = " AND KD_TERMINAL ='" + paramContainer.kd_terminal + "'";
                    }

                    string paramOrderby = "";
                    if (!string.IsNullOrEmpty(paramContainer.order_by_column) && paramContainer.order_by_column != "string" && !string.IsNullOrEmpty(paramContainer.order_by_sort) && paramContainer.order_by_sort != "string")
                    {
                        paramOrderby = " ORDER BY " + paramContainer.order_by_column + " " + paramContainer.order_by_sort;
                    }


                    string sql = "SELECT * FROM VW_STORAGE_CONT_DETAIL_NEW " + paramKodeRegional + paramKodeCabang + paramKodeTerminal + paramOrderby;

                    result = connection.Query <ContainerData>(sql, new
                    {
                        KD_REGIONAL = paramContainer.kd_region
                    });
                }
                catch (Exception)
                {
                    result = null;
                }
            }

            return(result);
        }
Example #14
0
        public IActionResult getListContainer(ParamContainer data)
        {
            MonContainerAvailableDL dal = new MonContainerAvailableDL();

            MonContainerAvailableModel hasil = new MonContainerAvailableModel();

            /**
             * This params is for pagination function
             */
            if (!string.IsNullOrEmpty(data.limit) && data.limit != "string" && !string.IsNullOrEmpty(data.page) && data.page != "string")
            {
                data.page  = data.page;
                data.limit = data.limit;
            }
            else if (!string.IsNullOrEmpty(data.page) && data.page != "string" && string.IsNullOrEmpty(data.limit) && data.limit != "string")
            {
                data.page  = data.page;
                data.limit = "10";
            }
            else if (!string.IsNullOrEmpty(data.limit) && data.limit != "string" && string.IsNullOrEmpty(data.page) && data.page != "string")
            {
                data.page  = "1";
                data.limit = data.limit;
            }
            else
            {
                data.page  = "1";
                data.limit = "10";
            }

            if (!string.IsNullOrEmpty(data.kd_region) && data.kd_region != "string")
            {
                IEnumerable <ContainerData> result = dal.getContainerAvailableData(data);
                hasil.message = "Success";
                hasil.status  = "S";
                hasil.count   = result.Cast <Object>().Count();
                hasil.data    = new PagedList <ContainerData>(result.ToList(), Convert.ToInt32(data.page), Convert.ToInt32(data.limit));
            }
            else
            {
                hasil.message = "Kode Regional Null !!!";
                hasil.status  = "E";
                hasil.count   = 0;
            }

            return(Ok(hasil));
        }
Example #15
0
        public ModuleInstaller(ParamContainer requestParam) : base(requestParam)
        {
            _moduleInstaller   = new ZNxtApp.Core.ModuleInstaller.Installer.ModuleInstaller(Logger, DBProxy);
            _moduleUninstaller = new ZNxtApp.Core.ModuleInstaller.Installer.Uninstaller(Logger, DBProxy);

            _moduleMethodCaller = (Func <string, JObject> methodCall) =>
            {
                try
                {
                    if (ApplicationConfig.GetApplicationMode == ApplicationMode.Maintenance)
                    {
                        var moduleName = HttpProxy.GetQueryString("module_name");

                        if (string.IsNullOrEmpty(moduleName))
                        {
                            Logger.Info("ModuleInstaller module name is empty");
                            return(ResponseBuilder.CreateReponse(ModuleInstallerResponseCode._MODULE_NAME_EMPTY));
                        }
                        try
                        {
                            var response = methodCall(moduleName);
                            return(response);
                        }
                        catch (DirectoryNotFoundException dx)
                        {
                            Logger.Error(string.Format("ModuleInstaller module not found. Erro:{0}", dx.Message), dx);
                            return(ResponseBuilder.CreateReponse(ModuleInstallerResponseCode._MODULE_NOT_FOUND));
                        }
                        catch (FileNotFoundException fx)
                        {
                            Logger.Error(string.Format("ModuleInstaller module config not found. Erro:{0}", fx.Message), fx);
                            return(ResponseBuilder.CreateReponse(ModuleInstallerResponseCode._MODULE_CONFIG_MISSING));
                        }
                    }
                    else
                    {
                        Logger.Info("ModuleInstaller.GetModuleDetails MAINTANCE_MODE_OFF");
                        return(ResponseBuilder.CreateReponse(ModuleInstallerResponseCode._MAINTANCE_MODE_OFF));
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(string.Format("ModuleInstaller, Error:", ex.Message), ex);
                    return(ResponseBuilder.CreateReponse(CommonConst._500_SERVER_ERROR));
                }
            };
        }
        public UInt32 Read(ref TASKMessage msg)
        {
            Reg    reg      = null;
            byte   baddress = 0;
            UInt16 wdata    = 0;
            UInt32 ret      = LibErrorCode.IDS_ERR_SUCCESSFUL;

            List <byte> OpReglist = new List <byte>();

            ParamContainer demparameterlist = msg.task_parameterlist;

            if (demparameterlist == null)
            {
                return(ret);
            }


            foreach (Parameter p in demparameterlist.parameterlist)
            {
                if (p == null)
                {
                    break;
                }
                foreach (KeyValuePair <string, Reg> dic in p.reglist)
                {
                    reg      = dic.Value;
                    baddress = (byte)reg.address;
                    OpReglist.Add(baddress);
                }
            }
            OpReglist = OpReglist.Distinct().ToList();

            //Read

            foreach (byte badd in OpReglist)
            {
                ret = ReadWord(badd, ref wdata);
                parent.m_OpRegImg[badd].err = ret;
                parent.m_OpRegImg[badd].val = wdata;
                if (ret != LibErrorCode.IDS_ERR_SUCCESSFUL)
                {
                    return(ret);
                }
            }
            return(ret);
        }
Example #17
0
        public void ProcessUpdateLiveData()
        {
            string urlUpdateLodds = string.Concat(
                IbetConfig.URL_UPDATE_LODDS_MARKET,
                ParamContainer["LIVE_CT"].KeyName + "=" + HttpUtility.UrlEncode(ParamContainer["LIVE_CT"].KeyValue),
                "&key=", GetKey(UserName, this.Host, "lodds", null, ParamContainer["LIVE_CT"].KeyValue, "U"),
                "&" + ParamContainer["K"].KeyName + "=" + ParamContainer["K"].KeyValue,
                "&_=" + Utils.GetUnixTimestamp());

            var updateLiveOddMessage = Get(urlUpdateLodds, IbetConfig.URL_NEW_MARKET, "application/x-www-form-urlencoded");

            try
            {
                if (updateLiveOddMessage.StatusCode == HttpStatusCode.OK &&
                    !string.IsNullOrEmpty(updateLiveOddMessage.Result))
                {
                    string updateTime;
                    ConvertUpdateData(updateLiveOddMessage.Result, out updateTime,
                                      DataContainer.LiveMatchOddBag);
                    if (!ParamContainer.ContainsKey("LIVE_CT"))
                    {
                        ParamContainer["LIVE_CT"] = new ParamRequest("CT", updateTime);
                    }
                    else
                    {
                        ParamContainer["LIVE_CT"].KeyValue = updateTime;
                    }

                    UpdateException(this);
                }
                else
                {
                    //Logger.Error("IBET: END->ProcessUpdateLiveData -> FAIL");
                    //Logger.Error("MESSAGE : " + updateLiveOddMessage.Result + " URL REQUEST:: " + urlUpdateLodds);
                    UpdateException(this, eExceptionType.RequestFail);
                }
            }
            catch (Exception ex)
            {
                //Logger.Error(ex);
                Logger.Error("MESSAGE : " + updateLiveOddMessage.Result, ex);
                //UpdateException(this, eExceptionType.RequestFail);
            }
            //UpdateException(this, eExceptionType.RequestFail);
        }
        private void InitParameters()
        {
            ParamContainer pc = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.OperationElement);

            OVP_H   = pc.GetParameterByGuid(ElementDefine.OVP_H);
            DOC1P   = pc.GetParameterByGuid(ElementDefine.DOC1P);
            COCP    = pc.GetParameterByGuid(ElementDefine.COCP);
            pc      = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.VirtualElement);
            OVP_E   = pc.GetParameterByGuid(ElementDefine.OVP_E);
            DOC1P_E = pc.GetParameterByGuid(ElementDefine.DOC1P_E);
            COCP_E  = pc.GetParameterByGuid(ElementDefine.COCP_E);

            CellNum = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.OperationElement).GetParameterByGuid(ElementDefine.CellNum);
            for (int i = 0; i < 17; i++)
            {
                Cell[i] = m_Section_ParamlistContainer.GetParameterListByGuid(ElementDefine.OperationElement).GetParameterByGuid(ElementDefine.CellBase + (UInt32)(i * 0x100));
            }
        }
        //public void Physical2Hex(ref Parameter param)
        //{
        //    m_dem_dm.Physical2Hex(ref param);
        //}

        //public void Hex2Physical(ref Parameter param)
        //{
        //    m_dem_dm.Hex2Physical(ref param);
        //}

        private void SectionParameterListInit(ref ParamListContainer devicedescriptionlist)
        {
            tempParamlist = devicedescriptionlist.GetParameterListByGuid(ElementDefine.TemperatureElement);
            if (tempParamlist == null)
            {
                return;
            }

            //EFParamlist = devicedescriptionlist.GetParameterListByGuid(ElementDefine.EFUSEElement);
            //if (EFParamlist == null) return;

            OPParamlist = devicedescriptionlist.GetParameterListByGuid(ElementDefine.OperationElement);
            if (OPParamlist == null)
            {
                return;
            }

            //pullupR = tempParamlist.GetParameterByGuid(ElementDefine.TpETPullupR).phydata;
            //itv0 = tempParamlist.GetParameterByGuid(ElementDefine.TpITSlope).phydata;
        }
Example #20
0
        public object Exec(string action, IDBService dbProxy, ParamContainer helper)
        {
            JObject filter = JObject.Parse(CommonConst.Filters.IS_OVERRIDE_FILTER);

            filter[CommonConst.CommonField.METHOD] = CommonConst.ActionMethods.ACTION;
            filter[CommonConst.CommonField.ROUTE]  = action;

            var data = dbProxy.Get(CommonConst.Collection.SERVER_ROUTES, filter.ToString());

            if (data.Count == 0)
            {
                throw new KeyNotFoundException(string.Format("Not Found: {0}", filter.ToString()));
            }
            RoutingModel route = JObjectHelper.Deserialize <RoutingModel>(data[0].ToString());

            Func <dynamic> routeAction = () => { return(route); };

            helper[CommonConst.CommonValue.PARAM_ROUTE] = routeAction;

            return(Exec(route, helper));
        }
        public virtual UInt32 Read(ref TASKMessage msg)
        {
            UInt16      wdata     = 0;
            UInt32      ret       = LibErrorCode.IDS_ERR_SUCCESSFUL;
            List <byte> OpReglist = new List <byte>();

            ParamContainer demparameterlist = msg.task_parameterlist;

            if (demparameterlist == null)
            {
                return(ret);
            }

            AutomationElement aElem = parent.m_busoption.GetATMElementbyGuid(AutomationElement.GUIDATMTestStart);

            if (aElem != null)
            {
                bool bsim = true;
                bsim |= (aElem.dbValue > 0.0) ? true : false;
                aElem = parent.m_busoption.GetATMElementbyGuid(AutomationElement.GUIDATMTestSimulation);
                bsim |= (aElem.dbValue > 0.0) ? true : false;
            }
            OpReglist = RegisterListGenerator.Generate(ref msg);
            if (OpReglist == null)
            {
                return(ret);
            }

            foreach (byte badd in OpReglist)
            {
                ret = ReadWord(badd, ref wdata);
                parent.m_OpRegImg[badd].err = ret;
                parent.m_OpRegImg[badd].val = wdata;
                if (ret != LibErrorCode.IDS_ERR_SUCCESSFUL)
                {
                    return(ret);
                }
            }
            return(ret);
        }
        public UInt32 ConvertPhysicalToHex(ref TASKMessage msg)
        {
            Parameter param = null;
            UInt32    ret   = LibErrorCode.IDS_ERR_SUCCESSFUL;

            List <Parameter> OpReglist = new List <Parameter>();

            ParamContainer demparameterlist = msg.task_parameterlist;

            if (demparameterlist == null)
            {
                return(ret);
            }

            foreach (Parameter p in demparameterlist.parameterlist)
            {
                if (p == null)
                {
                    continue;
                }
                OpReglist.Add(p);
            }

            if (OpReglist.Count != 0)
            {
                for (int i = 0; i < OpReglist.Count; i++)
                {
                    param = OpReglist[i];
                    if (param == null)
                    {
                        continue;
                    }

                    parent.Physical2Hex(ref param);
                }
            }
            return(ret);
        }
Example #23
0
 public SessionCleanup(ParamContainer paramContainer) : base(paramContainer)
 {
 }
 public BackendMenuController(ParamContainer paramContainer) : base(paramContainer)
 {
 }
Example #25
0
 public UsersController(ParamContainer paramContainer) : base(paramContainer)
 {
     bool.TryParse(AppSettingService.GetAppSettingData(OAUTH_VERIFICATION_ON_HOST), out isOauthVerification);
 }
Example #26
0
        private void addParamsToTreeNode(ParamContainer pc, TreeNode node)
        {
            foreach (ParamGroup pg in pc.paramGroups)
            {
                addParamsToTreeNode(pg as ParamContainer, node);
            }

            foreach (CVParam param in pc.cvParams)
            {
                if (param.empty())
                {
                    continue;
                }

                string nodeText;
                if (param.value.ToString().Length > 0)
                {
                    // has value
                    if (param.units != CVID.CVID_Unknown)
                    {
                        // has value and units
                        nodeText = String.Format("{0}: {1} {2}", param.name, param.value, param.unitsName);
                    }
                    else
                    {
                        // has value but no units
                        nodeText = String.Format("{0}: {1}", param.name, param.value);
                    }
                }
                else
                {
                    // has controlled value, look up category in the CV
                    nodeText = String.Format("{0}: {1}", new CVTermInfo(new CVTermInfo(param.cvid).parentsIsA[0]).name, param.name);
                }
                TreeNode childNode = node.Nodes.Add(nodeText);
                childNode.ToolTipText = new CVTermInfo(param.cvid).def;
            }

            foreach (UserParam param in pc.userParams)
            {
                string nodeText;
                if (param.value.ToString().Length > 0)
                {
                    // has value
                    if (param.units != CVID.CVID_Unknown)
                    {
                        // has value and units
                        nodeText = String.Format("{0}: {1} {2}", param.name, param.value, new CVTermInfo(param.units).name);
                    }
                    else
                    {
                        // has value but no units
                        nodeText = String.Format("{0}: {1}", param.name, param.value);
                    }
                }
                else
                {
                    // has uncontrolled value
                    nodeText = String.Format("{0}", param.name);
                }
                TreeNode childNode = node.Nodes.Add(nodeText);
                childNode.ToolTipText = param.type;
            }
        }
Example #27
0
        public object Exec(string execultAssembly, string executeType, string executeMethod, ParamContainer helper)
        {
            Type exeType = _assemblyLoader.GetType(execultAssembly, executeType, _logger);

            if (exeType == null)
            {
                string error = string.Format("Execute Type is null for {0} :: {1}", execultAssembly, executeType);
                _logger.Error(error, null);
                throw new Exception(error);
            }
            Type[]   argTypes   = new Type[] { typeof(string) };
            object[] argValues  = new object[] { helper };
            dynamic  obj        = Activator.CreateInstance(exeType, argValues);
            var      methodInfo = exeType.GetMethod(executeMethod);

            if (methodInfo != null)
            {
                return(methodInfo.Invoke(obj, null));
            }
            else
            {
                return(null);
            }
        }
Example #28
0
        public T Exec <T>(string action, IDBService dbProxy, ParamContainer helper)
        {
            var result = Exec(action, dbProxy, helper);

            return(JObjectHelper.Deserialize <T>(result.ToString()));
        }
Example #29
0
 public ImageEditor(ParamContainer paramContainer)
     : base(paramContainer)
 {
 }
Example #30
0
        private void addParamsToTreeNode( ParamContainer pc, TreeNode node)
        {
            foreach( ParamGroup pg in pc.paramGroups )
                addParamsToTreeNode( pg as ParamContainer, node);

            foreach( CVParam param in pc.cvParams )
            {
                if( param.empty() )
                    continue;

                string nodeText;
                if( param.value.ToString().Length > 0 )
                {
                    // has value
                    if( param.units != CVID.CVID_Unknown )
                    {
                        // has value and units
                        nodeText = String.Format( "{0}: {1} {2}", param.name, param.value, param.unitsName);
                    } else
                    {
                        // has value but no units
                        nodeText = String.Format( "{0}: {1}", param.name, param.value);
                    }
                } else
                {
                    // has controlled value, look up category in the CV
                    nodeText = String.Format( "{0}: {1}", new CVTermInfo(new CVTermInfo(param.cvid).parentsIsA[0]).name, param.name);
                }
                TreeNode childNode = node.Nodes.Add(nodeText);
                childNode.ToolTipText = new CVTermInfo( param.cvid ).def;
            }

            foreach( UserParam param in pc.userParams )
            {
                string nodeText;
                if( param.value.ToString().Length > 0 )
                {
                    // has value
                    if( param.units != CVID.CVID_Unknown )
                    {
                        // has value and units
                        nodeText = String.Format( "{0}: {1} {2}", param.name, param.value, new CVTermInfo(param.units).name);
                    } else
                    {
                        // has value but no units
                        nodeText = String.Format( "{0}: {1}", param.name, param.value);
                    }
                } else
                {
                    // has uncontrolled value
                    nodeText = String.Format( "{0}", param.name);
                }
                TreeNode childNode = node.Nodes.Add(nodeText);
                childNode.ToolTipText = param.type;
            }
        }
Example #31
0
 public CronServiceBase(ParamContainer paramContainer)
     : base(paramContainer)
 {
     Routings = (IRouting)paramContainer.GetKey(CommonConst.CommonValue.PARAM_ROUTING_OBJECT);
 }