Beispiel #1
0
        private void AddPatient(String name, String surname, String patronymic, String date, String nation, String religion, String mType)
        {
            Patient p = new Patient();
            p.Name = name;
            p.Surname = surname;
            p.Patronymic = patronymic;
            p.Birthday = Convert.ToDateTime(date);
            p.Nation = nation;
            p.Religion = religion;

            p.MedCard = new MedCard();
            //p.MedAccount = new MedAccount();
            p.MilitaryCard = new MilitaryCard();
            p.PsyCard = new PsyCard();
            p.StudyCard = new StudyCard();
            p.WorkCard = new WorkCard();
            p.Relatives = new EntitySet<Relative>();
            p.BehaviorCard = new BehaviorCard();
            p.FamilyCard = new FamilyCard();

            p.MilitaryCard.ServType = mType;

            p.MilitaryCard.Academy = false;
            p.MilitaryCard.ContrDesire = false;
            p.FamilyCard.Divorced = false;
            p.FamilyCard.Widower = false;
            p.BehaviorCard.Alcohol = false;
            p.BehaviorCard.Drugs = false;

            myContext.Patients.InsertOnSubmit(p);

            myContext.SubmitChanges();
        }
Beispiel #2
0
        public void AddPatient(Patient newPatient)
        {
            //Data.DataPatient data = new Data.DataPatient();
            DataRow row = this.NewRow();
            row[0] = newPatient.ID;

            foreach (List<Data.Item> list in Data.DataPatient.Columns)
                foreach(Data.Item item in list)
                    if (this.Columns.Contains(item.Name))
                        row[this.Columns[item.Name]] = Data.DataPatient.GetData(newPatient, item.Name);

            this.Rows.Add(row);
        }
