Пример #1
0
        public void PreencheDadosEmployee(Employee employee)
        {
            lblEmployeeId.Text = UtilConvert.ToString(employee.EmployeeId);
            //lblWords.Text = UtilConvert.ToString(employee.Words);
            //lblWordsLanguage.Text = UtilConvert.ToString(employee.WordsLanguage);
            lblArchiveId.Text     = UtilConvert.ToString(employee.ArchiveId);
            picProfilePhoto.Image = UtilImage.ByteToImage(new Archive {
                ArchiveId = employee.ArchiveId
            }.ObterPorCod().Blob);
            uiTxtPNome.Text      = UtilConvert.ToString(employee.FirstName);
            uiTxtUNome.Text      = UtilConvert.ToString(employee.LastName);
            uiTxtDataNasc.Text   = UtilConvert.ToString(employee.DateBirth.ToString("dd/MM/yyyy"));
            uiTxtSexo.Text       = UtilConvert.ToString(employee.Gender);
            uiTxtCPF.Text        = UtilConvert.ToString(employee.CPF);
            uiTxtRG.Text         = UtilConvert.ToString(employee.RG);
            uiTxtEmail.Text      = UtilConvert.ToString(employee.Email);
            uiTxtLogradouro.Text = UtilConvert.ToString(employee.StreetLine);
            //uiPanelEndereco.Text = UtilConvert.ToString("0");
            uiTxtBairro.Text  = UtilConvert.ToString(employee.Neighborhood);
            uiTxtPais.Text    = UtilConvert.ToString(employee.Country);
            uiTxtCidade.Text  = UtilConvert.ToString(employee.City);
            uiTxtEstado.Text  = UtilConvert.ToString(employee.Region);
            uiTxtNumero.Text  = UtilConvert.ToString(employee.Number);
            uiTxtCep.Text     = UtilConvert.ToString(employee.PostCode);
            uiTxtTelCel.Text  = UtilConvert.ToString(employee.MobileNumber);
            uiTxtTelFixo.Text = UtilConvert.ToString(employee.PhoneNumber);

            btnCriar.Visible     = false;
            btnCancelar.Visible  = true;
            btnAtualizar.Visible = true;
            uiTxtCPF.ReadOnly    = true;
        }
Пример #2
0
        private void Employee_Click(object sender, EventArgs e)
        {
            if (sender is Panel)
            {
                Panel panel = sender as Panel;
                employee = (new Employee {
                    EmployeeId = UtilConvert.ToInt(panel.Tag)
                }.ObterPorId());

                uiTxtCPF.ReadOnly = true;
                uiTxtCPF.Text     = UtilConvert.ToString(employee.CPF);
            }
            else if (sender is Label)
            {
                Label label = sender as Label;
                employee = (new Employee {
                    EmployeeId = UtilConvert.ToInt(label.Tag)
                }.ObterPorId());

                uiTxtCPF.ReadOnly = true;
                uiTxtCPF.Text     = UtilConvert.ToString(employee.CPF);
            }
            else if (sender is PictureBox)
            {
                PictureBox pictureBox = sender as PictureBox;
                employee = (new Employee {
                    EmployeeId = UtilConvert.ToInt(pictureBox.Tag)
                }.ObterPorId());

                uiTxtCPF.ReadOnly = true;
                uiTxtCPF.Text     = UtilConvert.ToString(employee.CPF);
            }
        }
