Beispiel #1
0
 private void MenuButtonNotaDebito_OnClick(object sender, RoutedEventArgs e)
 {
     if (_grid == null)
     {
         return;
     }
     _grid.FormType = typeof(FDebitNotes);
     //_grid.ObjetoApp = new SInvokeMethod(typeof(DebitNoteApp), "SearchAllDebitNote");
     _grid.Caption = "Notas de débito";
     _grid.Refresh();
     _grid.Visible = true;
 }
Beispiel #2
0
 private void MenuButtonUsuario_OnClick(object sender, RoutedEventArgs e)
 {
     if (_grid == null)
     {
         return;
     }
     _grid.FormType = typeof(FUser);
     //_grid.ObjetoApp = new InvokeMethod(typeof());
     _grid.ValueControl = new List <User>();
     _grid.Caption      = "Usuários";
     _grid.Refresh();
     _grid.Visible = true;
 }
        private void upd_Click(object sender, EventArgs e)
        {
            string id      = sId.Text;
            Regex  regexId = new Regex(@"^[1-9]\d*$");

            if (regexId.IsMatch(id))
            {
                string    name       = sName.Text;
                string    country    = sCou.Text;
                string    searchId   = "Id = " + id;
                string    searchName = "Name = '" + name + "'";
                DataRow[] rowId      = virusesDBDataSet2.Scientist.Select(searchId);
                DataRow[] rowName    = virusesDBDataSet2.Scientist.Select(searchName);
                Regex     regex      = new Regex("^([a-zA-Z]{2,}\\s[a-zA-z]{1,}'?-?[a-zA-Z]{2,}\\s?([a-zA-Z]{1,})?)");

                if (rowId.Length == 1 && rowName.Length == 0 && regex.IsMatch(name) && CountryValidator(country))
                {
                    SqlDataAdapter adapter = new SqlDataAdapter();
                    String         sql     = "UPDATE Scientist SET Name = '" + name + "', Country ='" + country + "' Where Id = " + id;
                    adapter.UpdateCommand = new SqlCommand(sql, cnn);
                    adapter.UpdateCommand.ExecuteNonQuery();
                    this.scientistTableAdapter.Fill(this.virusesDBDataSet2.Scientist);
                    SGrid.Refresh();
                    SGrid.Update();
                }
                else
                {
                    MessageBox.Show("Name is not correct or element with this ID or Name is not in table!");
                }
            }
            else
            {
                MessageBox.Show("Id is not correct!");
            }
        }
        private void del_Click(object sender, EventArgs e)
        {
            string id      = sId.Text;
            Regex  regexId = new Regex(@"^[1-9]\d*$");

            if (regexId.IsMatch(id))
            {
                string         searchId = "Id = " + id;
                DataRow[]      rowId    = virusesDBDataSet2.Scientist.Select(searchId);
                SqlDataAdapter adapter  = new SqlDataAdapter();
                String         vCheck   = "Select Id from VirusScientist where ScientistId = '" + id + "'";
                adapter.SelectCommand = new SqlCommand(vCheck, cnn);
                Object check = adapter.SelectCommand.ExecuteScalar();
                if (rowId.Length == 1 && check == null)
                {
                    String sql = "DELETE from Scientist Where Id = " + id;
                    adapter.DeleteCommand = new SqlCommand(sql, cnn);
                    adapter.DeleteCommand.ExecuteNonQuery();
                    this.scientistTableAdapter.Fill(this.virusesDBDataSet2.Scientist);
                    SGrid.Refresh();
                    SGrid.Update();
                }
                else
                {
                    MessageBox.Show("Element with this ID is not in table!");
                }
            }
            else
            {
                MessageBox.Show("Id is not correct!");
            }
        }
Beispiel #5
0
 private void MenuButtonImpostos_OnClick(object sender, RoutedEventArgs e)
 {
     if (_grid == null)
     {
         return;
     }
     _grid.FormType = typeof(FTaxation);
     _grid.Caption  = "Impostos";
     _grid.Refresh();
     _grid.Visible = true;
 }
Beispiel #6
0
 private void MenuButtonPessoaJuridica_OnClick(object sender, RoutedEventArgs e)
 {
     if (_grid == null)
     {
         return;
     }
     _grid.FormType = typeof(FLegalPerson);
     //_grid.ObjetoApp = new SInvokeMethod(typeof(LegalPersonApp), "SearchAllLegalPerson");
     _grid.Caption = "Pessoa Jurídica";
     _grid.Refresh();
     _grid.Visible = true;
 }
        public frmRolePrivileges()
        {
            InitializeComponent();

            InitializeGrid();


            Shown += (s, e) =>
            {
                LoadItems();
                SGrid.PrimaryGrid.ExpandAll(3);

                SGrid.Refresh();
            };
        }
Beispiel #8
0
 private void MenuButtonItemEstoque_OnClick(object sender, RoutedEventArgs e)
 {
     if (_grid == null)
     {
         return;
     }
     _grid.FormType = typeof(FStockItem);
     //_grid.ObjetoApp = new SInvokeMethod(typeof(StockItemApp), "SearchAllStockItem");
     _grid.Caption = "item de estoque";
     _grid.Refresh();
     _grid.Visible = true;
 }