Beispiel #1
0
        public FrmMoedas(Principal principal)
        {
            InitializeComponent();

            this.principal = principal;

            SplitMoedas.Panel1Collapsed = false;
            SplitMoedas.Panel2Collapsed = true;
            SplitMoedas.Refresh();

            SplitListaPais.Panel1Collapsed = true;
            SplitListaPais.Panel2Collapsed = false;
            SplitListaPais.Refresh();

            Image  image  = Image.FromFile(iconSystem);
            Bitmap bitmap = new Bitmap(image);

            this.Icon = Icon.FromHandle(bitmap.GetHicon());

            FormUtil.Resize(principal, this);

            image         = Image.FromFile(actionEdit);
            BtnEdit.Image = image;

            image             = Image.FromFile(actionFilter);
            BtnFFiltrar.Image = image;

            image         = Image.FromFile(actionSave);
            BtnSave.Image = image;

            image          = Image.FromFile(actionClose);
            BtnClose.Image = image;

            image           = Image.FromFile(actionDelete);
            BtnDelete.Image = image;

            image           = Image.FromFile(actionBack);
            BtnVoltar.Image = image;

            image            = Image.FromFile(actionUp);
            BtnFiltrar.Image = image;

            BtnEdit.Enabled   = true;
            BtnNew.Enabled    = false;
            BtnSave.Enabled   = false;
            BtnDelete.Enabled = false;
            BtnVoltar.Visible = false;

            ValDesde.Mask = "00/00/0000";

            this.IsInsert = false;
            this.IsEdit   = false;

            popula_dados = new Thread(Inicializa);
            popula_dados.IsBackground = true;
            popula_dados.Start();

            DataMoedas.Focus();
        }
Beispiel #2
0
 private void FrmMoedas_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         if (e.KeyChar == (char)Keys.Escape)
         {
             BtnVoltar.Visible   = false;
             BtnEdit.Visible     = true;
             BtnFiltrar.Visible  = true;
             toolStrip06.Visible = true;
             if (this.IsEdit || this.IsInsert)
             {
                 if (SplitMoedas.Panel1Collapsed == true)
                 {
                     SplitMoedas.Panel1Collapsed = false;
                     SplitMoedas.Panel2Collapsed = true;
                     BtnSave.Enabled             = false;
                     if (IsEdit)
                     {
                         BtnDelete.Enabled = true;
                         BtnNew.Enabled    = true;
                     }
                     else
                     {
                         BtnDelete.Enabled = false;
                         BtnNew.Enabled    = false;
                     }
                     SplitMoedas.Refresh();
                 }
                 else
                 {
                     BtnNew.Enabled    = false;
                     BtnSave.Enabled   = false;
                     BtnDelete.Enabled = false;
                     IsEdit            = false;
                     IsInsert          = false;
                 }
             }
             else
             {
                 if (SplitMoedas.Panel1Collapsed == true)
                 {
                     SplitMoedas.Panel1Collapsed = false;
                     SplitMoedas.Panel2Collapsed = true;
                 }
                 else
                 {
                     this.Close();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(this, ex.Message, "Erro Moedas",
                           MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #3
0
 private void BtnNew_Click(object sender, EventArgs e)
 {
     SplitMoedas.Panel1Collapsed = true;
     SplitMoedas.Panel2Collapsed = false;
     ValMoeda.Enabled            = true;
     ValIso.Enabled       = true;
     ValDecimal.Enabled   = true;
     ValDescricao.Enabled = true;
     ValDesde.Enabled     = true;
     ValDescricao.Text    = "";
     ValPrimario.Checked  = false;
     ValDecimal.Text      = "";
     ValIso.Text          = "";
     ValMoeda.Text        = "";
     SplitMoedas.Refresh();
     ValMoeda.Focus();
     IsInsert            = true;
     BtnFiltrar.Visible  = false;
     BtnNew.Enabled      = false;
     BtnDelete.Enabled   = false;
     BtnSave.Enabled     = true;
     toolStrip06.Visible = false;
     ValDesde.Text       = "";
 }
Beispiel #4
0
        private void DataMoedas_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                String waers = DataMoedas.Rows[e.RowIndex].Cells[0].Value.ToString();

                if (waers != "")
                {
                    Moeda moeda = moedaDAO.FindByWaers(waers);

                    if (moeda != null)
                    {
                        ValMoeda.Text     = moeda.Waers;
                        ValIso.Text       = moeda.Tcurc;
                        ValDescricao.Text = moeda.Descricao;
                        ValDecimal.Text   = moeda.Cdecimal;
                        if (moeda.Primario == "X")
                        {
                            ValPrimario.Checked = true;
                        }
                        else
                        {
                            ValPrimario.Checked = false;
                        }
                        if (!moeda.ValDesde.ToString().Equals("01/01/0001 00:00:00"))
                        {
                            ValDesde.Text = moeda.ValDesde.ToString();
                        }
                        else
                        {
                            ValDesde.Text = "";
                        }
                    }

                    SplitMoedas.Panel1Collapsed = true;
                    SplitMoedas.Panel2Collapsed = false;
                    BtnEdit.Visible             = false;
                    BtnVoltar.Visible           = true;

                    SplitMoedas.Refresh();

                    if (this.IsEdit || this.IsInsert)
                    {
                        BtnSave.Enabled           = true;
                        BtnDelete.Enabled         = false;
                        BtnNew.Enabled            = false;
                        ValDecimal.Enabled        = true;
                        ValDescricao.Enabled      = true;
                        ValDesde.Enabled          = true;
                        ValFCheckPrimario.Enabled = true;
                        ValFMoeda.Enabled         = true;
                        ValMoeda.Enabled          = true;
                        ValIso.Enabled            = true;
                    }
                    else
                    {
                        ValDecimal.Enabled        = false;
                        ValDescricao.Enabled      = false;
                        ValDesde.Enabled          = false;
                        ValFCheckPrimario.Enabled = false;
                        ValFMoeda.Enabled         = false;
                        ValMoeda.Enabled          = false;
                        ValIso.Enabled            = false;
                    }

                    if (IsEdit)
                    {
                        ValDescricao.Focus();
                    }

                    if (IsInsert)
                    {
                        ValMoeda.Focus();
                    }

                    BtnFiltrar.Visible  = false;
                    toolStrip06.Visible = false;
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(this, ex.Message, "Erro Moedas",
                                  MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }