Example #1
0
        public int New_(ChroniGenNHibernate.Enumerated.Chroni.SlotStatusEnum p_status, Nullable <DateTime> p_startDate, Nullable <DateTime> p_endDate, string p_note, int p_schedule)
        {
            SlotEN slotEN = null;
            int    oid;

            //Initialized SlotEN
            slotEN        = new SlotEN();
            slotEN.Status = p_status;

            slotEN.StartDate = p_startDate;

            slotEN.EndDate = p_endDate;

            slotEN.Note = p_note;


            if (p_schedule != -1)
            {
                // El argumento p_schedule -> Property schedule es oid = false
                // Lista de oids identifier
                slotEN.Schedule            = new ChroniGenNHibernate.EN.Chroni.ScheduleEN();
                slotEN.Schedule.Identifier = p_schedule;
            }

            //Call to SlotCAD

            oid = _ISlotCAD.New_(slotEN);
            return(oid);
        }
        public void SetStatus(int p_oid, ChroniGenNHibernate.Enumerated.Chroni.SlotStatusEnum p_status)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Slot_setStatus) ENABLED START*/

            // Write here your custom code...

            SlotCAD slotCAD = new SlotCAD();
            SlotCEN slotCEN = new SlotCEN(slotCAD);

            if (p_oid > 0)
            {
                SlotEN slot = slotCEN.ReadOID(p_oid);

                if (slot != null)
                {
                    if (p_status > 0)
                    {
                        slot.Status = p_status;
                        slotCAD.Modify(slot);
                    }
                }
            }

            /*PROTECTED REGION END*/
        }
Example #3
0
        public void SetStartDate(int p_oid, Nullable <DateTime> p_startDate)
        {
            /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Slot_setStartDate) ENABLED START*/

            // Write here your custom code...

            SlotCAD slotCAD = new SlotCAD();
            SlotCEN slotCEN = new SlotCEN(slotCAD);

            if (p_oid > 0)
            {
                SlotEN slot = slotCEN.ReadOID(p_oid);

                if (slot != null)
                {
                    if (p_startDate != null && p_startDate < slot.EndDate)
                    {
                        slot.StartDate = p_startDate;
                        slotCAD.Modify(slot);
                    }
                }
            }

            /*PROTECTED REGION END*/
        }
Example #4
0
        public SlotEN ReadOIDDefault(int identifier
                                     )
        {
            SlotEN slotEN = null;

            try
            {
                SessionInitializeTransaction();
                slotEN = (SlotEN)session.Get(typeof(SlotEN), identifier);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(slotEN);
        }
Example #5
0
        public void Destroy(int identifier
                            )
        {
            try
            {
                SessionInitializeTransaction();
                SlotEN slotEN = (SlotEN)session.Load(typeof(SlotEN), identifier);
                session.Delete(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();
            }
        }
Example #6
0
        public int New_(SlotEN slot)
        {
            try
            {
                SessionInitializeTransaction();
                if (slot.Schedule != null)
                {
                    // Argumento OID y no colección.
                    slot.Schedule = (ChroniGenNHibernate.EN.Chroni.ScheduleEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.ScheduleEN), slot.Schedule.Identifier);

                    slot.Schedule.Slot
                    .Add(slot);
                }

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

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


            finally
            {
                SessionClose();
            }

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

            // Write here your custom code...

            SlotCAD slotCAD = new SlotCAD();
            SlotCEN slotCEN = new SlotCEN(slotCAD);

            if (p_oid > 0)
            {
                SlotEN slot = slotCEN.ReadOID(p_oid);

                if (slot != null)
                {
                    if (!string.IsNullOrEmpty(p_note))
                    {
                        slot.Note = p_note;
                        slotCAD.Modify(slot);
                    }
                }
            }

            /*PROTECTED REGION END*/
        }
Example #8
0
        public SlotEN ReadOID(int identifier
                              )
        {
            SlotEN slotEN = null;

            slotEN = _ISlotCAD.ReadOID(identifier);
            return(slotEN);
        }
Example #9
0
        public void Modify(int p_Slot_OID, ChroniGenNHibernate.Enumerated.Chroni.SlotStatusEnum p_status, Nullable <DateTime> p_startDate, Nullable <DateTime> p_endDate, string p_note)
        {
            SlotEN slotEN = null;

            //Initialized SlotEN
            slotEN            = new SlotEN();
            slotEN.Identifier = p_Slot_OID;
            slotEN.Status     = p_status;
            slotEN.StartDate  = p_startDate;
            slotEN.EndDate    = p_endDate;
            slotEN.Note       = p_note;
            //Call to SlotCAD

            _ISlotCAD.Modify(slotEN);
        }
Example #10
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(SlotEN slot)
        {
            try
            {
                SessionInitializeTransaction();
                SlotEN slotEN = (SlotEN)session.Load(typeof(SlotEN), slot.Identifier);

                slotEN.Status = slot.Status;


                slotEN.StartDate = slot.StartDate;


                slotEN.EndDate = slot.EndDate;


                slotEN.Note = slot.Note;



                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();
            }
        }