Пример #3
0
        private void CreateUserPanel(Employee employee, FlowLayoutPanel flowLayoutPanel)
        {
            uiPanel uiPanel = new uiPanel();

            uiPanel.Name        = "pnlEmployee" + employee.EmployeeId;
            uiPanel.Size        = new Size(221, 86);
            uiPanel.PanelRadius = 5;
            uiPanel.Tag         = employee.EmployeeId;
            uiPanel.BackColor   = Color.FromArgb(215, 223, 255);
            uiPanel.Click      += new EventHandler(Employee_Click);

            PictureBox pictureBox = new PictureBox();

            pictureBox.Name  = "picEmployee" + employee.EmployeeId;
            pictureBox.Size  = new Size(77, 77);
            pictureBox.Image = UtilImage.ByteToImage(new Archive {
                ArchiveId = employee.ArchiveId
            }.ObterPorCod().Blob);
            pictureBox.SizeMode  = PictureBoxSizeMode.StretchImage;
            pictureBox.Tag       = employee.EmployeeId;
            pictureBox.BackColor = Color.Transparent;
            uiPanel.Controls.Add(pictureBox);
            pictureBox.Location = new Point(4, 4);
            pictureBox.Click   += new EventHandler(Employee_Click);

            Label label = new Label();

            label.Name         = "lblEmployee" + employee.EmployeeId;
            label.Font         = new Font("Gadugi", 14, FontStyle.Bold);
            label.ForeColor    = Color.FromArgb(80, 63, 153);
            label.Tag          = employee.EmployeeId;
            label.BackColor    = Color.FromArgb(242, 245, 255);
            label.Text         = employee.FirstName + " " + employee.LastName;
            label.AutoEllipsis = true;
            label.AutoSize     = false;
            label.Size         = new Size(133, 21);
            uiPanel.Controls.Add(label);
            label.Location = new Point(85, 6);
            label.Click   += new EventHandler(Employee_Click);

            Label labelCPF = new Label();

            labelCPF.Name         = "lblEmployeeCPF" + employee.EmployeeId;
            labelCPF.Font         = new Font("Gadugi", 8);
            labelCPF.ForeColor    = Color.FromArgb(180, 182, 194);
            labelCPF.BackColor    = Color.FromArgb(242, 245, 255);
            labelCPF.Text         = UtilConvert.ToString(employee.CPF);
            labelCPF.AutoEllipsis = true;
            labelCPF.Tag          = employee.EmployeeId;
            labelCPF.AutoSize     = false;
            labelCPF.Size         = new Size(131, 14);
            uiPanel.Controls.Add(labelCPF);
            labelCPF.Location = new Point(87, 27);
            labelCPF.Click   += new EventHandler(Employee_Click);


            flowLayoutPanel.Controls.Add(uiPanel);
            //flowLayoutPanel.Controls.Add(uiPanelEmployee);
        }
Пример #4
0
        public static void CreateCustomerJPanel(CustomerJuridico customer, FlowLayoutPanel flowLayoutPanel, EventHandler eventHandler)
        {
            uiPanel uiPanel = new uiPanel();

            uiPanel.Name        = "pnlCustomer" + customer.CustomerId;
            uiPanel.Size        = new Size(241, 86);
            uiPanel.PanelRadius = 5;
            uiPanel.Tag         = customer.CustomerId;
            uiPanel.BackColor   = Color.Transparent;
            uiPanel.Click      += new EventHandler(eventHandler);

            PictureBox pictureBox = new PictureBox();

            pictureBox.Name  = "picCustomer" + customer.CustomerId;
            pictureBox.Size  = new Size(77, 77);
            pictureBox.Image = Resources.unknown;
            //pictureBox.Image = UtilImage.ByteToImage(new Archive { ArchiveId = customer.ArchiveId }.ObterPorCod().Blob);
            pictureBox.SizeMode  = PictureBoxSizeMode.StretchImage;
            pictureBox.Tag       = customer.CustomerId;
            pictureBox.BackColor = Color.Transparent;
            uiPanel.Controls.Add(pictureBox);
            pictureBox.Location = new Point(4, 4);
            pictureBox.Click   += new EventHandler(eventHandler);

            Label label = new Label();

            label.Name         = "lblCustomerName" + customer.CustomerId;
            label.Font         = new Font("Gadugi", 14, FontStyle.Bold);
            label.ForeColor    = Color.FromArgb(80, 63, 153);
            label.Tag          = customer.CustomerId;
            label.BackColor    = Color.FromArgb(242, 245, 255);
            label.Text         = customer.CNPJ;
            label.AutoEllipsis = true;
            label.AutoSize     = false;
            label.Size         = new Size(133, 21);
            uiPanel.Controls.Add(label);
            label.Location = new Point(85, 6);
            label.Click   += new EventHandler(eventHandler);

            Label labelBalance = new Label();

            labelBalance.Name         = "lblCustomerEmail" + customer.CustomerId;
            labelBalance.Font         = new Font("Gadugi", 8);
            labelBalance.ForeColor    = Color.FromArgb(180, 182, 194);
            labelBalance.BackColor    = Color.FromArgb(242, 245, 255);
            labelBalance.Text         = UtilConvert.ToString(customer.Email);
            labelBalance.AutoEllipsis = true;
            labelBalance.Tag          = customer.CustomerId;
            labelBalance.AutoSize     = false;
            labelBalance.Size         = new Size(131, 14);
            uiPanel.Controls.Add(labelBalance);
            labelBalance.Location = new Point(87, 27);
            labelBalance.Click   += new EventHandler(eventHandler);

            flowLayoutPanel.Controls.Add(uiPanel);
            //flowLayoutPanel.Controls.Add(uiPanelEmployee);
        }
