private void DetachZamestnancis(Zamestnanci entity)
 {
     entity.Ambulancie = null;
 }
 private bool FilterZamestnanci(Zamestnanci entity)
 {
     return (entity.id_zamestnanec == this.id_kto_vykonal);
 }
 private bool FilterZamestnanci1(Zamestnanci entity)
 {
     return (entity.id_zamestnanec == this.id_kto_vlozil_data);
 }
 private bool FilterZamestnancis(Zamestnanci entity)
 {
     return (entity.id_obcan == this.id_obcan);
 }
 private void AttachZamestnancis(Zamestnanci entity)
 {
     entity.Ambulancie = this;
 }
 public void InsertZamestnanci(Zamestnanci zamestnanci)
 {
     if ((zamestnanci.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(zamestnanci, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Zamestnancis.AddObject(zamestnanci);
     }
 }
 private void DetachZamestnancis(Zamestnanci entity)
 {
     entity.Obcania = null;
 }
 private void DetachZamestnancis(Zamestnanci entity)
 {
     entity.Laboratoria = null;
 }
 private bool FilterZamestnancis(Zamestnanci entity)
 {
     return (entity.id_laboratorium == this.id_laboratorium);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Zamestnancis EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToZamestnancis(Zamestnanci zamestnanci)
 {
     base.AddObject("Zamestnancis", zamestnanci);
 }
 private void AttachZamestnancis(Zamestnanci entity)
 {
     entity.Laboratoria = this;
 }
 /// <summary>
 /// Create a new Zamestnanci object.
 /// </summary>
 /// <param name="id_zamestnanec">Initial value of the id_zamestnanec property.</param>
 /// <param name="id_obcan">Initial value of the id_obcan property.</param>
 /// <param name="tombstone">Initial value of the tombstone property.</param>
 public static Zamestnanci CreateZamestnanci(global::System.Int32 id_zamestnanec, global::System.Int32 id_obcan, global::System.Boolean tombstone)
 {
     Zamestnanci zamestnanci = new Zamestnanci();
     zamestnanci.id_zamestnanec = id_zamestnanec;
     zamestnanci.id_obcan = id_obcan;
     zamestnanci.tombstone = tombstone;
     return zamestnanci;
 }
        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 UpdateZamestnanci(Zamestnanci currentZamestnanci)
 {
     this.ObjectContext.Zamestnancis.AttachAsModified(currentZamestnanci, this.ChangeSet.GetOriginal(currentZamestnanci));
 }
 private bool FilterZamestnancis(Zamestnanci entity)
 {
     return (entity.id_ambulancia == this.id_ambulancia);
 }
 private void AttachZamestnancis(Zamestnanci entity)
 {
     entity.Obcania = this;
 }
 private bool FilterZamestnanci(Zamestnanci entity)
 {
     return (entity.id_zamestnanec == this.kto_odobral);
 }
        /// <summary>
        /// button evet click handler,adds new Zamestanec entity, handles showing previous screen
        /// </summary>
        public IResult OnAdd()
        {
            Obcania obcan = ZamestanecPO.TransformPoToEntity();
            if (Ambulancia.id_ambulancia == 0)
            {
                AddAmbulanciaViewModel addAmbulanceViewModel = _serviceLocator.GetInstance<AddAmbulanciaViewModel>();
                addAmbulanceViewModel.Ambulacia = Ambulancia;
                _laboratoryDomainContext.Obcanias.Add(obcan);
                _laboratoryDomainContext.SubmitChanges().Completed += (sender, e) =>
                {
                };
                addAmbulanceViewModel.Ambulacia = Ambulancia;
                return Show.Child(addAmbulanceViewModel).In<IShellViewModel>();
            }
            else 
            {
                AmbulanciaSummaryViewModel ambulanceViewModel = _serviceLocator.GetInstance<AmbulanciaSummaryViewModel>();
                ambulanceViewModel.Ambulancia = Ambulancia;
                Zamestnanci zamestnanec = new Zamestnanci();
                zamestnanec.Obcania = obcan;
                Ambulancia.Zamestnancis.Add(zamestnanec);
                _laboratoryDomainContext.Zamestnancis.Add(zamestnanec);
                _laboratoryDomainContext.Obcanias.Add(obcan);
                _laboratoryDomainContext.SubmitChanges().Completed += (sender, e) =>
                {
                    ambulanceViewModel.AddZamestanec(obcan);
                };

                ambulanceViewModel.Ambulancia = Ambulancia;
                return Show.Child(ambulanceViewModel).In<IShellViewModel>();
            }
        }