예제 #1
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);
            }
        }
예제 #2
0
            public bool call(DataGridView dgv, string pesquisa, bool ativo)
            {
                DateTime?         data        = UtilConvert.ObterNullableData(pesquisa);
                List <clnReserva> objReservas = null;

                if (data != null)
                {
                    objReservas = new clnReserva
                    {
                        Agendado = (DateTime)data,
                        Ativo    = ativo
                    }.obterPorDataAgendada();
                }
                else
                {
                    objReservas = new clnReserva
                    {
                        Ativo = ativo
                    }.obterReservas();
                }
                foreach (clnReserva objReserva in objReservas)
                {
                    //"Código", "Pessoas", "Data", "Situação"
                    dgv.Rows.Add(new object[] { objReserva.Cod, objReserva.Pessoas, UtilFormatar.formatarData(objReserva.Agendado), objReserva.Situacao });
                }
                return(false);
            }
예제 #3
0
        public string listarReservas(string codCliente)
        {
            if (codCliente != null && UtilValidar.validarInt(codCliente))
            {
                int cod = UtilConvert.ToInt(codCliente);

                List <clnReserva> objReservas = new clnReserva
                {
                    CodCliente = cod
                }.obterPorCliente();

                StringBuilder listarBuilder = new StringBuilder();

                foreach (clnReserva objReserva in objReservas)
                {
                    if (listarBuilder.Length > 0)
                    {
                        listarBuilder.AppendLine("$");
                    }
                    listarBuilder.Append(objReserva.Cod);
                    listarBuilder.Append("&").Append(new DateTimeOffset(objReserva.Agendado).ToUnixTimeMilliseconds());
                    listarBuilder.Append("&").Append(objReserva.Pessoas);
                    listarBuilder.Append("&").Append(objReserva.Informacoes);
                    listarBuilder.Append("&").Append(objReserva.prefixo(objReserva.Situacao));
                }

                return(listarBuilder.ToString());
            }
            else
            {
                return("0Cliente não informado");
            }
        }
예제 #4
0
        public object GetJwtStr(string name, string pass)
        {
            string jwtStr = string.Empty;
            bool   suc    = false;

            //这里就是用户登录以后,通过数据库去调取数据,分配权限的操作
            //这里直接写死了
            if (name == "admin" && pass == "123456")
            {
                TokenModel tokenModel = new TokenModel();
                tokenModel.Uid            = "1";
                tokenModel.Roles          = UtilConvert.StringToList("admin");
                tokenModel.Users          = UtilConvert.StringToList(name);
                tokenModel.ExpiryDateTime = DateTime.Now.AddMinutes((Convert.ToDouble(ConfigHelper.GetValue("EffectiveMin"))));
                jwtStr = JwtHelper.IssueJwt(tokenModel);
                suc    = true;
            }
            else
            {
                jwtStr = "login fail!!!";
            }
            var result = new
            {
                data = new { success = suc, token = jwtStr }
            };

            return(Json(result));
        }
예제 #5
0
        private void Employee_Click(object sender, EventArgs e)
        {
            if (sender is Panel)
            {
                Panel panel = sender as Panel;
                PreencheDadosEmployee(new Employee {
                    EmployeeId = UtilConvert.ToInt(panel.Tag)
                }.ObterPorId());
            }
            else if (sender is Label)
            {
                Label label = sender as Label;
                PreencheDadosEmployee(new Employee {
                    EmployeeId = UtilConvert.ToInt(label.Tag)
                }.ObterPorId());
            }
            else if (sender is PictureBox)
            {
                PictureBox pictureBox = sender as PictureBox;
                PreencheDadosEmployee(new Employee {
                    EmployeeId = UtilConvert.ToInt(pictureBox.Tag)
                }.ObterPorId());
            }

            newImage = false;
        }
예제 #6
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;
        }
