コード例 #1
0
ファイル: CheckRid.aspx.cs プロジェクト: vhil/OpenNemID
        protected void validateRid(object sender, EventArgs e)
        {
            Session.Remove("cpr");
            Session.Remove("errorText");

            try
            {
                var rid = RequestValidator.getValidatedParam("rid", ridTxt.Text, 30);


                var        wsUrl      = Properties.Get("rid.service.url." + _spidEnv);
                RidService ridService = new RidService(wsUrl);
                var        cpr        = ridService.getCPR(rid);
                if (cpr != null && !"".Equals(cpr.Trim()))
                {
                    Session.Add("cpr", cpr);
                    Session.Add("Text", "Det lykkedes at hente CPR på PID.");
                }
                else
                {
                    Session.Add("errorText", "Rid " + rid + " matcher ikke et cpr");
                }

                ridTxt.Text   = HttpUtility.HtmlEncode(rid);
                cprLabel.Text = HttpUtility.HtmlEncode(cpr);
                ridLabel.Text = HttpUtility.HtmlEncode(rid);
            }
            catch (RidServiceException ex)
            {
                Session.Add("errorText", ex);
            }
            catch (ArgumentException ae)
            {
                Session.Add("errorText", ae.Message);
            }
        }
コード例 #2
0
        public static bool ReadPlusMcDbValuesRemote(this ClientSession session,
                                                    ICoreObject onlineTarget, ICoreObject blockDb, out OnlineBinary binaryToRead, uint dbValuesAid)
        {
            if (onlineTarget == null || blockDb == null)
            {
                throw new BlockLogicException("onlineTarget, blockDb is null");
            }
            if (!IecplUtilities.IsPlusPLC(blockDb) || !onlineTarget.GetObjectType().IsTypeOf(OnlineControllerTargetData.FullName))
            {
                throw new BlockLogicException("Target is no Plus- or Online target");
            }
            IGeneralBlockSourceData generalBlockSourceData = blockDb.GetAttributeSet(typeof(IGeneralBlockSourceData), false) as IGeneralBlockSourceData;

            if (generalBlockSourceData == null || generalBlockSourceData.BlockType != BlockType.DB)
            {
                throw new BlockLogicException("block is no data block!");
            }
            if ((int)dbValuesAid != 2550 && (int)dbValuesAid != 2548)
            {
                throw new System.NotSupportedException("Only ValueActual_Aid and ValueInitial_Aid are supported");
            }
            uint  blockRid = RidService.GetRidService(onlineTarget, true).GetBlockRid(blockDb);
            Error error    = new Error();
            ulong ticks    = 0UL;
            Dictionary <uint, byte[]> dictionary = new Dictionary <uint, byte[]>()
            {
                {
                    3U,
                    new byte[0]
                },
                {
                    4U,
                    new byte[0]
                },
                {
                    5U,
                    new byte[0]
                }
            };

            binaryToRead = new OnlineBinary(dictionary[4U], dictionary[5U], dictionary[3U], new System.DateTime());
            try
            {
                int   requestID      = -1;
                Value obj1           = new Value();
                Value obj2           = null;
                Error variableRemote = session.GetVariableRemote(new Rid(blockRid), new Aid(dbValuesAid), ref obj1, ref requestID);
                using (obj1)
                {
                    if (variableRemote.Failed)
                    {
                        return(false);
                    }
                    foreach (uint key in Enumerable.ToList(dictionary.Keys))
                    {
                        Error errorState = obj1.GetValue(key, ref obj2);
                        using (obj2)
                        {
                            if (errorState.Failed)
                            {
                                return(false);
                            }
                            byte[] numArray = new byte[0];
                            obj2.GetValue(ref numArray);
                            dictionary[key] = numArray;
                        }
                    }
                    Error errorState1 = obj1.GetValue(6U, ref obj2);
                    using (obj2)
                    {
                        if (errorState1.Failed)
                        {
                            return(false);
                        }
                        obj2.GetValue(ref ticks);
                    }
                    binaryToRead = new OnlineBinary(dictionary[4U], dictionary[5U], dictionary[3U], DateTimeExtensions.ConvertPLCToESTime(ticks));
                }
            }
            finally
            {
            }
            return(true);
        }
コード例 #3
0
        static void Ping(string serviceUrl)
        {
            var wsClient = new RidService(serviceUrl);

            wsClient.Test();
        }