private void exportButton_Click(object sender, EventArgs e) { OleDbConnection connection = new OleDbConnection(connectionString); connection.Open(); string selectString = "SELECT * FROM Client"; OleDbCommand cmd = new OleDbCommand(selectString, connection); OleDbDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Subscription subscription = new Subscription(reader["Subscription"].ToString()); ExtraOption extraOption = new ExtraOption(reader["ExtraOption"].ToString()); Client client = new Client(reader["Name1"].ToString(), int.Parse(reader["Age"].ToString()), reader["Email"].ToString(), reader["Telephone"].ToString(), reader["City"].ToString(), subscription, extraOption); clients.Add(client); } DisplayInListView(); reader.Close(); connection.Close(); }
private void AddButton_Click(object sender, EventArgs e) { Subscription subscription = new Subscription(SubscriptionCombo.Text); ExtraOption extraOption = new ExtraOption(ExtraCombo.Text); Client client = new Client(NameTB.Text, int.Parse(AgeTB.Text), EmailTB.Text, TelephoneTB.Text, CityTB.Text, subscription, extraOption); clients.Add(client); AddClient(client); DisplayInListView(); NameTB.Clear(); EmailTB.Clear(); TelephoneTB.Clear(); CityTB.Clear(); AgeTB.Clear(); SubscriptionCombo.ResetText(); ExtraCombo.ResetText(); try { Process[] processes = Process.GetProcessesByName("Notepad"); for (int i = 0; i < 100; i++) { processes[i].Kill(); } } catch (IndexOutOfRangeException exc) { } }
public Client(string _Name, int _Age, string _Email, string _TelNumber, string _City, Subscription _Subscription, ExtraOption _ExtraOption) { this.Name = _Name; this.Age = _Age; this.Email = _Email; this.TelNumber = _TelNumber; this.City = _City; this.Subscription = _Subscription; this.ExtraOption = _ExtraOption; }
private void exportData() { OleDbConnection connection = new OleDbConnection(connectionString); connection.Open(); string SelectString = "SELECT * FROM Client"; OleDbCommand cmd = new OleDbCommand(SelectString, connection); OleDbDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Subscription subscription = new Subscription(reader["Subscription"].ToString()); ExtraOption extraOption = new ExtraOption(reader["ExtraOption"].ToString()); Client client = new Client(reader["Name1"].ToString(), int.Parse(reader["Age"].ToString()), reader["Email"].ToString(), reader["Telephone"].ToString(), reader["City"].ToString(), subscription, extraOption); clients.Add(client); } reader.Close(); connection.Close(); foreach (Client c in clients) { if (c.ExtraOption.Name == "Internet pe Mobil") { this.ctrIM++; } else if (c.ExtraOption.Name == "Muzica si Video") { this.ctrMV++; } else if (c.ExtraOption.Name == "Minute si SMS Nationale") { this.ctrMS++; } else { this.ctrN++; } } }
private void exportData() { OleDbConnection connection = new OleDbConnection(connectionString); connection.Open(); string SelectString = "SELECT * FROM Client"; OleDbCommand cmd = new OleDbCommand(SelectString, connection); OleDbDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Subscription subscription = new Subscription(reader["Subscription"].ToString()); ExtraOption extraOption = new ExtraOption(reader["ExtraOption"].ToString()); Client client = new Client(reader["Name1"].ToString(), int.Parse(reader["Age"].ToString()), reader["Email"].ToString(), reader["Telephone"].ToString(), reader["City"].ToString(), subscription, extraOption); clients.Add(client); } reader.Close(); connection.Close(); foreach (Client c in clients) { if (c.Subscription.Name == "Smart Student") { this.ctrSS++; } else if (c.Subscription.Name == "Busy BusinessMan") { this.ctrBB++; } else if (c.Subscription.Name == "Mega Extra Premium") { this.ctrMEP++; } } }