public void SetValue2(int p_oid, double p_value2)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Observation_setValue2) ENABLED START*/

            // Write here your custom code...

            ObservationCAD observationCAD = new ObservationCAD();
            ObservationCEN observationCEN = new ObservationCEN(observationCAD);

            if (p_oid > 0)
            {
                ObservationEN observation = observationCEN.ReadOID(p_oid);

                if (observation != null)
                {
                    if (p_value2 >= 0)
                    {
                        observation.Value2 = p_value2;
                        observationCAD.Modify(observation);
                    }
                }
            }

            /*PROTECTED REGION END*/
        }
        public void SetMeasureType(int p_oid, ChroniGenNHibernate.Enumerated.Chroni.MeasureTypeEnum p_measureType)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Observation_setMeasureType) ENABLED START*/

            // Write here your custom code...

            ObservationCAD observationCAD = new ObservationCAD();
            ObservationCEN observationCEN = new ObservationCEN(observationCAD);

            if (p_oid > 0)
            {
                ObservationEN observation = observationCEN.ReadOID(p_oid);

                if (observation != null)
                {
                    if (p_measureType > 0)
                    {
                        observation.MeasureType = p_measureType;
                        observationCAD.Modify(observation);
                    }
                }
            }

            /*PROTECTED REGION END*/
        }
Exemple #3
0
        public void Destroy(int identifier
                            )
        {
            try
            {
                SessionInitializeTransaction();
                ObservationEN observationEN = (ObservationEN)session.Load(typeof(ObservationEN), identifier);
                session.Delete(observationEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is ChroniGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in ObservationCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Exemple #4
0
        public void SetDateObservation(int p_oid, Nullable <DateTime> p_dateObservation)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Observation_setDateObservation) ENABLED START*/

            // Write here your custom code...

            ObservationCAD observationCAD = new ObservationCAD();
            ObservationCEN observationCEN = new ObservationCEN(observationCAD);

            if (p_oid > 0)
            {
                ObservationEN observation = observationCEN.ReadOID(p_oid);

                if (observation != null)
                {
                    if (p_dateObservation != null)
                    {
                        observation.DateObservation = p_dateObservation;
                        observationCAD.Modify(observation);
                    }
                }
            }

            /*PROTECTED REGION END*/
        }
Exemple #5
0
        public ObservationEN ReadOIDDefault(int identifier
                                            )
        {
            ObservationEN observationEN = null;

            try
            {
                SessionInitializeTransaction();
                observationEN = (ObservationEN)session.Get(typeof(ObservationEN), identifier);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is ChroniGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in ObservationCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(observationEN);
        }
Exemple #6
0
        public int New_(ObservationEN observation)
        {
            try
            {
                SessionInitializeTransaction();
                if (observation.Diary != null)
                {
                    // Argumento OID y no colección.
                    observation.Diary = (ChroniGenNHibernate.EN.Chroni.DiaryEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.DiaryEN), observation.Diary.Identifier);

                    observation.Diary.Observation
                    .Add(observation);
                }

                session.Save(observation);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is ChroniGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in ObservationCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(observation.Identifier);
        }
Exemple #7
0
        public void SetNote(int p_oid, string p_note)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Observation_setNote) ENABLED START*/

            // Write here your custom code...

            ObservationCAD observationCAD = new ObservationCAD();
            ObservationCEN observationCEN = new ObservationCEN(observationCAD);

            if (p_oid > 0)
            {
                ObservationEN observation = observationCEN.ReadOID(p_oid);

                if (observation != null)
                {
                    if (!string.IsNullOrEmpty(p_note))
                    {
                        observation.Note = p_note;
                        observationCAD.Modify(observation);
                    }
                }
            }

            /*PROTECTED REGION END*/
        }
Exemple #8
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(ObservationEN observation)
        {
            try
            {
                SessionInitializeTransaction();
                ObservationEN observationEN = (ObservationEN)session.Load(typeof(ObservationEN), observation.Identifier);

                observationEN.MeasureType = observation.MeasureType;


                observationEN.Name = observation.Name;


                observationEN.DateEntry = observation.DateEntry;


                observationEN.Note = observation.Note;


                observationEN.DateAdded = observation.DateAdded;



                observationEN.DateObservation = observation.DateObservation;


                observationEN.Category = observation.Category;


                observationEN.Grade = observation.Grade;


                observationEN.Value1 = observation.Value1;


                observationEN.Value2 = observation.Value2;


                observationEN.PersonOID = observation.PersonOID;

                session.Update(observationEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is ChroniGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in ObservationCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Exemple #9
0
        public ObservationEN ReadOID(int identifier
                                     )
        {
            ObservationEN observationEN = null;

            observationEN = _IObservationCAD.ReadOID(identifier);
            return(observationEN);
        }
Exemple #10
0
        public int New_(ChroniGenNHibernate.Enumerated.Chroni.MeasureTypeEnum p_measureType, string p_name, Nullable <DateTime> p_dateEntry, string p_note, Nullable <DateTime> p_dateAdded, int p_diary, Nullable <DateTime> p_dateObservation, ChroniGenNHibernate.Enumerated.Chroni.ObservationCategoryEnum p_category, ChroniGenNHibernate.Enumerated.Chroni.SymptomGradeEnum p_grade, double p_value1, double p_value2, int p_personOID)
        {
            ObservationEN observationEN = null;
            int           oid;

            //Initialized ObservationEN
            observationEN             = new ObservationEN();
            observationEN.MeasureType = p_measureType;

            observationEN.Name = p_name;

            observationEN.DateEntry = p_dateEntry;

            observationEN.Note = p_note;

            observationEN.DateAdded = p_dateAdded;


            if (p_diary != -1)
            {
                // El argumento p_diary -> Property diary es oid = false
                // Lista de oids identifier
                observationEN.Diary            = new ChroniGenNHibernate.EN.Chroni.DiaryEN();
                observationEN.Diary.Identifier = p_diary;
            }

            observationEN.DateObservation = p_dateObservation;

            observationEN.Category = p_category;

            observationEN.Grade = p_grade;

            observationEN.Value1 = p_value1;

            observationEN.Value2 = p_value2;

            observationEN.PersonOID = p_personOID;

            //Call to ObservationCAD

            oid = _IObservationCAD.New_(observationEN);
            return(oid);
        }
Exemple #11
0
        public void Modify(int p_Observation_OID, ChroniGenNHibernate.Enumerated.Chroni.MeasureTypeEnum p_measureType, string p_name, Nullable <DateTime> p_dateEntry, string p_note, Nullable <DateTime> p_dateAdded, Nullable <DateTime> p_dateObservation, ChroniGenNHibernate.Enumerated.Chroni.ObservationCategoryEnum p_category, ChroniGenNHibernate.Enumerated.Chroni.SymptomGradeEnum p_grade, double p_value1, double p_value2, int p_personOID)
        {
            ObservationEN observationEN = null;

            //Initialized ObservationEN
            observationEN                 = new ObservationEN();
            observationEN.Identifier      = p_Observation_OID;
            observationEN.MeasureType     = p_measureType;
            observationEN.Name            = p_name;
            observationEN.DateEntry       = p_dateEntry;
            observationEN.Note            = p_note;
            observationEN.DateAdded       = p_dateAdded;
            observationEN.DateObservation = p_dateObservation;
            observationEN.Category        = p_category;
            observationEN.Grade           = p_grade;
            observationEN.Value1          = p_value1;
            observationEN.Value2          = p_value2;
            observationEN.PersonOID       = p_personOID;
            //Call to ObservationCAD

            _IObservationCAD.Modify(observationEN);
        }