示例#1
0
        private void CriarCaixa()
        {
            pictureBoxLoad.Visible = true;
            thread = new Thread(PreencherCaixaThread);
            form1.ExecutarThread(thread);
            this.Activate();

            if (Form1.EmpresaEmail != null)
            {
                if (enumCaixa == EnumCaixa.Caixa)
                {
                    EmailNegocio negocioEmail = new EmailNegocio(Form1.EmpresaEmail, Form1.Empresa.empfantasia);
                    EmailInfo    email        = new EmailInfo
                    {
                        emailAssunto = "Caixa Fechado - " + caixaAbrirInfo.caixaabrirdata.Date.ToShortDateString(),
                        emailMessage = ArrCupom[0],
                        emailTo      = Form1.EmpresaEmail.emailenviar,
                        emailCC      = new string[0],
                        emailCCo     = new string[0],
                        emailAnexo   = new string[0]
                    };

                    negocioEmail.EnviarEmailGmail(email);
                }
            }

            PreencherForm(ArrCupom[0]);
        }
示例#2
0
        private void ButtonBuscar_Click(object sender, EventArgs e)
        {
            string cpf = maskedTextBoxCpf.Text;

            if (!string.IsNullOrEmpty(cpf))
            {
                negocioUser  = new UserNegocio(Form1.Empresa.empconexao);
                negocioEmail = new EmailNegocio(Form1.EmpresaEmail, Form1.Empresa.empfantasia);
                pessoa       = negocioUser.ConsultarPessoaCpf(cpf);

                if (pessoa != null)
                {
                    labelNome.Text  = "Nome: " + pessoa.pssnome;
                    labelEmail.Text = "E-mail: " + pessoa.pssemail;

                    user = negocioUser.ConsultarUsuarioFuncId(pessoa.pssid);

                    buttonBuscar.Enabled = false;
                    buttonEmail.Enabled  = true;
                }
                else
                {
                    buttonBuscar.Enabled = true;
                    buttonEmail.Enabled  = false;
                    FormMessage.ShowMessegeWarning("Ninguém foi encontrado!");
                }
            }
        }
示例#3
0
        private void ButtonEnviar_Click(object sender, EventArgs e)
        {
            if (CampoObrigatorio())
            {
                if (PreencherEmail())
                {
                    negocioEmail = new EmailNegocio(Form1.EmpresaEmail, Form1.Empresa.empfantasia);

                    if (negocioEmail.EnviarEmailGmail(infoEmail))
                    {
                        FormMessage.ShowMessegeWarning("Mensagem enviada por email");
                    }
                }
            }
        }
示例#4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Computer = new ComputerInfo();
            ConfiguracaoRede();
            toolStripStatusLabelPcNome.Text = Computer.comphostname;
            toolStripStatusLabelIP.Text     = Computer.compip;

            if (Desserializar())
            {
                try
                {
                    if (Dns.GetHostAddresses("empresadb.mysql.uhserver.com") != null)
                    {
                        IPAddress[] ip = Dns.GetHostAddresses("empresadb.mysql.uhserver.com");
                        ConectedSystem = true;
                    }
                    else
                    {
                        ConectedSystem = false;
                    }
                }
                catch (Exception)
                {
                    ConectedSystem = false;
                }

                if (ConectedSystem)
                {
                    EmpresaNegocios empresaNegocios = new EmpresaNegocios(Empresa.empconexao);
                    ComputerInfo    comp            = empresaNegocios.ConsultarComputadorId(Computer.compid);
                    EmpresaEmail = empresaNegocios.ConsultarEmpresaEmail(Empresa.empid);

                    if (comp != null)
                    {
                        if (!comp.compativo)
                        {
                            FormMessage.ShowMessegeWarning("A licença para este computador está expirada. O sistema será encerrado!");
                            negocioEmail = new EmailNegocio(EmpresaEmail, Empresa.empfantasia);
                            string mensagem = string.Empty;
                            ConfiguracaoRede();
                            mensagem += "Empresa: " + Empresa.empfantasia + Environment.NewLine;
                            mensagem += Computer.ToString();

                            negocioEmail.EnviarEmailBasico("*****@*****.**", "Computador - Licença Expirada!", mensagem);
                            Application.Exit();
                            return;
                        }

                        Thread t = new Thread(ConsultarNovoIphone);
                        ExecutarThread(t);

                        threadLogin = new Thread(UpdateUserLogin);
                        threadLogin.Start();


                        //if (Unidade != null)
                        //{
                        //    ComputerColecao colecao = empresaNegocios.ConsultarComputadorIdUnid(Unidade.uniid);

                        //    if (colecao != null)
                        //        foreach (ComputerInfo comp in colecao)
                        //            if (comp.compserver)
                        //            {
                        //                Server = comp;
                        //                break;
                        //            }
                        //}

                        if (Empresa != null)
                        {
                            Empresa = empresaNegocios.ConsultarEmpresaSysId(Empresa.empcod);

                            if (Empresa.empativada == 1)
                            {
                                TimeSpan timeSpan = Empresa.empdataativo.Subtract(DateTime.Now.Date);
                                if (timeSpan.Days >= 0)
                                {
                                    if (timeSpan.Days < 7)
                                    {
                                        FormMessage.ShowMessegeWarning(Empresa.empobs.Replace("**", timeSpan.Days.ToString()));
                                    }
                                    colecaoUnidade = empresaNegocios.ConsultarUnidade();
                                    InicializarSistema();
                                    this.Text += " :: " + Empresa.empfantasia;
                                }
                                else
                                {
                                    if (timeSpan.Days < -15)
                                    {
                                        FormMessage.ShowMessegeWarning("Seu sistema está bloqueado!");
                                        Application.Exit();
                                    }
                                    else
                                    {
                                        FormMessage.ShowMessegeWarning("Seu sistema será bloqueado em * dias!".Replace("*", (15 + timeSpan.Days).ToString()));

                                        colecaoUnidade = empresaNegocios.ConsultarUnidade();
                                        InicializarSistema();
                                        this.Text += " :: " + Empresa.empfantasia;
                                    }
                                }
                            }
                            else
                            {
                                FormMessage.ShowMessegeWarning("Seu sistema está bloqueado!");
                                Application.Exit();
                            }
                        }
                        else
                        {
                            FormMessage.ShowMessegeWarning("Falha!");
                        }
                    }
                    else
                    {
                        AbrirFormEmpresa();
                    }
                }
                else
                {
                    FormMessage.ShowMessegeWarning("Este computador está sem conexão com a internet, o sistema será encerrado!");
                    Application.Exit();
                }
            }
            else
            {
                AbrirFormEmpresa();
            }

            if (Empresa != null)
            {
                caixaNegocios = new CaixaNegocios(Empresa.empconexao);
            }
        }