Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 public Obcania TransformPoToEntity()
 {
     Obcania obcan = new Obcania();
     obcan.meno = this.meno;
     obcan.priezvisko = this.priezvisko;
     obcan.datum_narodenia = this.datumNarodenia;
     obcan.pohlavie = "";
     obcan.titul = this.titul;
     return obcan;
 }
 private bool FilterObcania(Obcania entity)
 {
     return (entity.id_obcan == this.id_obcan);
 }
Ejemplo n.º 3
0
 public void TransformEntityToPo(Obcania pacient) 
 {
     if (pacient != null)
     {
         Meno = pacient.meno;
         Priezvisko = pacient.priezvisko;
         DatumNarodenia = pacient.datum_narodenia;
         Titul = pacient.titul;
         if (pacient.pohlavie != null)
         {
             if (pacient.pohlavie.Contains("m"))
             {
                 Muz = true;
                 Zena = false;
             }
             else
             {
                 if (pacient.pohlavie.Contains("ž"))
                 {
                     Muz = false;
                     Zena = true;
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        public Pacienti TransformPoToEntityPacient()
        {
            string pohlavie = GetPohlavie();
            Obcania obcan = new Obcania();
            obcan.meno = this.meno;
            obcan.priezvisko = this.priezvisko;
            obcan.datum_narodenia = this.datumNarodenia;
            obcan.pohlavie = pohlavie;
            obcan.titul = this.titul;
            Pacienti pacient = new Pacienti();
            pacient.Obcania = obcan;

            return pacient;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Obcanias EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToObcanias(Obcania obcania)
 {
     base.AddObject("Obcanias", obcania);
 }
 /// <summary>
 /// Create a new Obcania object.
 /// </summary>
 /// <param name="id_obcan">Initial value of the id_obcan property.</param>
 /// <param name="meno">Initial value of the meno property.</param>
 /// <param name="priezvisko">Initial value of the priezvisko property.</param>
 /// <param name="tombstone">Initial value of the tombstone property.</param>
 public static Obcania CreateObcania(global::System.Int32 id_obcan, global::System.String meno, global::System.String priezvisko, global::System.Boolean tombstone)
 {
     Obcania obcania = new Obcania();
     obcania.id_obcan = id_obcan;
     obcania.meno = meno;
     obcania.priezvisko = priezvisko;
     obcania.tombstone = tombstone;
     return obcania;
 }
        /// <summary>
        /// 
        /// </summary>
        public PatientSummaryViewModel(IServiceLocator servislocator, LaboratoryDomainContext context)
        {
            _serviceLocator = servislocator;
            _laboratoryDomainContext = context;
            Obcan = new Obcania();
            PatientPo = new AddPatientPo();
            Vzorky = new BindableCollection<Vzorky>();
            Vysetrenia = new BindableCollection<Vysetrenia>();
            Poistovne = new BindableCollection<Server.Model.Poistovne>();

            VzorkaFilter = new VzorkaFilter();
            VysetrenieFilter = new VysetrenieFilter();
        }
 public Pacienti GetPacientForVysetrenieImport(string meno, string priezvisko, DateTime? datumNar, string poistovna)
 {
     if ((meno == "" || meno == null) && 
         (priezvisko == "" || priezvisko == null) && 
         datumNar == null && 
         (poistovna == null || poistovna == "")
         )
     {
         return null;
     }
     else
     {
         Pacienti res = null;
         try
         {
             res = (from a in ObjectContext.Obcanias
                    from b in ObjectContext.Pacientis
                    where a.id_obcan == b.id_obcan
                    && a.meno == meno
                    && a.priezvisko == priezvisko
                    && a.datum_narodenia == datumNar
                    select b).First();
         }
         catch (InvalidOperationException)
         {
         }
         if (res != null)
         {
             return res;
         }
         else
         {
             Obcania obc = new Obcania();
             obc.meno = meno;
             obc.priezvisko = priezvisko;
             obc.datum_narodenia = datumNar;
             InsertObcania(obc);
             Pacienti pacient = new Pacienti();
             pacient.Obcania = obc;
             pacient.Poistovne = GetPoistovnaForVysetrenieImport(poistovna);
             InsertPacienti(pacient);
             ObjectContext.SaveChanges();
             return pacient;
         }
     }
 }
        public Zamestnanci GetSchvalilForVysetrenieImport(string meno, string priezvisko, int idLaboratoria)
        {
            if ((meno == null || meno == "") && 
                (priezvisko == null || priezvisko =="")
                )
            {
                return null;
            }
            else
            {
                Zamestnanci res = null;
                try
                {
                    res = (from a in ObjectContext.Laboratorias
                           from b in ObjectContext.Zamestnancis.Include("Obcania")
                           where a.id_laboratorium == b.id_laboratorium
                           && b.Obcania.meno == meno
                           && b.Obcania.priezvisko == priezvisko
                           && a.id_laboratorium == idLaboratoria
                           select b).First();
                }
                catch (InvalidOperationException)
                {
                }

                if (res != null)
                {
                    return res;
                }
                else
                {
                    Obcania obc = new Obcania();
                    obc.meno = meno;
                    obc.priezvisko = priezvisko;
                    InsertObcania(obc);
                    Zamestnanci zamestnanec = new Zamestnanci();
                    zamestnanec.Obcania = obc;
                    zamestnanec.id_laboratorium = idLaboratoria;
                    InsertZamestnanci(zamestnanec);
                    ObjectContext.SaveChanges();
                    return zamestnanec;
                }
            }
        }
 public void UpdateObcania(Obcania currentObcania)
 {
     this.ObjectContext.Obcanias.AttachAsModified(currentObcania, this.ChangeSet.GetOriginal(currentObcania));
 }
 public void InsertObcania(Obcania obcania)
 {
     if ((obcania.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(obcania, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Obcanias.AddObject(obcania);
     }
 }