public void Destroy(int identifier
                            )
        {
            try
            {
                SessionInitializeTransaction();
                ScheduleEN scheduleEN = (ScheduleEN)session.Load(typeof(ScheduleEN), identifier);
                session.Delete(scheduleEN);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }
        }
        public ScheduleEN ReadOID(int identifier
                                  )
        {
            ScheduleEN scheduleEN = null;

            scheduleEN = _IScheduleCAD.ReadOID(identifier);
            return(scheduleEN);
        }
// Modify default (Update all attributes of the class)

        public void ModifyDefault(ScheduleEN schedule)
        {
            try
            {
                SessionInitializeTransaction();
                ScheduleEN scheduleEN = (ScheduleEN)session.Load(typeof(ScheduleEN), schedule.Identifier);



                scheduleEN.Active = schedule.Active;


                scheduleEN.MorningStart = schedule.MorningStart;


                scheduleEN.MorningEnd = schedule.MorningEnd;


                scheduleEN.AfternoonStart = schedule.AfternoonStart;


                scheduleEN.AfternoonEnd = schedule.AfternoonEnd;


                scheduleEN.DateStart = schedule.DateStart;


                scheduleEN.DateEnd = schedule.DateEnd;

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

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


            finally
            {
                SessionClose();
            }
        }
        public void Modify(int p_Schedule_OID, bool p_active, Nullable <DateTime> p_morningStart, Nullable <DateTime> p_morningEnd, Nullable <DateTime> p_afternoonStart, Nullable <DateTime> p_afternoonEnd, Nullable <DateTime> p_dateStart, Nullable <DateTime> p_dateEnd)
        {
            ScheduleEN scheduleEN = null;

            //Initialized ScheduleEN
            scheduleEN                = new ScheduleEN();
            scheduleEN.Identifier     = p_Schedule_OID;
            scheduleEN.Active         = p_active;
            scheduleEN.MorningStart   = p_morningStart;
            scheduleEN.MorningEnd     = p_morningEnd;
            scheduleEN.AfternoonStart = p_afternoonStart;
            scheduleEN.AfternoonEnd   = p_afternoonEnd;
            scheduleEN.DateStart      = p_dateStart;
            scheduleEN.DateEnd        = p_dateEnd;
            //Call to ScheduleCAD

            _IScheduleCAD.Modify(scheduleEN);
        }
Ejemplo n.º 5
0
        public int New_(int p_practitioner, int p_location, bool p_active, Nullable <DateTime> p_morningStart, Nullable <DateTime> p_morningEnd, Nullable <DateTime> p_afternoonStart, Nullable <DateTime> p_afternoonEnd, Nullable <DateTime> p_dateStart, Nullable <DateTime> p_dateEnd)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Schedule_new__customized) START*/

            ScheduleEN scheduleEN = null;

            int oid;

            //Initialized ScheduleEN
            scheduleEN = new ScheduleEN();

            if (p_practitioner != -1)
            {
                scheduleEN.Practitioner            = new ChroniGenNHibernate.EN.Chroni.PractitionerEN();
                scheduleEN.Practitioner.Identifier = p_practitioner;
            }


            if (p_location != -1)
            {
                scheduleEN.Location            = new ChroniGenNHibernate.EN.Chroni.LocationEN();
                scheduleEN.Location.Identifier = p_location;
            }

            scheduleEN.Active = p_active;

            scheduleEN.MorningStart = p_morningStart;

            scheduleEN.MorningEnd = p_morningEnd;

            scheduleEN.AfternoonStart = p_afternoonStart;

            scheduleEN.AfternoonEnd = p_afternoonEnd;

            scheduleEN.DateStart = p_dateStart;

            scheduleEN.DateEnd = p_dateEnd;

            //Call to ScheduleCAD

            oid = _IScheduleCAD.New_(scheduleEN);
            return(oid);
            /*PROTECTED REGION END*/
        }
        public int New_(ScheduleEN schedule)
        {
            try
            {
                SessionInitializeTransaction();
                if (schedule.Practitioner != null)
                {
                    // Argumento OID y no colección.
                    schedule.Practitioner = (ChroniGenNHibernate.EN.Chroni.PractitionerEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.PractitionerEN), schedule.Practitioner.Identifier);

                    schedule.Practitioner.Schedule
                    .Add(schedule);
                }
                if (schedule.Location != null)
                {
                    // Argumento OID y no colección.
                    schedule.Location = (ChroniGenNHibernate.EN.Chroni.LocationEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.LocationEN), schedule.Location.Identifier);

                    schedule.Location.Schedule
                    .Add(schedule);
                }

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

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


            finally
            {
                SessionClose();
            }

            return(schedule.Identifier);
        }
Ejemplo n.º 7
0
        public void SetActive(int p_oid, bool p_active)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Schedule_setActive) ENABLED START*/

            // Write here your custom code...

            ScheduleCAD scheduleCAD = new ScheduleCAD();
            ScheduleCEN scheduleCEN = new ScheduleCEN(scheduleCAD);

            if (p_oid > 0)
            {
                ScheduleEN schedule = scheduleCEN.ReadOID(p_oid);

                if (schedule != null)
                {
                    schedule.Active = p_active;
                    scheduleCAD.Modify(schedule);
                }
            }

            /*PROTECTED REGION END*/
        }