예제 #1
0
 public EndPoint(ushort port, string[] ips)
 {
     foreach (var ip in ips)
     {
         Address.Add(new Addr(ip));
     }
     Port = port;
 }
예제 #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            Address adr = new Address();

            adr.Add();

            adr.full_address = Guid.NewGuid().ToString();
            adr.Save();
            adr = null;
        }
 public void SetValue(string key, string value)
 {
     if (Address.ContainsKey(key))
     {
         Address[key] = value;
     }
     else
     {
         Address.Add(key, value);
     }
 }
예제 #4
0
        public void SetAddress(Language lang, string value)
        {
            if (Address == null)
            {
                Address = new List <Text>();
            }

            var existing = Address.FirstOrDefault(a => a.Language == lang);

            if (existing == null)
            {
                existing = new Text {
                    Language = lang
                };
                Address.Add(existing);
            }

            existing.Value = value;
        }
예제 #5
0
    public bool isinaddress(string an, string ar)
    {
        int ok = 0;

        for (int i = 0; i < AddName.Count; i++)
        {
            if (AddName[i] == an && Address[i] == ar)
            {
                ok = 1;
            }
        }
        if (ok == 0)
        {
            Address.Add(ar);
            AddName.Add(an);
            return(true);
        }
        return(false);
    }
예제 #6
0
        }                                   //字段


        public MasterTable()
        {
            this.Address = new Dictionary <string, string[]>();
            Address.Add("SysDatabase", new[] { Lib.DirectoryUtil.GetCurrentDirectory() + "\\tdb\\SysDatabase.ydbc" });
            //表实体备份地址
            this.BakAddress         = new[] { Lib.DirectoryUtil.GetCurrentDirectory() + "\\bak\\SysDatabase.ybak" };
            this.IsBak              = true;
            this.LastUpdateSumCount = 0;
            this.LastRollbackCount  = 0;
            this.Owner              = new[] { "sys", "admin", "jyf" };
            this.Rollback           = true;
            this.RollbackCount      = 1000;
            this.Speediness         = true;
            this.TableCount         = 1000;
            this.User = new string[] { "jyf=rw", "admin=rw", "sys=rw" };
            var triggerMo = new Trigger();

            this.LastUpdateCount = new int[] { 0 };

            //triggerMo.BehaviorTrigger.Add(EnumArrayYsql.BehaviorTrigger.Inster, "delete:none");
            //this.Trigger.Add(EnumArrayYsql.Trigger.BehaviorTrigger, triggerMo);
        }
예제 #7
0
파일: Redis.cs 프로젝트: zyj0021/DBAcessSrv
        public void Init()
        {
            StringBuilder builder    = new StringBuilder();
            List <string> lstConnect = new List <string>();

            if (Address == null)
            {
                Address = new List <string>();
            }
            if (Address.Count == 0)
            {
                Address.Add("127.0.0.1:6379");
            }
            foreach (string addr in Address)
            {
                builder.Clear();
                builder.AppendFormat("{0},password={1},defaultDatabase=0,poolsize={2},preheat=true,ssl={3},writeBuffer=10240,prefix={4}", addr, Password, PoolSize, IsSSL, Prefix);
                lstConnect.Add(builder.ToString());
            }
            var csredis = new CSRedis.CSRedisClient(null, lstConnect.ToArray());

            RedisHelper.Initialization(csredis, null, null);
        }