예제 #7
0
        private void UiPicture_Click(object sender, EventArgs e)
        {
            uiPicture pic = sender as uiPicture;

            if (currentCustomerFisico != null)
            {
                Wallet wallet = new Wallet
                {
                    CustomerId       = currentCustomerFisico.CustomerId,
                    CryptoCurrencyId = UtilConvert.ToInt(pic.Tag)
                }.ObterPorId();

                GeneratePanel(wallet);
            }
            else if (currentCustomerJuridico != null)
            {
                Wallet wallet = new Wallet
                {
                    CustomerId       = currentCustomerJuridico.CustomerId,
                    CryptoCurrencyId = UtilConvert.ToInt(pic.Tag)
                }.ObterPorId();

                GeneratePanel(wallet);
            }
            else
            {
                new Alert("Ocorreu um erro grave! comunique ao seu gestor.", uiCSB.Toastr.Type.Error);
            }
        }
예제 #8
0
        public object UserLogin([FromBody] LoginModel model)
        {
            string jwtStr = string.Empty;
            bool   suc    = false;
            //这里就是用户登录以后,通过数据库去调取数据,分配权限的操作
            string      passWordHash = Common.Helper.MD5Helper.GetMD5(model.Password);
            QueryParams param        = new QueryParams();

            param.UserName = model.Account;
            param.PassWord = passWordHash;
            UserInfoModel user = userService.LogOn(param);

            if (user != null && !string.IsNullOrEmpty(user.RoleID))
            {
                RoleModel  role       = roleService.QueryById(user.RoleID);
                TokenModel tokenModel = new TokenModel();
                tokenModel.Uid            = DateTime.Now.ToString("yyyyMMddHHssmm");
                tokenModel.Roles          = UtilConvert.StringToList(role == null ? "Common" : role.RoleName);
                tokenModel.Users          = UtilConvert.StringToList(user.Account);
                tokenModel.ExpiryDateTime = DateTime.Now.AddMinutes((Convert.ToDouble(ConfigHelper.GetValue("EffectiveMin"))));
                jwtStr = JwtHelper.IssueJwt(tokenModel);
                suc    = true;
            }
            else
            {
                jwtStr = "用户名或密码错误!";
            }
            var result = new
            {
                data = new { success = suc, token = jwtStr }
            };

            return(Json(result));
        }
예제 #9
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);
        }
예제 #10
0
        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            try
            {
                if (UtilValidar.CamposValidos(uiPanelCryptocurrency))
                {
                    if (newImage)
                    {
                        int archiveId = new Archive
                        {
                            Blob = UtilImage.ImageToByte(picCriptocurrency.Image),
                        }.Gravar();

                        bool updated = new Cryptocurency
                        {
                            ArchiveId             = archiveId,
                            Name                  = uiTxtCriptocurrency.Text,
                            Base                  = uiTxtCryptocurrencyBase.Text,
                            Description           = uiTxtDescription.Text,
                            CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text),
                            CryptocurrencyUnit    = uiTxtCryptocurrencyUnit.Text
                        }.AlterarPorId();

                        if (updated)
                        {
                            new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info);
                            newImage = false;
                        }
                        else
                        {
                            new Alert(String.Format("A criptomoeda {0} não foi cadastrada. Tente novamente mais tarde.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Warning);
                            newImage = true;
                        }
                    }
                    else
                    {
                        bool response = new Cryptocurency
                        {
                            ArchiveId             = UtilConvert.ToInt(lblArchiveId.Text),
                            Name                  = uiTxtCriptocurrency.Text,
                            Base                  = uiTxtCryptocurrencyBase.Text,
                            Description           = uiTxtDescription.Text,
                            CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text),
                            CryptocurrencyUnit    = uiTxtCryptocurrencyUnit.Text
                        }.AlterarPorId();

                        new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info);
                    }
                }
            }
            catch (Exception ex)
            {
                new Alert(ex.Message, uiCSB.Toastr.Type.Warning);
            }
            finally
            {
                ObterCriptomoedas();
            }
        }
예제 #11
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);
            }
        }
예제 #12
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);
        }