Beispiel #3
0
        public FormPatientCommon(ref Patient patient)
        {
            InitializeComponent();

            _patient = patient;

            txtName.Text = patient.Name;
            txtSurname.Text = patient.Surname;
            txtPatronymic.Text = patient.Patronymic;
            txtReligion.Text = patient.Religion;
            txtNation.Text = patient.Nation;
            txtBirthday.Text = Data.DataPatient.GetDate(patient.Birthday);

            if (patient.MilitaryCard.ServType == "Призыв")
                comboServ.SelectedIndex = 0;
            else
                comboServ.SelectedIndex = 1;

            txtRank.Text = patient.MilitaryCard.MilRank;
            txtRecPlace.Text = patient.MilitaryCard.RecruitPlace;

            comboCotract.SelectedIndex = 1;
            if (patient.MilitaryCard.ContrDesire != null)
                if ((bool)patient.MilitaryCard.ContrDesire)
                    comboCotract.SelectedIndex = 0;

            foreach (Ship ship in FormMain.myContext.Ships)
            {
                comboShip.Items.Add(ship.Name);
            }
            comboShip.SelectedIndex = FormMain.myContext.Ships.ToList().IndexOf(patient.MilitaryCard.Ship);

            txtUnit.Text = patient.MilitaryCard.Unit.ToString();
            txtRecDate.Text = Data.DataPatient.GetDate(patient.MilitaryCard.RecData);

            comboAcademy.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboMarried.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboDivorced.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboWidower.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboOrphan.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboFather.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboMother.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboSisters.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboBrothers.SelectedIndex = 1;
            if (patient.MilitaryCard.Academy != null)
                if ((bool)patient.MilitaryCard.Academy)
                    comboAcademy.SelectedIndex = 0;

            comboBrain.SelectedIndex = 1;
            if (patient.MedCard.BrainInjury != null)
                if ((bool)patient.MedCard.BrainInjury)
                    comboBrain.SelectedIndex = 0;

            txtHealth.Text = patient.MedCard.HealthInfo;

            comboAlcohol.SelectedIndex = 1;
            if (patient.BehaviorCard.Alcohol != null)
                if ((bool)patient.BehaviorCard.Alcohol)
                    comboAlcohol.SelectedIndex = 0;

            txtAlcohol.Text = patient.BehaviorCard.AlcoholInfo;

            comboDrugs.SelectedIndex = 1;
            if (patient.BehaviorCard.Drugs != null)
                if ((bool)patient.BehaviorCard.Drugs)
                    comboDrugs.SelectedIndex = 0;

            txtDrugs.Text = patient.BehaviorCard.DrugsInfo;
            txtStudyType.Text = patient.StudyCard.StudyType;
            txtStudyTime.Text = (String)patient.StudyCard.StudyTime;
            txtSpeciality.Text = patient.WorkCard.Speciality;
            txtWorkTime.Text = (String)patient.WorkCard.WorkTime;

            if (patient.PsyCard.DateSurvey != null)
                txtSurveyDate.Text = patient.PsyCard.DateSurvey.Value.ToString();

            cmbAttention.SelectedIndex = cmbAttention.Items.IndexOf(patient.PsyCard.Attention == null ? "" : patient.PsyCard.Attention);

            cmbCommAb.SelectedIndex = cmbCommAb.Items.IndexOf(patient.PsyCard.CommSkill == null ? "" : patient.PsyCard.CommSkill);

            cmbConflictTend.SelectedIndex = cmbConflictTend.Items.IndexOf(patient.PsyCard.ConflictTend == null ? "" : patient.PsyCard.ConflictTend);

            cmbConflictOrient.SelectedIndex = cmbConflictOrient.Items.IndexOf(patient.PsyCard.ConflictOrient == null ? "" : patient.PsyCard.ConflictOrient);

            cmbGCA.SelectedIndex = cmbGCA.Items.IndexOf(patient.PsyCard.GCA == null ? "" : patient.PsyCard.GCA);

            cmbGroup.SelectedIndex = cmbGroup.Items.IndexOf(patient.PsyCard.ProfFitness == null ? "" : patient.PsyCard.ProfFitness);

            cmbMemory.SelectedIndex = cmbMemory.Items.IndexOf(patient.PsyCard.Memory == null ? "" : patient.PsyCard.Memory);

            cmbMoral.SelectedIndex = cmbMoral.Items.IndexOf(patient.PsyCard.MoralNormativity == null ? "" : patient.PsyCard.MoralNormativity);

            cmbNMB.SelectedIndex = cmbNMB.Items.IndexOf(patient.PsyCard.NMB == null ? "" : patient.PsyCard.NMB);

            cmbNPS.SelectedIndex = cmbNPS.Items.IndexOf(patient.PsyCard.NPS == null ? "" : patient.PsyCard.NPS);

            cmbRisk.SelectedIndex = cmbRisk.Items.IndexOf(patient.PsyCard.SuicideRisk == null ? "" : patient.PsyCard.SuicideRisk);

            foreach (PersonalityType type in FormMain.myContext.PersonalityTypes)
            {
                comboPerson.Items.Add(type.Name);
            }
            comboPerson.SelectedIndex = FormMain.myContext.PersonalityTypes.ToList().IndexOf(patient.PsyCard.PersonalityType);

            if (patient.MedCard.Illnesses.Count > 0)
            {
                dataIllnesses.Rows.Add(patient.MedCard.Illnesses.Count);
                for (int i = 0; i < patient.MedCard.Illnesses.Count; i++)
                    dataIllnesses.Rows[i].Cells[0].Value = patient.MedCard.Illnesses[i].Disease;
            }

            if (patient.BehaviorCard.PoliceEvents.Count > 0)
            {
                dataEvents.Rows.Add(patient.BehaviorCard.PoliceEvents.Count);
                for (int i = 0; i < patient.BehaviorCard.PoliceEvents.Count; i++)
                {
                    dataEvents.Rows[i].Cells[0].Value = patient.BehaviorCard.PoliceEvents[i].Reason;
                    dataEvents.Rows[i].Cells[1].Value = patient.BehaviorCard.PoliceEvents[i].DateEvent;
                }
            }

            if (patient.Relatives.Count > 0)
            {
                dataRelatives.Rows.Add(patient.Relatives.Count);
                for (int i = 0; i < patient.Relatives.Count; i++)
                {
                    dataRelatives.Rows[i].Cells[0].Value = patient.Relatives[i].Kinsman;
                    dataRelatives.Rows[i].Cells[1].Value = patient.Relatives[i].Relations;
                }
            }

            _canAdd = true;
        }
