private void btnDelete_Click(object sender, EventArgs e) { try { DialogResult option; option = MessageBox.Show("Do you really want to delete?", "SysBusiness", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (option == DialogResult.OK) { string Code; string resp = ""; foreach (DataGridViewRow row in dataList.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Code = Convert.ToString(row.Cells[1].Value); resp = BPresentation.Delete(Convert.ToInt32(Code)); if (resp.Equals("OK")) { this.MessageOk("Success deleted"); } else { this.MessageError(resp); } } } this.ShowValues(); } } catch (Exception ex) { } }
private void btnSave_Click(object sender, EventArgs e) { try { string resp = ""; if (txtNameConfig.Text == string.Empty) { MessageError("Fill the fields"); errorIcon.SetError(txtNameConfig, "Insert the name"); } else { if (this.eNew) { resp = BPresentation.Insert(this.txtNameConfig.Text.Trim().ToUpper(), txtDescription.Text.Trim()); } else { resp = BPresentation.Edit(Convert.ToInt32(this.txtIdPresentation.Text), this.txtNameConfig.Text.Trim().ToUpper(), txtDescription.Text.Trim()); } if (resp.Equals("OK")) { if (this.eNew) { this.MessageOk("Register saved"); } else { this.MessageOk("Register Edited"); } } else { this.MessageError(resp); } this.eNew = false; this.eEdit = false; this.Enabledbuttons(); this.Clean(); this.ShowValues(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void SearchName() { this.dataList.DataSource = BPresentation.SearchName(this.txtSearch.Text); this.HideCollumns(); lblTotal.Text = Convert.ToString(dataList.Rows.Count) + " registers found"; }
private void ShowValues() { this.dataList.DataSource = BPresentation.ShowValues(); this.HideCollumns(); lblTotal.Text = Convert.ToString(dataList.Rows.Count) + " registers found"; }
private void CombPresentation() { cbPresentation.DataSource = BPresentation.ShowValues(); cbPresentation.ValueMember = "idpresentation"; cbPresentation.DisplayMember = "name"; }