private void BtnEdit_Click(object sender, EventArgs e) { PartnerModel clientNou = new PartnerModel(); clientNou.ClientId = this.client.ClientId; clientNou.Nume = tbNume.Text; clientNou.Prenume = tbPrenume.Text; clientNou.CodClient = tbCod.Text; clientNou.Telefon = tbTelefon.Text; clientNou.Email = tbEmail.Text; BLClients blClient = new BLClients(); DialogResult dialogResult = MessageBox.Show("Sigur doriti sa modificati datele clientului?", "Adresa Client", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { blClient.UpdateClient(clientNou, out string message); MessageBox.Show(message, "Status", MessageBoxButtons.OK, MessageBoxIcon.Information); form.initializareDataGridView(); this.Close(); } else if (dialogResult == DialogResult.No) { this.Hide(); } }
public void initComboBoxes() { BLClients bLClients = new BLClients(); DataTable clienti = bLClients.GetClient(); cbClient.DataSource = clienti; cbClient.ValueMember = "PartnerId"; cbClient.DisplayMember = "PartnerName"; cbClient.Text = "Clienti"; }
private void filter() { string nume = tbNume.Text; string prenume = tbPrenume.Text; string cod = tbCod.Text; string tel = tbTelefon.Text; BLClients blClienti = new BLClients(); DataTable dt = new DataTable(); dt = blClienti.FiltrareClienti(nume, prenume, cod, tel); dataGridViewClienti.DataSource = dt; }
private void BtnAdd_Click(object sender, EventArgs e) { BLClients blClients = new BLClients(); if (String.IsNullOrWhiteSpace(tbNume.Text)) { errorProvider1.SetError(tbNume, "Camp obligatoriu!"); } else if (String.IsNullOrWhiteSpace(tbPrenume.Text)) { errorProvider1.SetError(tbPrenume, "Camp obligatoriu!"); } else if (String.IsNullOrWhiteSpace(tbCod.Text)) { errorProvider1.SetError(tbCod, "Camp obligatoriu!"); } else if (String.IsNullOrWhiteSpace(tbTelefon.Text)) { errorProvider1.SetError(tbTelefon, "Camp obligatoriu!"); } else { PartnerModel clientNou = new PartnerModel(); string nume = tbNume.Text; clientNou.Nume = nume; string prenume = tbPrenume.Text; clientNou.Prenume = prenume; string cod = tbCod.Text; clientNou.CodClient = cod; string tel = tbTelefon.Text; clientNou.Telefon = tel; string email = tbEmail.Text; clientNou.Email = email; blClients.InsertUser(nume, prenume, cod, tel, email, out bool status, out string error); MessageBox.Show(error, "Status", MessageBoxButtons.OK, MessageBoxIcon.Information); form.initializareDataGridView(); DialogResult dialogResult = MessageBox.Show("Doriti sa adaugati si adresa pentru clientul introdus?", "Adresa Client", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { AddressModel adresa = new AddressModel(); adresa.PartnerId = blClients.SelectPartnerId(nume, prenume, cod); EditClientAddressForm form = new EditClientAddressForm(adresa, clientNou); form.Show(); } else if (dialogResult == DialogResult.No) { this.Hide(); } } }
private void StergereClientToolStripMenuItem_Click(object sender, EventArgs e) { if (filled) { if (dataGridViewClienti.SelectedRows.Count > 0) { int clientId = -2; BLClients blClients = new BLClients(); BLAddress bLAddress = new BLAddress(); BLInvoices blInvoice = new BLInvoices(); foreach (DataGridViewRow row in dataGridViewClienti.SelectedRows) { clientId = Convert.ToInt32(row.Cells[0].Value.ToString()); } DataTable facturiClient = blInvoice.GetInvoicesById(clientId); if (facturiClient.Rows.Count <= 0) { DialogResult dialogResult = MessageBox.Show("Sigur doriti sa stergeti datele clientului?", "Stergere Client", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { bLAddress.DeleteAllAddresses(clientId, out string errorMessage); blClients.DeleteClient(clientId, out string message); MessageBox.Show(message, "Status", MessageBoxButtons.OK, MessageBoxIcon.Information); initializareDataGridView(); } else if (dialogResult == DialogResult.No) { this.Hide(); } } else { MessageBox.Show("Nu se poate sterge clientul, deoarece are facturi inregistrate!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information); initializareDataGridView(); } } else { MessageBox.Show("Selectati un client pentru stergere!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Lista clieti goala! Efectuati o cautare!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void initializareDataGridView() { try { BLClients blClienti = new BLClients(); DataTable dt = new DataTable(); dt = blClienti.GetClient(); dataGridViewClienti.DataSource = dt; filled = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void InitForm(InvoiceModel factura) { BLAddress blAdresa = new BLAddress(); BLClients blClient = new BLClients(); DataTable adresa = new DataTable(); DataTable client = new DataTable(); initComboBoxes(); tbNumar.Text = factura.InvoiceNumber.ToString(); dateTimePickerFactura.Value = factura.InvoiceDate; client = blClient.GetClientById(factura.client.ClientId); cbClient.Text = client.Rows[0]["NumeClient"].ToString(); adresa = blAdresa.GetClientAddressesById(factura.client.ClientId, factura.adresa.PartnerAddressId); cbAdrese.Text = adresa.Rows[0]["AdresaClient"].ToString(); tbObs.Text = factura.Observations.ToString(); }
private void userFormSelect_Load(object sender, EventArgs e) { // populate combobox List <CLI_FetchTousClients_Result> clientList = new List <CLI_FetchTousClients_Result>(); try { clientList = BLClients.GetAllClients(); comboBox1.DataSource = clientList; comboBox1.ValueMember = "CLIENT_ID"; comboBox1.DisplayMember = "CLIENT_LOGIN"; CLI_FetchTousClients_Result oCLi = (CLI_FetchTousClients_Result)comboBox1.SelectedItem; txtClientName.Text = oCLi.CLIENT_NOM.ToString() + " " + oCLi.CLIENT_PRENOM.ToString(); } catch (CustomError cEx) { MessageBox.Show(cEx.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); CustomError cEx = new CustomError(666); } }
private void cmbListeVolsReserves_SelectedIndexChanged(object sender, EventArgs e) { RES_GetResByClientId_Result oMonVol = (RES_GetResByClientId_Result)cmbListeVolsReserves.SelectedItem; BLAccompagnateurs oBlVoyageur = new BLAccompagnateurs(); List <CLI_GetClientMoneyInfo_Result> oListInfo = new List <CLI_GetClientMoneyInfo_Result>(); List <ACC_GetAccompagnateurChiffreParTete_Result> oList = new List <ACC_GetAccompagnateurChiffreParTete_Result>(); DataTable oData = new DataTable(); DataView oView = new DataView(); try { oListInfo = BLClients.GetClientMoneyInfo(_Client.CLIENT_ID, oMonVol.RES_ID); foreach (CLI_GetClientMoneyInfo_Result row in oListInfo) { txtPrixVol.Text = row.TRA_PRIX.ToString(); txtPrixTotalReservation.Text = row.RES_PRIX.ToString(); } txtDateVol.Text = oMonVol.PLAN_VOL_DATE.ToShortDateString(); oView = BLAccompagnateurs.GetVoyageursAvecPrixData(oMonVol.RES_ID); oList = BLAccompagnateurs.GetVoyageursAvecPrix(oMonVol.RES_ID); DataTable oDataTable = ToDataTable(oList); BindingList <ACC_GetAccompagnateurChiffreParTete_Result> oBList = new BindingList <ACC_GetAccompagnateurChiffreParTete_Result>(oList); dataGridViewVoyageursMod.DataSource = oList; dataGridViewVoyageursMod.Columns[0].Visible = false; dataGridViewVoyageursMod.Columns[4].ReadOnly = true; cmbVoyageurAModifier.DataSource = oList; cmbVoyageurAModifier.ValueMember = "ACC_ID"; cmbVoyageurAModifier.DisplayMember = "ACC_NOM"; } catch (CustomError cEx) { MessageBox.Show(cEx.Message); } catch (Exception ex) { CustomError cEx = new CustomError(666); MessageBox.Show(cEx.Message); } }