/// <summary>
 /// Open new view with drug detail
 /// </summary>
 /// <param name="liecivo"></param>
 /// <returns></returns>
 public IResult OnGetDrugDetail(Liecivo liecivo)
 {
     if (liecivo != null)
     {
         DetailDrugViewModel detailDrugviewModel = _serviceLocator.GetInstance<DetailDrugViewModel>();
         detailDrugviewModel.DrugName = liecivo.Nazov_lieciva.nazov_lieciva1;
         detailDrugviewModel.BarCode = liecivo.ciarovy_kod;
         detailDrugviewModel.SuklCode = liecivo.sukl_kod;
         detailDrugviewModel.Forma = liecivo.Forma.forma1;
         detailDrugviewModel.ActiveSubstance = liecivo.Ucinna_latka.nazov;
         detailDrugviewModel.Prescription = (liecivo.na_predpis == "0") ? "Nie" : "Áno";
         detailDrugviewModel.Price = liecivo.jednotkova_cena.ToString();
         detailDrugviewModel.DistributorName = liecivo.Distributor.nazov_distributora;
         detailDrugviewModel.RegNumber = liecivo.Distributor.registracne_cislo;
         detailDrugviewModel.CorpName = liecivo.Distributor.nazov_firmy;
         detailDrugviewModel.StreetAddress = liecivo.Distributor.ulica;
         detailDrugviewModel.CityAddress = liecivo.Distributor.Cis_Obec.Nazov;
         detailDrugviewModel.PatientInfoLeaf = liecivo.pribalovy_letak;
         return Show.Child(detailDrugviewModel).In<IShellViewModel>();
     }
     else
     {
         MessageBox.Show("Pre náhľad je potrebné vybrať konkrétne liečivo z tabuľky!");
     }
     return null;
 }
 private bool FilterLiecivo(Liecivo entity)
 {
     return (entity.registracne_cislo == this.registracne_cislo);
 }
 private void DetachLiecivo(Liecivo entity)
 {
     entity.Distributor = null;
 }
 private void AttachLiecivo(Liecivo entity)
 {
     entity.Distributor = this;
 }
 private bool FilterLiecivo(Liecivo entity)
 {
     return (entity.id_ucinna_latka == this.id_ucinna_latka);
 }
示例#6
0
        /// <summary>
        /// Add drug into database
        /// </summary>
        public void OnAddDrugAction()
        {
            if (DrugNameSelected == string.Empty || SuklCode == string.Empty || BarCode == string.Empty ||
                ActiveSubstanceSelected == string.Empty || CorporationDistributorSelected == string.Empty ||
                DrugFormSelected == string.Empty || PrescriptionIndex == string.Empty || DrugPrice == string.Empty)
            {
                MessageBox.Show("Niektoré údaje neboli správne alebo vôbec vyplnené!");
            }
            else
            {
                //overim, ci sa tam take liecivo uz nenachadza
                bool barCodeExists = _pharmacyDomainContext.Liecivos.Where(a => a.ciarovy_kod == BarCode).Any();
                bool suklCodeExists = _pharmacyDomainContext.Liecivos.Where(a => a.sukl_kod == SuklCode).Any();

                if (barCodeExists || suklCodeExists)
                {
                    MessageBox.Show("Dané liečivo sa už v databáze nachádza! - zhoda čiarového alebo ŠUKL kódu");
                }
                else
                {
                    Liecivo liecivo = new Liecivo();
                    liecivo.id_nazov_lieciva = Int32.Parse(DrugNameSelected);
                    liecivo.sukl_kod = SuklCode;
                    liecivo.ciarovy_kod = BarCode;
                    liecivo.id_ucinna_latka = Int32.Parse(ActiveSubstanceSelected);
                    liecivo.registracne_cislo = CorporationDistributorSelected;
                    liecivo.id_forma = Int32.Parse(DrugFormSelected);
                    liecivo.na_predpis = PrescriptionIndex;
                    liecivo.jednotkova_cena = float.Parse(DrugPrice);
                    liecivo.pribalovy_letak = PatientInfoLeaf;

                    _pharmacyDomainContext.Liecivos.Add(liecivo);
                    _pharmacyDomainContext.SubmitChanges();

                    MessageBox.Show("Liečivo bolo úspešne pridané do centrálnej databázy!");
                }
            }
        }
