private void btnSalvarSel_Click(object sender, EventArgs e) { if (edtPreView.Text != "") { if (_controle == 'p') { try { if (_objProcBO.SalvarProcedureView(edtPreView.Text, edtCaminho.Text + @"\procedures\", listProcedures.SelectedValue.ToString() + ".sql")) { MessageBox.Show("Procedure salva com sucesso no caminho " + edtCaminho.Text + @"\procedures", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.InnerException + Environment.NewLine + ex.StackTrace + Environment.NewLine); } } else if (_controle == 'v') { try { if (_objProcBO.SalvarProcedureView(edtPreView.Text, edtCaminho.Text + @"\views\", listView.SelectedValue.ToString() + ".sql")) { MessageBox.Show("View salva com sucesso no caminho " + edtCaminho.Text + @"\views", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.InnerException + Environment.NewLine + ex.StackTrace + Environment.NewLine); } } else if (_controle == 't') { if (_objProcBO.SalvarProcedureView(edtPreView.Text, edtCaminho.Text + @"\triggers\", listTriggers.SelectedValue.ToString() + ".sql")) { MessageBox.Show("Trigger salva com sucesso no caminho " + edtCaminho.Text + @"\triggers", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (_controle == 'c') { List <infConstraints> lInfConst = new List <infConstraints>(); infConstraints objInfConst = new infConstraints { nomeConst = listConstraints.SelectedItem.ToString(), scriptConst = objConstrBo.MontaScript( lConstraints.Where(c => c.sConstrName == listConstraints.SelectedItem.ToString()).FirstOrDefault()) }; lInfConst.Add(objInfConst); try { SalvarConstraint(lInfConst); MessageBox.Show("Constraint salva com sucesso no caminho " + edtCaminho.Text + @"\constraints"); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } } else { MessageBox.Show("Não foi selecionada nenhuma procedure ou view", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void btnSalvarSel_Click(object sender, EventArgs e) { if (edtPreView.Text != "") { if (_controle == 'p') { try { if (_objProcBO.SalvarProcedureView(edtPreView.Text, edtCaminho.Text +@"\procedures\", listProcedures.SelectedValue.ToString() + ".sql")) { MessageBox.Show("Procedure salva com sucesso no caminho " + edtCaminho.Text+@"\procedures", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.InnerException + Environment.NewLine + ex.StackTrace + Environment.NewLine); } } else if (_controle == 'v') { try { if (_objProcBO.SalvarProcedureView(edtPreView.Text, edtCaminho.Text + @"\views\", listView.SelectedValue.ToString() + ".sql")) { MessageBox.Show("View salva com sucesso no caminho " + edtCaminho.Text+@"\views", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.InnerException + Environment.NewLine + ex.StackTrace + Environment.NewLine); } } else if (_controle == 't') { if (_objProcBO.SalvarProcedureView(edtPreView.Text, edtCaminho.Text + @"\triggers\", listTriggers.SelectedValue.ToString() + ".sql")) { MessageBox.Show("Trigger salva com sucesso no caminho " + edtCaminho.Text + @"\triggers", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if(_controle == 'c') { List<infConstraints> lInfConst = new List<infConstraints>(); infConstraints objInfConst = new infConstraints { nomeConst = listConstraints.SelectedItem.ToString(), scriptConst = objConstrBo.MontaScript( lConstraints.Where(c => c.sConstrName == listConstraints.SelectedItem.ToString()).FirstOrDefault()) }; lInfConst.Add(objInfConst); try { SalvarConstraint(lInfConst); MessageBox.Show("Constraint salva com sucesso no caminho " + edtCaminho.Text + @"\constraints"); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } } else { MessageBox.Show("Não foi selecionada nenhuma procedure ou view", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void btnSalvarTodos_Click(object sender, EventArgs e) { if (!cbProcedures.Checked && !cbViews.Checked && !cbTriggers.Checked && !cbConstraints.Checked) { MessageBox.Show("Marque uma das opções para o salvamento, Procedures ou Views", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (cbProcedures.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando procedures"; SalvarTodos(vlistView: ref listProcedures, vcompl: @"\procedures"); MessageBox.Show("Procedures salvas com sucesso em: " + edtCaminho.Text + @"\procedures"); } catch (Exception) { } } if (cbViews.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando views"; SalvarTodos(vlistView: ref listView, vcompl: @"\views"); MessageBox.Show("Views salvas com sucesso em: " + edtCaminho.Text + @"\views"); } catch (Exception) { } } if (cbTriggers.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando Triggers"; SalvarTodos(vlistView: ref listTriggers, vcompl: @"\triggers"); MessageBox.Show("Triggers salvas com sucesso em: " + edtCaminho.Text + @"\triggers"); } catch (Exception) { } } if (cbConstraints.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando Constraints"; infConstraints objInfConst; List <infConstraints> lInfConst = new List <infConstraints>(); foreach (string item in listConstraints.Items) { objInfConst = new infConstraints { nomeConst = item, scriptConst = objConstrBo.MontaScript( lConstraints.Where(c => c.sConstrName == item).FirstOrDefault()) }; lInfConst.Add(objInfConst); } try { SalvarConstraint(lInfConst); MessageBox.Show("Constraint salva com sucesso no caminho " + edtCaminho.Text + @"\constraints"); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } } pbGeral.Visible = false; lblStatus.Visible = false; } }
private void btnSalvarTodos_Click(object sender, EventArgs e) { if (!cbProcedures.Checked && !cbViews.Checked && !cbTriggers.Checked && !cbConstraints.Checked) { MessageBox.Show("Marque uma das opções para o salvamento, Procedures ou Views", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (cbProcedures.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando procedures"; SalvarTodos(vlistView: ref listProcedures, vcompl: @"\procedures"); MessageBox.Show("Procedures salvas com sucesso em: " + edtCaminho.Text+@"\procedures"); } catch (Exception) { } } if (cbViews.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando views"; SalvarTodos(vlistView: ref listView, vcompl: @"\views"); MessageBox.Show("Views salvas com sucesso em: " + edtCaminho.Text+@"\views"); } catch (Exception) { } } if(cbTriggers.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando Triggers"; SalvarTodos(vlistView: ref listTriggers, vcompl: @"\triggers"); MessageBox.Show("Triggers salvas com sucesso em: " + edtCaminho.Text + @"\triggers"); } catch (Exception) { } } if(cbConstraints.Checked) { try { pbGeral.Visible = true; lblStatus.Visible = true; lblStatus.Text = "Salvando Constraints"; infConstraints objInfConst; List<infConstraints> lInfConst = new List<infConstraints>(); foreach (string item in listConstraints.Items) { objInfConst = new infConstraints { nomeConst = item, scriptConst = objConstrBo.MontaScript( lConstraints.Where(c => c.sConstrName == item).FirstOrDefault()) }; lInfConst.Add(objInfConst); } try { SalvarConstraint(lInfConst); MessageBox.Show("Constraint salva com sucesso no caminho " + edtCaminho.Text + @"\constraints"); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } } pbGeral.Visible = false; lblStatus.Visible = false; } }