예제 #13
0
        public bool tokenValidade(string token)
        {
            String conteudo = UtilConvert.FromBase64(token);

            String[] dataHora      = conteudo.Split('&')[1].Split('$');
            DateTime tokenValidade = UtilConvert.ObterDataHora(dataHora[0], dataHora[1]);

            return(tokenValidade.CompareTo(DateTime.Now) >= 1);
        }
예제 #14
0
        private String construirToken(clnCliente objCliente)
        {
            String tokenCliente = gerarTokenCliente(objCliente);

            DateTime tempoParaRecuperar = DateTime.Now;

            tempoParaRecuperar = tempoParaRecuperar.AddHours(3);

            String tokenDataHora = UtilFormatar.formatarData(tempoParaRecuperar) + "$" + UtilFormatar.formatarHora(tempoParaRecuperar);
            String token         = tokenCliente + "&" + tokenDataHora;

            return(UtilConvert.ToBase64(token));
        }
예제 #15
0
        public string novaReserva(string cpf, string dataStr, string horaStr, string lugaresStr, string informacoes, string codCliente)
        {
            cpf = UtilFormatar.retirarFormatacao(cpf);

            clnCliente objCliente;

            if (clienteBLL.autenticado())
            {
                objCliente = clienteBLL.obterCliente();
            }
            else if (codCliente != null && UtilValidar.validarInt(codCliente))
            {
                objCliente = new clnCliente
                {
                    Cod = UtilConvert.ToInt(codCliente)
                }.obterPorCod();
            }
            else
            {
                return("0Cliente não informado");
            }

            string validar = validarDados(cpf, dataStr, horaStr, lugaresStr, informacoes, objCliente);

            if (string.IsNullOrEmpty(validar))
            {
                if (string.IsNullOrEmpty(informacoes))
                {
                    informacoes = "Sem informações adicionais.";
                }

                clnReserva objReserva = new clnReserva
                {
                    Informacoes = informacoes,
                    Pessoas     = UtilConvert.ToInt(lugaresStr),
                    CodCliente  = objCliente.Cod,
                    Agendado    = UtilConvert.ObterDataHora(dataStr, horaStr),
                    Agendamento = DateTime.Now.Date,
                    Situacao    = clnReserva.reservaSituacao.MARCADA
                };
                objReserva.gravar();

                atribuirMesas(objReserva);

                return("1Reserva realizada com sucesso");
            }
            else
            {
                return("0" + validar);
            }
        }
예제 #16
0
        //add by I.TYOU 20141031 カスタム改ページグリッド「GridViewExt」の対応 start
        private System.Data.DataTable getDataSource(Object obj)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            if (obj is DataSet)
            {
                if (((System.Data.DataSet)obj).Tables.Count > 0)
                {
                    dt = ((System.Data.DataSet)obj).Tables[0];
                }
                else
                {
                    dt = new System.Data.DataTable();
                }
            }
            else if (obj is System.Data.DataTable)
            {
                dt = (System.Data.DataTable)obj;
            }
            else if (obj is ArrayList)
            {
                ArrayList arr = (ArrayList)obj;
                dt = UtilConvert.ArrayList2DataTable(arr);
            }
            else if (obj is BindingSource)
            {
                BindingSource bs = (BindingSource)obj;
                if (bs.DataSource is DataSet)
                {
                    if (((System.Data.DataSet)bs.DataSource).Tables.Count > 0)
                    {
                        dt = ((System.Data.DataSet)bs.DataSource).Tables[0];
                    }
                    else
                    {
                        dt = new System.Data.DataTable();
                    }
                }
                else if (bs.DataSource is System.Data.DataTable)
                {
                    dt = (System.Data.DataTable)bs.DataSource;
                }
                else if (bs.DataSource is ArrayList)
                {
                    ArrayList arr = (ArrayList)bs.DataSource;
                    dt = UtilConvert.ArrayList2DataTable(arr);
                }
            }

            return(dt);
        }
