Esempio n. 1
0
        public FormStart()
        {
            InitializeComponent();

            directory = new Directory();
            directory.FillTestData(100);

            ListDoctor.DataSource    = directory.Doctors;
            ListDoctor.DisplayMember = "Name";
        }
Esempio n. 2
0
        public ReciepForm(Directory directory, Doctor doctor, Illness ill)
        {
            InitializeComponent();

            this.directory = directory;
            this.doctor    = doctor;
            this.ill       = ill;
            string symp = ill.Symptoms[0];

            for (int i = 1; i < ill.Symptoms.Count; i++)
            {
                symp += $", {ill.Symptoms[i]}";
            }
            SympBox.Text   = symp;
            DoctorBox.Text = doctor.Name;
            illBox.Text    = ill.Name;
            for (int i = 0; i < ill.Portions.Count; i++)
            {
                var portion = ill.Portions[i];
                if (ill.Portions[i].Drug.Total - ill.Portions[i].Amount > 0)
                {
                    drug.Add(new Drug {
                        Name = portion.Drug.Name, Total = portion.Amount, Unit = portion.Drug.Unit, Change = null
                    });
                }
                for (int j = 0; j < portion.Drug.Change.Count; j++)
                {
                    Drug dr = GetDrugByName(portion.Drug.Change[j]);
                    if (dr.Total - portion.Amount > 0)
                    {
                        drug.Add(new Drug {
                            Name = dr.Name, Total = portion.Amount, Unit = dr.Unit, Change = null
                        });
                    }
                }
            }
            if (drug == null)
            {
                DrugGriedView.DataSource = "Лекарств нет";
            }
            else
            {
                DrugGriedView.DataSource = drug;
            }
        }
Esempio n. 3
0
        public void Load()
        {
            using (Stream stream = File.OpenRead(filePath))
            {
                var       serializer = new BinaryFormatter();
                Directory st         = (Directory)serializer.Deserialize(stream);

                Copy(st.Doctors, directory.Doctors);
                Copy(st.Drugs, directory.Drugs);
                Copy(st.Illnesses, directory.Illnesses);
                Copy(st.Recipes, directory.Recipes);
            }

            void Copy <T>(List <T> from, List <T> to)
            {
                to.Clear();
                to.AddRange(from);
            }
        }
Esempio n. 4
0
 public Dao(Directory directory)
 {
     this.directory = directory;
 }