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