예제 #8
0
 private static void ProcessSubscriber(OrderFlowInfo orderFlowInfo, UserInfo userInfo)
 {
     if (!userInfo.IsNull)
     {
         ClientInfo    clientInfo    = new ClientInfo();
         CompanyInfo   companyInfo   = new CompanyInfo();
         ContacterInfo contacterInfo = new ContacterInfo();
         if ((userInfo.UserId > 0) && (userInfo.ClientId == 0))
         {
             if (userInfo.UserType > UserType.Persional)
             {
                 companyInfo = Company.GetCompayById(userInfo.CompanyId);
                 if (!companyInfo.IsNull)
                 {
                     string companyName = companyInfo.CompanyName;
                     companyName            = string.IsNullOrEmpty(companyName) ? string.Empty : companyName;
                     clientInfo.ClientName  = companyInfo.CompanyName;
                     clientInfo.ShortedForm = companyInfo.CompanyName.Substring(0, 6);
                     clientInfo.ClientType  = 0;
                 }
             }
             else
             {
                 clientInfo.ClientName  = orderFlowInfo.ConsigneeName;
                 clientInfo.ShortedForm = orderFlowInfo.ConsigneeName;
                 clientInfo.ClientType  = 1;
             }
             clientInfo.ClientId        = companyInfo.ClientId = userInfo.ClientId = Client.GetMaxId() + 1;
             clientInfo.ClientNum       = Client.GetClientNum();
             clientInfo.Area            = -1;
             clientInfo.ClientField     = -1;
             clientInfo.ValueLevel      = -1;
             clientInfo.CreditLevel     = -1;
             clientInfo.Importance      = -1;
             clientInfo.ConnectionLevel = -1;
             clientInfo.SourceType      = -1;
             clientInfo.PhaseType       = -1;
             clientInfo.UpdateTime      = clientInfo.CreateTime = DateTime.Now;
             Client.Add(clientInfo);
             userInfo.ClientId = clientInfo.ClientId;
             Users.Update(userInfo);
             Company.Update(companyInfo);
             Contacter.UpdateClientForSameCompany(clientInfo.ClientId, userInfo.CompanyId);
         }
         if (userInfo.UserId > 0)
         {
             StringBuilder builder = new StringBuilder();
             if (orderFlowInfo.Country != "中华人民共和国")
             {
                 builder.Append(orderFlowInfo.Country);
             }
             builder.Append(orderFlowInfo.Province);
             builder.Append(orderFlowInfo.City);
             builder.Append(orderFlowInfo.Area);
             builder.Append(orderFlowInfo.Address);
             if (!Contacter.Exists(userInfo.UserName))
             {
                 contacterInfo.ContacterId = Contacter.GetMaxId() + 1;
                 contacterInfo.UserName    = userInfo.UserName;
                 contacterInfo.ClientId    = userInfo.ClientId;
                 contacterInfo.CreateTime  = contacterInfo.UpdateTime = DateTime.Now;
                 contacterInfo.TrueName    = orderFlowInfo.ConsigneeName;
                 contacterInfo.ZipCode     = orderFlowInfo.ZipCode;
                 contacterInfo.Address     = builder.ToString();
                 contacterInfo.Mobile      = orderFlowInfo.Mobile;
                 contacterInfo.OfficePhone = contacterInfo.HomePhone = orderFlowInfo.HomePhone;
                 contacterInfo.Email       = orderFlowInfo.Email;
                 contacterInfo.Education   = -1;
                 contacterInfo.Income      = -1;
                 contacterInfo.Sex         = UserSexType.Secrecy;
                 contacterInfo.Marriage    = UserMarriageType.Secrecy;
                 contacterInfo.Country     = orderFlowInfo.Country;
                 contacterInfo.Province    = orderFlowInfo.Province;
                 contacterInfo.City        = orderFlowInfo.City;
                 Contacter.Add(contacterInfo);
             }
             else
             {
                 contacterInfo = Contacter.GetContacterByUserName(userInfo.UserName);
                 if (!contacterInfo.IsNull)
                 {
                     if (contacterInfo.ClientId <= 0)
                     {
                         contacterInfo.ClientId = userInfo.ClientId;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.TrueName))
                     {
                         contacterInfo.TrueName = orderFlowInfo.ConsigneeName;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.ZipCode))
                     {
                         contacterInfo.ZipCode = orderFlowInfo.ZipCode;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.Address))
                     {
                         contacterInfo.Address = builder.ToString();
                     }
                     if (string.IsNullOrEmpty(contacterInfo.Mobile))
                     {
                         contacterInfo.Mobile = orderFlowInfo.Mobile;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.HomePhone))
                     {
                         contacterInfo.HomePhone = orderFlowInfo.HomePhone;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.Email))
                     {
                         contacterInfo.Email = orderFlowInfo.Email;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.Country))
                     {
                         contacterInfo.Country = orderFlowInfo.Country;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.Province))
                     {
                         contacterInfo.Province = orderFlowInfo.Province;
                     }
                     if (string.IsNullOrEmpty(contacterInfo.City))
                     {
                         contacterInfo.City = orderFlowInfo.City;
                     }
                     Contacter.Update(contacterInfo);
                 }
             }
             AddressInfo defaultAddressByUserName = Address.GetDefaultAddressByUserName(userInfo.UserName);
             if (defaultAddressByUserName.IsNull)
             {
                 defaultAddressByUserName.UserName      = userInfo.UserName;
                 defaultAddressByUserName.Address       = orderFlowInfo.Address;
                 defaultAddressByUserName.Area          = orderFlowInfo.Area;
                 defaultAddressByUserName.City          = orderFlowInfo.City;
                 defaultAddressByUserName.ConsigneeName = orderFlowInfo.ConsigneeName;
                 defaultAddressByUserName.Country       = orderFlowInfo.Country;
                 defaultAddressByUserName.Province      = orderFlowInfo.Province;
                 defaultAddressByUserName.HomePhone     = orderFlowInfo.HomePhone;
                 defaultAddressByUserName.Mobile        = orderFlowInfo.Mobile;
                 defaultAddressByUserName.ZipCode       = orderFlowInfo.ZipCode;
                 defaultAddressByUserName.IsDefault     = true;
                 Address.Add(defaultAddressByUserName);
             }
         }
     }
 }
