Example #1
0
 public void DeleteLiecivo_na_recepte(Liecivo_na_recepte liecivo_na_recepte)
 {
     if ((liecivo_na_recepte.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(liecivo_na_recepte, EntityState.Deleted);
     }
     else
     {
         this.ObjectContext.Liecivo_na_recepte.Attach(liecivo_na_recepte);
         this.ObjectContext.Liecivo_na_recepte.DeleteObject(liecivo_na_recepte);
     }
 }
Example #2
0
 public void InsertLiecivo_na_recepte(Liecivo_na_recepte liecivo_na_recepte)
 {
     if ((liecivo_na_recepte.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(liecivo_na_recepte, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Liecivo_na_recepte.AddObject(liecivo_na_recepte);
     }
 }
Example #3
0
 public void UpdateLiecivo_na_recepte(Liecivo_na_recepte currentLiecivo_na_recepte)
 {
     this.ObjectContext.Liecivo_na_recepte.AttachAsModified(currentLiecivo_na_recepte, this.ChangeSet.GetOriginal(currentLiecivo_na_recepte));
 }
Example #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Liecivo_na_recepte EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLiecivo_na_recepte(Liecivo_na_recepte liecivo_na_recepte)
 {
     base.AddObject("Liecivo_na_recepte", liecivo_na_recepte);
 }
Example #5
0
        /// <summary>
        /// Save recipe into database
        /// </summary>
        public void AddRecipeWithActiveSubstanceAction()
        {
            if (string.IsNullOrEmpty(SelectedDoctor) || string.IsNullOrEmpty(SelectedPatient) ||
                string.IsNullOrEmpty(SelectedDrugBarCodeWithActiveSubstance))
            {
                MessageBox.Show("Niektoré povinné údaje neboli vybraté alebo vyplnené!");
            }
            else
            {
                if (ChemistID <= 0)
                {
                    MessageBox.Show("Nie ste registrovaným lekárnikom!");
                    return;
                }
                Recept recept = new Recept();
                recept.id_lekar = Int32.Parse(SelectedDoctor);
                recept.id_pacient = Int32.Parse(SelectedPatient);
                recept.datum_vystavenia = DateTime.Now;

                _pharmacyDomainContext.Recepts.Add(recept);

                Liecivo_na_recepte lnr = new Liecivo_na_recepte();
                lnr.ciarovy_kod = SelectedDrugBarCodeWithActiveSubstance;
                lnr.id_lekarnik = ChemistID;

                _pharmacyDomainContext.SubmitChanges().Completed += (args, e) =>
                {
                    //lambda iba koli idcku, ktore az v tomto momente poznam
                    RecipeID = recept.id_recept;
                    lnr.id_recept = RecipeID;
                    _pharmacyDomainContext.Liecivo_na_receptes.Add(lnr);
                    _pharmacyDomainContext.SubmitChanges();
                };

                MessageBox.Show("Recept bol úspešne pridaný do databázy");
            }
        }
 private bool FilterLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     return (entity.id_recept == this.id_recept);
 }
Example #7
0
 /// <summary>
 /// Create a new Liecivo_na_recepte object.
 /// </summary>
 /// <param name="id_recept">Initial value of the id_recept property.</param>
 /// <param name="ciarovy_kod">Initial value of the ciarovy_kod property.</param>
 /// <param name="id_lekarnik">Initial value of the id_lekarnik property.</param>
 /// <param name="id_liecivo_na_recepte">Initial value of the id_liecivo_na_recepte property.</param>
 public static Liecivo_na_recepte CreateLiecivo_na_recepte(global::System.Int32 id_recept, global::System.String ciarovy_kod, global::System.Int32 id_lekarnik, global::System.Int32 id_liecivo_na_recepte)
 {
     Liecivo_na_recepte liecivo_na_recepte = new Liecivo_na_recepte();
     liecivo_na_recepte.id_recept = id_recept;
     liecivo_na_recepte.ciarovy_kod = ciarovy_kod;
     liecivo_na_recepte.id_lekarnik = id_lekarnik;
     liecivo_na_recepte.id_liecivo_na_recepte = id_liecivo_na_recepte;
     return liecivo_na_recepte;
 }
 private void AttachLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     entity.Recept = this;
 }
 private void DetachLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     entity.Recept = null;
 }
 private bool FilterLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     return (entity.id_lekarnik == this.id_lekarnik);
 }
 private bool FilterLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     return (entity.ciarovy_kod == this.ciarovy_kod);
 }
 private void DetachLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     entity.Lekarnik = null;
 }
 private void AttachLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     entity.Lekarnik = this;
 }
 private void DetachLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     entity.IdentifikacneUdaje = null;
 }
 private void AttachLiecivo_na_recepte(Liecivo_na_recepte entity)
 {
     entity.IdentifikacneUdaje = this;
 }
        /// <summary>
        /// Adding drugs in recipe action - send data into database
        /// </summary>
        public void AddDrugsInRecipeAction()
        {
            Liecivo_na_recepte lnr = new Liecivo_na_recepte();
            lnr.ciarovy_kod = SelectedDrugBarCode;
            lnr.id_lekarnik = ChemistID;
            lnr.id_recept = RecipeID;
            _pharmacyDomainContext.Liecivo_na_receptes.Add(lnr);
            _pharmacyDomainContext.SubmitChanges();

            MessageBox.Show("Liečivo bolo úspešne pridané k receptu!");
        }