public override void doOnLoad() { //auditagemCompativel(); trans_table = new DataTable(); if (!(Usuario.Cidade == null)) { this.Text = Usuario.Cidade; preencheTransformadores(); if (trans_table.Rows.Count > 0) { comboChaves.SelectedIndex = 0; Usuario.Chave = comboChaves.SelectedItem.ToString(); } else { if (MessageBox.Show("Não há transformadores cadastrados para este" + " município.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.OK) { Enabled = false; //inserirChavePanel.Visible = true; EditarTransformadores editTrans = new EditarTransformadores(); editTrans.ShowDialog(); preencheTransformadores(); } } } //btPlanilha.Enabled = false; //if (Usuario.Tipo == "ADMIN" || Usuario.Tipo == "AUDIT") //{ // btPlanilha.Enabled = true; //} this.Enabled = true; this.Visible = true; }
//private void showTelaCadastro() //{ // if (Usuario.Edita) // { // if (Library.IsNullOrEmpty(Usuario.Chave)) // { // editando = false; // //MessageBox.Show("Escolha uma Chave para esta função"); // MessageBox.Show("Favor selecionar a Chave antes de tentar esta opção."); // //notification1.Visible = true; // return; // } // else if (!Library.IsNullOrEmpty(Usuario.Chave)) // { // SqlCeCommand sql = // new SqlCeCommand("select * from transformadores where cidade_fk = '"+Usuario.Cidade+"' and chave = '"+Usuario.Chave+"'", Conn.sqlConn); // SqlCeDataAdapter adapter = // new SqlCeDataAdapter(sql); // DataTable table = new DataTable(); // adapter.Fill(table); // DataRow row = table.Rows[0]; // //DataRow[] row = cipDatabaseDataSet.Transformadores.Select("cidade_fk = '" + Usuario.Cidade + "' " + // // "AND chave = '" + Usuario.Chave + "'"); // chaveTextBox.Text = (String)row["chave"]; // ciaTextBox.Text = (String)row["cia"]; // } // } // salvarButton.Enabled = editando; // inserirButton.Enabled = !editando; // //inserirChavePanel.Dock = DockStyle.Fill; // //panel2.BringToFront(); // inserirChavePanel.Visible = true; // chaveTextBox.Focus(); // //Menu = null; // menuItem1.Enabled = false; //} private void menuItem6_Click(object sender, EventArgs e) { //editando = true; //showTelaCadastro(); int comboIndex = comboChaves.SelectedIndex; Cursor.Current = Cursors.WaitCursor; Application.DoEvents(); EditarTransformadores editTrans = new EditarTransformadores(); editTrans.ShowDialog(); preencheTransformadores(); comboChaves.SelectedIndex = comboIndex; }
private void menuItem5_Click(object sender, EventArgs e) { //editando = false; //showTelaCadastro(); Cursor.Current = Cursors.WaitCursor; Application.DoEvents(); EditarTransformadores editTrans = new EditarTransformadores(); editTrans.ShowDialog(); preencheTransformadores(); if (trans_table.Rows.Count > 0) { comboChaves.SelectedIndex = 0; Usuario.Chave = comboChaves.SelectedItem.ToString(); } }