Example #1
0
        private void DonatorsListControl_Load(object sender, EventArgs e)
        {
            listView1.View = View.Details;

            dt = new DataTable();
            dt.Columns.Add("Nome");
            dt.Columns.Add("Sexo");
            dt.Columns.Add("Idade");
            dt.Columns.Add("GrupoSanguineo");
            dt.Columns.Add("IMC");

            var donators = CreateListDonators.ListDonators(); // listar recebe a lista completa

            CarregarDadosTabela(donators);
            dv = new DataView(dt);

            CarregarDataProcura(dv);

            comboBoxFilter.Items.Add("Nome");
            comboBoxFilter.Items.Add("Sexo");
            comboBoxFilter.Items.Add("Idade");
            comboBoxFilter.Items.Add("GrupoSanguineo");
            comboBoxFilter.Items.Add("IMC");
            comboBoxFilter.SelectedIndex = 0;
        }
        public static List <BloodDonator> ListaDonators()
        {
            // listar recebe a lista completa
            List <BloodDonator> donators = new List <BloodDonator>();

            donators = CreateListDonators.ListDonators();
            return(donators);
        }
        private void Form2_Load(object sender, EventArgs e)
        {
            var donators = CreateListDonators.ListDonators();

            string[]  a;
            string [] b;
            foreach (var item in donators.Where(item => item.Number == number))
            {
                a = Regex.Split(item.StreetAddress, @"(?<!^)(?=[A-Z])");

                b = Regex.Split(item.Vehicle, @"(?<!^)(?=[A-Z])");


                firstNameLabel.Text = item.FirstName;
                lastNameLabel.Text  = item.LastName;
                //colocar bem a morada
                streetAdressLabel.ResetText();
                for (int i = 0; i < a.Count(); i++)
                {
                    streetAdressLabel.Text = streetAdressLabel.Text + " " + a[i];
                }
                //colocar bem o veiculo
                veichleLabel.ResetText();
                for (int k = 0; k < b.Count(); k++)
                {
                    veichleLabel.Text = veichleLabel.Text + " " + b[k];
                }

                cityLabel.Text         = item.City;
                stateFullLabel.Text    = item.Statefull;
                zipcodeLabel.Text      = item.ZipCode;
                emailLabel.Text        = item.Email;
                usernameLabel.Text     = item.UserName;
                telephoneLabel.Text    = Convert.ToString(item.TelephoneNumber);
                motherMaidenLabel.Text = item.MothersMaiden;
                //colocar data bem
                birthdayLabel.Text  = item.BirthDay.Day + "/" + item.BirthDay.Month + "/" + item.BirthDay.Year;
                ageLabel.Text       = Convert.ToString(item.Age);
                ocupationLabel.Text = item.Occupation;
                companyLabel.Text   = item.Company;

                bloodTypeLabel.Text   = item.BloodType;
                kilogramsLabel.Text   = Convert.ToString(item.Kilograms);
                centimetersLabel.Text = Convert.ToString(item.Centimeters);
                latitudeLabel.Text    = item.Latitude;
                longitudeLabel.Text   = item.Longitude;
            }
        }
Example #4
0
        public static bool BloodTypeEmail(List <String> bloodtype)
        {
            List <BloodDonator> donators = new List <BloodDonator>();


            donators = CreateListDonators.ListDonators();

            try
            {
                if (bloodtype.Contains("A+"))
                {
                    var listAMore = donators.Where(item => item.BloodType == "A+");

                    foreach (var a in listAMore)
                    {
                        SendEmails(a.Email, "A+");
                    }
                }

                if (bloodtype.Contains("A-"))
                {
                    var listALess = donators.Where(item => item.BloodType == "A-");

                    foreach (var a in listALess)
                    {
                        SendEmails(a.Email, "A-");
                    }
                }

                if (bloodtype.Contains("B+"))
                {
                    var listBMore = donators.Where(item => item.BloodType == "B+");

                    foreach (var a in listBMore)
                    {
                        SendEmails(a.Email, "B+");
                    }
                }
                if (bloodtype.Contains("B-"))
                {
                    var listBLess = donators.Where(item => item.BloodType == "B-");

                    foreach (var a in listBLess)
                    {
                        SendEmails(a.Email, "B-");
                    }
                }
                if (bloodtype.Contains("AB+"))
                {
                    var listABMore = donators.Where(item => item.BloodType == "AB+");

                    foreach (var a in listABMore)
                    {
                        SendEmails(a.Email, "AB+");
                    }
                }
                if (bloodtype.Contains("AB-"))
                {
                    var listABLess = donators.Where(item => item.BloodType == "AB-");

                    foreach (var a in listABLess)
                    {
                        SendEmails(a.Email, "AB-");
                    }
                }
                if (bloodtype.Contains("O+"))
                {
                    var listOMore = donators.Where(item => item.BloodType == "O+");

                    foreach (var a in listOMore)
                    {
                        SendEmails(a.Email, "O+");
                    }
                }
                if (bloodtype.Contains("O-"))
                {
                    var listOLess = donators.Where(item => item.BloodType == "O-");

                    foreach (var a in listOLess)
                    {
                        SendEmails(a.Email, "O-");
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }