Exemple #1
0
        /*
         * public PatientProtocolForm(CStateBox box)
         * {
         *
         *  InitializeComponent();
         *
         *  dt2 = box.date;
         *
         *  protocol2 = new CProtocol();
         *  protocol2 = box.protocol;
         *  protocol2.sid = box.patient.pid;   // теперь мы можем найти по исследованию id пациента
         *
         *  initials2.Text = box.patient.initials.surname;
         *  sex2.Text = box.patient.sex;
         *  birthdate2.Text = box.patient.birth_date.date;
         *  ambcard2.Text = box.patient.amb_card;
         *  child2.Text = box.patient.is_child;
         *  modality2.Text = box.study.modality;
         *
         *  shadow.sql.RetrieveProtocol(protocol2, dt2);
         *  //protocol2.sid = 0;  // для корректности
         *  pr_box.Text = protocol2.text;
         *
         * }
         * */


        public PatientProtocolForm(CStateBox box)
        {
            InitializeComponent();

            this.box          = new CStateBox();
            this.box.patient  = new CPatient();
            this.box.study    = new CStudy();
            this.box.protocol = new CProtocol();
            this.box.locker   = new object();

            this.box.patient  = box.patient;
            this.box.study    = box.study;
            this.box.protocol = box.protocol;
            this.box.date     = box.date;
            this.box.locker   = box.locker;

            this.box.state        = State.WaitForAction;
            this.box.protocol.sid = box.patient.pid;  // !!!

            text_was_changed = false;

            initials2.Text  = box.patient.initials.surname;
            sex2.Text       = box.patient.sex;
            birthdate2.Text = box.patient.birth_date.date;
            ambcard2.Text   = box.patient.amb_card;
            child2.Text     = box.patient.is_child;
            modality2.Text  = box.study.modality;

            //box.protocol.sid = 0;  // для корректности
            pr_box.Text = this.box.protocol.text;
        }
Exemple #2
0
 public void SetBoxText(CStateBox obj)
 {
     lock (obj.locker)
     {
         if (obj.protocol != null && obj.protocol.text != null && pw.box.protocol != null && pw.box.protocol.text != null && pw.box != null)
         {
             obj.protocol.text = pw.box.protocol.text;
         }
     }
 }
Exemple #3
0
        /*Запуск методов для работы с базой данных*/

        /*
         * public void WorkWithDB(object o)
         * {
         *
         *  //State state = (State)o;  // ????
         *  CStateBox obj = (CStateBox)o;
         *
         *  while (true)
         *  {
         *      switch (obj.state)
         *      {
         *          case State.UpdateDataFromDB:
         *              {
         *                  //sql.CheckDB(obj);  // ????
         *                  autoEvent.WaitOne();
         *                  break;
         *              }
         *          case State.SendData:
         *              {
         *                  //sql.AddPatientObj();
         *                  autoEvent.WaitOne();
         *                  break;
         *              }
         *          case State.RetrievePatientData:
         *              {
         *
         *                  autoEvent.WaitOne();
         *                  break;
         *              }
         *          case State.RetrieveCustomData:
         *              {
         *                  autoEvent.WaitOne();
         *                  break;
         *              }
         *              //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         *          case State.QuickSave:
         *              {
         *                  sql.UpdateProtocol(obj);
         *                  autoEvent.WaitOne();
         *                  break;
         *              }
         *              //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         *          case State.Finish:
         *              {
         *                  autoEvent.WaitOne();
         *                  break;
         *              }
         *
         *      }
         *  }
         * }
         * */


        /*
         * public void SetState(); // устанавливает состояние для модуля
         * TransferData(); // передача данных от одного модуля, другому
         * SendMessage(); // отправляет сообщение модулю
         */
        public void WorkWithWindows(object o)
        {
            CStateBox obj = (CStateBox)o;


            while (true)
            {
                switch (win.pw.box.state)
                {
                case State.MakeaWindow:
                {
                    break;
                }

                /*
                 * case State.QuickLoad:
                 *  {
                 *      sql.RetrieveProtocol(obj);
                 *      win.pw.box.state = State.WaitForAction;
                 *      break;
                 *  }
                 */
                case State.QuickSave:
                {
                    sql.UpdateProtocol(obj);
                    win.pw.box.state = State.WaitForAction;

                    break;
                }

                case State.Finish:
                {
                    box.state = State.Finish;
                    return;
                }

                /* в протоколе исследования произошло изменения*/
                case State.TextChanged:
                {
                    win.SetBoxText(obj);
                    win.pw.box.state = State.QuickSave;
                    break;
                }

                case State.WaitForAction: { break; }
                }
            }
        }
Exemple #4
0
        /*параллельная версия*/
        public void UpdateProtocol(CStateBox box)
        {
            lock (box.locker){
                conn.Open();

                NpgsqlTransaction t    = conn.BeginTransaction();
                NpgsqlCommand     comm = new NpgsqlCommand("\"UpdateProtocol\"", conn);

                NpgsqlParameter pid  = new NpgsqlParameter("pid", NpgsqlTypes.NpgsqlDbType.Integer);
                NpgsqlParameter dat  = new NpgsqlParameter("dat", NpgsqlTypes.NpgsqlDbType.Date);
                NpgsqlParameter text = new NpgsqlParameter("text", NpgsqlTypes.NpgsqlDbType.Varchar);


                pid.Direction  = ParameterDirection.Input;
                dat.Direction  = ParameterDirection.Input;
                text.Direction = ParameterDirection.Input;


                comm.Parameters.Add(pid);
                comm.Parameters.Add(dat);
                comm.Parameters.Add(text);

                comm.Parameters[0].Value = box.protocol.sid;
                comm.Parameters[1].Value = box.date.Date;
                comm.Parameters[2].Value = box.protocol.text;

                comm.CommandType = CommandType.StoredProcedure;

                try
                {
                    var result = comm.ExecuteScalar();
                    //box.protocol.text = (string)result;
                }
                finally
                {
                    t.Commit();
                    conn.Close();
                }
                return;
            }
        }
 public void OnInit(CStateBox stateBox, float deathTime)
 {
     base.OnInit(stateBox);
     _deathTime = deathTime;
 }
 public virtual void OnInit(CStateBox stateBox)
 {
     StateBox = stateBox;
 }
Exemple #7
0
 public void OnInit(CStateBox stateBox, float spwanTime)
 {
     base.OnInit(stateBox);
     _spwanTime = spwanTime;
 }
 public void OnInit(CStateBox stateBox, float waitTime)
 {
     base.OnInit(stateBox);
     _waiteTime = waitTime;
     _autoSpawn = true;
 }
        private bool _isAfterBornPauseDone; // 出生后的暂停动作是否完成

        public void OnInit(CStateBox stateBox, float pauseTime)
        {
            base.OnInit(stateBox);
            _pauseTime = pauseTime;
        }
Exemple #10
0
 public void CreateProtocolWindow(CStateBox box)
 {
     pw = new PatientProtocolForm(box);
     pw.Show();
 }