예제 #17
0
        private void btnCriar_Click(object sender, EventArgs e)
        {
            try
            {
                if (UtilValidar.CamposValidos(uiPanelCryptocurrency))
                {
                    if (newImage)
                    {
                        int archiveId = new Archive
                        {
                            Blob = UtilImage.ImageToByte(picCriptocurrency.Image),
                        }.Gravar();

                        int response = new Cryptocurency
                        {
                            ArchiveId             = archiveId,
                            Name                  = uiTxtCriptocurrency.Text,
                            Base                  = uiTxtCryptocurrencyBase.Text,
                            Description           = uiTxtDescription.Text,
                            CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text),
                            CryptocurrencyUnit    = uiTxtCryptocurrencyUnit.Text
                        }.Gravar();

                        new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info);
                        newImage = false;
                    }
                    else
                    {
                        int response = new Cryptocurency
                        {
                            ArchiveId             = 1,
                            Name                  = uiTxtCriptocurrency.Text,
                            Base                  = uiTxtCryptocurrencyBase.Text,
                            Description           = uiTxtDescription.Text,
                            CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text),
                            CryptocurrencyUnit    = uiTxtCryptocurrencyUnit.Text
                        }.Gravar();

                        new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info);
                    }
                }
            }
            catch (Exception ex)
            {
                new Alert(ex.Message, uiCSB.Toastr.Type.Warning);
            }
        }
예제 #18
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);
            }
        }
예제 #19
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);
                }
            }
        }
예제 #20
0
            public bool call(DataGridViewRow row)
            {
                clnFuncionario objFuncionario = new clnFuncionario
                {
                    Cod = UtilConvert.ToInt(row.Cells[0].Value)
                }.obterPorCod();

                if (objFuncionario != null)
                {
                    frmFuncionario frmAlterarFuncionario = new frmFuncionario
                    {
                        ObjFuncionario = objFuncionario
                    };
                    frmAlterarFuncionario.ShowDialog();
                    return(true);
                }
                return(false);
            }
예제 #21
0
            public bool call(DataGridViewRow row)
            {
                clnFornecedor objFornecedor = new clnFornecedor
                {
                    Cod = UtilConvert.ToInt(row.Cells[0].Value)
                }.obterPorCod();

                if (objFornecedor != null)
                {
                    frmFornecedor frmAlterarFornecedor = new frmFornecedor
                    {
                        ObjFornecedor = objFornecedor
                    };
                    frmAlterarFornecedor.ShowDialog();
                    return(true);
                }
                return(false);
            }
예제 #22
0
            public bool call(DataGridViewRow row)
            {
                clnMercadoria objMercadoria = new clnMercadoria
                {
                    Cod = UtilConvert.ToInt(row.Cells[0].Value)
                }.obterPorCod();

                if (objMercadoria != null)
                {
                    frmMercadoria frmAlterarMercadoria = new frmMercadoria
                    {
                        ObjMercadoria = objMercadoria
                    };
                    frmAlterarMercadoria.ShowDialog();
                    return(true);
                }
                return(false);
            }
예제 #23
0
            public bool call(DataGridViewRow row)
            {
                clnReserva objReserva = new clnReserva
                {
                    Cod = UtilConvert.ToInt(row.Cells[0].Value)
                }.obterPorCod();

                if (objReserva != null)
                {
                    frmReserva frmAlterarReserva = new frmReserva
                    {
                        ObjReserva = objReserva
                    };
                    frmAlterarReserva.ShowDialog();
                    return(true);
                }
                return(false);
            }
예제 #24
0
            public bool call(DataGridViewRow row)
            {
                clnEstoque objEstoque = new clnEstoque
                {
                    Cod = UtilConvert.ToInt(row.Cells[0].Value)
                }.obterPorCod();

                if (objEstoque != null)
                {
                    frmEstoque frmAlterarEstoque = new frmEstoque
                    {
                        ObjEstoque = objEstoque
                    };
                    frmAlterarEstoque.ShowDialog();
                    return(true);
                }
                return(false);
            }
