Example #1
0
        /// <summary>导入</summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public static HardInfo FromXml(String xml)
        {
            if (!String.IsNullOrEmpty(xml))
            {
                xml = xml.Trim();
            }

            return(FromExtend(ExtendData.FromXml(xml)));
        }
        private void ResolveRules(StyleSheet sheet)
        {
            foreach (var complexSelector in sheet.complexSelectors)
            {
                if (complexSelector.rule == null)
                {
                    continue;
                }

                var  selectorName = StyleSheetToUss.ToUssSelector(complexSelector);
                Rule aggregateRule;
                if (!Rules.TryGetValue(selectorName, out aggregateRule))
                {
                    aggregateRule = new Rule(selectorName, complexSelector, complexSelector.rule.line);
                    Rules.Add(selectorName, aggregateRule);
                }

                // Override existing properties and append new ones:
                foreach (var property in complexSelector.rule.properties)
                {
                    Property dstProp;
                    if (aggregateRule.Properties.TryGetValue(property.name, out dstProp))
                    {
                        dstProp.Values = ToValues(property, sheet);
                    }
                    else
                    {
                        dstProp = AddProperty(aggregateRule, property, sheet);
                    }
                    if (dstProp.Name.StartsWith("--"))
                    {
                        Variables.Set(dstProp.Name, dstProp);
                    }
                }

                Property derivationProperty;
                if (aggregateRule.Properties.TryGetValue(ConverterUtils.k_Extend, out derivationProperty))
                {
                    var        parentName = derivationProperty.Values[0].AsString();
                    ExtendData derivationData;
                    if (!ParentToChildren.TryGetValue(parentName, out derivationData))
                    {
                        derivationData = new ExtendData(parentName);
                        ParentToChildren.Add(parentName, derivationData);
                    }
                    derivationData.ChildrenRules.Add(aggregateRule);
                    if (!ChildToParent.ContainsKey(aggregateRule.SelectorName))
                    {
                        ChildToParent.Add(aggregateRule.SelectorName, parentName);
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        ///     The calculate extend data.
        /// </summary>
        public override void CalculateExtendData()
        {
            // base.CalculateExtendData();
            ExtendData.Clear();
            DataLength = Convert.ToUInt16(Data.Count + 2);
            var temp = BitConverter.GetBytes(DataLength);

            Array.Reverse(temp);
            ExtendData.AddRange(temp);
            ExtendData.Add((byte)Function);
            ExtendData.Add(0x01);
            ExtendData.AddRange(_data);
        }
Example #4
0
 /// <summary>
 /// Adds an Extend Data object to
 /// the extend data list held by transaction
 /// object.
 /// </summary>
 /// <param name="ExtData">Extend Data object to be added.</param>
 /// <example>
 /// <code lang="C#" escaped="false">
 ///		............
 ///		//Trans is the transaction object.
 ///		............
 ///
 ///		//Create an object of <see cref="PayPal.Payments.DataObjects.ExtendData">ExtendData</see>
 ///		ExtendData ExtData = new ExtendData("PFPRO_PARAM_NAME","Param Value");
 ///
 ///		//Add to Transaction Extend Data list.
 ///		Trans.AddToExtendData(ExtData);
 ///
 /// </code>
 /// <code lang="Visual Basic" escaped="false">
 ///		............
 ///		'Trans is the transaction object.
 ///		............
 ///
 ///		'Create an object of <see cref="PayPal.Payments.DataObjects.ExtendData">ExtendData</see>
 ///		Dim ExtData as ExtendData = new ExtendData("PFPRO_PARAM_NAME","Param Value")
 ///
 ///		'Add to Transaction Extend Data list.
 ///		Trans.AddToExtendData(ExtData)
 ///
 /// </code>
 /// </example>
 public virtual void AddToExtendData(ExtendData ExtData)
 {
     if (mExtData == null)
     {
         mExtData = new ArrayList();
     }
     if (ExtData != null)
     {
         ExtData.Context       = Context;
         ExtData.RequestBuffer = mRequestBuffer;
         mExtData.Add(ExtData);
     }
 }
 /// <summary>
 ///     Adds an Extend Data object to
 ///     the extend data list held by transaction
 ///     object.
 /// </summary>
 /// <param name="extData">Extend Data object to be added.</param>
 /// <example>
 ///     <code lang="C#" escaped="false">
 ///         ............
 ///         //Trans is the transaction object.
 ///         ............
 ///
 ///         //Create an object of <see cref="DataObjects.ExtendData">ExtendData</see>
 ///         ExtendData ExtData = new ExtendData("PFPRO_PARAM_NAME","Param Value");
 ///
 ///         //Add to Transaction Extend Data list.
 ///         Trans.AddToExtendData(ExtData);
 ///
 ///  </code>
 ///     <code lang="Visual Basic" escaped="false">
 ///         ............
 ///         'Trans is the transaction object.
 ///         ............
 ///
 ///         'Create an object of <see cref="DataObjects.ExtendData">ExtendData</see>
 ///         Dim ExtData as ExtendData = new ExtendData("PFPRO_PARAM_NAME","Param Value")
 ///
 ///         'Add to Transaction Extend Data list.
 ///         Trans.AddToExtendData(ExtData)
 ///
 ///  </code>
 /// </example>
 public virtual void AddToExtendData(ExtendData extData)
 {
     if (_mExtData == null)
     {
         _mExtData = new ArrayList();
     }
     if (extData != null)
     {
         extData.Context       = Context;
         extData.RequestBuffer = _mRequestBuffer;
         _mExtData.Add(extData);
     }
 }
Example #6
0
        /// <summary></summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static HardInfo FromExtend(ExtendData data)
        {
            var entity = new HardInfo();

            entity.MachineName  = data["MachineName"];
            entity.BaseBoard    = data["BaseBoard"];
            entity.Processors   = data["Processors"];
            entity.Disk         = data["Disk"];
            entity.DiskSerial   = data["DiskSerial"];
            entity.Volume       = data["Volume"];
            entity.Macs         = data["Macs"];
            entity.IPs          = data["IPs"];
            entity.OSVersion    = data["OSVersion"];
            entity.Memory       = data.GetItem <Int64>("Memory");
            entity.ScreenWidth  = data.GetItem <Int32>("ScreenWidth");
            entity.ScreenHeight = data.GetItem <Int32>("ScreenHeight");
            entity.DiskSize     = data.GetItem <Int64>("DiskSize");

            return(entity);
        }
Example #7
0
        /// <summary></summary>
        /// <returns></returns>
        public ExtendData ToExtend()
        {
            var data = new ExtendData();

            data["MachineName"]  = MachineName;
            data["BaseBoard"]    = BaseBoard;
            data["Processors"]   = Processors;
            data["Disk"]         = Disk;
            data["DiskSerial"]   = DiskSerial;
            data["Volume"]       = Volume;
            data["Macs"]         = Macs;
            data["IPs"]          = IPs;
            data["OSVersion"]    = OSVersion;
            data["Memory"]       = Memory.ToString();
            data["ScreenWidth"]  = ScreenWidth.ToString();
            data["ScreenHeight"] = ScreenHeight.ToString();
            data["DiskSize"]     = DiskSize.ToString();

            return(data);
        }
        private void GetExtendData(string uid, JObject jObject)
        {
            IList <UserExtend> myExtendData = MySqlManager <UserExtend> .Instance.GetMyExtendDataByUid(uid);

            List <ExtendData> extendDatas = new List <ExtendData>();

            foreach (var data in myExtendData)
            {
                UserInfo userInfo = MySqlManager <UserInfo> .Instance.GetByUid(data.Uid);

                ExtendData extendData = new ExtendData()
                {
                    uid         = data.Uid,
                    name        = userInfo.NickName,
                    task1_state = data.task1,
                    task2_state = data.task2
                };
                extendDatas.Add(extendData);
            }
            jObject.Add("myTuiGuangYouLiDataList", JsonConvert.SerializeObject(extendDatas));
        }
Example #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static HardInfo FromExtend(ExtendData data)
        {
            HardInfo entity = new HardInfo();
            entity.MachineName = data["MachineName"];
            entity.BaseBoard = data["BaseBoard"];
            entity.Processors = data["Processors"];
            entity.Disk = data["Disk"];
            entity.DiskSerial = data["DiskSerial"];
            entity.Volume = data["Volume"];
            entity.Macs = data["Macs"];
            entity.IPs = data["IPs"];
            entity.OSVersion = data["OSVersion"];
            entity.Memory = data.GetItem<Int64>("Memory");
            entity.ScreenWidth = data.GetItem<Int32>("ScreenWidth");
            entity.ScreenHeight = data.GetItem<Int32>("ScreenHeight");
            entity.DiskSize = data.GetItem<Int64>("DiskSize");

            return entity;
        }
Example #10
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ExtendData ToExtend()
        {
            ExtendData data = new ExtendData();
            data["MachineName"] = MachineName;
            data["BaseBoard"] = BaseBoard;
            data["Processors"] = Processors;
            data["Disk"] = Disk;
            data["DiskSerial"] = DiskSerial;
            data["Volume"] = Volume;
            data["Macs"] = Macs;
            data["IPs"] = IPs;
            data["OSVersion"] = OSVersion;
            data["Memory"] = Memory.ToString();
            data["ScreenWidth"] = ScreenWidth.ToString();
            data["ScreenHeight"] = ScreenHeight.ToString();
            data["DiskSize"] = DiskSize.ToString();

            return data;
        }
Example #11
0
 /// <summary>
 ///     The calculate extend data.
 /// </summary>
 public override void CalculateExtendData()
 {
     // base.CalculateExtendData();
     ExtendData.Clear();
     ExtendData.Add((byte)Function);
 }
Example #12
0
        public static void Main(string[] Args)
        {
            Console.WriteLine("------------------------------------------------------");
            Console.WriteLine("Executing Sample from File: DOSecureTokenAuth.cs");
            Console.WriteLine("------------------------------------------------------");

            // Create the Data Objects.
            // Create the User data object with the required user details.
            // UserInfo User = new UserInfo("<user>", "<vendor>", "<partner>", "<password>");


            // Create the Payflow  Connection data object with the required connection details.
            PayflowConnectionData Connection = new PayflowConnectionData();

            // Create a new Invoice data object with the Amount, Billing Address etc. details.
            Invoice Inv = new Invoice();

            // Set Amount.  The amount cannot be changed once submitted.
            Currency Amt = new Currency(new decimal(25.00), "USD");

            Inv.Amt    = Amt;
            Inv.InvNum = "INV12345";

            // Set the Billing Address details.  You can also send the shipping information.  Both the Billing
            // and Shipping information can be changed if the functionality is allowed in the Configuration section
            // of Manager.  No other information submitted using a secure token call can be changed.
            BillTo Bill = new BillTo();

            Bill.BillToFirstName = "Sam";
            Bill.BillToLastName  = "Smith";
            Bill.BillToStreet    = "123 Main St.";
            Bill.BillToCity      = "Anytown";
            Bill.BillToState     = "CA";
            Bill.BillToZip       = "12345";
            Bill.BillToPhone     = "408-123-1234";
            Bill.BillToEmail     = "*****@*****.**";
            Bill.BillToCountry   = "124";
            Inv.BillTo           = Bill;

            // Create a new Payment Device - Credit Card data object.
            // The input parameters are Credit Card Number and Expiration Date of the Credit Card.
            //CreditCard CC = new CreditCard("5105105105105100", "0110");
            //CC.Cvv2 = "023";

            // Create a new Tender - Card Tender data object.
            //CardTender Card = new CardTender(CC);
            ///////////////////////////////////////////////////////////////////

            // Since we are using the hosted payment pages, you will not be sending the credit card data with the
            // Secure Token Request.  You just send all other 'sensitive' data within this request and when you
            // call the hosted payment pages, you'll only need to pass the SECURETOKEN; which is generated and returned
            // and the SECURETOKENID that was created and used in the request.
            //
            // Create a new Secure Token Authorization Transaction.  Even though this example is performing
            // an authorization, you can create a secure token using SaleTransaction too.  Only Authorization and Sale
            // type transactions are permitted.
            //
            // Remember, all data submitted as part of the Secure Token call cannot be modified at a later time.  The only exception
            // is the billing and shipping information if these items are selection in the Setup section in PayPal Manager.
            AuthorizationTransaction Trans = new AuthorizationTransaction(User, Connection, Inv, null, PayflowUtility.RequestId);

            // Set VERBOSITY to High
            Trans.Verbosity = "High";

            // Set the flag to create a Secure Token.
            Trans.CreateSecureToken = "Y";
            // The Secure Token Id must be a unique id up to 36 characters.  Using the RequestID object to
            // generate a random id, but any means to create an id can be used.
            Trans.SecureTokenId = PayflowUtility.RequestId;

            // Set the extended data value.
            ExtendData ExtData = new ExtendData("SILENTTRAN", "True");

            // Add extended data to transaction.
            Trans.AddToExtendData(ExtData);

            // IMPORTANT NOTE:
            //
            // Remember, the Secure Token can only be used once.  Once it is redeemed by a valid transaction it cannot be used again and you will
            // need to generate a new token.  Also, the token has a life time of 30 minutes.

            // Submit the Transaction
            Response Resp = Trans.SubmitTransaction();

            // Display the transaction response parameters.
            if (Resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse TrxnResponse = Resp.TransactionResponse;

                if (TrxnResponse != null)
                {
                    Console.WriteLine("RESULT = " + TrxnResponse.Result);
                    Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg);
                    Console.WriteLine("SECURETOKEN = " + TrxnResponse.SecureToken);
                    Console.WriteLine("SECURETOKENID = " + TrxnResponse.SecureTokenId);
                    // If value is true, then the Request ID has not been changed and the original response
                    // of the original transction is returned.
                    Console.WriteLine("DUPLICATE = " + TrxnResponse.Duplicate);
                }

                if (TrxnResponse.Result == 0)
                {
                    Console.WriteLine(Environment.NewLine + "Transaction was successful.");
                    Console.WriteLine(Environment.NewLine + "The next step would be to redirect to PayPal to display the hosted");
                    Console.WriteLine("checkout page to allow your customer to select and enter payment.");
                    Console.WriteLine(Environment.NewLine + "This is only a simple example, which does not take into account things like");
                    Console.WriteLine(Environment.NewLine + "RETURN or SILENT POST URL, etc.");
                    Console.WriteLine(Environment.NewLine + "Press <Enter> to redirect to PayPal.");
                    Console.ReadLine();
                    // Simple way to pass token data to Payflow Link Servers.
                    String PayPalUrl = "https://payflowlink.paypal.com?securetoken=" + TrxnResponse.SecureToken + "&securetokenid=" + TrxnResponse.SecureTokenId + "&MODE=test&USER1=testuser1&ACCT=5105105105105100&EXPDATE=1212&CVV2=123";
                    //Process.Start(PayPalUrl);  // Open default browser.
                    Process.Start("iexplore.exe", PayPalUrl);
                    //Process.Start("C:\\Program Files\\Mozilla Firefox\\firefox.exe", PayPalUrl);
                }

                // Display the response.
                Console.WriteLine(Environment.NewLine + PayflowUtility.GetStatus(Resp));

                // Get the Transaction Context and check for any contained SDK specific errors (optional code).
                Context TransCtx = Resp.TransactionContext;
                if (TransCtx != null && TransCtx.getErrorCount() > 0)
                {
                    Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString());
                }
            }
            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();
        }
Example #13
0
        public static void Main(string[] Args)
        {
            Console.WriteLine("------------------------------------------------------");
            Console.WriteLine("Executing Sample from File: DOAuth.cs");
            Console.WriteLine("------------------------------------------------------");

            // Create the Data Objects.
            // Create the User data object with the required user details.
            UserInfo User = new UserInfo("<user>", "<vendor>", "<partner>", "<password>");

            // Create the Payflow  Connection data object with the required connection details.
            // The PAYFLOW_HOST property is defined in the App config file.
            PayflowConnectionData Connection = new PayflowConnectionData();

            // Create a new Invoice data object with the Amount, Billing Address etc. details.
            Invoice Inv = new Invoice();

            // Set Amount.
            Currency Amt = new Currency(new decimal(10.00));

            Inv.Amt    = Amt;
            Inv.PoNum  = "PO12345";
            Inv.InvNum = "INV123415";

            // Set the Billing Address details.
            BillTo Bill = new BillTo();

            Bill.BillToFirstName = "Sam";
            Bill.BillToLastName  = "Smith";
            Bill.BillToStreet    = "123 Main St.";
            Bill.BillToZip       = "12345";
            Inv.BillTo           = Bill;

            // Create a new Payment Device - Credit Card data object.
            // The input parameters are Credit Card Number and Expiration Date of the Credit Card.
            CreditCard CC = new CreditCard("5105105105105100", "0125");

            CC.Cvv2 = "123";

            // Create a new Tender - Card Tender data object.
            CardTender Card = new CardTender(CC);

            // Create a new Auth Transaction.
            AuthorizationTransaction Trans = new AuthorizationTransaction(User, Connection, Inv, Card, PayflowUtility.RequestId);

            // Set the transaction verbosity to HIGH to display most details.
            Trans.Verbosity = "HIGH";
            Trans.AddTransHeader("PAYPAL-NVP", "Y");

            // Set the extended data value.
            ExtendData ExtData = new ExtendData("VERSION", "214.0");

            // Add extended data to transaction.
            Trans.AddToExtendData(ExtData);

            // Submit the Transaction
            Response Resp = Trans.SubmitTransaction();

            // Display the transaction response parameters.
            if (Resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse TrxnResponse = Resp.TransactionResponse;

                if (TrxnResponse != null)
                {
                    Console.WriteLine("RESULT = " + TrxnResponse.Result);
                    Console.WriteLine("PNREF = " + TrxnResponse.Pnref);
                    Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg);
                    Console.WriteLine("AUTHCODE = " + TrxnResponse.AuthCode);
                    Console.WriteLine("AVSADDR = " + TrxnResponse.AVSAddr);
                    Console.WriteLine("AVSZIP = " + TrxnResponse.AVSZip);
                    Console.WriteLine("IAVS = " + TrxnResponse.IAVS);
                    Console.WriteLine("CVV2MATCH = " + TrxnResponse.CVV2Match);
                    // If value is true, then the Request ID has not been changed and the original response
                    // of the original transaction is returned.
                    Console.WriteLine("DUPLICATE = " + TrxnResponse.Duplicate);
                }

                // Get the Fraud Response parameters.
                FraudResponse FraudResp = Resp.FraudResponse;

                // Display Fraud Response parameter
                if (FraudResp != null)
                {
                    Console.WriteLine("PREFPSMSG = " + FraudResp.PreFpsMsg);
                    Console.WriteLine("POSTFPSMSG = " + FraudResp.PostFpsMsg);
                }

                // Display the response.
                Console.WriteLine(Environment.NewLine + PayflowUtility.GetStatus(Resp));

                // Get the Transaction Context and check for any contained SDK specific errors (optional code).
                Context TransCtx = Resp.TransactionContext;
                if (TransCtx != null && TransCtx.getErrorCount() > 0)
                {
                    Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString());
                }
            }

            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();
        }
Example #14
0
 /// <summary>
 /// 提交报名信息
 /// </summary>
 /// <param name="apply"></param>
 public static void SubmitApply(ApplyInfo apply)
 {
     ExtendData.SubmitApply(apply);
 }
Example #15
0
 /// <summary>
 /// 获取符合条件的前N条广告信息
 /// </summary>
 /// <param name="appChannel">应用渠道标识码</param>
 /// <param name="schoolId">学校编号</param>
 /// <param name="topCount">获取的最大广告数量</param>
 /// <returns>符合条件的前N条广告信息</returns>
 public static IEnumerable <AdvertDetail> GetTopAdverts(string appChannel, int schoolId, int topCount)
 {
     return(ExtendData.GetTopAdverts(appChannel, schoolId, topCount));
 }