예제 #9
0
        private void Translate(QuadrupleNode Node, int Index)
        {
            Node.Start = Programs.Count;
            int typeV = Convert.ToInt32(Node.Type);

            if (typeV <= IsJump)
            {
                TranslateJump(Node);
                return;
            }
            switch (Node.Type)
            {
            case QuadrupleType.Return:
                Add(new PNode(PCode.EXP));
                Address.Add(Index + 1, Programs.Count);
                break;

            case QuadrupleType.Call:
                int a = 1;
                if (Address.ContainsKey((int)Node.Result))
                {
                    a = Address[(int)Node.Result];
                }
                Add(new PNode(PCode.CAL, a, 4));
                break;

            case QuadrupleType.Add:
            case QuadrupleType.Sub:
            case QuadrupleType.Mul:
            case QuadrupleType.Div:
                TranslateOpr(Node);
                break;

            case QuadrupleType.Assign:
                if (Node.Arg2 is int)
                {
                    var node = new PNode(PCode.LOD, (int)Node.Arg2, 2);
                    Add(node);
                }
                else if (Node.Arg2 is string)
                {
                    int arg = int.Parse(((string)Node.Arg2).Substring(1));
                    Add(new PNode(PCode.LIT, arg, 1));
                }
                else
                {
                    Add(new PNode(PCode.LOD, ((QuadrupleNode)(Node.Arg2)).Offset, 3)
                    {
                        Offset = ((QuadrupleNode)(Node.Arg2)).AddressOffset, Level = ((QuadrupleNode)(Node.Arg2)).Level
                    });
                }
                var qnode = (QuadrupleNode)(Node.Arg1);
                Add(new PNode(PCode.STO, qnode.Offset, 3)
                {
                    Offset = qnode.AddressOffset, Level = qnode.Level
                });
                break;

            case QuadrupleType.Write:
                var list = Node.Arg1 as ArrayList;
                foreach (var i in list)
                {
                    if (i is string)
                    {
                        Add(new PNode(PCode.LIT, Convert.ToInt32(((string)i).Substring(1)), 1));
                        Add(new PNode(PCode.WRT));
                        continue;
                    }
                    var param = i as QuadrupleNode;
                    Add(new PNode(PCode.LOD, param.Offset, 3)
                    {
                        Offset = param.AddressOffset, Level = param.Level
                    });
                    Add(new PNode(PCode.WRT));
                }
                break;

            case QuadrupleType.Read:
                list = Node.Arg1 as ArrayList;
                foreach (var i in list)
                {
                    var param = i as QuadrupleNode;
                    Add(new PNode(PCode.RED, param.Offset, 3)
                    {
                        Offset = param.AddressOffset, Level = param.Level
                    });
                }
                break;
            }
        }
