public void SetHealthInsurance(HealthInsurance healthInsurance)
        {
            txtBoxHealthInsurance.Text = healthInsurance.Name;
            txtBoxInsuranceID.Text     = healthInsurance.InsuranceID.ToString();

            HealthInsurance = healthInsurance;
        }
        public async Task AddToDatabaseTask(HealthInsurance healthInsurance)
        {
            using (var db = new DatabaseContext())
            {
                db.HealthInsurances.Add(healthInsurance);

                await db.SaveChangesAsync();
            }
        }
        private void btnNew_Click(object sender, EventArgs e)
        {
            btnSave.Visible = true;

            HealthInsurance = new HealthInsurance
            {
                Name = "Bitte Krankenkassendaten ausfüllen"
            };

            lstBoxHealthInsurance.Items.Add(HealthInsurance);
            lstBoxHealthInsurance.SelectedItem = HealthInsurance;
        }
Ejemplo n.º 4
0
        public Main()
        {
            InitializeComponent();

            createPatientCtrl1.SetParent(this);
            healthInsuranceCtrl1.SetParent(this);
            //logTreatmentsCtrl1.SetParent(this);

            Patient         = new Patient();
            HealthInsurance = new HealthInsurance();

            // Look for JSON Path
            InitializeJson();
        }
Ejemplo n.º 5
0
        public Patient(string firstName, string secondName, string street, int streetNumber, int postalcode, string city, long insuranceId, HealthInsurance healthInsurance, DateTime bitBirthday, int phonenumber, List <string> specialTraits, List <Treatment> treatments)
        {
            FirstName       = firstName;
            SecondName      = secondName;
            Street          = street;
            StreetNumber    = streetNumber;
            Postalcode      = postalcode;
            City            = city;
            InsuranceID     = insuranceId;
            HealthInsurance = healthInsurance;
            Birthday        = bitBirthday;
            Phonenumber     = phonenumber;
            SpecialTraits   = specialTraits;
            Treatments      = treatments;

            Key = $@"{SecondName}-{FirstName}-{Birthday}";
        }
Ejemplo n.º 6
0
        private static bool ReadJson(ref HealthInsurance model, string extraOptions = "")
        {
            try
            {
                var bRead = false;

                if (!File.Exists($@"{SaveLocation}\HealthInsurances.json"))
                {
                    return(false);
                }

                var json = File.ReadAllText($@"{SaveLocation}\HealthInsurances.json");

                if (json == string.Empty)
                {
                    throw new HealthInsurancesDoesNotExist();
                }

                var list = JsonConvert.DeserializeObject <List <HealthInsurance> >(json);
                HealthInsurances = list;

                var healthInsuranceModel = (HealthInsurance)model;
                foreach (var healthInsurance in HealthInsurances)
                {
                    if (!healthInsurance.Name.Equals(healthInsuranceModel.Name))
                    {
                        continue;
                    }
                    model = healthInsurance;
                    return(true);
                }

                return(bRead);
            }
            catch (NullReferenceException e)
            {
                Console.WriteLine(e);
                throw new HealthInsurancesDoesNotExist();
            }
        }
Ejemplo n.º 7
0
        public static bool Read(ref HealthInsurance model, string extraOptions = "")
        {
            if (!Initialized)
            {
                Initialize();
            }

            var bRead = false;

            if (SaveType.Equals("JSON"))
            {
                bRead = ReadJson(ref model, extraOptions);
            }
            else if (SaveType.Equals("SQL"))
            {
                bRead = ReadSql(ref model, extraOptions);
            }
            else if (SaveType.Equals("XML"))
            {
                bRead = ReadXml(ref model, extraOptions);
            }

            return(bRead);
        }
Ejemplo n.º 8
0
 private static bool ReadSql(ref HealthInsurance model, string extraOptions)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
 public void SetHealthInsurance(HealthInsurance healthInsurance)
 {
     createPatientCtrl1.SetHealthInsurance(healthInsurance);
 }
 public void SetSelectedItem(HealthInsurance getHealthInsurance)
 {
     lstBoxHealthInsurance.SelectedItem = getHealthInsurance;
 }
 public void SetValues(HealthInsurance healthInsurance)
 {
     this.HealthInsurance = healthInsurance;
 }