private void ReloadBusiness() { businessModels = BusinessManagement.SelectAllBusiness(); BusinessDataGridView.MultiSelect = false; BusinessDataGridView.DataSource = businessModels; BusinessDataGridView.Columns["Id_Business"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; BusinessDataGridView.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; BusinessDataGridView.Columns["Society_Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; BusinessDataGridView.Columns["LegalCertification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; BusinessDataGridView.Columns["Telephone"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; BusinessDataGridView.Columns["Main_Address"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; BusinessDataGridView.Columns["Email"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; BusinessDataGridView.Columns["WebPage"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; BusinessDataGridView.Columns["Logo"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; BusinessDataGridView.Columns["Id_Business"].HeaderText = "Id"; BusinessDataGridView.Columns["Name"].HeaderText = "Nombre"; BusinessDataGridView.Columns["Society_Name"].HeaderText = "Nombre de Sociedad"; BusinessDataGridView.Columns["LegalCertification"].HeaderText = "Cédula Jurídica"; BusinessDataGridView.Columns["Telephone"].HeaderText = "Teléfono"; BusinessDataGridView.Columns["Main_Address"].HeaderText = "Dirección"; BusinessDataGridView.Columns["Email"].HeaderText = "Correo Electronico"; BusinessDataGridView.Columns["WebPage"].HeaderText = "Página Web"; BusinessDataGridView.Columns["Logo"].HeaderText = "Logo"; BusinessDataGridView.Columns["Id_Business"].Visible = false; BusinessDataGridView.Columns["Logo"].Visible = false; BusinessDataGridView.Columns["LegalCertification"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }
//---------CRUD---------// private void createButton_Click(object sender, EventArgs e) { string fantasyName = txtFantasyName.Text; string society = txtSocietyName.Text; string legalDoc = txtlegalCertification.Text; string telephone = mtxtTelephone.Text; string mainAddress = txaMainAddress.Text; string generalAddress = txaGeneralAddress.Text; string email = txtEmail.Text; string webPage = txtWebPage.Text; logo = ImageManagement.ImageToByte(file); try { if (BusinessManagement.InsertBusiness(fantasyName, society, legalDoc, telephone, mainAddress, generalAddress, email, webPage, logo)) { Clear(); businessModels = BusinessManagement.SelectAllBusiness(); WireUpBusinessGridView(); FrmMain.Instance.ToolStripLabel.Text = "Negocio agregado correctamente"; } else { FrmMain.Instance.ToolStripLabel.Text = "Error al agregar el negocio"; } } catch (Exception) { throw; } }
private void UcAparts_Load(object sender, EventArgs e) { employeeComboBox.DataSource = EmployeeManagement.SelectAllEmployees(); employeeComboBox.DisplayMember = "Name"; StoreComboBox.DataSource = BusinessManagement.SelectAllBusiness(); StoreComboBox.DisplayMember = "fantasyName"; clientComboBox.DataSource = ClientManagement.SelectAllClients(); clientComboBox.DisplayMember = "Name"; WrapProductsGridView(); }
private void UcInputInvoice_Load(object sender, EventArgs e) { EmployeeComboBox.DataSource = EmployeeManagement.SelectAllEmployees(); EmployeeComboBox.DisplayMember = "Name"; DestinyComboBox.DataSource = BusinessManagement.SelectAllBusiness(); DestinyComboBox.DisplayMember = "fantasyName"; ProviderComboBox.DataSource = BusinessManagement.SelectAllBusiness(); ProviderComboBox.DisplayMember = "fantasyName"; WrapProductsGridView(); }
private void UcBusiness_Load(object sender, EventArgs e) { //dgvBusiness.Columns["idBusiness"].DisplayIndex = 0; //dgvBusiness.Columns["idBusiness"].HeaderText = "Id"; try { if (BusinessManagement.SelectAllBusiness() != null) { businessModels = BusinessManagement.SelectAllBusiness(); WireUpBusinessGridView(); FrmMain.Instance.ToolStripLabel.Text = "Los registros de la base de datos fueron cargados."; } } catch (Exception) { FrmMain.Instance.ToolStripLabel.Text = "No se encontraron registros en la base de datos."; throw; } }
private void deleteButton_Click(object sender, EventArgs e) { try { string id = businessGridView.CurrentRow.Cells[0].Value.ToString(); if (BusinessManagement.DeleteBusinessById(id)) { Clear(); businessModels = BusinessManagement.SelectAllBusiness(); WireUpBusinessGridView(); FrmMain.Instance.ToolStripLabel.Text = "El negocio ha sido elimado correctamente"; } else { FrmMain.Instance.ToolStripLabel.Text = "Error al eliminar el negocio"; } } catch (Exception) { throw; } }
private void updateButton_Click(object sender, EventArgs e) { string id = businessGridView.CurrentRow.Cells[0].Value.ToString(); string fantasyName = txtFantasyName.Text; string society = txtSocietyName.Text; string legalDoc = txtlegalCertification.Text; string telephone = mtxtTelephone.Text; string mainAddress = txaMainAddress.Text; string generalAddress = txaGeneralAddress.Text; string email = txtEmail.Text; string webPage = txtWebPage.Text; if (!string.IsNullOrEmpty(file)) { logo = ImageManagement.ImageToByte(file); } try { if (BusinessManagement.UpdateBusinessById(id, fantasyName, society, legalDoc, telephone, mainAddress, generalAddress, email, webPage, logo)) { Clear(); businessModels = BusinessManagement.SelectAllBusiness(); WireUpBusinessGridView(); FrmMain.Instance.ToolStripLabel.Text = "Negocio modificado correctamente"; } else { FrmMain.Instance.ToolStripLabel.Text = "Error al modificar el negocio"; } } catch (Exception) { throw; } }