Ejemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            string message = "";

            Cerere cerere_de_selectat = (Cerere)dataGridView3.SelectedRows[0].DataBoundItem;
            var    lista_cereri       = serviceCentru.GetAllCereri();
            Cerere cerere             = null;

            foreach (var i in lista_cereri)
            {
                if (i.Id == cerere_de_selectat.Id)
                {
                    cerere = i;
                }
            }

            if (cerere != null && cerere.Efectuata != true)
            {
                var stoc = serviceCentru.GetAllStocuri();

                int grupa;

                Stoc stocBun = null;

                foreach (var i in stoc)
                {
                    if (cerere.Grupa == i.Grupa && cerere.RH == i.RH)
                    {
                        stocBun = i;
                        if (cerere.CantitateGlobuleRosii <= i.GlobuleRosii &&
                            cerere.CantitatePlasma <= i.Plasma &&
                            cerere.CantitateTrombocite <= i.Trombocite &&
                            cerere.CantitateSange <= i.TotalSange)
                        {
                            message = "Cantitatea este suficienta pentru a implini cererea";
                        }
                        else
                        {
                            message = "Ne pare rau dar nu este suficient sange pentru cererea dumneavoastra. \n Notificati donatori sau trimiteti cantitatea de sange din stoc.";
                        }
                    }
                }

                if (stocBun != null)
                {
                    CentruService cService = new CentruService();

                    CentruTransfuzie ctr = cService.GetCentruTransfuzieByName(username);

                    CerereForm formCerere = new CerereForm(message, cerere, stocBun, ctr, this);

                    formCerere.Show();
                    loadStocSange();
                }
            }
            else
            {
                MessageBox.Show("Cererea a fost deja completata.");
            }
        }
Ejemplo n.º 2
0
        public FormLogareCentru(CentruService serviceCentru)
        {
            this.serviceCentru = serviceCentru;
            InitializeComponent();
            List <CentruTransfuzie> centre = serviceCentru.GetAllCentre();

            foreach (CentruTransfuzie c in centre)
            {
                comboBoxNumeCentru.Items.Add(c.Nume);
            }
        }
        public void testAddAnalize()
        {  // NU RULATI , nu este delete
            DonatorService srvDon  = new DonatorService();
            Donator        donator = srvDon.GetDonator("Dmihai");
            CentruService  service = new CentruService();

            PungaSange punga = service.GetPunga(1);

            service.AddAnaliza(BIII, Pozitiv, false, false, true, false, false, -774, punga, donator);

            Assert.AreEqual(srvDon.GetAllAnalizeByIdDonator("Dmihai").Where(x => x.NivelALT == -774), 1);

            //serivice.DeleteAnaliza(analiza)
        }
        public void testAddPungaSange()
        {
            DonatorService srvDon = new DonatorService();

            srvDon.RegisterDonator("test", "test", "testNume", "testPrenume", "M", Convert.ToDateTime("04-02-1997"), "testDomiciliu", "testLocalitate", "testJudet", "", "", "", "1935647856", "*****@*****.**");
            Donator donator = srvDon.GetDonator("test");

            CentruService service = new CentruService();

            CentruTransfuzie centru = new CentruTransfuzie("test", "test", "test", "test");

            PungaSange punga = new PungaSange();

            punga.CantitateSange        = 0.5F;
            punga.CantitatePlasma       = 0.275F;
            punga.CantitateGlobuleRosii = -1;
            punga.CantitateTrombocite   = 150;

            service.AddPungaSange(punga, donator, centru.Nume);

            Assert.AreNotEqual(service.GetAllPungiSange().Where(x => x.CantitateGlobuleRosii == -1), null);
        }
Ejemplo n.º 5
0
 public FormTrimitereAnalize(CentruService service, Donator donator)
 {
     this.donator = donator;
     this.service = service;
     InitializeComponent();
 }