Example #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;

        }    
Example #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;
     }
 }
Example #3
0
        public void CreateProtocolWindow(CStateBox box) 
        {

            pw = new PatientProtocolForm(box);
            pw.Show();
            

        } 
Example #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; 
         }
        
        }