예제 #1
0
        private void CalcularButton_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Gerar o arquivo de Registro de Boletos?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }
            int _tipo = Convert.ToInt32(TipoList.Text.Substring(0, 2));

            sw = new StreamWriter(_path + sFileName, false, ANSI);
            Sistema_bll sistema_Class = new Sistema_bll(_connection);

            Grava_Header(_tipo);
            if (_tipo == 1)
            {
                Grava_Registro_01();
            }
            Grava_Trailer(_qtde_registros);
            sw.Flush();
            sw.Close();

            Exception ex = sistema_Class.Atualiza_Codigo_Remessa_Cobranca();

            if (ex != null)
            {
                ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                eBox.ShowDialog();
            }
            else
            {
                MessageBox.Show("Arquivo gerado com sucesso.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
        private void LoadReg(int nId)
        {
            Clear_Reg();
            Sistema_bll   sistema_Class = new Sistema_bll(_connection);
            usuarioStruct reg           = sistema_Class.Retorna_Usuario(nId);

            IdLabel.Text                = Convert.ToInt32(reg.Id).ToString("0000");
            NomeCompletoTextBox.Text    = reg.Nome_completo;
            NomeLoginTextBox.Text       = reg.Nome_login;
            LocalComboBox.SelectedValue = reg.Setor_atual == null ? -1 : reg.Setor_atual;
            LocalTextBox.Text           = reg.Nome_setor;
            AtivoCheckbox.Checked       = reg.Ativo == 1?true:false;

            bExec = false;
            List <Usuariocc> ListaCC = sistema_Class.Lista_Usuario_Local(nId);

            foreach (Usuariocc item in ListaCC)
            {
                for (int i = 0; i < LocalListBox.Items.Count; i++)
                {
                    CustomListBoxItem linha = (CustomListBoxItem)LocalListBox.Items[i];
                    int nCodCC = linha._value;
                    if (nCodCC == item.Codigocc)
                    {
                        LocalListBox.SetItemChecked(i, true);
                    }
                }
            }
            bExec = true;
        }
예제 #3
0
        private void GravarButton_Click(object sender, EventArgs e)
        {
            Sistema_bll sistema_Class = new Sistema_bll(_connection);
            int         nSize         = sistema_Class.GetSizeofBinary();
            string      sZero         = new string('0', nSize);

            var aString = sZero.ToCharArray();

            List <TreeNode> checked_nodes = CheckedNodes(MainTreeView);

            foreach (TreeNode itemTv in checked_nodes)
            {
                aString[Convert.ToInt32(itemTv.Tag) - 1] = '1';
            }
            string sNewBinary = new string(aString);

            GtiTypes.UserBinary = sNewBinary;
            CustomListBoxItem UsuarioId = (CustomListBoxItem)UsuarioComboBox.SelectedItem;

            GTI_Models.Models.Usuario reg = new GTI_Models.Models.Usuario();
            reg.Id         = UsuarioId._value;
            reg.Userbinary = gtiCore.Encrypt(sNewBinary);
            Exception ex = sistema_Class.SaveUserBinary(reg);

            if (ex != null)
            {
                ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                eBox.ShowDialog();
            }
            else
            {
                MessageBox.Show("Alterações gravadas com sucesso.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #4
0
        public JsonResult Inserir_Anexo(string Seq, string Id)
        {
            if (Request.Files.Count > 0)
            {
                Sistema_bll sistemaRepository = new Sistema_bll(_connection);
                foreach (string file in Request.Files)
                {
                    var _file             = Request.Files[file];
                    Usuario_web_anexo reg = new Usuario_web_anexo()
                    {
                        Userid  = Convert.ToInt32(Id),
                        Tipo    = Convert.ToInt16(Seq),
                        Arquivo = _file.FileName
                    };
                    Exception ex = sistemaRepository.Incluir_Usuario_Web_Anexo(reg);

                    //Salva cópia do Anexo
                    string fileName = "";
                    string _cod     = Convert.ToInt32(Id).ToString("00000");
                    string _path    = "~/Files/UserDoc/" + _cod;
                    Directory.CreateDirectory(Server.MapPath(_path));
                    fileName = _file.FileName;
                    var path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath(_path), fileName);
                    _file.SaveAs(path);
                    break;
                }
            }
            return(Json(new { success = true, responseText = "Arquivo anexado com sucesso." }, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public JsonResult Remove_Anexo(string Seq, string Id)
        {
            Sistema_bll sistemaRepository = new Sistema_bll(_connection);
            Exception   ex = sistemaRepository.Excluir_Usuario_Web_Anexo(Convert.ToInt32(Id), Convert.ToInt16(Seq));

            return(Json(new { success = true, responseText = "Arquivo removido com sucesso." }, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public ActionResult User_Query(LoginViewModel model, int?ide, string tp, string action)
        {
            List <Usuario_web> Lista             = new List <Usuario_web>();
            Sistema_bll        sistemaRepository = new Sistema_bll(_connection);

            if (action == "rs")
            {
                //Usuario_web _user = sistemaRepository.Retorna_Usuario_Web((int)ide);
                //if (!_user.Ativo) {
                //    ViewBag.Result = "A conta não esta ativa";
                //    return View(model);
                //} else {
                Exception ex = sistemaRepository.Alterar_Usuario_Web_Senha((int)ide, Functions.Encrypt("123456"));
                //    ViewBag.Result = "A senha foi reseta com sucesso";
                //}
                model.Lista_Usuario_Web = Lista;
                return(Json(new { success = true, data = model }, JsonRequestBehavior.AllowGet));
            }

            if (!string.IsNullOrEmpty(model.Filter))
            {
                Lista = sistemaRepository.Lista_Usuario_Web(model.Filter);
            }

            model.Lista_Usuario_Web = Lista;
//            return Json(new { success = true, data = model }, JsonRequestBehavior.AllowGet);
            return(View(model));
        }
예제 #7
0
        public ActionResult User_doc()
        {
            LoginViewModel model = new LoginViewModel();

            if (Request.Cookies["2lG1H*"] == null)
            {
                return(RedirectToAction("Login"));
            }

            Sistema_bll sistemaRepository = new Sistema_bll(_connection);
            int         _userId           = Convert.ToInt32(Functions.Decrypt(Request.Cookies["2uC*"].Value));

            Usuario_web reg = sistemaRepository.Retorna_Usuario_Web(_userId);

            model.UserId       = _userId;
            model.Usuario      = reg.Nome;
            model.CpfCnpjLabel = Functions.FormatarCpfCnpj(reg.Cpf_Cnpj);
            bool _fisica = reg.Cpf_Cnpj.Length == 11 ? true : false;

            model.Lista_Usuario_Web_Anexo = sistemaRepository.Lista_Usuario_Web_Tipo_Anexo(_userId, _fisica);
            int _pos = 0;

            foreach (Usuario_Web_Anexo_Struct _anexo in model.Lista_Usuario_Web_Anexo)
            {
                Usuario_web_anexo _reg = sistemaRepository.Retorna_Web_Anexo(_userId, _anexo.Codigo);
                if (_reg != null)
                {
                    model.Lista_Usuario_Web_Anexo[_pos].Arquivo = Functions.TruncateTo(_reg.Arquivo, 32);
                }
                _pos++;
            }

            return(View(model));
        }
예제 #8
0
        public ActionResult User_query_doc()
        {
            LoginViewModel model = new LoginViewModel();

            if (Session["hashid"] == null)
            {
                return(RedirectToAction("Login"));
            }

            bool _func = Session["hashfunc"].ToString() == "S" ? true : false;

            if (!_func)
            {
                return(RedirectToAction("Login"));
            }
            int _id = Convert.ToInt32(Session["hashid"].ToString());

            if (_id != 392 && _id != 270 && _id != 118 && _id != 433 && _id != 427)//392-renata,270-joseane,118-elivaine ,433-schwartz, 427-rose
            {
                return(RedirectToAction("Login"));
            }

            Sistema_bll sistemaRepository = new Sistema_bll(_connection);
            int         _fiscal           = Convert.ToInt32(Functions.Decrypt(Request.Cookies["2uC*"].Value));

            usuarioStruct reg = sistemaRepository.Retorna_Usuario(_fiscal);

            List <Usuario_Web_Analise_Struct> Lista = sistemaRepository.Lista_Usuario_Web_Analise();

            model.Lista_Usuario_Web_Analise = Lista;

            return(View(model));
        }
예제 #9
0
        public ActionResult Login_reset(LoginViewModel model)
        {
            //if (Session["hashid"] == null) {
            //    Functions.pUserFullName = "Visitante";
            //    return View(model);
            //}
            var    response  = Request["g-recaptcha-response"];
            var    client    = new WebClient();
            string secretKey = "6LfRjG0aAAAAACH5nVGFkotzXTQW_V8qpKzUTqZV";
            var    result    = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response));
            var    obj       = JObject.Parse(result);
            var    status    = (bool)obj.SelectToken("success");
            string msg       = status ? "Sucesso" : "Falha";

            if (!status)
            {
                ViewBag.Result = "Código Recaptcha inválido.";
                return(View(model));
            }

            Sistema_bll sistemaRepository = new Sistema_bll(_connection);
            Usuario_web reg = sistemaRepository.Retorna_Usuario_Web(model.Email);
            int         Id  = reg.Id;
            Exception   ex  = sistemaRepository.Alterar_Usuario_Web_Senha(Id, model.Senha);

            ViewBag.Message = "A senha foi alterar com sucesso.";

            return(View(model));
        }
예제 #10
0
        private void GravarButton_Click(object sender, EventArgs e)
        {
            Sistema_bll   sistema_Class = new Sistema_bll(_connection);
            usuarioStruct cUser         = sistema_Class.Retorna_Usuario(nId);

            GTI_Models.Models.Usuario reg = new GTI_Models.Models.Usuario();
            reg.Id           = cUser.Id;
            reg.Nomecompleto = cUser.Nome_completo;
            reg.Nomelogin    = cUser.Nome_login;
            reg.Ativo        = cUser.Ativo;
            reg.Setor_atual  = Convert.ToInt32(SetorComboBox.SelectedValue);
            Exception ex = sistema_Class.Alterar_Usuario(reg);

            if (ex == null)
            {
                DialogResult = DialogResult.OK;
            }
            else
            {
                DialogResult = DialogResult.Cancel;
                ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                eBox.ShowDialog();
            }
            Close();
        }
예제 #11
0
        private void Header()
        {
            Sistema_bll sistema_Class         = new Sistema_bll(_connection);
            Contribuinte_Header_Struct _dados = sistema_Class.Contribuinte_Header(_lista_selecionados[0].Codreduzido);

            NomeText.Text     = _dados.Nome;
            CPFText.Text      = _dados.Cpf_cnpj;
            EnderecoText.Text = _dados.Endereco_abreviado + ", " + _dados.Numero.ToString() + " " + _dados.Complemento + " " + _dados.Nome_bairro;
            CidadeText.Text   = _dados.Nome_cidade;
            UFText.Text       = _dados.Nome_uf;
            CepText.Text      = _dados.Cep;

            _data_refis_inicio   = Convert.ToDateTime(sistema_Class.Retorna_Valor_Parametro("REFIS_INICIO"));
            _data_refis_final    = Convert.ToDateTime(sistema_Class.Retorna_Valor_Parametro("REFIS_FIM"));
            _data_refisdi_inicio = Convert.ToDateTime(sistema_Class.Retorna_Valor_Parametro("REFISDI_INICIO"));
            _data_refisdi_final  = Convert.ToDateTime(sistema_Class.Retorna_Valor_Parametro("REFISI_FIM"));

            DateTime _data_now = DateTime.Now;

            if (_data_now >= _data_refis_inicio && _data_now <= _data_refis_final)
            {
                _refis_ativo = true;
            }

            if (_data_now >= _data_refisdi_inicio && _data_now <= _data_refisdi_final)
            {
                _refisdi_ativo = true;
            }
        }
예제 #12
0
        private void UsuarioComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (UsuarioComboBox.SelectedItem != null)
            {
                Sistema_bll       sistema_Class = new Sistema_bll(_connection);
                CustomListBoxItem item          = (CustomListBoxItem)UsuarioComboBox.SelectedItem;
                LoginLabel.Text = sistema_Class.Retorna_User_LoginName(item._value);
                string sTmp = sistema_Class.GetUserBinary(item._value);

                //Verifica a qtde de eventos cadastrados
                int nSize = sistema_Class.GetSizeofBinary();
                sUserBinary = gtiCore.Decrypt(sTmp);

                //**Caso o binário do usuário for menor que a qtde de eventos, acrescenta zeros no final.
                if (nSize > sUserBinary.Length)
                {
                    int nDif = nSize - sUserBinary.Length;
                    sTmp         = new string('0', nDif);
                    sUserBinary += sTmp;
                }
                //***********************************************

                MainTreeView.Nodes.Clear();
                ListaEventos = sistema_Class.Lista_Sec_Eventos();
                TreeNode root        = null;
                var      departments = ListaEventos;
                PopulateTree(ref root, departments);
                MainTreeView.Nodes.Add(root);
                MainTreeView.ExpandAll();
                MainTreeView.Nodes[0].EnsureVisible();
            }
        }
예제 #13
0
        private void GravarButton_Click(object sender, EventArgs e)
        {
            if (bDirty)
            {
                bDirty = false;

                Sistema_bll sistema_Class = new Sistema_bll(_connection);
                obscidadao  reg           = new obscidadao();
                reg.Codigo    = _codigo;
                reg.Userid    = sistema_Class.Retorna_User_LoginId(Properties.Settings.Default.LastUser);
                reg.timestamp = DateTime.Now;
                reg.Obs       = HistoricoText.Text;

                Cidadao_bll cidadao_Class = new Cidadao_bll(_connection);
                Exception   ex            = cidadao_Class.Incluir_observacao_cidadao(reg);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                }
                else
                {
                    Carrega_Lista();
                }
            }
        }
예제 #14
0
        public ActionResult Login_create(LoginViewModel model)
        {
            var    response  = Request["g-recaptcha-response"];
            var    client    = new WebClient();
            string secretKey = "6LfRjG0aAAAAACH5nVGFkotzXTQW_V8qpKzUTqZV";
            var    result    = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response));
            var    obj       = JObject.Parse(result);
            var    status    = (bool)obj.SelectToken("success");
            string msg       = status ? "Sucesso" : "Falha";

            if (!status)
            {
                ViewBag.Result = "Código Recaptcha inválido.";
                return(View(model));
            }

            Sistema_bll sistemaRepository = new Sistema_bll(_connection);

            if (sistemaRepository.Existe_Usuario_Web(model.Email))
            {
                ViewBag.Result = "Este email já esta cadastrado.";
                return(View(model));
            }

            Usuario_web reg = new Usuario_web()
            {
                Nome          = model.Usuario,
                Email         = model.Email,
                Telefone      = model.Telefone,
                Cpf_Cnpj      = Functions.RetornaNumero(model.CpfValue),
                Senha         = Functions.Encrypt(model.Senha2),
                Data_Cadastro = DateTime.Now,
                Ativo         = false,
                Bloqueado     = false
            };
            int id = sistemaRepository.Incluir_Usuario_Web(reg);

            string sid  = Url.Encode(Functions.Encrypt("#GTI - Serviços Online#" + id.ToString("000000")));
            string Body = System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("~/Files/AccessTemplate.htm"));

            Body = Body.Replace("#$$$#", sid);
            using (MailMessage emailMessage = new MailMessage()) {
                emailMessage.From = new MailAddress("*****@*****.**", "Prefeitura de Jaboticabal");
                emailMessage.To.Add(new MailAddress(model.Email));
                emailMessage.Subject    = "Prefeitura Municipal de Jaboticabal - Acesso aos serviços online (G.T.I.)";
                emailMessage.Body       = Body;
                emailMessage.Priority   = MailPriority.Normal;
                emailMessage.IsBodyHtml = true;

                using (SmtpClient MailClient = new SmtpClient("smtp.gmail.com", 587)) {
                    MailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
                    MailClient.EnableSsl      = true;
                    MailClient.Credentials    = new NetworkCredential("*****@*****.**", "esnssgzxxjcdjrpk");
                    MailClient.Send(emailMessage);
                }
            }

            return(View("Login_create2", model));
        }
예제 #15
0
        public ViewResult Login_update(LoginViewModel model)
        {
            int             _id           = 0;
            Sistema_bll     sistema_Class = new Sistema_bll(_connection);
            string          sLogin        = Session["hashfname"].ToString();
            TAcessoFunction tacesso_Class = new TAcessoFunction();
            string          _oldPwd       = "";

            if (Session["hashfunc"].ToString() == "S")
            {
                _oldPwd = tacesso_Class.DecryptGTI(sistema_Class.Retorna_User_Password(Session["hashlname"].ToString()));
            }
            else
            {
                Usuario_web user = sistema_Class.Retorna_Usuario_Web(Session["hashlname"].ToString());
                _id     = user.Id;
                _oldPwd = Functions.Decrypt(user.Senha);
            }


            if (model.Senha != _oldPwd)
            {
                ViewBag.Result = "Senha atual não confere!";
            }
            else
            {
                if (Session["hashfunc"].ToString() == "N")
                {
                    Exception ex = sistema_Class.Alterar_Usuario_Web_Senha(_id, Functions.Encrypt(model.Senha2));
                    if (ex != null)
                    {
                        ViewBag.Result = "Erro, senha não alterada";
                    }
                    else
                    {
                        ViewBag.Result = "Sua senha foi alterada, por favor efetue login novamente";
                        return(View("sysMenu"));
                    }
                }
                else
                {
                    Usuario reg = new Usuario {
                        Nomelogin = Session["hashlname"].ToString(),
                        Senha     = tacesso_Class.Encrypt128(model.Senha2)
                    };
                    Exception ex = sistema_Class.Alterar_Senha(reg);
                    if (ex != null)
                    {
                        ViewBag.Result = "Erro, senha não alterada";
                    }
                    else
                    {
                        ViewBag.Result = "Sua senha foi alterada, por favor efetue login novamente";
                    }
                }
            }
            return(View(model));
        }
예제 #16
0
        public JsonResult Libera_Acesso(string userId, string dataenvio)
        {
            Sistema_bll sistemaRepository = new Sistema_bll(_connection);
            int         _fiscal           = Convert.ToInt32(Functions.Decrypt(Request.Cookies["2uC*"].Value));
            string      _dataenvio        = Convert.ToDateTime(dataenvio).ToString("dd/MM/yyyy HH:mm");
            Exception   ex = sistemaRepository.Ativar_Usuario_Web_Doc(Convert.ToInt32(userId), _fiscal, Convert.ToDateTime(_dataenvio));

            return(Json(new { success = true, responseText = "Acesso liberado com sucesso." }, JsonRequestBehavior.AllowGet));
        }
예제 #17
0
        public ActionResult Checkguid(CertidaoViewModel model, string c)
        {
            Imovel_bll imovelRepository       = new Imovel_bll(_connection);
            Itbi_isencao_main_Struct   _itbi  = imovelRepository.Retorna_Itbi_Isencao_Main(c);
            List <Itbi_isencao_imovel> _Lista = imovelRepository.Retorna_Itbi_Isencao_Imovel(c);

            ReportDocument rd = new ReportDocument();

            rd.Load(System.Web.HttpContext.Current.Server.MapPath("~/Reports/Certidao_Isencao_Itbi_Valida.rpt"));
            TableLogOnInfos            crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo             crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo             crConnectionInfo  = new ConnectionInfo();
            Tables                     CrTables;
            string                     myConn    = ConfigurationManager.ConnectionStrings[_connection].ToString();
            SqlConnectionStringBuilder builder   = new SqlConnectionStringBuilder(myConn);
            string                     IPAddress = builder.DataSource;
            string                     _userId   = builder.UserID;
            string                     _pwd      = builder.Password;

            crConnectionInfo.ServerName   = IPAddress;
            crConnectionInfo.DatabaseName = "Tributacao";
            crConnectionInfo.UserID       = _userId;
            crConnectionInfo.Password     = _pwd;
            CrTables = rd.Database.Tables;
            foreach (Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }

            Sistema_bll   sistemaRepository = new Sistema_bll(_connection);
            Assinatura    assinatura        = sistemaRepository.Retorna_Usuario_Assinatura(_itbi.Fiscal_id);
            usuarioStruct usuario           = sistemaRepository.Retorna_Usuario(_itbi.Fiscal_id);

            rd.SetParameterValue("ANONUMERO", _itbi.Isencao_numero.ToString("00000") + "/" + _itbi.Isencao_ano.ToString("0000"));
            rd.SetParameterValue("NATUREZA", _itbi.Natureza_Nome);
            rd.SetParameterValue("NOMEFISCAL", usuario.Nome_completo);
            rd.SetParameterValue("CARGO", assinatura.Cargo);

            string imovel = "";

            foreach (Itbi_isencao_imovel item in _Lista)
            {
                imovel += item.Descricao + ", ";
            }
            imovel = imovel.Substring(0, imovel.Length - 2);
            rd.SetParameterValue("IMOVEL", imovel);
            try {
                rd.RecordSelectionFormula = "{itbi_isencao_main.guid}='" + c + "'";
                Stream stream = rd.ExportToStream(ExportFormatType.PortableDocFormat);
                return(File(stream, "application/pdf", "Certidao_Isencao_Itbi_Valida.pdf"));
            } catch {
                throw;
            }
        }
예제 #18
0
        public Usuario_Lista()
        {
            InitializeComponent();
            lvwColumnSorter = new ListViewColumnSorter();
            MainListView.ListViewItemSorter = lvwColumnSorter;
            Sistema_bll sistema_Class = new Sistema_bll(_connection);

            Lista = sistema_Class.Lista_Usuarios();
            CarregaLista();
        }
예제 #19
0
 private void GravarButton_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(Pwd1Text.Text) || String.IsNullOrEmpty(Pwd2Text.Text))
     {
         MessageBox.Show("Digite a nova senha e confirme a senha.", "Erro de gravação", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (string.Compare(Pwd1Text.Text, Pwd2Text.Text) != 0)
         {
             MessageBox.Show("Confirmação da senha diferente da senha digitada.", "Erro de gravação", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             if (Pwd1Text.Text.Length < 6)
             {
                 MessageBox.Show("Senha deve ter no mínimo 6 caracteres.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 string          _connection       = gtiCore.Connection_Name();
                 Sistema_bll     sistemaRepository = new Sistema_bll(_connection);
                 string          sPwd     = sistemaRepository.Retorna_User_Password(LoginText.Text);
                 TAcessoFunction _tAcesso = new TAcessoFunction();
                 if (!string.IsNullOrEmpty(sPwd) && _tAcesso.DecryptGTI(sPwd) != PwdText.Text)
                 {
                     MessageBox.Show("Senha atual inválida!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
                 else
                 {
                     GTI_Models.Models.Usuario reg = new GTI_Models.Models.Usuario {
                         Nomelogin = LoginText.Text.ToUpper(),
                         Senha     = _tAcesso.Encrypt128(Pwd1Text.Text)
                     };
                     Exception ex = sistemaRepository.Alterar_Senha(reg);
                     if (ex != null)
                     {
                         ErrorBox eBox = new ErrorBox("Atenção", "Erro ao gravar nova senha.", ex);
                         eBox.ShowDialog();
                     }
                     else
                     {
                         MessageBox.Show("Senha alterada.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         LoginText.Enabled   = true;
                         SenhaButton.Enabled = true;
                         LoginButton.Enabled = true;
                         SairButton.Enabled  = true;
                         PwdText.Text        = Pwd1Text.Text;
                         this.Size           = new Size(this.Size.Width, OriginSize);
                     }
                 }
             }
         }
     }
 }
예제 #20
0
 private void BtGravar_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtPwd1.Text) || string.IsNullOrEmpty(txtPwd2.Text))
     {
         MessageBox.Show("Digite a nova senha e confirme a senha.", "Erro de gravação", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (string.Compare(txtPwd1.Text, txtPwd2.Text) != 0)
         {
             MessageBox.Show("Confirmação da senha diferente da senha digitada.", "Erro de gravação", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             if (txtPwd1.Text.Length < 6)
             {
                 MessageBox.Show("Senha deve ter no mínimo 6 caracteres.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 string      _connection  = gtiCore.Connection_Name();
                 Sistema_bll sistemaClass = new Sistema_bll(_connection);
                 string      sPwd         = sistemaClass.Retorna_User_Password(txtLogin.Text);
                 if (!string.IsNullOrEmpty(sPwd) && gtiCore.Decrypt(sPwd) != txtPwd.Text)
                 {
                     MessageBox.Show("Senha atual inválida!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
                 else
                 {
                     GTI_Models.Models.Usuario reg = new GTI_Models.Models.Usuario {
                         Nomelogin = txtLogin.Text.ToUpper(),
                         Senha2    = gtiCore.Encrypt(txtPwd1.Text)
                     };
                     Exception ex = sistemaClass.Alterar_Senha(reg);
                     if (ex != null)
                     {
                         ErrorBox eBox = new ErrorBox("Atenção", "Erro ao gravar nova senha.", ex);
                         eBox.ShowDialog();
                     }
                     else
                     {
                         MessageBox.Show("Senha alterada.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         txtLogin.Enabled    = true;
                         SenhaButton.Enabled = true;
                         LoginButton.Enabled = true;
                         SairButton.Enabled  = true;
                         txtPwd.Text         = txtPwd1.Text;
                         Size = new Size(Size.Width, OriginSize);
                     }
                 }
             }
         }
     }
 }
예제 #21
0
        private void VerificarButton_Click(object sender, EventArgs e)
        {
            int          _codigo;
            Processo_bll processo_Class = new Processo_bll(_connection);
            Sistema_bll  sistema_Class  = new Sistema_bll(_connection);

            ClearFields();
            if (Codigo.Text.Trim() == "")
            {
                MessageBox.Show("Código não informado.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (Processo.Text.Trim() == "")
                {
                    MessageBox.Show("Processo não informado.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    Exception ex = processo_Class.ValidaProcesso(Processo.Text);
                    if (ex != null)
                    {
                        MessageBox.Show("Processo não cadastrado ou inválido.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        _codigo        = Convert.ToInt32(Codigo.Text);
                        _tipo_cadastro = sistema_Class.Tipo_Cadastro(_codigo);
                        int _ano    = processo_Class.ExtractAnoProcesso(Processo.Text);
                        int _numero = processo_Class.ExtractNumeroProcessoNoDV(Processo.Text);
                        _data_processo = processo_Class.Data_Processo(_ano, _numero);

                        Tipo_Certidao(TipoList.SelectedIndex);
                        if ((_tipo_certidao == TipoCertidao.Endereco || _tipo_certidao == TipoCertidao.Isencao || _tipo_certidao == TipoCertidao.ValorVenal) && _tipo_cadastro != TipoCadastro.Imovel)
                        {
                            MessageBox.Show("Este tipo de certidão só pode ser emitida para imóveis.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            if (_tipo_certidao == TipoCertidao.Debito && _tipo_cadastro == TipoCadastro.Cidadao)
                            {
                                MessageBox.Show("Este tipo de certidão não pode ser emitida para cidadão.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                gtiCore.Ocupado(this);
                                Dados_Impressao(_codigo);
                                gtiCore.Liberado(this);
                            }
                        }
                    }
                }
            }
        }
예제 #22
0
 private void ProprietarioButton_Click(object sender, EventArgs e)
 {
     using (var form = new Cidadao_Lista()) {
         var result = form.ShowDialog(this);
         if (result == DialogResult.OK)
         {
             int         val                = form.ReturnValue;
             Sistema_bll sistema_Class      = new Sistema_bll(_connection);
             Contribuinte_Header_Struct reg = sistema_Class.Contribuinte_Header(val);
             Proprietario.Text = reg.Nome;
             Proprietario.Tag  = val.ToString();
         }
     }
 }
예제 #23
0
        protected void AcessoButton_Click(object sender, EventArgs e)
        {
            string sLogin = Login.Text, sNewPwd = Pwd.Text, sOldPwd, sOldPwd2, sName;
            int    UserId;

            if (sLogin == "")
            {
                lblMsg.Text = "Digite o Login!";
            }
            else
            {
                if (sNewPwd == "")
                {
                    lblMsg.Text = "Digite a senha!";
                }
                else
                {
                    Sistema_bll     sistema_Class = new Sistema_bll("GTIconnection");
                    TAcessoFunction tacesso_Class = new TAcessoFunction();
                    sOldPwd = sistema_Class.Retorna_User_Password(sLogin);
                    UserId  = sistema_Class.Retorna_User_LoginId(sLogin);
                    sName   = sistema_Class.Retorna_User_FullName(UserId);
                    if (sOldPwd == null)
                    {
                        lblMsg.Text        = "Usuário/Senha inválido!";
                        Session["pUserId"] = 0;
                    }
                    else
                    {
                        gtiCore.pUserId        = UserId;
                        gtiCore.pUserFullName  = sName;
                        gtiCore.pUserLoginName = sLogin;
                        sOldPwd2 = tacesso_Class.DecryptGTI(sOldPwd);
                        if (sOldPwd2 != sNewPwd)
                        {
                            lblMsg.Text        = "Usuário/Senha inválido!";
                            Session["pUserId"] = 0;
                        }
                        else
                        {
                            lblMsg.Text        = "";
                            Session["pUserId"] = UserId;
                            //Label lbl = Master.FindControl("lblLogin") as Label;
                            //lbl.Text = sName;
                            Response.Redirect("gtiMenu3.aspx");
                        }
                    }
                }
            }
        }
예제 #24
0
        private void CarregaLista()
        {
            MainListView.Items.Clear();
            Sistema_bll           sistema_Class = new Sistema_bll(_connection);
            List <security_event> Lista         = sistema_Class.Lista_Sec_Eventos();

            foreach (security_event item in Lista)
            {
                ListViewItem lvItem = new ListViewItem(item.Id.ToString("0000"));
                lvItem.SubItems.Add(item.IdMaster.ToString("0000"));
                lvItem.SubItems.Add(item.Descricao);
                MainListView.Items.Add(lvItem);
            }
        }
예제 #25
0
        private void Grava_Header(int _tipo)
        {
            string _codigo_banco = "001", _lote = "0000", _tipo_registro = "0", _uso_febraban1 = new String(' ', 9), _tipo_inscricao = "2", _numero_inscricao = "50387844000105";
            string _codigo_convenio, _numero_conta, _dv_conta, _agencia = "00269", _dv_agencia = "0", _nome_empresa = "PREFEITURA MUN. DE JABOTICABAL".PadRight(30, ' '), _densidade = "00000";
            string _nome_banco = "BANCO DO BRASIL S.A.".PadRight(30, ' '), _uso_febraban2 = " ".PadRight(10, ' '), _codigo_remessa = "1", _seq_arquivo = "000000", _versao_layout = "000";
            string _uso_banco = " ".PadLeft(20, ' '), _uso_empresa = " ".PadLeft(20, ' '), _uso_febraban3 = " ".PadLeft(29, ' ');

            if (_tipo != 5)
            {
                _codigo_convenio = "2873532".PadLeft(9, '0') + "001417019  ";
                _numero_conta    = "74000".PadLeft(12, '0');
                _dv_conta        = "4 ";
            }
            else
            {
                _codigo_convenio = "2950230".PadLeft(9, '0') + "001417019  ";
                _numero_conta    = "34692".PadLeft(12, '0');
                _dv_conta        = "6 ";
            }

            string _data_geracao = DateTime.Now.Day.ToString("00") + DateTime.Now.Month.ToString("00") + DateTime.Now.Year.ToString("0000");
            string _hora_geracao = DateTime.Now.ToString("HHmmss");

            string _header_file = _codigo_banco + _lote + _tipo_registro + _uso_febraban1 + _tipo_inscricao + _numero_inscricao + _codigo_convenio + _agencia + _dv_agencia;

            _header_file += _numero_conta + _dv_conta + _nome_empresa + _nome_banco + _uso_febraban2 + _codigo_remessa + _data_geracao + _hora_geracao + _seq_arquivo + _versao_layout;
            _header_file += _densidade + _uso_banco + _uso_empresa + _uso_febraban3;

            sw.Write(_header_file + Environment.NewLine);

            //Header lote
            Sistema_bll sistema_Class   = new Sistema_bll(_connection);
            int         _ultima_remessa = sistema_Class.Retorna_Ultima_Remessa_Cobranca() + 1;

            _lote          = "0001";
            _tipo_registro = "1";
            string _tipo_operacao = "R", _tipo_servico = "01", _numero_versao = "000", _mensagem1 = " ".PadLeft(40, ' '), _mensagem2 = " ".PadLeft(40, ' ');
            string _numero_remessa = _ultima_remessa.ToString().PadLeft(8, '0'), _data_credito = "00000000";

            _uso_febraban1    = "  ";
            _uso_febraban2    = " ";
            _uso_febraban3    = " ".PadLeft(33, ' ');
            _numero_inscricao = "050387844000105";

            string _header_lote = _codigo_banco + _lote + _tipo_registro + _tipo_operacao + _tipo_servico + _uso_febraban1 + _numero_versao + _uso_febraban2 + _tipo_inscricao + _numero_inscricao;

            _header_lote += _codigo_convenio + _agencia + _dv_agencia + _numero_conta + _dv_conta + _nome_empresa + _mensagem1 + _mensagem2 + _numero_remessa + _data_geracao + _data_credito + _uso_febraban3;
            sw.Write(_header_lote + Environment.NewLine);
        }
예제 #26
0
        public ActionResult Findcd(DebitoViewModel model, string action)
        {
            TipoCadastro tipo = model.Cadastro == "Imóvel" ? TipoCadastro.Imovel : model.Cadastro == "Empresa" ? TipoCadastro.Empresa : TipoCadastro.Cidadao;
            string       cpf  = model.CpfValue == null ? "" : Functions.RetornaNumero(model.CpfValue);
            string       cnpj = model.CnpjValue == null ? "" : Functions.RetornaNumero(model.CnpjValue);
            string       name = model.Nome == null?"":  model.Nome.Trim();

            Sistema_bll sistemaClass = new Sistema_bll(_connection);

            model.Lista_Header = sistemaClass.CodigoHeader(tipo, cpf, cnpj, name);
            if (model.Lista_Header.Count == 0)
            {
                ViewBag.Erro = "Nenhum contribuinte localizado.";
            }
            return(View(model));
        }
예제 #27
0
        private void BtObs_Click(object sender, EventArgs e)
        {
            if (lvMain.Items.Count == 0 || lvMain.SelectedItems.Count == 0)
            {
                return;
            }

            if (String.IsNullOrEmpty(lvMain.SelectedItems[0].SubItems[2].Text))
            {
                MessageBox.Show("Local ainda não tramitado.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bool         bReadOnly          = true;
            int          CodCC              = Convert.ToInt16(lvMain.SelectedItems[0].SubItems[2].Text);
            Processo_bll processo_Class     = new Processo_bll(_connection);
            Sistema_bll  sistema_Class      = new Sistema_bll(_connection);
            List <UsuariocentroCusto> Lista = processo_Class.ListaCentrocustoUsuario(sistema_Class.Retorna_User_LoginId(gtiCore.Retorna_Last_User()));

            foreach (UsuariocentroCusto item in Lista)
            {
                if (item.Codigo == CodCC)
                {
                    bReadOnly = false;
                    break;
                }
            }

            ZoomBox f1 = new ZoomBox("Observação do trâmite", this, txtObs.Text, bReadOnly);

            f1.ShowDialog();
            txtObs.Text = f1.ReturnText;

            if (!bReadOnly)
            {
                lvMain.SelectedItems[0].SubItems[11].Text = f1.ReturnText;
                int       Ano    = processo_Class.ExtractAnoProcesso(lblNumProc.Text);
                int       Numero = processo_Class.ExtractNumeroProcessoNoDV(lblNumProc.Text);
                int       Seq    = Convert.ToInt16(lvMain.SelectedItems[0].SubItems[1].Text);
                Exception ex     = processo_Class.Alterar_Observacao_Tramite(Ano, Numero, Seq, txtObs.Text);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Erro!", ex.Message, ex);
                    eBox.ShowDialog();
                }
            }
        }
예제 #28
0
        private void LoadDBSettings(int UserId)
        {
            Sistema_bll sistema_Class = new Sistema_bll(gtiCore.Connection_Name());
            Gti000      _settings     = sistema_Class.Load_GTI_Settings(UserId, Application.StartupPath);

            if (_settings.Form_Extrato_Height == 0)
            {
                _settings = sistema_Class.Load_GTI_Settings(UserId, Application.StartupPath);
            }

            gtiCore.Path_Anexo            = _settings.Path_Anexo;
            gtiCore.Path_Report           = _settings.Path_Report;
            gtiCore.Form_Extrato          = new Size(_settings.Form_Extrato_Width, _settings.Form_Extrato_Height);
            gtiCore.Form_Processo_Lista   = new Size(_settings.Form_Processo_Lista_Width, _settings.Form_Processo_Lista_Height);
            gtiCore.Form_Processo_Tramite = new Size(_settings.Form_Processo_Tramite_Width, _settings.Form_Processo_Tramite_Height);
            gtiCore.Form_Report           = new Size(_settings.Form_Report_Width, _settings.Form_Report_Height);
        }
예제 #29
0
 private void LancamentoList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (LancamentoList.SelectedIndex > -1 && _codigo > 0)
     {
         GtiTypes.CustomListBoxItem selectedItem = (GtiTypes.CustomListBoxItem)LancamentoList.SelectedItem;
         int _codLancamento = selectedItem._value;
         if (_codLancamento == 50 || _codLancamento == 65)
         {
             AbateNFText.ReadOnly  = false;
             AbateNFText.BackColor = Color.White;
         }
         else
         {
             AbateNFText.ReadOnly  = true;
             AbateNFText.BackColor = BackColor;
         }
         Sistema_bll sistema_Class = new Sistema_bll(_connection);
         Contribuinte_Header_Struct _contribuinte = sistema_Class.Contribuinte_Header(_codigo);
         int _tipoGuia = TipoGuiaList.SelectedIndex;
         if (_contribuinte.Tipo == TipoCadastro.Imovel)
         {
             if (_tipoGuia > 1 && _tipoGuia < 4)
             {
                 MessageBox.Show("Um imóvel não pode ter lançamentos de ISS, Taxa de Licença e Vigilância Sanitária.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 TipoGuiaList.SelectedIndex = 0;
             }
         }
         else
         {
             if (_tipoGuia == 5)
             {
                 MessageBox.Show("Apenas imóveis podem ter lançamentos de Roçada.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 TipoGuiaList.SelectedIndex = 0;
             }
             else
             {
                 if (_tipoGuia == 1)
                 {
                     MessageBox.Show("Apenas imóveis podem ter lançamentos de IPTU.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     TipoGuiaList.SelectedIndex = 0;
                 }
             }
         }
         Carrega_Tributo(_codLancamento);
     }
 }
예제 #30
0
 protected void OKButton_Click(object sender, EventArgs e)
 {
     if (SenhaAtual.Text.Trim() == "" || NovaSenha.Text.Trim() == "" || Confirmacao.Text.Trim() == "")
     {
         lblMsg.Text = "Preencha todos os campos!";
     }
     else
     {
         Sistema_bll     sistema_Class = new Sistema_bll("GTIconnection");
         TAcessoFunction tacesso_Class = new TAcessoFunction();
         string          _oldPwd       = tacesso_Class.DecryptGTI(sistema_Class.Retorna_User_Password(gtiCore.pUserLoginName));
         if (SenhaAtual.Text != _oldPwd)
         {
             lblMsg.Text = "Senha atual não confere!";
         }
         else
         {
             if (NovaSenha.Text != Confirmacao.Text)
             {
                 lblMsg.Text = "Nova senha e a confirmação de senha são diferentes!";
             }
             else
             {
                 Usuario reg = new Usuario {
                     Nomelogin = gtiCore.pUserLoginName,
                     Senha     = tacesso_Class.Encrypt128(NovaSenha.Text)
                 };
                 Exception ex = sistema_Class.Alterar_Senha(reg);
                 if (ex != null)
                 {
                     lblMsg.Text = "Erro, senha não alterada";
                 }
                 else
                 {
                     gtiCore.pUserId    = 0;
                     Session["pUserId"] = 0;
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "MsgChange();", true);
                     Response.Redirect("Login.aspx");
                 }
             }
         }
     }
 }