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); } } } }