Example #1
0
 private void InitializeClientForDb(Client client, ClientsEntities db)
 {
     client.Surname              = Client.Surname;
     client.Name                 = Client.Name;
     client.Patronimic           = Client.Patronimic;
     client.BirthDate            = Client.BirthDate;
     client.PassportSeries       = Client.PassportSeries;
     client.PassportNumber       = Client.PassportNumber;
     client.Authority            = Client.Authority;
     client.DateOfIssue          = Client.IssueDate;
     client.PlaceOfBirth         = Client.PlaceOfBirth;
     client.IdentificationNumber = Client.IdentificationNumber;
     client.Location             = db.GetCityIDByValue(Client.Location);
     client.Address              = Client.Address;
     client.MobileNumber         = Client.MobileNumber;
     client.PhoneNumber          = Client.PhoneNumber?.Replace("_", "");
     client.Email                = Client.Email;
     client.MaritalStatus        = db.GetMaritualStatusIDByValue(Client.MaritualStatus);
     client.Disability           = db.GetDisabilityIDByValue(Client.Disability);
     client.Nationality          = db.GetNationalityIDByValue(Client.Nationality);
     client.Pensioner            = Client.Pensioner;
     client.RegistrationCity     = db.GetCityIDByValue(Client.RegistrationCity);
     client.Gender               = (Client.MaleGender) ? true : false;
     client.MonthlyIncome        = ConvertStringToMoneyValue(Client.MonthlyIncome);
 }
Example #2
0
        private void UpdateClientInfo()
        {
            using (var db = new ClientsEntities())
            {
                var client = db.GetClientById(Client.Id);

                client.Surname              = Client.Surname;
                client.Name                 = Client.Name;
                client.Patronimic           = Client.Patronimic;
                client.BirthDate            = Client.BirthDate;
                client.PassportSeries       = Client.PassportSeries;
                client.PassportNumber       = Client.PassportNumber;
                client.Authority            = Client.Authority;
                client.DateOfIssue          = Client.IssueDate;
                client.PlaceOfBirth         = Client.PlaceOfBirth;
                client.IdentificationNumber = Client.IdentificationNumber;
                client.Location             = db.GetCityIDByValue(Client.Location);
                client.Address              = Client.Address;
                client.MobileNumber         = Client.MobileNumber;
                client.PhoneNumber          = Client.PhoneNumber?.Replace("_", "");
                client.Email                = Client.Email;
                client.MaritalStatus        = db.GetMaritualStatusIDByValue(Client.MaritualStatus);
                client.Disability           = db.GetDisabilityIDByValue(Client.Disability);
                client.Nationality          = db.GetNationalityIDByValue(Client.Nationality);
                client.Pensioner            = Client.Pensioner;
                client.RegistrationCity     = db.GetCityIDByValue(Client.RegistrationCity);
                client.Gender               = (Client.MaleGender) ? true : false;
                client.MonthlyIncome        = ConvertStringToMoneyValue(Client.MonthlyIncome);

                db.SaveChanges();
            }
        }