You are on page 1of 10

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FriendBirthday
{
class birth
{
private string FirstName;
private string LastName;
private string PhoneNumber;
private string BirthMonth;
private int BirthDate;

public birth()
{
FirstName = "";
LastName = "";
PhoneNumber = "";
BirthMonth = "";
BirthDate = 0;
}
public string firstName
{
get { return FirstName; }
set { FirstName = value; }
}
public string lastName
{
get { return LastName; }
set { LastName = value; }
}
public string phoneNumber
{
get { return PhoneNumber; }
set { PhoneNumber = value; }
}
public string birthMonth
{
get { return BirthMonth; }
set { BirthMonth = value; }
}
public int birthDate
{
get { return BirthDate; }
set { BirthDate = value; }
}
public birth(string FirstName, string LastName, string PhoneNumber, string
BirthMonth, int BirthDate)
{
this.FirstName = FirstName;
this.LastName = LastName;
this.PhoneNumber = PhoneNumber;
this.BirthMonth = BirthMonth;
this.BirthDate = BirthDate;
}
public override string ToString()
{
return firstName + "," + lastName + "," + phoneNumber + "," + birthMonth +
"," + birthDate + ",";
}

}
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FriendBirthday
{
public partial class Form1 : Form
{
List<birth> bhd = new List<birth>();

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'birthdayDataSet.Table1'
table. You can move, or remove it, as needed.
this.table1TableAdapter.Fill(this.birthdayDataSet.Table1);
comboBox1.Items.Add("January");
comboBox1.Items.Add("February");
comboBox1.Items.Add("March");
comboBox1.Items.Add("April");
comboBox1.Items.Add("May");
comboBox1.Items.Add("June");
comboBox1.Items.Add("July");
comboBox1.Items.Add("August");
comboBox1.Items.Add("September");
comboBox1.Items.Add("October");
comboBox1.Items.Add("November");
comboBox1.Items.Add("December");
comboBox1.SelectedIndex = 0;
comboBox2.Items.Add("1");
comboBox2.Items.Add("2");
comboBox2.Items.Add("3");
comboBox2.Items.Add("4");
comboBox2.Items.Add("5");
comboBox2.Items.Add("6");
comboBox2.Items.Add("7");
comboBox2.Items.Add("8");
comboBox2.Items.Add("9");
comboBox2.Items.Add("10");
comboBox2.Items.Add("11");
comboBox2.Items.Add("12");
comboBox2.Items.Add("13");
comboBox2.Items.Add("14");
comboBox2.Items.Add("15");
comboBox2.Items.Add("16");
comboBox2.Items.Add("17");
comboBox2.Items.Add("18");
comboBox2.Items.Add("19");
comboBox2.Items.Add("20");
comboBox2.Items.Add("21");
comboBox2.Items.Add("22");
comboBox2.Items.Add("23");
comboBox2.Items.Add("24");
comboBox2.Items.Add("25");
comboBox2.Items.Add("26");
comboBox2.Items.Add("27");
comboBox2.Items.Add("28");
comboBox2.Items.Add("29");
comboBox2.Items.Add("30");
comboBox2.Items.Add("31");
comboBox2.SelectedIndex = 0;
}




private void radioButton1_CheckedChanged(object sender, EventArgs e)
{

}

private void groupBox1_Enter(object sender, EventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
birth bhd = new birth();
if (radioButton1.Checked == true)
{
if (textBox1.Text != "")
{
bhd.firstName = textBox1.Text;

var firstName =
from b in this.birthdayDataSet.Table1
where b.FirstName == bhd.firstName
select b;
listBox1.Items.Clear();
foreach (var b in firstName)
{
textBox1.Text = "";
listBox1.Items.Add("First Name:"+b.FirstName +"\tLast Name:" +
b.LastName + "\tPhone Number:" + b.PhoneNumber + "\tBirthday Month:" + b.BirthMonth +
"\tBirthday Date:" + b.BirthDate);
}
}
else
MessageBox.Show("There is no name found");

}
if (radioButton2.Checked == true)
{
if (textBox2.Text != "")
{
bhd.lastName = textBox2.Text;

var lastName =
from b in this.birthdayDataSet.Table1
where b.LastName == bhd.lastName
select b;
listBox1.Items.Clear();
foreach (var b in lastName)
{
textBox2.Text = "";
listBox1.Items.Add("First Name:" + b.FirstName + "\tLast Name:" +
b.LastName + "\tPhone Number:" + b.PhoneNumber + "\tBirthday Month:" + b.BirthMonth +
"\tBirthday Date:" + b.BirthDate);
}

}
else
MessageBox.Show("There is no last name found");
}
if (radioButton3.Checked == true)
{
if (comboBox1.SelectedIndex == 0)
{
bhd.birthMonth = "January";
}
if (comboBox1.SelectedIndex == 1)
{
bhd.birthMonth = "February";
}
if (comboBox1.SelectedIndex == 2)
{
bhd.birthMonth = "March";
}
if (comboBox1.SelectedIndex == 3)
{
bhd.birthMonth = "April";
}
if (comboBox1.SelectedIndex == 4)
{
bhd.birthMonth = "May";
}
if (comboBox1.SelectedIndex == 5)
{
bhd.birthMonth = "June";
}
if (comboBox1.SelectedIndex == 6)
{
bhd.birthMonth = "July";
}
if (comboBox1.SelectedIndex == 7)
{
bhd.birthMonth = "August";
}
if (comboBox1.SelectedIndex == 8)
{
bhd.birthMonth = "September";
}
if (comboBox1.SelectedIndex == 9)
{
bhd.birthMonth = "October";
}
if (comboBox1.SelectedIndex == 10)
{
bhd.birthMonth = "November";
}
if (comboBox1.SelectedIndex == 11)
{
bhd.birthMonth = "December";
}
var birthMonth =
from b in this.birthdayDataSet.Table1
orderby b.FirstName
where b.BirthMonth == bhd.birthMonth
select b;

listBox1.Items.Clear();
foreach (var b in birthMonth)
{
listBox1.Items.Add("First Name:" + b.FirstName + "\tLast Name:" +
b.LastName + "\tPhone Number:" + b.PhoneNumber + "\tBirthday Month:" + b.BirthMonth +
"\tBirthday Date:" + b.BirthDate);
}
}

if (radioButton4.Checked == true)
{
if (comboBox2.SelectedIndex == 0)
{
bhd.birthDate = 1;
}
if (comboBox2.SelectedIndex == 1)
{
bhd.birthDate = 2;
}
if (comboBox2.SelectedIndex == 2)
{
bhd.birthDate = 3;
}
if (comboBox2.SelectedIndex == 3)
{
bhd.birthDate = 4;
}
if (comboBox2.SelectedIndex == 4)
{
bhd.birthDate = 5;
}
if (comboBox2.SelectedIndex == 5)
{
bhd.birthDate = 6;
}
if (comboBox2.SelectedIndex == 6)
{
bhd.birthDate = 7;
}
if (comboBox2.SelectedIndex == 7)
{
bhd.birthDate = 8;
}
if (comboBox2.SelectedIndex == 8)
{
bhd.birthDate = 9;
}
if (comboBox2.SelectedIndex == 9)
{
bhd.birthDate = 10;
}
if (comboBox2.SelectedIndex == 10)
{
bhd.birthDate = 11;
}
if (comboBox2.SelectedIndex == 11)
{
bhd.birthDate = 12;
}
if (comboBox2.SelectedIndex == 12)
{
bhd.birthDate = 13;
}
if (comboBox2.SelectedIndex == 13)
{
bhd.birthDate = 14;
}
if (comboBox2.SelectedIndex == 14)
{
bhd.birthDate = 15;
}
if (comboBox2.SelectedIndex == 15)
{
bhd.birthDate = 16;
}
if (comboBox2.SelectedIndex == 16)
{
bhd.birthDate = 17;
}
if (comboBox2.SelectedIndex == 17)
{
bhd.birthDate = 18;
}
if (comboBox2.SelectedIndex == 18)
{
bhd.birthDate = 19;
}
if (comboBox2.SelectedIndex == 19)
{
bhd.birthDate = 20;
}
if (comboBox2.SelectedIndex == 20)
{
bhd.birthDate = 21;
}
if (comboBox2.SelectedIndex == 21)
{
bhd.birthDate = 22;
}
if (comboBox2.SelectedIndex == 22)
{
bhd.birthDate = 23;
}
if (comboBox2.SelectedIndex == 23)
{
bhd.birthDate = 24;
}
if (comboBox2.SelectedIndex == 24)
{
bhd.birthDate = 25;
}
if (comboBox2.SelectedIndex == 25)
{
bhd.birthDate = 26;
}
if (comboBox2.SelectedIndex == 26)
{
bhd.birthDate = 27;
}
if (comboBox2.SelectedIndex == 27)
{
bhd.birthDate = 28;
}
if (comboBox2.SelectedIndex == 28)
{
bhd.birthDate = 29;
}
if (comboBox2.SelectedIndex == 29)
{
bhd.birthDate = 30;
}
if (comboBox2.SelectedIndex == 30)
{
bhd.birthDate = 31;
}

var birthDate =
from b in this.birthdayDataSet.Table1
orderby b.FirstName
where b.BirthDate == bhd.birthDate
select b;

listBox1.Items.Clear();
foreach (var b in birthDate)
{
listBox1.Items.Add("First Name:" + b.FirstName + "\tLast Name:" +
b.LastName + "\tPhone Number:" + b.PhoneNumber + "\tBirthday Month:" + b.BirthMonth +
"\tBirthday Date:" + b.BirthDate);
}

}

}


}

}

You might also like