示例#7
0
 public void DeleteLiecivo(Liecivo liecivo)
 {
     if ((liecivo.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(liecivo, EntityState.Deleted);
     }
     else
     {
         this.ObjectContext.Liecivo.Attach(liecivo);
         this.ObjectContext.Liecivo.DeleteObject(liecivo);
     }
 }
示例#8
0
 public void InsertLiecivo(Liecivo liecivo)
 {
     if ((liecivo.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(liecivo, EntityState.Added);
     }
     else
     {
         this.ObjectContext.Liecivo.AddObject(liecivo);
     }
 }
 private void DetachLiecivo(Liecivo entity)
 {
     entity.Nazov_lieciva = null;
 }
 private void AttachLiecivo(Liecivo entity)
 {
     entity.Nazov_lieciva = this;
 }
 private bool FilterLiecivo(Liecivo entity)
 {
     return (entity.ciarovy_kod == this.ciarovy_kod);
 }
 private bool FilterLiecivo(Liecivo entity)
 {
     return (entity.id_forma == this.id_forma);
 }
 private void DetachLiecivo(Liecivo entity)
 {
     entity.Forma = null;
 }
 private void AttachLiecivo(Liecivo entity)
 {
     entity.Forma = this;
 }
示例#15
0
 /// <summary>
 /// Create a new Liecivo object.
 /// </summary>
 /// <param name="ciarovy_kod">Initial value of the ciarovy_kod property.</param>
 /// <param name="id_forma">Initial value of the id_forma property.</param>
 /// <param name="id_nazov_lieciva">Initial value of the id_nazov_lieciva property.</param>
 /// <param name="id_ucinna_latka">Initial value of the id_ucinna_latka property.</param>
 /// <param name="sukl_kod">Initial value of the sukl_kod property.</param>
 /// <param name="na_predpis">Initial value of the na_predpis property.</param>
 /// <param name="jednotkova_cena">Initial value of the jednotkova_cena property.</param>
 public static Liecivo CreateLiecivo(global::System.String ciarovy_kod, global::System.Int32 id_forma, global::System.Int32 id_nazov_lieciva, global::System.Int32 id_ucinna_latka, global::System.String sukl_kod, global::System.String na_predpis, global::System.Single jednotkova_cena)
 {
     Liecivo liecivo = new Liecivo();
     liecivo.ciarovy_kod = ciarovy_kod;
     liecivo.id_forma = id_forma;
     liecivo.id_nazov_lieciva = id_nazov_lieciva;
     liecivo.id_ucinna_latka = id_ucinna_latka;
     liecivo.sukl_kod = sukl_kod;
     liecivo.na_predpis = na_predpis;
     liecivo.jednotkova_cena = jednotkova_cena;
     return liecivo;
 }
示例#16
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Liecivo EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLiecivo(Liecivo liecivo)
 {
     base.AddObject("Liecivo", liecivo);
 }
 private bool FilterLiecivo(Liecivo entity)
 {
     return (entity.id_nazov_lieciva == this.id_nazov_lieciva);
 }
示例#18
0
 public void UpdateLiecivo(Liecivo currentLiecivo)
 {
     this.ObjectContext.Liecivo.AttachAsModified(currentLiecivo, this.ChangeSet.GetOriginal(currentLiecivo));
 }
 private void AttachLiecivo(Liecivo entity)
 {
     entity.Ucinna_latka = this;
 }
示例#20
0
        /// <summary>
        /// Change price of drug
        /// </summary>
        /// <param name="liecivo"></param>
        public void OnChangePriceAction(Liecivo liecivo)
        {
            if (liecivo != null)
            {
                _pharmacyDomainContext.Load(_pharmacyDomainContext.GetLiecivo_na_recepteQuery(), true).Completed +=
                    (args, events) =>
                    {
                        var drugsInRecipe = from lnr in _pharmacyDomainContext.Liecivo_na_receptes
                            where lnr.id_recept == Int32.Parse(RecipeID) && lnr.ciarovy_kod == liecivo.ciarovy_kod
                            select lnr;

                        foreach (var drug in drugsInRecipe)
                        {
                            drug.cena_lieciva = float.Parse(NewPrice);
                        }
                        _pharmacyDomainContext.SubmitChanges().Completed += (a, e) =>
                        {
                            MessageBox.Show("Cena bola úspešne zmenená!");
                        };
                    };
            }
            else
            {
                MessageBox.Show("Nebolo zvolené liečivo z tabuľky");
            }
        }
 private void DetachLiecivo(Liecivo entity)
 {
     entity.Ucinna_latka = null;
 }