public static BaseAreaEntity GetObject(BaseUserInfo userInfo, string id) { BaseAreaEntity result = null; string url = BaseSystemInfo.UserCenterHost + "/UserCenterV42/AreaService.ashx"; WebClient webClient = new WebClient(); NameValueCollection postValues = new NameValueCollection(); postValues.Add("system", BaseSystemInfo.SoftFullName); postValues.Add("systemCode", BaseSystemInfo.SystemCode); postValues.Add("securityKey", BaseSystemInfo.SecurityKey); // 2015-11-25 吉日嘎拉,这里还是从缓存里获取就可以了,提高登录的效率。 postValues.Add("function", "GetObject"); postValues.Add("userInfo", userInfo.Serialize()); postValues.Add("encrypted", true.ToString()); postValues.Add("id", SecretUtil.Encrypt(id)); // 向服务器发送POST数据 byte[] responseArray = webClient.UploadValues(url, postValues); string response = Encoding.UTF8.GetString(responseArray); if (!string.IsNullOrEmpty(response)) { result = JsonConvert.DeserializeObject <BaseAreaEntity>(response); } return(result); }
public static BaseRoleEntity GetObject(BaseUserInfo userInfo, string systemCode, string id) { BaseRoleEntity result = null; string url = BaseSystemInfo.UserCenterHost + "/UserCenterV42/RoleService.ashx"; WebClient webClient = new WebClient(); NameValueCollection postValues = new NameValueCollection(); postValues.Add("system", BaseSystemInfo.SoftFullName); postValues.Add("systemCode", systemCode); postValues.Add("securityKey", BaseSystemInfo.SecurityKey); postValues.Add("function", "GetObject"); postValues.Add("userInfo", userInfo.Serialize()); postValues.Add("encrypted", true.ToString()); postValues.Add("id", SecretUtil.Encrypt(id)); // 向服务器发送POST数据 byte[] responseArray = webClient.UploadValues(url, postValues); string response = Encoding.UTF8.GetString(responseArray); if (!string.IsNullOrEmpty(response)) { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); result = javaScriptSerializer.Deserialize <BaseRoleEntity>(response); } return(result); }
/// <summary> /// 将登录信息保存到XML文件中。 /// 若不保存用户名密码,那就应该删除掉。 /// </summary> /// <param name="userInfo">登录用户</param> private void SaveLogOnInfo(BaseUserInfo userInfo) { BaseSystemInfo.RememberPassword = this.chkRememberPassword.Checked; if (this.chkRememberPassword.Checked) { BaseSystemInfo.CurrentUserName = userInfo.UserName; // BaseSystemInfo.CurrentUserName = SecretUtil.Encrypt(userInfo.UserName); BaseSystemInfo.CurrentPassword = SecretUtil.Encrypt(this.txtPassword.Text); } else { BaseSystemInfo.CurrentUserName = string.Empty; BaseSystemInfo.CurrentPassword = string.Empty; } // 保存用户的信息 UserConfigHelper.SaveConfig(); /* * // 写入注册表,有时候会没有权限,发生异常信息等,可以考虑写入XML文件 * RegistryKey registryKey = Registry.LocalMachine.CreateSubKey(@"Software\" + BaseConfiguration.COMPANY_NAME + "\\" + BaseSystemInfo.SoftName); * if (this.chkRememberPassword.Checked) * { * // 默认的信息写入注册表,呵呵需要改进一下 * registryKey.SetValue(BaseConfiguration.CURRENT_USERNAME, SecretUtil.Encrypt(userInfo.UserName)); * registryKey.SetValue(BaseConfiguration.CURRENT_PASSWORD, SecretUtil.Encrypt(this.txtPassword.Text)); * } * else * { * registryKey.SetValue(BaseConfiguration.CURRENT_USERNAME, string.Empty); * registryKey.SetValue(BaseConfiguration.CURRENT_PASSWORD, string.Empty); * } */ }
/// <summary> /// 保存商家ID实体序列化加密字符串到本地数据库 /// </summary> void AddElecCustomerInfo() { if (!string.IsNullOrEmpty(txtCustomerID.Text) && !string.IsNullOrEmpty(txtCustomerPassword.Text)) { ZtoElecUserInfoEntity elecUserInfoEntity = new ZtoElecUserInfoEntity(); elecUserInfoEntity.Kehuid = txtCustomerID.Text.Replace(" ", ""); elecUserInfoEntity.Pwd = txtCustomerPassword.Text.Replace(" ", ""); elecUserInfoEntity.Phone = string.IsNullOrEmpty(txtMobile.Text.Trim()) ? txtTelePhone.Text : txtMobile.Text; var areaArray = dgvSearchSendArea.Text.Split('-'); if (areaArray.Length > 0 && areaArray.Length == 3) { elecUserInfoEntity.Province = areaArray[0]; elecUserInfoEntity.City = areaArray[1]; elecUserInfoEntity.Area = areaArray[2]; } elecUserInfoEntity.Result = "false"; elecUserInfoEntity.InterfaceType = "0"; string encryInfo = JsonConvert.SerializeObject(elecUserInfoEntity); BillPrintHelper.SetZtoCustomerInfo(SecretUtil.Encrypt(encryInfo, BaseSystemInfo.SecurityKey)); } else { BillPrintHelper.DeleteElecUserInfoEntity(); } }
public static BaseDepartmentEntity GetObjectByName(BaseUserInfo userInfo, string companyId, string fullName) { BaseDepartmentEntity result = null; string url = BaseSystemInfo.UserCenterHost + "/UserCenterV42/DepartmentService.ashx"; WebClient webClient = new WebClient(); NameValueCollection postValues = new NameValueCollection(); postValues.Add("system", BaseSystemInfo.SoftFullName); postValues.Add("systemCode", BaseSystemInfo.SystemCode); postValues.Add("securityKey", BaseSystemInfo.SecurityKey); postValues.Add("function", "GetObjectByName"); postValues.Add("userInfo", userInfo.Serialize()); postValues.Add("encrypted", true.ToString()); postValues.Add("companyId", SecretUtil.Encrypt(companyId)); postValues.Add("fullName", SecretUtil.Encrypt(fullName)); // 向服务器发送POST数据 byte[] responseArray = webClient.UploadValues(url, postValues); string response = Encoding.UTF8.GetString(responseArray); if (!string.IsNullOrEmpty(response)) { result = JsonConvert.DeserializeObject <BaseDepartmentEntity>(response); } return(result); }
/// <summary> /// 保存系统设置 /// </summary> private void SaveConfigInfo() { // 是否加密先保存好 BaseSystemInfo.ClientEncryptPassword = this.chkClientEncryptPassword.Checked; BaseSystemInfo.CurrentUserName = this.txtUser.Text; BaseSystemInfo.CurrentPassword = this.txtClientPassword.Text; if (BaseSystemInfo.ClientEncryptPassword) { BaseSystemInfo.CurrentPassword = SecretUtil.Encrypt(this.txtClientPassword.Text); } if (!string.IsNullOrEmpty(this.cmbCurrentLanguage.Text)) { BaseSystemInfo.CurrentLanguage = this.cmbCurrentLanguage.SelectedItem.ToString(); } BaseSystemInfo.RememberPassword = this.chkRememberPassword.Checked; BaseSystemInfo.AutoLogOn = this.chbAutoLogOn.Checked; BaseSystemInfo.UseMessage = this.chkUseMessage.Checked; BaseSystemInfo.Service = this.cmbService.SelectedItem.ToString(); BaseSystemInfo.MainForm = txtMainForm.Text; BaseSystemInfo.LogOnForm = this.txtLogOnForm.Text; BaseSystemInfo.RecordLog = this.chkRecordLog.Checked; BaseSystemInfo.AllowUserRegister = this.chkAllowUserRegister.Checked; BaseSystemInfo.UseUserPermission = this.chkUseUserPermission.Checked; BaseSystemInfo.UseOrganizePermission = this.chkUseOrganizePermission.Checked; BaseSystemInfo.UseModulePermission = this.chkUseModulePermission.Checked; BaseSystemInfo.UsePermissionScope = this.chkUsePermissionScope.Checked; BaseSystemInfo.UseAuthorizationScope = this.chkUseAuthorizationScope.Checked; BaseSystemInfo.UseTableColumnPermission = this.chkUseTableColumnPermission.Checked; BaseSystemInfo.UseTableScopePermission = this.chkUseTableScopePermission.Checked; BaseSystemInfo.UseWorkFlow = this.chkWorkFlow.Checked; BaseSystemInfo.OnLineLimit = (int)this.nupOnLineLimit.Value; BaseSystemInfo.CustomerCompanyName = this.txtCustomerCompanyName.Text; if (this.cmbUserCenterDbDbType.Text.Length != 0) { BaseSystemInfo.UserCenterDbType = BaseConfiguration.GetDbType(this.cmbUserCenterDbDbType.SelectedItem.ToString()); } if (this.cmbBusinessDbDbType.Text.Length != 0) { BaseSystemInfo.BusinessDbType = BaseConfiguration.GetDbType(this.cmbBusinessDbDbType.SelectedItem.ToString()); } if (this.cmbWorkFlowDbDbType.Text.Length != 0) { BaseSystemInfo.WorkFlowDbType = BaseConfiguration.GetDbType(this.cmbWorkFlowDbDbType.SelectedItem.ToString()); } BaseSystemInfo.EncryptDbConnection = this.chkEncryptDbConnection.Checked; BaseSystemInfo.UserCenterDbConnectionString = this.txtUserCenterDbConnection.Text; BaseSystemInfo.BusinessDbConnectionString = this.txtBusinessDbConnection.Text; BaseSystemInfo.WorkFlowDbConnectionString = this.txtWorkFlowDbConnection.Text; // 保存用户的信息 UserConfigHelper.SaveConfig(); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // System.Console.WriteLine(WindowsIdentity.GetCurrent().Name); // 主应用程序集名 BaseSystemInfo.MainAssembly = System.Reflection.Assembly.GetEntryAssembly().GetName().Name; BaseSystemInfo.StartupPath = Application.StartupPath; BaseSystemInfo.AppIco = Path.Combine(Application.StartupPath, "Resource/Form.ico"); // PermissionItemService permissionItemService = new Business.PermissionItemService(); // BasePermissionItemEntity permissionItemEntity = permissionItemService.GetEntityByCode(BaseSystemInfo.UserInfo, "UserAdmin"); // System.Console.WriteLine(permissionItemEntity); // 获取配置信息 GetConfig(); // 强制使用表数据权限 // BaseSystemInfo.UseTablePermission = true; BaseSystemInfo.WebHostUrl = ConfigurationManager.AppSettings["WebHostUrl"]; // 这里检查是否有外部用户名密码传输进来过 if (args.Length > 0) { for (int i = 0; i < args.Length; i++) { if (args[i].ToString().StartsWith("UserName")) { BaseSystemInfo.CurrentUserName = args[i].ToString().Substring("UserName".Length + 1); } else if (args[i].ToString().StartsWith("Password")) { BaseSystemInfo.CurrentPassword = args[i].ToString().Substring("Password".Length + 1); if (BaseSystemInfo.ClientEncryptPassword) { BaseSystemInfo.CurrentPassword = SecretUtil.Encrypt(BaseSystemInfo.CurrentPassword); } } // Console.WriteLine(i.ToString() + ":" + args[i].ToString()); } } if (BaseSystemInfo.MultiLanguage) { // 多语言国际化加载 ResourceManagerWrapper.Instance.LoadResources(Path.Combine(Application.StartupPath, "Resources/Localization/")); // 从当前指定的语言包读取信息 AppMessage.GetLanguageResource(); } // 初始化服务 DotNetService.Instance.InitService(); // 按配置的登录页面进行登录,这里需要运行的是主程序才可以 Form mainForm = BaseInterfaceLogic.GetForm(BaseSystemInfo.MainAssembly, BaseSystemInfo.MainForm); Application.Run(mainForm); }
/// <summary> /// 保存签名密钥 /// </summary> /// <param name="privateKey">密钥</param> /// <param name="password">签名密码</param> /// <returns>是否成功</returns> private bool SaveDigitalSignature(string privateKey, string password) { bool returnValue = false; // 01: 保存文件路径 string fileName = this.txtOutput.Text + "\\" + UserInfo.RealName + ".Key"; // 这里需要判断文件是否已经存在 if (System.IO.File.Exists(fileName)) { if (MessageBox.Show("签名密钥" + UserInfo.RealName + ".Key" + "已存在,您确认要覆盖原文件吗?", AppMessage.MSG0000, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.OK) { // 文件已经存在,不能覆盖的为好,或者需要提醒才可以。 return(returnValue); } } XmlDocument xmlDocument = new XmlDocument(); XmlNode xmlNode = xmlDocument.CreateXmlDeclaration("1.0", "utf-8", null); xmlDocument.AppendChild(xmlNode); XmlNode root = xmlDocument.CreateElement("DigitalSignature"); xmlDocument.AppendChild(root); XmlElement xmlElement = xmlDocument.CreateElement("Key"); // 02: 当前用户的Id保存到xml文件 xmlElement.SetAttribute("Id", UserInfo.Id); // 03:当前的用户名为文件名 xmlElement.SetAttribute("UserName", UserInfo.UserName); // 04:当前的用户名签名密码(加密保存,单向加密) xmlElement.SetAttribute("SignedPassword", SecretUtil.md5(password, 32)); // 05: 当前创建日期保存到xml文件 xmlElement.SetAttribute("CreateOn", DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat)); // 06: 当前私钥保存到xml文件 xmlElement.SetAttribute("PrivateKey", privateKey); root.AppendChild(xmlElement); // 07: 这里需要加密保存 // xmlDocument.Save("C:\\DigitalSignature.xml"); // 08: 加密文件内容 string keyFile = SecretUtil.Encrypt(xmlDocument.InnerXml); try { // 09: 创建二进制加密文件 FileUtil.WriteBinaryFile(fileName, keyFile); // 10:打开生成文件所在的目录 // Process.Start(this.txtOutput.Text); // 11:记住用户参数 DotNetService.Instance.ParameterService.SetParameter(UserInfo, "User", this.UserInfo.Id, "DigitalSignatureFilePath", this.txtOutput.Text); returnValue = true; } catch { MessageBox.Show("保存签名密钥文件失败、请重新生成签名密钥。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); returnValue = false; } return(returnValue); }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtCustomerID.Text.Trim())) { txtCustomerID.Focus(); txtCustomerID.Select(); txtCustomerID.ShowTip("商家ID必填"); return; } if (string.IsNullOrEmpty(txtCustomerPassword.Text.Trim())) { txtCustomerPassword.Focus(); txtCustomerPassword.Select(); txtCustomerPassword.ShowTip("商家ID密码必填"); return; } if (string.IsNullOrEmpty(txtSiteName.Text.Trim())) { txtSiteName.Focus(); txtSiteName.Select(); txtSiteName.ShowTip("所属网点名称必填"); return; } if (string.IsNullOrEmpty(txtSiteCode.Text.Trim())) { txtSiteCode.Focus(); txtSiteCode.Select(); txtSiteCode.ShowTip("所属网点编号必填"); return; } if (!string.IsNullOrEmpty(txtCustomerID.Text) && !string.IsNullOrEmpty(txtCustomerPassword.Text)) { var elecUserInfoEntity = new ZtoElecUserInfoEntity(); elecUserInfoEntity.Kehuid = txtCustomerID.Text.Replace(" ", ""); elecUserInfoEntity.Pwd = txtCustomerPassword.Text.Replace(" ", ""); elecUserInfoEntity.Result = "false"; elecUserInfoEntity.InterfaceType = "0"; string encryInfo = JsonConvert.SerializeObject(elecUserInfoEntity); // 扩展类保存一下 ZtoElecUserInfoExtendEntity elecUserInfoExtendEntity = new ZtoElecUserInfoExtendEntity(); elecUserInfoExtendEntity.Kehuid = txtCustomerID.Text.Replace(" ", ""); elecUserInfoExtendEntity.Pwd = txtCustomerPassword.Text.Replace(" ", ""); elecUserInfoExtendEntity.Result = "false"; elecUserInfoExtendEntity.InterfaceType = "0"; elecUserInfoExtendEntity.siteCode = txtSiteCode.Text; elecUserInfoExtendEntity.siteName = txtSiteName.Text; string encryExtendInfo = JsonConvert.SerializeObject(elecUserInfoExtendEntity); BillPrintHelper.SetZtoCustomerInfo(SecretUtil.Encrypt(encryInfo, BaseSystemInfo.SecurityKey)); BillPrintHelper.SetZtoCustomerExtendInfo(SecretUtil.Encrypt(encryExtendInfo, BaseSystemInfo.SecurityKey)); XtraMessageBox.Show("绑定成功", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { BillPrintHelper.DeleteElecUserInfoEntity(); } }
private void btnEncrypt_Click(object sender, EventArgs e) { // 如果当前处于未加密状态,则对数据库连接字符窜进行加密操作; if (!this.chkEncryptDbConnection.Checked) { this.chkEncryptDbConnection.Checked = true; this.txtUserCenterDbConnection.Text = SecretUtil.Encrypt(this.txtUserCenterDbConnection.Text); this.txtBusinessDbConnection.Text = SecretUtil.Encrypt(this.txtBusinessDbConnection.Text); this.txtWorkFlowDbConnection.Text = SecretUtil.Encrypt(this.txtWorkFlowDbConnection.Text); } }
/// <summary> /// 保存签名密钥 /// </summary> /// <param name="privateKey">密钥</param> /// <param name="password">签名密码</param> /// <returns>是否成功</returns> private bool SaveDigitalSignature(string privateKey, string password) { bool returnValue = false; // 01: 保存文件路径 string fileName = this.txtDigitalSignature.Text; XmlDocument xmlDocument = new XmlDocument(); XmlNode xmlNode = xmlDocument.CreateXmlDeclaration("1.0", "utf-8", null); xmlDocument.AppendChild(xmlNode); XmlNode root = xmlDocument.CreateElement("DigitalSignature"); xmlDocument.AppendChild(root); XmlElement xmlElement = xmlDocument.CreateElement("Key"); // 02: 当前用户的Id保存到xml文件 xmlElement.SetAttribute("Id", UserInfo.Id); // 03:当前的用户名为文件名 xmlElement.SetAttribute("UserName", UserInfo.UserName); // 04:当前的用户名签名密码(加密保存) xmlElement.SetAttribute("SignedPassword", SecretUtil.md5(password, 32)); // 05: 当前创建日期保存到xml文件 xmlElement.SetAttribute("CreateOn", DateTime.Now.ToString(BaseSystemInfo.DateTimeFormat)); // 06: 当前私钥保存到xml文件 xmlElement.SetAttribute("PrivateKey", privateKey); root.AppendChild(xmlElement); // 07: 这里需要加密保存 // xmlDocument.Save("C:\\DigitalSignature.xml"); // 08: 加密文件内容 string keyFile = SecretUtil.Encrypt(xmlDocument.InnerXml); try { // 09: 创建二进制加密文件 FileUtil.WriteBinaryFile(fileName, keyFile); // 10:打开生成文件所在的目录 // Process.Start(this.txtDigitalSignature.Text); // 11:记住用户参数 // DotNetService.Instance.ParameterService.SetParameter(UserInfo, "User", this.UserInfo.Id, "DigitalSignatureFilePath", this.txtOutput.Text); // MessageBox.Show("修改签名密码成功、请妥善保管好签名密钥文件。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("修改签名密码失败、请重修改签名密码。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); returnValue = false; } return(returnValue); }
/// <summary> /// 修改密码 /// </summary> private bool ChangePassword() { // 设置鼠标繁忙状态,并保留原先的状态 Cursor holdCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; bool returnValue = false; string statusCode = string.Empty; string statusMessage = string.Empty; DotNetService.Instance.LogOnService.ChangePassword(UserInfo, this.txtOldPassword.Text, this.txtNewPassword.Text, out statusCode, out statusMessage); // 设置为平常状态 this.Cursor = holdCursor; if (statusCode == StatusCode.ChangePasswordOK.ToString()) { if (BaseSystemInfo.ShowInformation) { // 提示修改成功 MessageBox.Show(statusMessage, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); } // 保存用户的密码信息,方便下次登录时直接记住了新密码,否则登录时,还是会出错的。 #if (!DEBUG) if (BaseSystemInfo.ClientEncryptPassword) { BaseSystemInfo.CurrentPassword = SecretUtil.Encrypt(this.txtNewPassword.Text); } UserConfigHelper.SaveConfig(); #endif this.DialogResult = DialogResult.OK; returnValue = true; } else { if (statusCode == StatusCode.PasswordCanNotBeNull.ToString()) { this.ClearOldPassword(); } if (statusCode == StatusCode.OldPasswordError.ToString()) { this.ClearOldPassword(); } MessageBox.Show(statusMessage, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information); returnValue = false; } return(returnValue); }
/// <summary> /// 将登录信息保存到XML文件中。 /// 若不保存用户名密码,那就应该删除掉。 /// </summary> /// <param name="userInfo">登录用户</param> private void SaveLogOnInfo(BaseUserInfo userInfo) { BaseSystemInfo.RememberPassword = this.chkRememberPassword.Checked; if (this.chkRememberPassword.Checked) { BaseSystemInfo.CurrentUserName = userInfo.UserName; // BaseSystemInfo.CurrentUserName = SecretUtil.Encrypt(userInfo.UserName); if (BaseSystemInfo.ClientEncryptPassword) { BaseSystemInfo.CurrentPassword = SecretUtil.Encrypt(this.txtPassword.Text); } else { BaseSystemInfo.CurrentPassword = this.txtPassword.Text; } } else { BaseSystemInfo.CurrentUserName = string.Empty; BaseSystemInfo.CurrentPassword = string.Empty; } // 保存用户的信息 UserConfigHelper.SaveConfig(); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtCustomerID.Text.Trim())) { txtCustomerID.Focus(); txtCustomerID.Select(); txtCustomerID.ShowTip("商家ID必填"); return; } if (string.IsNullOrEmpty(txtCustomerPassword.Text.Trim())) { txtCustomerPassword.Focus(); txtCustomerPassword.Select(); txtCustomerPassword.ShowTip("密码必填"); return; } if (string.IsNullOrEmpty(txtSiteName.Text.Trim())) { txtSiteName.Focus(); txtSiteName.Select(); txtSiteName.ShowTip("所属网点名称必填"); return; } if (string.IsNullOrEmpty(txtSiteCode.Text.Trim())) { txtSiteCode.Focus(); txtSiteCode.Select(); txtSiteCode.ShowTip("所属网点编号必填"); return; } if (!string.IsNullOrEmpty(txtCustomerID.Text) && !string.IsNullOrEmpty(txtCustomerPassword.Text)) { var elecUserInfoEntity = new ZtoElecUserInfoEntity(); elecUserInfoEntity.Kehuid = txtCustomerID.Text.Replace(" ", ""); elecUserInfoEntity.Pwd = txtCustomerPassword.Text.Replace(" ", ""); elecUserInfoEntity.Result = "false"; elecUserInfoEntity.InterfaceType = "0"; string encryInfo = JsonConvert.SerializeObject(elecUserInfoEntity); // 扩展类保存一下 ZtoElecUserInfoExtendEntity elecUserInfoExtendEntity = new ZtoElecUserInfoExtendEntity(); elecUserInfoExtendEntity.Kehuid = txtCustomerID.Text.Replace(" ", ""); elecUserInfoExtendEntity.Pwd = txtCustomerPassword.Text.Replace(" ", ""); elecUserInfoExtendEntity.Result = "false"; elecUserInfoExtendEntity.InterfaceType = "0"; elecUserInfoExtendEntity.siteCode = txtSiteCode.Text; elecUserInfoExtendEntity.siteName = txtSiteName.Text; string encryExtendInfo = JsonConvert.SerializeObject(elecUserInfoExtendEntity); BillPrintHelper.SetZtoCustomerInfo(SecretUtil.Encrypt(encryInfo, BaseSystemInfo.SecurityKey)); BillPrintHelper.SetZtoCustomerExtendInfo(SecretUtil.Encrypt(encryExtendInfo, BaseSystemInfo.SecurityKey)); MessageUtil.ShowTips("绑定成功,账号密码不要告诉别人"); //if (!string.IsNullOrEmpty(txtQQNumber.Text)) //{ // ThreadPool.QueueUserWorkItem(delegate // { // string content = "商家id:" + elecUserInfoEntity.Kehuid + "<br />密码是:" + elecUserInfoEntity.Pwd + "<br />一定不要告诉别人,涉及到安全问题<br />如果手机坏了找不到账号密码可以从qq邮箱找到。"; // // 账号密码发送到邮箱里面做一个备份,2016-6-10 19:29:52 // MailHelper.SendMail(BaseSystemInfo.MailUserName, BaseSystemInfo.MailPassword, BaseSystemInfo.SoftFullName, new[] { txtQQNumber.Text + "@qq.com" }, "申通线下电子面单商家ID和密码备份", content, null, BaseSystemInfo.MailServer); // }); //} // 关闭窗口 Close(); } else { BillPrintHelper.DeleteElecUserInfoEntity(); } }