//prida nazov ucinnej latky do databazy
        private void AddActiveSubstance()
        {
            //overim, ci sa tam take liecivo uz nenachadza
            bool existuje = _pharmacyDomainContext.Ucinna_latkas.Where(a => a.nazov == UcinnaLatka).Any();
            if (existuje)
            {
                MessageBox.Show(UcinnaLatka + " sa už v databáze nachádza!");
            }
            else
            {
                var ucinnaLatka = new Ucinna_latka();
                ucinnaLatka.nazov = UcinnaLatka;
                _pharmacyDomainContext.Ucinna_latkas.Add(ucinnaLatka);
                _pharmacyDomainContext.SubmitChanges();

                MessageBox.Show("Účinná látka úspešne pridaná do databázy!");
            }
        }
示例#2
0
 public void DeleteUcinna_latka(Ucinna_latka ucinna_latka)
 {
     if ((ucinna_latka.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(ucinna_latka, EntityState.Deleted);
     }
     else
     {
         this.ObjectContext.Ucinna_latka.Attach(ucinna_latka);
         this.ObjectContext.Ucinna_latka.DeleteObject(ucinna_latka);
     }
 }
示例#3
0
 public void UpdateUcinna_latka(Ucinna_latka currentUcinna_latka)
 {
     this.ObjectContext.Ucinna_latka.AttachAsModified(currentUcinna_latka, this.ChangeSet.GetOriginal(currentUcinna_latka));
 }
示例#4
0
 public void InsertUcinna_latka(Ucinna_latka ucinna_latka)
 {
     if ((ucinna_latka.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(ucinna_latka, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Ucinna_latka.AddObject(ucinna_latka);
     }
 }
示例#5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Ucinna_latka EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUcinna_latka(Ucinna_latka ucinna_latka)
 {
     base.AddObject("Ucinna_latka", ucinna_latka);
 }
示例#6
0
 /// <summary>
 /// Create a new Ucinna_latka object.
 /// </summary>
 /// <param name="id_ucinna_latka">Initial value of the id_ucinna_latka property.</param>
 /// <param name="nazov">Initial value of the nazov property.</param>
 public static Ucinna_latka CreateUcinna_latka(global::System.Int32 id_ucinna_latka, global::System.String nazov)
 {
     Ucinna_latka ucinna_latka = new Ucinna_latka();
     ucinna_latka.id_ucinna_latka = id_ucinna_latka;
     ucinna_latka.nazov = nazov;
     return ucinna_latka;
 }
 private bool FilterUcinna_latka(Ucinna_latka entity)
 {
     return (entity.id_ucinna_latka == this.id_ucinna_latka);
 }