Пример #5
0
        public static void CreateCryptocurrencyPanel(List <Cryptocurency> cryptocurrencyList, FlowLayoutPanel flowLayoutPanel, EventHandler eventHandler)
        {
            foreach (var cryptocurrency in cryptocurrencyList)
            {
                uiPanel uiPanel = new uiPanel();
                uiPanel.Name        = "pnlCryptocurrency" + cryptocurrency.CryptocurrencyId;
                uiPanel.Size        = new Size(221, 86);
                uiPanel.PanelRadius = 5;
                uiPanel.Tag         = cryptocurrency.CryptocurrencyId;
                uiPanel.BackColor   = Color.FromArgb(215, 223, 255);
                uiPanel.Click      += new EventHandler(eventHandler);

                PictureBox pictureBox = new PictureBox();
                pictureBox.Name  = "picCryptocurrency" + cryptocurrency.CryptocurrencyId;
                pictureBox.Size  = new Size(77, 77);
                pictureBox.Image = UtilImage.ByteToImage(new Archive {
                    ArchiveId = cryptocurrency.ArchiveId
                }.ObterPorCod().Blob);
                pictureBox.SizeMode  = PictureBoxSizeMode.StretchImage;
                pictureBox.Tag       = cryptocurrency.CryptocurrencyId;
                pictureBox.BackColor = Color.Transparent;
                uiPanel.Controls.Add(pictureBox);
                pictureBox.Location = new Point(4, 4);
                pictureBox.Click   += new EventHandler(eventHandler);

                Label label = new Label();
                label.Name         = "lblCryptocurrency" + cryptocurrency.CryptocurrencyId;
                label.Font         = new Font("Gadugi", 14, FontStyle.Bold);
                label.ForeColor    = Color.FromArgb(80, 63, 153);
                label.Tag          = cryptocurrency.CryptocurrencyId;
                label.BackColor    = Color.FromArgb(242, 245, 255);
                label.Text         = String.Format("{0} [{1}]", cryptocurrency.Name, cryptocurrency.Base);
                label.AutoEllipsis = true;
                label.AutoSize     = false;
                label.Size         = new Size(133, 21);
                uiPanel.Controls.Add(label);
                label.Location = new Point(85, 6);
                label.Click   += new EventHandler(eventHandler);

                Label labelBalance = new Label();
                labelBalance.Name         = "lblCryptocurrencyBalance" + cryptocurrency.CryptocurrencyId;
                labelBalance.Font         = new Font("Gadugi", 8);
                labelBalance.ForeColor    = Color.FromArgb(180, 182, 194);
                labelBalance.BackColor    = Color.FromArgb(242, 245, 255);
                labelBalance.Text         = String.Format("{0} ({1})", UtilConvert.ToString(cryptocurrency.CryptocurrencyBalance), UtilConvert.ToString(cryptocurrency.CryptocurrencyUnit));
                labelBalance.AutoEllipsis = true;
                labelBalance.Tag          = cryptocurrency.CryptocurrencyId;
                labelBalance.AutoSize     = false;
                labelBalance.Size         = new Size(131, 14);
                uiPanel.Controls.Add(labelBalance);
                labelBalance.Location = new Point(87, 27);
                labelBalance.Click   += new EventHandler(eventHandler);

                flowLayoutPanel.Controls.Add(uiPanel);
                //flowLayoutPanel.Controls.Add(uiPanelEmployee);
            }
        }
