Ejemplo n.º 1
0
        private void Posesenie_Load(object sender, EventArgs e)
        {
            posesenieTableAdapter.Adapter.RowUpdated  += new System.Data.OleDb.OleDbRowUpdatedEventHandler(PosesenieAdapter_RowUpdated);
            treatDSTableAdapter.Adapter.RowUpdated    += new OleDbRowUpdatedEventHandler(DSAdapter_RowUpdated);
            treatTreatTableAdapter.Adapter.RowUpdated += new OleDbRowUpdatedEventHandler(TRAdapter_RowUpdated);

            PID = (int)this.Tag;

            Pfio             = patientsTableAdapter.GetDataBy(PID)[0].PFIO;
            labelPatFIO.Text = Pfio;
            this.Text        = "Лечение: " + Pfio;

            PosRow          = ___bASA__DataSet.Posesenie.NewPosesenieRow();
            PosRow.Personal = 0;
            PosRow.Patient  = PID;
            PosRow.Narad    = false;
            PosRow.Data     = now;
            PosRow.Summa    = 0;
            PosRow.Zaloby   = PosRow.Anamnez = PosRow.Obekt = PosRow.Treat = PosRow.Diagnos = "";
            ___bASA__DataSet.Posesenie.AddPosesenieRow(PosRow);
            personalVievTableAdapter1.FillBy(___bASA__DataSet.PersonalViev, true, true);

            this.anamnezTableAdapter.FillByReal(this.___bASA__DataSet.Anamnez, true);
            obektTableAdapter.FillByReal(this.___bASA__DataSet.Obekt, true);
            zalobyTableAdapter.FillByReal(___bASA__DataSet.Zaloby, true);
            diagnosisTableAdapter.FillByReal(___bASA__DataSet.Diagnosis, true);
            treatTableAdapter.FillByReal(___bASA__DataSet.Treat, true);
            splitContainer_TR.Panel2Collapsed = splitContainer_DS.Panel2Collapsed = true;

            toolStripButtonNarad.Enabled = toolStripButton_Save.Enabled = toolStripButtonNoNarad.Enabled = false;
        }
Ejemplo n.º 2
0
        void Save(bool onClose, bool isNarad)
        {
            DS_DataGridView.RowsAdded         -= DS_DataGridView_RowsAdded;
            DS_DataGridView.RowsRemoved       -= DS_DataGridView_RowsRemoved;
            Tr_dataGridView.RowsAdded         -= Tr_dataGridView_RowsAdded;
            Tr_dataGridView.RowsRemoved       -= Tr_dataGridView_RowsRemoved;
            richTextBox_TR_MY.ContentsResized -= richTextBox_TR_MY_ContentsResized_1;
            richTextBox_DS_MY.ContentsResized -= richTextBox_DS_MY_ContentsResized;

            this.Validate();
            if (dateTimePicker1.Value.Date != now.Date)
            {
                ___bASA__DataSet.Posesenie[0].Data = dateTimePicker1.Value.Date;
            }
            decimal d = numericUpDown1.Value;

            treatDSBindingSource.EndEdit();
            treatDSBindingSource2.EndEdit();
            treatTreatBindingSource.EndEdit();
            treatTreatBindingSource2.EndEdit();

            if (splitContainer_DS.Panel2Collapsed)
            {
                myDS();
            }
            if (splitContainer_TR.Panel2Collapsed)
            {
                myTR();
            }

            if (onClose)
            {
                if (isNarad)
                {
                    ___bASA__DataSet.Posesenie[0].Summa = d;
                    ___bASA__DataSet.Posesenie[0].Narad = true;
                }
                else
                {
                    ___bASA__DataSet.Posesenie[0].Summa = 0;
                    ___bASA__DataSet.Posesenie[0].Narad = false;
                }
                toolStripButtonNoNarad.Enabled = toolStripButtonNarad.Enabled = false;
            }
            posesenieBindingSource.EndEdit();
            posesenieTableAdapter.Update(___bASA__DataSet.Posesenie);

            if (posesenieN == 0)
            {
                posesenieN = ___bASA__DataSet.Posesenie[0].ID;

                foreach (___BASA__DataSet.TreatDSRow DSr in ___bASA__DataSet.TreatDS.Select("Posesenie<>" + posesenieN.ToString()))
                {
                    DSr.Posesenie = posesenieN;
                }
                foreach (___BASA__DataSet.TreatTreatRow TRr in ___bASA__DataSet.TreatTreat.Select("Posesenie<>" + posesenieN.ToString()))
                {
                    TRr.Posesenie = posesenieN;
                }
            }

            if (onClose)
            {
                if (isNarad)
                {
                    if (d != 0)
                    {
                        dolgTableAdapter.Insert(___bASA__DataSet.Posesenie[0].ID, d);
                    }
                }
                treatDSTableAdapter.Update(___bASA__DataSet.TreatDS);
                treatTreatTableAdapter.Update(___bASA__DataSet.TreatTreat);
            }
            else
            {
                ___BASA__DataSet.TreatDSDataTable chengDS = (___BASA__DataSet.TreatDSDataTable)___bASA__DataSet.TreatDS.GetChanges();
                if (chengDS != null)
                {
                    treatDSTableAdapter.Update(chengDS);
                    ___bASA__DataSet.TreatDS.Merge(chengDS);
                    ___bASA__DataSet.TreatDS.AcceptChanges();
                }

                ___BASA__DataSet.TreatTreatDataTable chengTR = (___BASA__DataSet.TreatTreatDataTable)___bASA__DataSet.TreatTreat.GetChanges();
                if (chengTR != null)
                {
                    treatTreatTableAdapter.Update(chengTR);
                    ___bASA__DataSet.TreatTreat.Merge(chengTR);
                    ___bASA__DataSet.TreatTreat.AcceptChanges();
                }

                numericUpDown1.Value = d;
                PosRow = ___bASA__DataSet.Posesenie[0];
                Tr_dataGridView.RowsAdded         += Tr_dataGridView_RowsAdded;
                Tr_dataGridView.RowsRemoved       += Tr_dataGridView_RowsRemoved;
                DS_DataGridView.RowsAdded         += DS_DataGridView_RowsAdded;
                DS_DataGridView.RowsRemoved       += DS_DataGridView_RowsRemoved;
                richTextBox_DS_MY.ContentsResized += richTextBox_DS_MY_ContentsResized;
                richTextBox_TR_MY.ContentsResized += richTextBox_TR_MY_ContentsResized_1;

                toolStripButton_Save.Enabled = false;
            }
        }