예제 #1
0
        protected void BtnRegister_Click(object sender, EventArgs e)
        {
            int num = DataConverter.CLng(this.ClientSelect.DataKey);

            if (num == 0)
            {
                AdminPage.WriteErrMsg("<li>请选择要加入的企业客户</li>");
            }
            UserInfo userInfo = this.ViewState["UserInfo"] as UserInfo;

            if (string.IsNullOrEmpty(userInfo.UserTrueName))
            {
                AdminPage.WriteErrMsg("<li>请在修改用户界面中输入会员的真实姓名</li>", "User.aspx?Action=Modify&UserID=" + userInfo.UserId);
            }
            if (userInfo != null)
            {
                userInfo.ClientId = num;
                Users.Update(userInfo);
            }
            ContacterInfo contacterInfo = this.ViewState["ContacterInfo"] as ContacterInfo;

            if (contacterInfo != null)
            {
                contacterInfo.ClientId = num;
                contacterInfo.UserType = ContacterType.EnterpriceMainContacter;
                Contacter.Update(contacterInfo);
            }
            AdminPage.WriteSuccessMsg("成功将会员“" + userInfo.UserName + "”升级为企业客户联系人!", "UserShow.aspx?UserID=" + userInfo.UserId.ToString());
        }
예제 #2
0
 private static bool SaveContacter(ContacterInfo contacterInfo)
 {
     if (Contacter.Exists(contacterInfo.UserName))
     {
         return(Contacter.Update(contacterInfo));
     }
     return(Contacter.Add(contacterInfo));
 }
예제 #3
0
 protected void BtnSave_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         ClientInfo clientInfo = new ClientInfo();
         clientInfo.ClientId        = Client.GetMaxId() + 1;
         clientInfo.ClientNum       = this.TxtClientNum.Text.Trim();
         clientInfo.ShortedForm     = this.TxtShortedForm.Text.Trim();
         clientInfo.Area            = DataConverter.CLng(this.DropArea.SelectedValue);
         clientInfo.ClientField     = DataConverter.CLng(this.DropClientField.SelectedValue);
         clientInfo.ValueLevel      = DataConverter.CLng(this.DropValueLevel.SelectedValue);
         clientInfo.CreditLevel     = DataConverter.CLng(this.DropCreditLevel.SelectedValue);
         clientInfo.Importance      = DataConverter.CLng(this.DropImportance.SelectedValue);
         clientInfo.ConnectionLevel = DataConverter.CLng(this.DropConnectionLevel.SelectedValue);
         clientInfo.SourceType      = DataConverter.CLng(this.DropSourceType.SelectedValue);
         clientInfo.GroupId         = DataConverter.CLng(this.DropGroupID.SelectedValue);
         clientInfo.PhaseType       = DataConverter.CLng(this.DropPhaseType.SelectedValue);
         if (string.IsNullOrEmpty(this.HdnClientName.Value))
         {
             clientInfo.ClientName = clientInfo.ShortedForm;
         }
         else
         {
             clientInfo.ClientName = this.HdnClientName.Value;
         }
         clientInfo.ClientType = DataConverter.CLng(this.HdnClientType.Value);
         clientInfo.UpdateTime = DateTime.Now;
         clientInfo.CreateTime = DateTime.Now;
         clientInfo.Owner      = PEContext.Current.Admin.AdminName;
         if (Client.Add(clientInfo))
         {
             UserInfo userInfo = this.ViewState["UserInfo"] as UserInfo;
             if (userInfo != null)
             {
                 userInfo.ClientId = clientInfo.ClientId;
                 Users.Update(userInfo);
             }
             ContacterInfo contacterInfo = this.ViewState["ContacterInfo"] as ContacterInfo;
             if (contacterInfo != null)
             {
                 contacterInfo.ClientId = clientInfo.ClientId;
                 Contacter.Update(contacterInfo);
             }
             CompanyInfo companyInfo = this.ViewState["CompanyInfo"] as CompanyInfo;
             if (companyInfo != null)
             {
                 companyInfo.ClientId = clientInfo.ClientId;
                 Company.Update(companyInfo);
             }
             AdminPage.WriteSuccessMsg("成功将会员“" + userInfo.UserName + "”升级为客户!", "UserShow.aspx?UserID=" + userInfo.UserId.ToString());
         }
         else
         {
             AdminPage.WriteErrMsg("升级不成功!");
         }
     }
 }
예제 #4
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);
             }
         }
     }
 }