Beispiel #1
0
        public static SubjectInfo FromJSON(JSONWrappers.SubjectInfo jsonInfo)
        {
            string firstName  = jsonInfo.FirstName;
            string lastName   = jsonInfo.LastName;
            string patronymic = jsonInfo.Patronymic;
            string name       = string.Join(" ", new string[] { lastName, firstName, patronymic });

            string address  = jsonInfo.Address;
            string job      = jsonInfo.Job;
            string diseases = jsonInfo.Diseases;
            string phone    = jsonInfo.Phone;

            Sex      sex       = Utils.SexStringToEnum(jsonInfo.Sex);
            DateTime birthDate = Convert.ToDateTime(jsonInfo.BirthDate);

            return(new SubjectInfo(name, sex, birthDate, address, job, diseases, phone));
        }
Beispiel #2
0
        public JSONWrappers.SubjectInfo ToJSON()
        {
            JSONWrappers.SubjectInfo jsonInfo = new JSONWrappers.SubjectInfo
            {
                FirstName  = FirstName,
                LastName   = LastName,
                Patronymic = Patronymic,
                Address    = Address,
                Job        = Job,
                Diseases   = Diseases,
                Phone      = Phone,
                Sex        = Sex.ToString("G"),
                BirthDate  = BirthDate.ToString("dd.MM.yyyy")
            };

            return(jsonInfo);
        }