/// <summary>
 /// 
 /// </summary>
 public Laboratoria TransformPoToEntity()
 {
     Laboratoria laboratoria = new Laboratoria();
     laboratoria.nazov = this.nazov;
     laboratoria.adresa = this.adresa;
     return laboratoria;
 }
 /// <summary>
 /// 
 /// </summary>
 public void TransformEntityToPo(Laboratoria laboratory)
 {
     if (laboratory != null)
     {
         Nazov = laboratory.nazov;
         Adresa = laboratory.adresa;
     }
 }
 private bool FilterLaboratoria(Laboratoria entity)
 {
     return (entity.id_laboratorium == this.id_laboratorium);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Laboratorias EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLaboratorias(Laboratoria laboratoria)
 {
     base.AddObject("Laboratorias", laboratoria);
 }
 /// <summary>
 /// Create a new Laboratoria object.
 /// </summary>
 /// <param name="id_laboratorium">Initial value of the id_laboratorium property.</param>
 /// <param name="nazov">Initial value of the nazov property.</param>
 /// <param name="tombstone">Initial value of the tombstone property.</param>
 public static Laboratoria CreateLaboratoria(global::System.Int32 id_laboratorium, global::System.String nazov, global::System.Boolean tombstone)
 {
     Laboratoria laboratoria = new Laboratoria();
     laboratoria.id_laboratorium = id_laboratorium;
     laboratoria.nazov = nazov;
     laboratoria.tombstone = tombstone;
     return laboratoria;
 }
 public void UpdateLaboratoria(Laboratoria currentLaboratoria)
 {
     this.ObjectContext.Laboratorias.AttachAsModified(currentLaboratoria, this.ChangeSet.GetOriginal(currentLaboratoria));
 }
 public void InsertLaboratoria(Laboratoria laboratoria)
 {
     if ((laboratoria.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(laboratoria, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Laboratorias.AddObject(laboratoria);
     }
 }
        public Laboratoria GetLaboratoriumForVysetrenieImport(string nazov, string adresa)
        {
            if ((nazov == null || nazov == "") && 
                (adresa == null || adresa == "")
                )
            {
                return null;
            }
            else
            {
                Laboratoria res = null;
                try
                {
                    res = (from a in ObjectContext.Laboratorias
                           where a.nazov == nazov
                           && a.adresa == adresa
                           select a).First();
                }
                catch (InvalidOperationException)
                {
                }

                if (res != null)
                {
                    return res;
                }
                else
                {
                    Laboratoria lab = new Laboratoria();
                    lab.nazov = nazov;
                    lab.adresa = adresa;
                    InsertLaboratoria(lab);
                    ObjectContext.SaveChanges();
                    return lab;
                }
            }
        }