예제 #25
0
            public bool call(DataGridViewRow row)
            {
                clnAtendimento objAtendimento = new clnAtendimento
                {
                    Cod = UtilConvert.ToInt(row.Cells[0].Value)
                }.obterPorCod();

                if (objAtendimento != null)
                {
                    frmAtendimento frmAlterarAtendimento = new frmAtendimento
                    {
                        ObjAtendimento = objAtendimento
                    };
                    frmAlterarAtendimento.ShowDialog();
                    return(true);
                }
                return(false);
            }
예제 #26
0
            public bool call(DataGridViewRow row)
            {
                clnIngrediente objIngrediente = new clnIngrediente
                {
                    Cod = UtilConvert.ToInt(row.Cells[0].Value)
                }.obterPorCod();

                if (objIngrediente != null)
                {
                    frmIngrediente frmAlterarIngrediente = new frmIngrediente
                    {
                        ObjIngrediente = objIngrediente
                    };
                    frmAlterarIngrediente.ShowDialog();
                    return(true);
                }
                return(false);
            }
예제 #27
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(',', '.');
         }
     }
예제 #28
0
        /// <summary>
        /// 解析
        /// </summary>
        /// <param name="jwtStr">jwt字符串</param>
        /// <returns></returns>
        public static TokenModel SerializeJwt(string jwtStr)
        {
            TokenModel result = null;

            try
            {
                var jwtHandler            = new JwtSecurityTokenHandler();
                JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(jwtStr);
                object           role;
                object           user;
                object           time;
                try
                {
                    jwtToken.Payload.TryGetValue(ClaimTypes.Role, out role);
                    jwtToken.Payload.TryGetValue(ClaimTypes.UserData, out user);
                    jwtToken.Payload.TryGetValue(JwtRegisteredClaimNames.Exp, out time);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
                if (role != null && user != null)
                {
                    result = new TokenModel
                    {
                        Uid                           = jwtToken.Id,
                        Roles                         = role != null?UtilConvert.StringToList(role.ToString()) : null,
                                                Users = user != null?UtilConvert.StringToList(user.ToString()) : null,
                    };
                    if (time != null)
                    {
                        result.ExpiryDateTime = Convert.ToDateTime(time.ToString());
                    }
                }
            }
            catch (Exception)
            {
                return(result);
            }
            return(result);
        }
예제 #29
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;
        }
예제 #30
0
파일: uctSupport.cs 프로젝트: CaaioSB/PIM2S
        private void support_Click(object sender, EventArgs e)
        {
            if (sender is Panel)
            {
                Panel panel = sender as Panel;
                RemoverMensagens();
                PreencheHeader(new Support {
                    SupportId = UtilConvert.ToInt(panel.Tag)
                }.ObterPorId());
                BuscarMensagens(new Support {
                    SupportId = UtilConvert.ToInt(panel.Tag)
                }.ObterPorId());
                uiFlowPanelChat.AutoScroll = true;
                uiFlowPanelChat.HorizontalScroll.Enabled = false;
                uiFlowPanelChat.HorizontalScroll.Visible = false;
                HabilitarChat();

                Support = new Support {
                    SupportId = UtilConvert.ToInt(panel.Tag)
                }.ObterPorId();
            }
            else if (sender is Label)
            {
                Label label = sender as Label;
                RemoverMensagens();
                PreencheHeader(new Support {
                    SupportId = UtilConvert.ToInt(label.Tag)
                }.ObterPorId());
                BuscarMensagens(new Support {
                    SupportId = UtilConvert.ToInt(label.Tag)
                }.ObterPorId());
                uiFlowPanelChat.AutoScroll = true;
                uiFlowPanelChat.HorizontalScroll.Enabled = false;
                uiFlowPanelChat.HorizontalScroll.Visible = false;
                HabilitarChat();

                Support = new Support {
                    SupportId = UtilConvert.ToInt(label.Tag)
                }.ObterPorId();
            }
        }