private void BtnDelete_Click(object sender, EventArgs e) //sa mut Delete-ul langa gridview { DAClient daclients = new DAClient(); daclients.DeleteClients(ClientId); MessageBox.Show("Clientul a fost sters"); ClientForm clientformC = new ClientForm(); clientformC.Show(); this.Hide(); clientformC.FormClosed += ClientForm_FormClosed; }
private void Button1_Click(object sender, EventArgs e) { DAClient daclients = new DAClient(); daclients.DeleteClients(ClientId); MessageBox.Show("Clientul a fost sters"); ClientForm clientformC = new ClientForm(); clientformC.Show(); this.Hide(); clientformC.FormClosed += ClientForm_FormClosed; }
private void BtnModify_Click(object sender, EventArgs e) { BlClient modificaClient = new BlClient(); var result = modificaClient.SalveazaClienti(txtName.Text, ClientId, txtSurname.Text, txtClientCode.Text, txtPhoneNo.Text, txtEmail.Text); if (result) { MessageBox.Show("Ai reusit! "); } else { MessageBox.Show(" Ceva nu e in regula, Clientul nu a fost modificat"); } ClientForm clientformC = new ClientForm(); clientformC.Show(); this.Hide(); clientformC.FormClosed += ClientForm_FormClosed; }
private void BtnSave_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(txtClientName.Text)) { MessageBox.Show("Numele nu este completat", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(txtClientSurname.Text)) { MessageBox.Show("Numele de familie nu este completat", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(txtClientCode.Text)) { MessageBox.Show("Codul nu este completat", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(txtClientPhoneNo.Text)) { MessageBox.Show("PhoneNo nu este completat", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(txtClientEmail.Text)) { MessageBox.Show("Email nu este completata", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DAClient daClient = new DAClient(); //apelez datele(txt) din winUI, in locul parametrilor AddClients. daClient.AddClients(txtClientName.Text, txtClientSurname.Text, txtClientCode.Text, txtClientEmail.Text, txtClientPhoneNo.Text); MessageBox.Show("S-a salvat"); ClientForm clientformC = new ClientForm(); clientformC.Show(); this.Hide(); clientformC.FormClosed += ClientForm_FormClosed; }
private void BtnAddAddress_Click(object sender, EventArgs e) { bool status = false; DAAddAddress dAAdd = new DAAddAddress(); status = dAAdd.addaddress(IdClient, comboBoxGetCity.SelectedItem.ToString(), comboBoxCounty.SelectedItem.ToString(), txtBoxStreet.Text, txtBoxStreetNo.Text); if (status == true) { MessageBox.Show("Adresa a fost adaugata!", "Notificare", MessageBoxButtons.OK, MessageBoxIcon.Information); ClientForm clientForm = new ClientForm(); this.Hide(); clientForm.Show(); DAGetClient dAGetClient = new DAGetClient(); DataTable dataTable = new DataTable(); dataTable = dAGetClient.getClient(IdClient); clientForm.txtBoxClientName.Text = dataTable.Rows[0]["ClientName"].ToString(); clientForm.lblIdInvisible.Text = IdClient.ToString(); clientForm.lblIdInvisible.Visible = false; clientForm.txtBoxSurName.Text = dataTable.Rows[0]["ClientSurName"].ToString(); clientForm.txtBoxPhoneNo.Text = dataTable.Rows[0]["PhoneNo"].ToString(); clientForm.txtBoxClientCode.Text = dataTable.Rows[0]["ClientCode"].ToString(); clientForm.txtBoxEmail.Text = dataTable.Rows[0]["Email"].ToString(); DAGetAddres addres = new DAGetAddres(); clientForm.dataGridViewClientAddress.DataSource = addres.GetAddress(IdClient); clientForm.dataGridViewClientAddress.Columns["ClientAddressId"].Visible = false; clientForm.dataGridViewClientAddress.Columns["CityName"].HeaderText = "Nume Oras"; clientForm.dataGridViewClientAddress.Columns["CountyName"].HeaderText = "Nume Regiune"; clientForm.dataGridViewClientAddress.Columns["StreetName"].HeaderText = "Nume Strada"; clientForm.dataGridViewClientAddress.Columns["StreetNo"].HeaderText = "Numar Strada"; clientForm.FormClosed += ClientDetail_Form_Closed; } else { MessageBox.Show("Adresa nu e adaugata!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Adrese Clienti: ClientId este in plus private void BtnSaveAddress_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(txtCity.Text)) { MessageBox.Show("Orasul nu este completat", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(txtCounty.Text)) { MessageBox.Show("Judetul nu este completat", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BlClient addAddress = new BlClient(); addAddress.addClientAddress(this.ClientId, txtCity.Text, txtCounty.Text, txtStreetName.Text, txtStreetNo.Text); //BlClient daAdresa = new BlClient(); ////apelez datele(txt) din winUI, in locul parametrilor AddClients. //DaClientAddress addressList = new DaClientAddress(); //AddAndModify adaugaAdress = new AddAndModify(); //adaugaAdress.GridViewAddresss.DataSource = addressList.AddClientAddress(ClientId, txtCity.Text, txtCounty.Text, txtStreetName.Text, null); //// daAdresa.AddClientAddress(ClientId, txtCity.Text, txtCounty.Text, txtStreetName.Text, StreetNo); ClientForm clientformAB = new ClientForm(); clientformAB.Show(); MessageBox.Show("Adresa a fost adaugata"); this.Hide(); clientformAB.FormClosed += ClientForm_FormClosed; }