Пример #6
0
        private void uiButtonValidar_Click(object sender, EventArgs e)
        {
            if (currentCustomerFisico != null)
            {
                if (uiTxtValidacao.Text == currentCustomerFisico.RG)
                {
                    uiPanelSecurity.Visible    = false;
                    flowPanelCustomerJ.Visible = false;

                    txtNomeF.Text  = string.Format("{0} {1}", currentCustomerFisico.FirstName, currentCustomerFisico.LastName);
                    txtDataF.Text  = UtilConvert.ToString(UtilConvert.ToDate(currentCustomerFisico.DateBirth).ToShortDateString());
                    txtSexoF.Text  = UtilConvert.ToString(currentCustomerFisico.Gender);
                    txtCPFF.Text   = UtilConvert.ToString(currentCustomerFisico.CPF);
                    txtRGF.Text    = UtilConvert.ToString(currentCustomerFisico.RG);
                    txtEmailF.Text = UtilConvert.ToString(currentCustomerFisico.Email);

                    flowPanelCustomerF.Controls.Add(uiFlowPanelMoedas);
                    flowPanelCustomerF.Controls.Add(panelCryptocurrency);
                    flowPanelCustomerF.Visible = true;
                }
                else
                {
                    new Alert("O RG fornecido não está de acordo com atual cliente.\nTente novamente mais tarde.", uiCSB.Toastr.Type.Warning);
                }
            }
            else if (currentCustomerJuridico != null)
            {
                if (uiTxtValidacao.Text == currentCustomerJuridico.RazaoSocial)
                {
                    uiPanelSecurity.Visible    = false;
                    flowPanelCustomerF.Visible = false;

                    txtRazaoSocialJ.Text = UtilConvert.ToString(currentCustomerJuridico.RazaoSocial);
                    txtCNPJJ.Text        = UtilConvert.ToString(currentCustomerJuridico.CNPJ);
                    txtEmailJ.Text       = UtilConvert.ToString(currentCustomerJuridico.Email);

                    flowPanelCustomerJ.Controls.Add(uiFlowPanelMoedas);
                    flowPanelCustomerJ.Controls.Add(panelCryptocurrencyJ);
                    flowPanelCustomerJ.Visible = true;
                }
                else
                {
                    new Alert("A razão social fornecida não está de acordo com atual cliente.\nTente novamente mais tarde.", uiCSB.Toastr.Type.Warning);
                }
            }
        }
Пример #7
0
        private void uiFlowPanelMoedas_ParentChanged(object sender, EventArgs e)
        {
            List <Cryptocurency> cryptocurrencys = new Cryptocurency().ObterTodos();

            foreach (Cryptocurency cryptocurrency in cryptocurrencys)
            {
                uiPicture uiPicture = uiPicture1;
                uiPicture.BackgroundImage = UtilImage.ByteToImage(new Archive()
                {
                    ArchiveId = cryptocurrency.ArchiveId
                }.ObterPorCod().Blob);
                uiPicture.Tag = UtilConvert.ToString(cryptocurrency.CryptocurrencyId);
                //uiPicture.Click += new EventHandler(UiPicture_Click);
                uiPicture.Visible = true;
                uiFlowPanelMoedas.Controls.Add(uiPicture);
            }
        }
