PersonHandlers.cs
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Parties.Person;
namespace Sungero.Parties
{
partial class PersonSharedHandlers
{
public virtual void MiddleNameChanged(Sungero.Domain.Shared.StringPropertyChangedEventArgs e)
{
Functions.Person.FillName(_obj);
}
public virtual void FirstNameChanged(Sungero.Domain.Shared.StringPropertyChangedEventArgs e)
{
Functions.Person.FillName(_obj);
}
public virtual void LastNameChanged(Sungero.Domain.Shared.StringPropertyChangedEventArgs e)
{
// Установить пол, если не установлен.
// TODO: 35010.
if (System.Threading.Thread.CurrentThread.CurrentUICulture.Equals(System.Globalization.CultureInfo.CreateSpecificCulture("ru-RU")))
{
if (!_obj.Sex.HasValue && e.NewValue != null && e.NewValue.Length > 2)
{
var lastSymbols = e.NewValue.Substring(e.NewValue.Length - 2).ToLower();
if (lastSymbols == "ва" || lastSymbols == "на" || lastSymbols == "ая")
_obj.Sex = Sex.Female;
else
_obj.Sex = Sex.Male;
}
}
Functions.Person.FillName(_obj);
}
}
}