コード例 #1
0
        public void AssignPosition(int p_Location_OID, int p_position_OID)
        {
            ChroniGenNHibernate.EN.Chroni.LocationEN locationEN = null;
            try
            {
                SessionInitializeTransaction();
                locationEN          = (LocationEN)session.Load(typeof(LocationEN), p_Location_OID);
                locationEN.Position = (ChroniGenNHibernate.EN.Chroni.PositionEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.PositionEN), p_position_OID);

                locationEN.Position.Location = locationEN;



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

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


            finally
            {
                SessionClose();
            }
        }
コード例 #2
0
        public int New_(string p_nif, bool p_active, string p_name, string p_surnames, ChroniGenNHibernate.Enumerated.Chroni.GenderEnum p_gender, Nullable <DateTime> p_birthDate, bool p_deceased, string p_address, string p_email, string p_phone, ChroniGenNHibernate.Enumerated.Chroni.MaritalStatusEnum p_maritalStatus, string p_photo, System.Collections.Generic.IList <int> p_location, ChroniGenNHibernate.EN.Chroni.DiaryEN p_diary, String p_password)
        {
            PatientEN patientEN = null;
            int       oid;

            //Initialized PatientEN
            patientEN     = new PatientEN();
            patientEN.Nif = p_nif;

            patientEN.Active = p_active;

            patientEN.Name = p_name;

            patientEN.Surnames = p_surnames;

            patientEN.Gender = p_gender;

            patientEN.BirthDate = p_birthDate;

            patientEN.Deceased = p_deceased;

            patientEN.Address = p_address;

            patientEN.Email = p_email;

            patientEN.Phone = p_phone;

            patientEN.MaritalStatus = p_maritalStatus;

            patientEN.Photo = p_photo;


            patientEN.Location = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.LocationEN>();
            if (p_location != null)
            {
                foreach (int item in p_location)
                {
                    ChroniGenNHibernate.EN.Chroni.LocationEN en = new ChroniGenNHibernate.EN.Chroni.LocationEN();
                    en.Identifier = item;
                    patientEN.Location.Add(en);
                }
            }

            else
            {
                patientEN.Location = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.LocationEN>();
            }

            patientEN.Diary = p_diary;

            patientEN.Password = Utils.Util.GetEncondeMD5(p_password);

            //Call to PatientCAD

            oid = _IPatientCAD.New_(patientEN);
            return(oid);
        }
コード例 #3
0
        public int New_(string p_nif, bool p_active, ChroniGenNHibernate.Enumerated.Chroni.PractitionerRoleEnum p_role, string p_name, string p_surnames, ChroniGenNHibernate.Enumerated.Chroni.GenderEnum p_gender, Nullable <DateTime> p_birthDate, string p_address, string p_email, string p_phone, string p_photo, Nullable <DateTime> p_startDate, Nullable <DateTime> p_endDate, System.Collections.Generic.IList <int> p_location, String p_password)
        {
            PractitionerEN practitionerEN = null;
            int            oid;

            //Initialized PractitionerEN
            practitionerEN     = new PractitionerEN();
            practitionerEN.Nif = p_nif;

            practitionerEN.Active = p_active;

            practitionerEN.Role = p_role;

            practitionerEN.Name = p_name;

            practitionerEN.Surnames = p_surnames;

            practitionerEN.Gender = p_gender;

            practitionerEN.BirthDate = p_birthDate;

            practitionerEN.Address = p_address;

            practitionerEN.Email = p_email;

            practitionerEN.Phone = p_phone;

            practitionerEN.Photo = p_photo;

            practitionerEN.StartDate = p_startDate;

            practitionerEN.EndDate = p_endDate;


            practitionerEN.Location = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.LocationEN>();
            if (p_location != null)
            {
                foreach (int item in p_location)
                {
                    ChroniGenNHibernate.EN.Chroni.LocationEN en = new ChroniGenNHibernate.EN.Chroni.LocationEN();
                    en.Identifier = item;
                    practitionerEN.Location.Add(en);
                }
            }

            else
            {
                practitionerEN.Location = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.LocationEN>();
            }

            practitionerEN.Password = Utils.Util.GetEncondeMD5(p_password);

            //Call to PractitionerCAD

            oid = _IPractitionerCAD.New_(practitionerEN);
            return(oid);
        }
コード例 #4
0
        public void UnassignLocation(int p_Patient_OID, System.Collections.Generic.IList <int> p_location_OIDs)
        {
            try
            {
                SessionInitializeTransaction();
                ChroniGenNHibernate.EN.Chroni.PatientEN patientEN = null;
                patientEN = (PatientEN)session.Load(typeof(PatientEN), p_Patient_OID);

                ChroniGenNHibernate.EN.Chroni.LocationEN locationENAux = null;
                if (patientEN.Location != null)
                {
                    foreach (int item in p_location_OIDs)
                    {
                        locationENAux = (ChroniGenNHibernate.EN.Chroni.LocationEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.LocationEN), item);
                        if (patientEN.Location.Contains(locationENAux) == true)
                        {
                            patientEN.Location.Remove(locationENAux);
                            locationENAux.Patient.Remove(patientEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_location_OIDs you are trying to unrelationer, doesn't exist in PatientEN");
                        }
                    }
                }

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

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


            finally
            {
                SessionClose();
            }
        }
コード例 #5
0
        public void AssignLocation(int p_Patient_OID, System.Collections.Generic.IList <int> p_location_OIDs)
        {
            ChroniGenNHibernate.EN.Chroni.PatientEN patientEN = null;
            try
            {
                SessionInitializeTransaction();
                patientEN = (PatientEN)session.Load(typeof(PatientEN), p_Patient_OID);
                ChroniGenNHibernate.EN.Chroni.LocationEN locationENAux = null;
                if (patientEN.Location == null)
                {
                    patientEN.Location = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.LocationEN>();
                }

                foreach (int item in p_location_OIDs)
                {
                    locationENAux = new ChroniGenNHibernate.EN.Chroni.LocationEN();
                    locationENAux = (ChroniGenNHibernate.EN.Chroni.LocationEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.LocationEN), item);
                    locationENAux.Patient.Add(patientEN);

                    patientEN.Location.Add(locationENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
コード例 #6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            LocationEN t = obj as LocationEN;

            if (t == null)
            {
                return(false);
            }
            if (Identifier.Equals(t.Identifier))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
        public void UnassignPosition(int p_Location_OID, int p_position_OID)
        {
            try
            {
                SessionInitializeTransaction();
                ChroniGenNHibernate.EN.Chroni.LocationEN locationEN = null;
                locationEN = (LocationEN)session.Load(typeof(LocationEN), p_Location_OID);

                if (locationEN.Position.Identifier == p_position_OID)
                {
                    locationEN.Position = null;
                    ChroniGenNHibernate.EN.Chroni.PositionEN positionEN = (ChroniGenNHibernate.EN.Chroni.PositionEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.PositionEN), p_position_OID);
                    positionEN.Location = null;
                }
                else
                {
                    throw new ModelException("The identifier " + p_position_OID + " in p_position_OID you are trying to unrelationer, doesn't exist in LocationEN");
                }

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

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


            finally
            {
                SessionClose();
            }
        }
コード例 #8
0
 public LocationEN(LocationEN location)
 {
     this.init(Identifier, location.Status, location.Name, location.Description, location.Mode, location.Type, location.Address, location.PhysicalType, location.ManagingOrganization, location.Position, location.Practitioner, location.Patient, location.Phone, location.Email, location.PostalCode, location.Schedule);
 }