Пример #8
0
 private void GeneratePanel(Wallet wallet)
 {
     if (wallet != null)
     {
         if (!(currentCustomerFisico is null))
         {
             txtAddressF.Text  = UtilConvert.ToString(wallet.Address);
             txtCurencyF.Text  = UtilConvert.ToString(wallet.CryptoCurrencyBalance).Replace(',', '.');
             txtSendedF.Text   = UtilConvert.ToString(wallet.CryptoCurrencySent).Replace(',', '.');
             txtReceivedF.Text = UtilConvert.ToString(wallet.CryptoCurrencyReceived).Replace(',', '.');
         }
         else if (!(currentCustomerJuridico is null))
         {
             txtAddressJ.Text  = UtilConvert.ToString(wallet.Address);
             txtBalanceJ.Text  = UtilConvert.ToString(wallet.CryptoCurrencyBalance).Replace(',', '.');
             txtSendedJ.Text   = UtilConvert.ToString(wallet.CryptoCurrencySent).Replace(',', '.');
             txtReceivedJ.Text = UtilConvert.ToString(wallet.CryptoCurrencyReceived).Replace(',', '.');
         }
     }
Пример #9
0
        public void PreencheDadosCryptocurrency(Cryptocurency cryptocurency)
        {
            newImage = false;

            picCriptocurrency.Image = UtilImage.ByteToImage(new Archive {
                ArchiveId = cryptocurency.ArchiveId
            }.ObterPorCod().Blob);
            lblCryptocurrencyId.Text            = UtilConvert.ToString(cryptocurency.CryptocurrencyId);
            lblArchiveId.Text                   = UtilConvert.ToString(cryptocurency.ArchiveId);
            uiTxtCriptocurrency.Text            = UtilConvert.ToString(cryptocurency.Name);
            uiTxtCryptocurrencyBalance.Text     = UtilConvert.ToString(cryptocurency.CryptocurrencyBalance);
            uiTxtCryptocurrencyUnit.Text        = UtilConvert.ToString(cryptocurency.CryptocurrencyUnit);
            uiTxtDescription.Text               = UtilConvert.ToString(cryptocurency.Description);
            uiTxtCryptocurrencyBase.Text        = UtilConvert.ToString(cryptocurency.Base);
            uiTxtCryptocurrencyBalance.ReadOnly = true;
            uiTxtCryptocurrencyUnit.ReadOnly    = true;

            btnCriar.Visible     = false;
            btnAtualizar.Visible = true;
        }
Пример #10
0
 private void btnCriar_ClickAsync(object sender, EventArgs e)
 {
     try
     {
         if (UtilValidar.CamposValidos(uiPanelDados))
         {
             if (newImage)
             {
                 new Employee
                 {
                     ArchiveId = new Archive {
                         Blob = UtilImage.ImageToByte(picProfilePhoto.Image)
                     }.Gravar(),
                     Words         = UtilConvert.ToString(RandomWordsAsync(12)),
                     WordsLanguage = UtilConvert.ToString("en-US"),
                     FirstName     = UtilConvert.ToString(uiTxtPNome.Text),
                     LastName      = UtilConvert.ToString(uiTxtUNome.Text),
                     DateBirth     = UtilConvert.ToDateTime(uiTxtDataNasc.Text),
                     Gender        = UtilConvert.ToChar(uiTxtSexo.Text),
                     CPF           = uiTxtCPF.Text,
                     RG            = uiTxtRG.Text,
                     Email         = uiTxtEmail.Text,
                     StreetLine    = uiTxtLogradouro.Text,
                     //uiTxtNumero.Text,
                     //uiTxtBairro.Text,
                     Country      = uiTxtPais.Text,
                     City         = uiTxtCidade.Text,
                     Neighborhood = uiTxtBairro.Text,
                     Region       = uiTxtEstado.Text,
                     Number       = uiTxtNumero.Text,
                     PostCode     = uiTxtCep.Text,
                     MobileNumber = uiTxtTelCel.Text,
                     PhoneNumber  = uiTxtTelFixo.Text
                 }.Gravar();
             }
             else
             {
                 new Employee
                 {
                     ArchiveId     = UtilConvert.ToInt(lblArchiveId.Text),
                     Words         = UtilConvert.ToString(RandomWordsAsync(12)),
                     WordsLanguage = UtilConvert.ToString("en-US"),
                     FirstName     = UtilConvert.ToString(uiTxtPNome.Text),
                     LastName      = UtilConvert.ToString(uiTxtUNome.Text),
                     DateBirth     = UtilConvert.ToDateTime(uiTxtDataNasc.Text),
                     Gender        = UtilConvert.ToChar(uiTxtSexo.Text),
                     CPF           = uiTxtCPF.Text,
                     RG            = uiTxtRG.Text,
                     Email         = uiTxtEmail.Text,
                     StreetLine    = uiTxtLogradouro.Text,
                     //uiTxtNumero.Text,
                     //uiTxtBairro.Text,
                     Country      = uiTxtPais.Text,
                     City         = uiTxtCidade.Text,
                     Neighborhood = uiTxtBairro.Text,
                     Region       = uiTxtEstado.Text,
                     Number       = uiTxtNumero.Text,
                     PostCode     = uiTxtCep.Text,
                     MobileNumber = uiTxtTelCel.Text,
                     PhoneNumber  = uiTxtTelFixo.Text
                 }.Gravar();
             }
         }
     }
     catch (NullReferenceException)
     {
         new Alert("Preencha todos os campos antes de atualizar.", Type.Warning);
     }
     catch (Exception ex)
     {
         new Alert(ex.Message, Type.Warning);
     }
 }