Пример #1
0
        /// <summary>
        /// Adding drug form into database
        /// </summary>
        public void OnAddDrugForm()
        {
            if (DrugForm != string.Empty)
            {
                //overim, ci sa tam take liecivo uz nenachadza
                bool existuje = _pharmacyDomainContext.Formas.Where(a => a.forma1 == DrugForm).Any();

                if (existuje)
                {
                    MessageBox.Show(DrugForm + " sa už v databáze nachádza!");
                }
                else
                {
                    var forma = new Forma();
                    forma.forma1 = DrugForm;
                    _pharmacyDomainContext.Formas.Add(forma);
                    _pharmacyDomainContext.SubmitChanges();
                    MessageBox.Show("Forma bola úspešne pridaná!");
                }
            }
        }
        //prida formu do databazy
        private void AddForme()
        {
            //overim, ci sa tam take liecivo uz nenachadza
            bool existuje = _pharmacyDomainContext.Formas.Where(a => a.forma1 == Forma).Any();

            if (existuje)
            {
                MessageBox.Show(Forma + " sa už v databáze nachádza!");
            }
            else
            {
                var forma = new Forma();
                forma.forma1 = Forma;
                _pharmacyDomainContext.Formas.Add(forma);
                _pharmacyDomainContext.SubmitChanges();
                MessageBox.Show("Forma bola úspešne pridaná!");
            }
        }
Пример #3
0
 public void DeleteForma(Forma forma)
 {
     if ((forma.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(forma, EntityState.Deleted);
     }
     else
     {
         this.ObjectContext.Forma.Attach(forma);
         this.ObjectContext.Forma.DeleteObject(forma);
     }
 }
Пример #4
0
 public void UpdateForma(Forma currentForma)
 {
     this.ObjectContext.Forma.AttachAsModified(currentForma, this.ChangeSet.GetOriginal(currentForma));
 }
Пример #5
0
 public void InsertForma(Forma forma)
 {
     if ((forma.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(forma, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Forma.AddObject(forma);
     }
 }
Пример #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Forma EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToForma(Forma forma)
 {
     base.AddObject("Forma", forma);
 }
Пример #7
0
 /// <summary>
 /// Create a new Forma object.
 /// </summary>
 /// <param name="id_forma">Initial value of the id_forma property.</param>
 /// <param name="forma1">Initial value of the forma1 property.</param>
 public static Forma CreateForma(global::System.Int32 id_forma, global::System.String forma1)
 {
     Forma forma = new Forma();
     forma.id_forma = id_forma;
     forma.forma1 = forma1;
     return forma;
 }
 private bool FilterForma(Forma entity)
 {
     return (entity.id_forma == this.id_forma);
 }