Beispiel #4
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < dataGridViewNew.RowCount - 1; i++)
            {
                if (!RowIsEmpty(dataGridViewNew.Rows[i]))
                {
                    switch (_tableType)
                    {
                        case SampleType.Patients:
                            Patient newPatient = new Patient();
                            //Data.DataPatient dataPatient = new Data.DataPatient();

                            newPatient.MedCard = new MedCard();
                            //newPatient.MedAccount = new MedAccount();
                            newPatient.MilitaryCard = new MilitaryCard();
                            newPatient.PsyCard = new PsyCard();
                            newPatient.StudyCard = new StudyCard();
                            newPatient.WorkCard = new WorkCard();
                            newPatient.BehaviorCard = new BehaviorCard();
                            newPatient.FamilyCard = new FamilyCard();

                            foreach (DataGridView gridTable in tables)
                            {
                                if (!RowIsEmpty(gridTable.Rows[i]))
                                {
                                    _table = (DataTable)gridTable.DataSource;
                                    for (int j = 0; j < _table.Columns.Count; j++)
                                        Data.DataPatient.SetData(_table.Rows[i][_table.Columns[j].ColumnName], _table.Columns[j].ColumnName, ref newPatient);
                                }
                            }

                            int shipID = 0;
                            if (int.TryParse(dataGridViewMil[2, i].Value.ToString(), out shipID))
                            {
                                var ships = from ship in FormMain.myContext.Ships
                                            where ship.BoardNum == shipID
                                            select ship;
                                newPatient.MilitaryCard.Ship = ships.Single();
                            }

                            newPatient.MedCard.Illnesses.AddRange(_illnesses[i]);
                            newPatient.BehaviorCard.PoliceEvents.AddRange(_events[i]);
                            newPatient.Relatives.AddRange(_relatives[i]);

                            FormMain.myContext.Patients.InsertOnSubmit(newPatient);

                            break;

                        case SampleType.Ships:
                            Ship newShip = new Ship();

                            _table = (DataTable)dataGridViewNew.DataSource;
                            for (int j = 0; j < _table.Columns.Count; j++)
                                Data.DataShip.SetData(_table.Rows[i][_table.Columns[j].ColumnName], _table.Columns[j].ColumnName, ref newShip);

                            if (dataGridViewNew[2, i].Value.ToString() != "" && dataGridViewNew[3, i].Value.ToString() != "")
                            {
                                var officers = from officer in FormMain.myContext.Officers
                                            where officer.Surname == dataGridViewNew[2, i].Value.ToString() && officer.Name == dataGridViewNew[3, i].Value.ToString()
                                            select officer;
                                newShip.Officer = officers.Single();
                            }

                            FormMain.myContext.Ships.InsertOnSubmit(newShip);

                            break;

                        case SampleType.Officers:
                            Officer newOfficer = new Officer();

                            _table = (DataTable)dataGridViewNew.DataSource;
                            for (int j = 0; j < _table.Columns.Count; j++)
                                Data.DataOfficer.SetData(_table.Rows[i][_table.Columns[j].ColumnName], _table.Columns[j].ColumnName, ref newOfficer);

                            FormMain.myContext.Officers.InsertOnSubmit(newOfficer);

                            break;
                    }
                }
            }

            FormMain.myContext.SubmitChanges();
        }
Beispiel #5
0
		private void detach_Patients(Patient entity)
		{
			this.SendPropertyChanging();
			entity.FamilyCard = null;
		}
Beispiel #6
0
		private void attach_Patients(Patient entity)
		{
			this.SendPropertyChanging();
			entity.WorkCard = this;
		}
Beispiel #7
0
 partial void DeletePatient(Patient instance);
Beispiel #8
0
 partial void UpdatePatient(Patient instance);
Beispiel #9
0
 partial void InsertPatient(Patient instance);
Beispiel #10
0
        private void DeletePatient(Patient patient)
        {
            myContext.PoliceEvents.DeleteAllOnSubmit(patient.BehaviorCard.PoliceEvents);
               myContext.Illnesses.DeleteAllOnSubmit(patient.MedCard.Illnesses);
               myContext.Relatives.DeleteAllOnSubmit(patient.Relatives);
               myContext.Patients.DeleteOnSubmit(patient);
               myContext.MedCards.DeleteOnSubmit(patient.MedCard);
               myContext.MilitaryCards.DeleteOnSubmit(patient.MilitaryCard);
               myContext.FamilyCards.DeleteOnSubmit(patient.FamilyCard);
               myContext.StudyCards.DeleteOnSubmit(patient.StudyCard);
               myContext.WorkCards.DeleteOnSubmit(patient.WorkCard);
               myContext.PsyCards.DeleteOnSubmit(patient.PsyCard);
               myContext.BehaviorCards.DeleteOnSubmit(patient.BehaviorCard);

               myContext.SubmitChanges();
        }