/// <summary> /// Allows you to generate an HTML representation of the current Address object. /// </summary> /// <returns>An HTML representation of the current Address object.</returns> public string ToHtmlString() { var sb = new StringBuilder(); if (NickName.Trim().Length > 0) { sb.Append("<em>" + NickName + "</em><br />"); } if (LastName.Length > 0 || FirstName.Length > 0) { sb.Append(FirstName); if (MiddleInitial.Trim().Length > 0) { sb.Append(" " + MiddleInitial); } sb.Append(" " + LastName + "<br />"); if (Company.Trim().Length > 0) { sb.Append(Company + "<br />"); } } sb.Append(GetLinesHtml()); return(sb.ToString()); }
/// <summary> /// 用户注册 /// </summary> private async void UserSignup() { if (UserName != null && UserPassword != null && ConfirmPassword != null && NickName != null && Age != null) { string userName = UserName.Trim(); string userPassword = UserPassword.Trim(); string confirmPassword = ConfirmPassword.Trim(); string nickName = NickName.Trim(); int age = int.Parse(Age.Trim()); string gender = Gender == true ? "男" : "女"; if (!userName.Equals(string.Empty) && !userPassword.Equals(string.Empty) && !confirmPassword.Equals(string.Empty) && !nickName.Equals(string.Empty)) { if (userPassword.Length >= 6 && userPassword.Equals(confirmPassword)) { signupCanExecute = false; miniClient = new MiniClient(userName, Config.ClientAddressFamily, Config.ClientAgreement, Config.GetServerIPEndPoint()); miniClient.ClientRequestResult += MiniClient_ClientRequestResult; miniClient.OpenClient(); if (await miniClient.ConnectionServerAsync()) { User user = new User() { UserName = userName, Password = ClientHelper.Encryption(userPassword), NickName = nickName, Gender = gender, Age = age, HeadIcon = ClientHelper.GetBytes(gender == "男" ? new Uri("/Resources/Images/boy.png", UriKind.Relative) : new Uri("/Resources/Images/girl.png", UriKind.Relative)) }; if (miniClient.SendDatabaseRequest(user, "Signup", null)) { if (!await ClientHelper.WaitAsync(() => signupCanExecute, 20)) { signupCanExecute = true; miniClient?.CloseClient(); miniClient = null; MessageBox.Show("服务器连接超时!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Error); } return; } } signupCanExecute = true; miniClient?.CloseClient(); miniClient = null; MessageBox.Show("无法连接到服务器!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBox.Show("密码不符合要求!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Warning); return; } } MessageBox.Show("用户信息不能为空!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Warning); }
internal void AddPerson(int originid, int?entrypointid, int?campusid) { Family f; if (FamilyId > 0) { f = Family; } else { f = new Family(); AddressInfo.CopyPropertiesTo(f); f.ResCodeId = AddressInfo.ResCode.Value.ToInt2(); f.HomePhone = HomePhone.GetDigits(); } if (NickName != null) { NickName = NickName.Trim(); } var position = DbUtil.Db.ComputePositionInFamily(Age ?? -1, MaritalStatus.Value == "20", FamilyId) ?? 10; FirstName = FirstName.Trim(); if (FirstName == "na") { FirstName = ""; } person = Person.Add(f, position, null, FirstName.Trim(), NickName, LastName.Trim(), DOB, false, Gender.Value.ToInt(), originid, entrypointid); this.CopyPropertiesTo(Person); Person.CellPhone = CellPhone.GetDigits(); if (campusid == 0) { campusid = null; } Person.CampusId = Util.PickFirst(campusid.ToString(), DbUtil.Db.Setting("DefaultCampusId", "")).ToInt2(); if (Person.CampusId == 0) { Person.CampusId = null; } DbUtil.Db.SubmitChanges(); DbUtil.LogActivity("AddPerson {0}".Fmt(person.PeopleId)); DbUtil.Db.Refresh(RefreshMode.OverwriteCurrentValues, Person); PeopleId = Person.PeopleId; }
/// <summary> /// 保存资料 /// </summary> private void SaveInfo() { if (NickName != null && Age != null) { string nickName = NickName.Trim(); int age = int.Parse(Age.Trim()); string gender = Gender == true ? "男" : "女"; if (!nickName.Equals(string.Empty)) { if (HomeViewModel.RequestResultAction == null) { User user = new User() { UserID = _userModel.UserID, UserName = _userModel.UserName, Password = _userModel.Password, NickName = nickName, Gender = gender, Age = age, HeadIcon = _userModel.HeadIcon, State = _userModel.State }; HomeViewModel.RequestResultAction = new Action <RequestResult>((RequestResult result) => { if (result.Success == true) { EditInfo.EditInfoWindow.Dispatcher.Invoke(() => { (Home.HomeWindow?.DataContext as HomeViewModel)?.LoadUserCommand?.Execute(null); EditInfo.EditInfoWindow?.Close(); }); MessageBox.Show("资料保存成功!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Asterisk); return; } MessageBox.Show("资料保存失败!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Error); }); if (!Config.MiniClient.SendDatabaseRequest(user, "AlterInfo", null)) { HomeViewModel.RequestResultAction = null; MessageBox.Show("保存资料时发生错误!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Error); } } return; } } MessageBox.Show("资料不能为空!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Warning); }
/// <summary> /// Allows you to compare another address object to determine if the two addresses are the same. /// </summary> /// <param name="a2">Another address object.</param> /// <returns>If true, the current address matches the address in the parameter.</returns> public bool IsEqualTo(Address a2) { if (a2 == null) { return(false); } var result = true; if (string.Compare(NickName.Trim(), a2.NickName.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(FirstName.Trim(), a2.FirstName.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(MiddleInitial.Trim(), a2.MiddleInitial.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(LastName.Trim(), a2.LastName.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(Company.Trim(), a2.Company.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(Line1.Trim(), a2.Line1.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(Line2.Trim(), a2.Line2.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(Line3.Trim(), a2.Line3.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(RegionBvin.Trim(), a2.RegionBvin.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(City.Trim(), a2.City.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(PostalCode.Trim(), a2.PostalCode.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(CountryBvin.Trim(), a2.CountryBvin.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(Phone.Trim(), a2.Phone.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(Fax.Trim(), a2.Fax.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } if (string.Compare(WebSiteUrl.Trim(), a2.WebSiteUrl.Trim(), true, CultureInfo.InvariantCulture) != 0) { result = false; } //if (this.Residential != a2.Residential) { // result = false; //} return(result); }
protected override void CollectVolatileData_Custom() { NickName = NickName.Trim(); }
public string ToHtmlString() { StringBuilder sb = new StringBuilder(); if (NickName.Trim().Length > 0) { sb.Append("<em>" + NickName + "</em><br />"); } if (LastName.Length > 0 || FirstName.Length > 0) { sb.Append(FirstName); if (MiddleInitial.Trim().Length > 0) { sb.Append(" " + MiddleInitial); } sb.Append(" " + LastName + "<br />"); if (Company.Trim().Length > 0) { sb.Append(Company + "<br />"); } } if (Line1.Length > 0) { sb.Append(Line1 + "<br />"); } if (Line2.Trim().Length > 0) { sb.Append(Line2 + "<br />"); } if (Line3.Trim().Length > 0) { sb.Append(Line3 + "<br />"); } MerchantTribe.Web.Geography.Country c = MerchantTribe.Web.Geography.Country.FindByBvin(CountryBvin); MerchantTribe.Web.Geography.Region r = c.Regions.Where(y => y.Abbreviation == RegionBvin).FirstOrDefault(); if (r != null) { sb.Append(City + ", " + r.Abbreviation + " " + _PostalCode + "<br />"); } else { if (RegionName.Trim().Length > 0) { sb.Append(City + ", " + RegionName + " " + _PostalCode + "<br />"); } else { sb.Append(City + ", " + _PostalCode + "<br />"); } } if (c != null) { sb.Append(c.DisplayName + "<br />"); } if (Phone.Trim().Length > 0) { sb.Append(Phone + "<br />"); } if (Fax.Trim().Length > 0) { sb.Append("Fax: " + Fax + "<br />"); } if (WebSiteUrl.Trim().Length > 0) { sb.Append(WebSiteUrl + "<br />"); } return(sb.ToString()); }