示例#1
0
        public void UnassignSchedule(int p_Practitioner_OID, System.Collections.Generic.IList <int> p_schedule_OIDs)
        {
            try
            {
                SessionInitializeTransaction();
                ChroniGenNHibernate.EN.Chroni.PractitionerEN practitionerEN = null;
                practitionerEN = (PractitionerEN)session.Load(typeof(PractitionerEN), p_Practitioner_OID);

                ChroniGenNHibernate.EN.Chroni.ScheduleEN scheduleENAux = null;
                if (practitionerEN.Schedule != null)
                {
                    foreach (int item in p_schedule_OIDs)
                    {
                        scheduleENAux = (ChroniGenNHibernate.EN.Chroni.ScheduleEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.ScheduleEN), item);
                        if (practitionerEN.Schedule.Contains(scheduleENAux) == true)
                        {
                            practitionerEN.Schedule.Remove(scheduleENAux);
                            scheduleENAux.Practitioner = null;
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_schedule_OIDs you are trying to unrelationer, doesn't exist in PractitionerEN");
                        }
                    }
                }

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

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


            finally
            {
                SessionClose();
            }
        }
示例#2
0
        public void AssignSchedule(int p_Practitioner_OID, System.Collections.Generic.IList <int> p_schedule_OIDs)
        {
            ChroniGenNHibernate.EN.Chroni.PractitionerEN practitionerEN = null;
            try
            {
                SessionInitializeTransaction();
                practitionerEN = (PractitionerEN)session.Load(typeof(PractitionerEN), p_Practitioner_OID);
                ChroniGenNHibernate.EN.Chroni.ScheduleEN scheduleENAux = null;
                if (practitionerEN.Schedule == null)
                {
                    practitionerEN.Schedule = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.ScheduleEN>();
                }

                foreach (int item in p_schedule_OIDs)
                {
                    scheduleENAux = new ChroniGenNHibernate.EN.Chroni.ScheduleEN();
                    scheduleENAux = (ChroniGenNHibernate.EN.Chroni.ScheduleEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.ScheduleEN), item);
                    scheduleENAux.Practitioner = practitionerEN;

                    practitionerEN.Schedule.Add(scheduleENAux);
                }


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

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


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

            if (t == null)
            {
                return(false);
            }
            if (Identifier.Equals(t.Identifier))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public ScheduleEN(ScheduleEN schedule)
 {
     this.init(Identifier, schedule.Slot, schedule.Practitioner, schedule.Location, schedule.Active, schedule.MorningStart, schedule.MorningEnd, schedule.AfternoonStart, schedule.AfternoonEnd, schedule.DateStart, schedule.DateEnd);
 }