예제 #10
0
        public override bool initiatePayment()
        {
            LogRequest("initiatePayment", "start");
            Errors.Clear();

            var BCResponse = new BankcardTransactionResponse();

            if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
            {
                BCResponse = GetCreditCardTokenID(PaymentData["Number"].ToString(),
                                                  ((DateTime) PaymentData["ExpDate"]).ToString("MMyy"),
                                                  (int) ((PayCrediCard) PaymentData).Type);
                PaymentData["TokenID"] = BCResponse.PaymentAccountDataToken;

                if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
                {
                    Errors.Add(1, "Unable to generate a valid payment account data token");
                    return false;
                }
            }

            var PayingInvoiceID = (int) PaymentData["InvoiceID"];
            var userHostAddress = (string) PaymentData["UserHostAddress"];
            var sessionID = (string) PaymentData["SessionID"];
            var Amount = (decimal) PaymentData["Amount"];
            var AddressLine1 = (string) PaymentData["AddressLine1"];
            var AddressLine2 = (string) PaymentData["AddressLine2"];
            var PostCode = (string) PaymentData["PostalCode"];
            var Town = (string) PaymentData["Town"];
            var Country = (string) PaymentData["Country"];

            var DB = new DataClassesDataContext();
            var billingAddress = new Address();

            billingAddress.add_AddressLine1 = AddressLine1;
            billingAddress.add_AddressLine2 = AddressLine2;
            billingAddress.add_DateModified = DateTime.Now;
            billingAddress.add_IsDeleted = false;
            billingAddress.add_PostalCode = PostCode;
            billingAddress.add_Town = Town;
            billingAddress.add_Country = Country;
            billingAddress.Add(DB);

            var cc = new CreditCard();
            cc.cca_AddressID = billingAddress.add_ID;
            cc.cca_CardNumber = BCResponse.MaskedPAN;
            cc.cca_IsDeleted = false;
            cc.cca_IsActive = true;
            cc.cca_Ref = (string) PaymentData["TransactionID"];
            cc.cca_Is3DS = false;
            cc.cca_ExpirationDate = ((PayCrediCard) PaymentData).ExpirationDate;
            cc.cca_DateModified = DateTime.Now;
            cc.cca_NameOnCard = ((PayCrediCard) PaymentData).HolderName;
            cc.cca_IssueNumber = ((PayCrediCard) PaymentData).IssueNumber;
            cc.CVV = ((PayCrediCard) PaymentData).CVV;
            cc.cca_CardType = (short) ((PayCrediCard) PaymentData).Type;
            cc.cca_IPCTokenID = (string) PaymentData["TokenID"];
            cc.Add(DB);

            var payment = new Payment();
            payment.pay_CreditCardID = cc.cca_ID;
            payment.pay_IsPaidByService = false;
            payment.pay_TypeID = (int) PaymentTypeEnum.CreditCard;
            payment.pay_StatusID = (int) PaymentStatusEnum.Initiated;
            payment.pay_InvoiceID = PayingInvoiceID;
            payment.pay_UserID = null; //logged user
            payment.pay_DateModified = DateTime.Now;
            payment.pay_DatePaid = DateTime.Now;
            payment.pay_IP = userHostAddress;
            payment.pay_Amount = Amount;
            payment.pay_UserID = null;
            payment.pay_Email = PaymentData["Email"].ToString();
            ;
            payment.pay_UsedPP = Convert.ToInt32(PaymentProcessorEnum.IPCommerce);
            payment.pay_InternalRefID = (string) PaymentData["TransactionID"];
            payment.pay_ExternalRefID = BCResponse.TransactionId;
            payment.CreditCard = cc;
            payment.Add(DB, userHostAddress, sessionID);

            PaymentData["PaymentID"] = payment.pay_ID;
            PaymentData["TransactionID"] = "PID_" + PaymentData["PaymentID"].ToString().PadLeft(7, '0');

            return Errors.Count == 0;
        }