Example #1
0
        public void AssignEncounter(int p_Slot_OID, int p_encounter_OID)
        {
            ChroniGenNHibernate.EN.Chroni.SlotEN slotEN = null;
            try
            {
                SessionInitializeTransaction();
                slotEN           = (SlotEN)session.Load(typeof(SlotEN), p_Slot_OID);
                slotEN.Encounter = (ChroniGenNHibernate.EN.Chroni.EncounterEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.EncounterEN), p_encounter_OID);

                slotEN.Encounter.Slot = slotEN;



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

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


            finally
            {
                SessionClose();
            }
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            SlotEN t = obj as SlotEN;

            if (t == null)
            {
                return(false);
            }
            if (Identifier.Equals(t.Identifier))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public void UnassignEncounter(int p_Slot_OID, int p_encounter_OID)
        {
            try
            {
                SessionInitializeTransaction();
                ChroniGenNHibernate.EN.Chroni.SlotEN slotEN = null;
                slotEN = (SlotEN)session.Load(typeof(SlotEN), p_Slot_OID);

                if (slotEN.Encounter.Identifier == p_encounter_OID)
                {
                    slotEN.Encounter = null;
                    ChroniGenNHibernate.EN.Chroni.EncounterEN encounterEN = (ChroniGenNHibernate.EN.Chroni.EncounterEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.EncounterEN), p_encounter_OID);
                    encounterEN.Slot = null;
                }
                else
                {
                    throw new ModelException("The identifier " + p_encounter_OID + " in p_encounter_OID you are trying to unrelationer, doesn't exist in SlotEN");
                }

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

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


            finally
            {
                SessionClose();
            }
        }
 public SlotEN(SlotEN slot)
 {
     this.init(Identifier, slot.Status, slot.StartDate, slot.EndDate, slot.Note, slot.Encounter, slot.Schedule);
 }