public void TestLogin2() { // 测试多个客服端用同一个客服帐号登录 LiveSupport.LiveSupportDAL.SqlProviders.DBHelper.ConnectionString = "Server=rd01;Database=LiveSupport;User ID=sa;Password=;Trusted_Connection=False;"; Account a = new Account(); a.LoginName = Util.RandLetter(10); a.Password = "******"; AccountsManager.AddAccount(a); Operator op = OperatorService.Login(a.LoginName, a.LoginName, a.Password); Assert.AreEqual(a.AccountId, op.OperatorId); Assert.AreEqual(op.LoginName, a.LoginName); Account ac = AccountService.FindAccountByLoginName(a.LoginName); Assert.AreEqual(op.AccountId, ac.AccountId); Assert.AreEqual(op.Password, a.Password); Assert.AreEqual(op.Status, OperatorStatus.Idle); Operator op2 = OperatorService.Login(a.LoginName, a.LoginName, a.Password); Assert.IsNull(op2); OperatorService.Logout(op.OperatorId); op = OperatorService.Login(a.LoginName, a.LoginName, a.Password); Assert.IsNotNull(op); }
//注册 protected void Button1_Click(object sender, EventArgs e) { if (Session["createRandom"] != null) { if (this.txtValidate.Text.ToLower() == Session["createRandom"].ToString().ToLower()) { try { Random ran = new Random(); int num = ran.Next(100000, 999999); //添加 Account at = new Account(); at.AccountId = Guid.NewGuid().ToString(); at.AccountNumber = num.ToString(); at.CompanyName = this.txtCompanyName.Text; at.Url = this.txtCompanyWebUrl.Text; at.Phone = this.txtCompanyPhone.Text; at.ContactName = this.txtName.Text; at.Email = this.txtMail.Text; at.Province = this.ddlSheng.SelectedItem.Text; at.City = this.ddlShi.SelectedItem.Text; at.Industry = this.ddlVocation.SelectedValue; at.OperatorCount = 1; at.RegisterDate = DateTime.Now; bool b = AccountsManager.AddAccount(at, this.txtNickname.Text, this.txtLoginId.Text, this.txtPwd.Text); if (b) { string toEmail = this.txtMail.Text; string email = ConfigurationManager.AppSettings["Email"]; string emailPwd = ConfigurationManager.AppSettings["Password"]; string emailSmtp = ConfigurationManager.AppSettings["SMTPServer"]; string title = "江西互动网络LiveSpport在线客服系统提示您:"; string content = "尊敬的客服 " + this.txtNickname.Text + " 您好!\n 您公司ID为:" + at.AccountNumber + ",您的账号为:" + this.txtLoginId.Text + ",您的密码为:" + this.txtPwd.Text + ",请您牢记,感谢您一直以来对我们公司产品的支持与厚爱!\n \n \n \n \n \n \n \n 如需帮助请浏览我们公司的官方网站 http://www.zxkefu.cn"; LiveSupport.BLL.Utils.Util.SendEmailAsync(toEmail, email, emailPwd, emailSmtp, title, content); ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('注册成功'); window.location='Hello.aspx?id=" + at.AccountNumber + "&loginName=" + this.txtLoginId.Text + "&Email=" + this.txtMail.Text + "';</script>"); return; } else { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('管理员ID已经存在,请从新注册...');</script>"); return; } } catch (Exception ex) { } } else { this.lblMessage.Text = "验证码错误!"; return; } } }
/// <summary> /// 创建管理员信息 /// </summary> /// <returns></returns> public bool NewAccount() { Account account = new Account(); account.AccountNumber = "10000"; account.CompanyName = forumtitle.Text; account.ContactName = systemadminname.Text; account.Email = adminemail.Text; account.Url = Util.GetApplicationPath(Request.UrlReferrer.ToString()); account.Province = "其它"; account.City = "其它"; account.Industry = "计算机"; account.Domain = Util.GetDomainName(Request.UrlReferrer.ToString()); return(AccountsManager.AddAccount(account, systemadminname.Text, systemadminname.Text, systemadminpws.Text)); }
private async void CreateAccountButton_Clicked(object sender, EventArgs e) { string application = applicationEntry.Text; string login = loginEntry.Text; string pass = passEntry.Text; string email = emailEntry.Text; Account account = new Account(login, email, application, LoginSystem.LoggedUser); bool validation = await AccountsManager.Validate(this, account, pass); if (validation) { AccountsManager.AddAccount(account, pass); await Navigation.PopAsync(); } }
private void btnAddoperator_Click(object sender, EventArgs e) { for (int i = 0; i < 500; i++) { //Random ran = new Random(); //int num = ran.Next(100000, 999999); //添加 Account at = new Account(); at.AccountId = Guid.NewGuid().ToString(); at.AccountNumber = i.ToString(); at.CompanyName = i + "公司"; at.Url = "http://www.www" + i + ".com"; at.Phone = i.ToString();; at.ContactName = i + ""; at.Email = i.ToString() + "@sina.com"; at.Province = "江西省"; at.City = "南昌市"; at.Industry = "计算机"; at.OperatorCount = 1; at.RegisterDate = DateTime.Now; bool b = AccountsManager.AddAccount(at, "admin客服", "admin", "admin"); //Account at = AccountsManager.GetAccountByAccountId(at.AccountId); Operator op = new Operator(); op.Account = at; op.LoginName = "admin" + i; op.Password = "******" + i; op.NickName = "admin1号客服"; op.IsAdmin = false; op.Department = DepartmentManager.GetDepartmentByAccountId(at.AccountId)[0]; op.Status = (OperatorStatus)Enum.Parse((typeof(OperatorStatus)), OperatorStatus.Offline.ToString()); op.AVChatStatus = OperatorStatus.Offline.ToString(); op.Email = "admin" + i + "@sina.com"; bool a = OperatorsManager.NewOperator(op); } }