//Inicjalizacja public Form1() { InitializeComponent(); SqlConnectionClass.Foo(); label1.Text = "Witaj! DziĆ jest " + DateTime.Now.ToString(); this.Text = "CRM - Zalogowano jako: " + Program.userName; label2.Text = "Zalogowano jako: " + Program.userName + ", ostatnie logowanie: " + Program.userLastLogin; //czat richTextBox2.MaxLength = 200; //this.ActiveControl = richTextBox2; // ma byc aktywny na starcie czat, okienko do wpisywania richTextBox2.GotFocus += richTextBox2_GotFocus; richTextBox2.LostFocus += richTextBox2_LostFocus; richTextBox2.Text = defRichText; richTextBox2.ForeColor = Color.LightGray; //lista ostanich klientow int j = 0; foreach (string i in Program.ostatnioTablica) { if (Program.ostatnioTablica[j] != "") { listBox1.Items.Add("Klient id: " + Program.ostatnioTablica[j]); } j++; } }
//Klikniecie na tabele przenosi do klient forma private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { bool dodaj = true; if (dataGridView1.ReadOnly == true) { //idklienta,imie,nazwisko,pesel,adres_zam,adres_kor,telefon_kon,email,z_przetw,z_market,z_fak string id = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string imie = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); string nazwisko = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); string pesel = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); string adres_zam = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); string adres_kor = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString(); string t_kon = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString(); string email = dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString(); string z_przetw = dataGridView1.Rows[e.RowIndex].Cells[8].Value.ToString(); string z_market = dataGridView1.Rows[e.RowIndex].Cells[9].Value.ToString(); string z_fak = dataGridView1.Rows[e.RowIndex].Cells[10].Value.ToString(); if (dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString() != "") { KlientForm klientFormForm = new KlientForm(); for (int i = 0; i < Program.ostatnioTablica.Length; i++) { if (Program.ostatnioTablica[i] == id.ToString()) { dodaj = false; } } if (dodaj) { SqlConnectionClass.updateLastKlient(id.ToString()); } klientFormForm.Show(); klientFormForm.foo(id, imie, nazwisko, pesel, adres_zam, adres_kor, t_kon, email, z_przetw, z_market, z_fak); } } }