Example #1
0
        /// <summary>
        /// 
        /// </summary>
        public Pristroje TransformPoToEntity()
        {
            Pristroje pristroj = new Pristroje();
            pristroj.nazov = this.nazov;
            pristroj.popis = this.popis;

            return pristroj;
        }
 private bool FilterPristroje(Pristroje entity)
 {
     return (entity.id_pristroj == this.id_pristroj);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Pristrojes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPristrojes(Pristroje pristroje)
 {
     base.AddObject("Pristrojes", pristroje);
 }
 /// <summary>
 /// Create a new Pristroje object.
 /// </summary>
 /// <param name="id_pristroj">Initial value of the id_pristroj property.</param>
 /// <param name="nazov">Initial value of the nazov property.</param>
 /// <param name="tombstone">Initial value of the tombstone property.</param>
 public static Pristroje CreatePristroje(global::System.Int32 id_pristroj, global::System.String nazov, global::System.Boolean tombstone)
 {
     Pristroje pristroje = new Pristroje();
     pristroje.id_pristroj = id_pristroj;
     pristroje.nazov = nazov;
     pristroje.tombstone = tombstone;
     return pristroje;
 }
 public Pristroje GetPristrojForVysetrenieImport(string nazov, int idLaboratoria)
 {
     if (nazov == null || nazov == "")
     {
         return null;
     }
     else
     {
         Pristroje res = null;
         try
         {
             res = (from b in ObjectContext.Pristroje_Laboratoria
                    from c in ObjectContext.Pristrojes
                    where b.id_laboratorium == idLaboratoria
                    && b.id_pristroj == c.id_pristroj
                    && c.nazov == nazov
                    select c).First();
         }
         catch (InvalidOperationException)
         {
         }
         if (res != null)
         {
             return res;
         }
         else
         {
             Pristroje p = new Pristroje();
             p.nazov = nazov;
             InsertPristroje(p);
             Pristroje_Laboratoria pl = new Pristroje_Laboratoria();
             pl.id_laboratorium = idLaboratoria;
             pl.Pristroje = p;
             InsertPristroje_Laboratoria(pl);
             ObjectContext.SaveChanges();
             return p;
         }
     }
 }
 public void UpdatePristroje(Pristroje currentPristroje)
 {
     this.ObjectContext.Pristrojes.AttachAsModified(currentPristroje, this.ChangeSet.GetOriginal(currentPristroje));
 }
 public void InsertPristroje(Pristroje pristroje)
 {
     if ((pristroje.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(pristroje, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Pristrojes.AddObject(pristroje);
     }
 }