Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["IdUsuario"] != null)
                {
                    if (Session["IdEmpresaUpdate"] != null)
                    {
                        Empresa empresa = new Empresa();

                        DataTable  dt         = new DataTable();
                        EmpresaBLL empresaBLL = new EmpresaBLL();
                        dt = empresaBLL.ListaEmpresaPorId(Convert.ToInt32(Session["IdEmpresaUpdate"].ToString()));

                        if (dt.Rows.Count > 0)
                        {
                            empresa           = PreencherEmpresaUpdate(dt);
                            empresa.IdEmpresa = Convert.ToInt32(Session["IdEmpresaUpdate"].ToString());

                            Session["objEmpresa"] = empresa;
                            PreencherCampos(empresa);
                        }

                        //Remove a session que contém o código da empresa
                        Session.Remove("IdEmpresaUpdate");
                    }
                }

                else
                {
                    Session.RemoveAll();
                    Response.Redirect("~/Conta");
                }
            }
        }
Example #2
0
        //String acbr_path;
        public GerarVendasXML()
        {
            InitializeComponent();

            EmpresaBLL cmd = new EmpresaBLL();
            var        x   = cmd.localizarEmTudo("");

            //String xx = "";

            //

            //acbr_path.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            DirectoryInfo dir = new DirectoryInfo("C:\\ACBrMonitorPLUS\\Arqs\\SAT\\Vendas\\" + x.Rows[0].ItemArray[9].ToString().Replace(".", "").Replace("/", "").Replace("-", ""));

            this.cnpj = x.Rows[0].ItemArray[9].ToString().Replace(".", "").Replace("/", "").Replace("-", "");

            foreach (DirectoryInfo file in dir.GetDirectories())
            {
                String diretorio = file.Name.Substring(4, 2) + "/" + file.Name.Substring(0, 4);
                cb_periodo.Items.Add(diretorio);

                // aqui no caso estou guardando o nome completo do arquivo em em controle ListBox
                // voce faz como quiser
                //                   lbxResultado.Items.Add(file.FullName);
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            EmpresaBLL empresaBLL = new EmpresaBLL();
            Empresa    miEmpresa  = empresaBLL.ObtenerEmpresa();

            this.Text = miEmpresa.Nombre;
        }
        /*</OBJETO>**/

        /*<FUNCAO>**/
        private bool AtualizarEmpresa()
        {
            bool ret = false;

            ConexaoDAL cx = new ConexaoDAL(DadosConexao.StringDeConexao);

            EmpAtMd.IDPessoa = Convert.ToInt32(cbboxATLEmpResp.SelectedValue.ToString());
            CarregarIndiceComboEstado(this.cbboxATLEmpEstado.SelectedItem.ToString());
            EmpAtMd.Cidade     = txtATLEmpCidade.Text;
            EmpAtMd.Bairro     = txtATLEmpBairro.Text;
            EmpAtMd.Logradouro = txtATLEmpLog.Text;
            EmpAtMd.NumeroEnd  = txtATLEmpNum.Text;
            EmpAtMd.Razao      = txtATLEmpRazao.Text;
            EmpAtMd.NumeroCom  = txtATLEmpTel.Text;
            EmpAtMd.NumeroFax  = txtATLEmpFax.Text;

            EmpresaBLL fcbll = new EmpresaBLL(cx);

            if (fcbll.AtualizarEmpresa(EmpAtMd))
            {
                if (MeusFormularios.PDSSForm == null)
                {
                    MeusFormularios.PDSSForm = new PadroesSistemaForm();
                }

                MeusFormularios.PDSSForm.Show();
                MeusFormularios.PDSSForm.Focus();

                ret = true;
            }

            return(ret);
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EmpresaBLL BLL = new EmpresaBLL();

            GridView1.DataSource = BLL.selectByAssociacao(Master.getAssociacaoSession());
            GridView1.DataBind();
        }
        private void BtnDesativar_Click(object sender, EventArgs e)
        {
            Empresa empresaobj = new Empresa();

            empresaobj.CNPJ = TxtCNPJ.Text;
            int emp = new EmpresaBLL().DesativarEmpresa(empresaobj);

            if (emp > 0)
            {
                DialogResult dialogResult = MessageBox.Show("Voce deseja desativar esta empresa?", "Desativar empresa", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    DialogResult dialogResult2 = MessageBox.Show("Todos os dados desta empresa serao apagados", "Desativar empresa", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                    if (dialogResult2 == DialogResult.OK)
                    {
                        MessageBox.Show("A empresa foi desativada!", "Desativar empresa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Desativacao cancelada", "Desativar empresa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
        }
Example #7
0
        public VincularForm()
        {
            fornecedorBLL = new FornecedorBLL();
            empresaBLL    = new EmpresaBLL();

            InitializeComponent();

            empresa = empresaBLL.Ler();

            if (empresa == null)
            {
                Enabled = false;
            }
            else
            {
                if (empresa.Fornecedores != null)
                {
                    fornecedores = empresa.Fornecedores;

                    fornecedoresDisponiveis = fornecedorBLL.Ler().Except(fornecedores).ToList();
                }
                else
                {
                    fornecedoresDisponiveis = fornecedorBLL.Ler();
                }
            }

            PreencheListBox();
            PreencheComboFornecedoresDisponiveis();
        }
        private void CarregaDecas(DateTime dDataIni, DateTime dDataFim)
        {
            gtiNet.DAL.Dados.StringDeConexao = ConfigurationManager.ConnectionStrings["GTIconnection"].ToString();
            EmpresaBLL      obj   = new EmpresaBLL();
            List <Decafile> Lista = obj.ListaDecaData(dDataIni, dDataFim, "");

            foreach (var item in Lista)
            {
                bool bFind = false;
                for (int y = 0; y < cmbProtocolo.Items.Count; y++)
                {
                    if (cmbProtocolo.Items[y].ToString() == item.Protocolosil.ToString())
                    {
                        bFind = true;
                        break;
                    }
                }
                if (!bFind)
                {
                    cmbProtocolo.Items.Add(item.Protocolosil.ToString());
                }
            }
            if (cmbProtocolo.Items.Count > 0)
            {
                CarregaDoc();
            }
        }
Example #9
0
        protected void BtnCadastrar_ServerClick(object sender, EventArgs e)
        {
            Empresa empresa = null;

            if (Session["objEmpresa"] != null)
            {
                empresa = (Empresa)Session["objEmpresa"];
                Session.Remove("objEmpresa");
            }

            else
            {
                empresa = new Empresa();
            }

            empresa = Preencher(empresa);

            if (ValidaCampos(empresa) == true)
            {
                EmpresaBLL empresaBLL = new EmpresaBLL();

                if (empresa.IdEmpresa != 0)
                {
                    //Chama método de atualização BLL passando objeto como parâmetro
                    empresaBLL.AtualizaEmpresaPorId(empresa);

                    ScriptManager.RegisterClientScriptBlock(BtnCadastrar, BtnCadastrar.GetType(), "msgSucesso", "alert('Empresa atualizada com sucesso.');", true);

                    //Remove a session que contém o código da empresa
                    Session.Remove("IdEmpresaUpdate");
                    LimpaCampos();
                }

                else
                {
                    //Valida se CNPJ ja existe na base
                    empresa.Ok = empresaBLL.ValidaCNPJ(empresa.Cnpj);

                    //Caso retorno Ok seja true
                    if (empresa.Ok == true)
                    {
                        //Chama método de inserção BLL passando objeto como parâmetro
                        empresaBLL.InsereEmpresa(empresa);

                        //Exibe mensagem de cadastro realizado com sucesso
                        ScriptManager.RegisterClientScriptBlock(BtnCadastrar, BtnCadastrar.GetType(), "msgSucesso", "alert('Empresa cadastrada com sucesso.');", true);
                        //Limpa campos após cadastro ser realizado
                        LimpaCampos();
                    }

                    else
                    {
                        //Mensagem sobre CNPJ aqui
                        ScriptManager.RegisterClientScriptBlock(BtnCadastrar, BtnCadastrar.GetType(), "msgError", "alert('Atenção este CNPJ ja esta cadastrado favor verificar.');", true);
                    }
                }
            }
        }
        private void CarregarComboPessoa(int id = 0)
        {
            ConexaoDAL cx     = new ConexaoDAL(DadosConexao.StringDeConexao);
            EmpresaBLL empBLL = new EmpresaBLL(cx);

            cbboxATLEmpResp.DataSource    = empBLL.LocalizarPessoa("ATLEMPFORM", id);
            cbboxATLEmpResp.DisplayMember = "nome";
            cbboxATLEmpResp.ValueMember   = "id_pessoa";
        }
        public AtualizarEmpresaForm(string @razao, int @indice)
        {
            InitializeComponent();

            ConexaoDAL cx     = new ConexaoDAL(DadosConexao.StringDeConexao);
            EmpresaBLL Empbll = new EmpresaBLL(cx);

            this.CarregarCampos(Empbll.ParametrosAtualizaEmpForm(@razao, @indice));
        }
 public ActionResult Edit([Bind(Include = "idempresa,nombre,telefono,ciudad,direccion")] Empresa empresa)
 {
     if (ModelState.IsValid)
     {
         EmpresaBLL.Update(empresa);
         return(RedirectToAction("Index"));
     }
     return(View(empresa));
 }
Example #13
0
        public frm_contabilidade_xml()
        {
            InitializeComponent();

            calcula();


            EmpresaBLL cmd = new EmpresaBLL();
            var        x   = cmd.localizarEmTudo("");

            //String xx = "";

            //

            acbr_path.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            DirectoryInfo dir = new DirectoryInfo("C:\\ACBrMonitorPLUS\\Arqs\\SAT\\Vendas\\" + x.Rows[0].ItemArray[9].ToString().Replace(".", "").Replace("/", "").Replace("-", ""));

            this.cnpj = x.Rows[0].ItemArray[9].ToString().Replace(".", "").Replace("/", "").Replace("-", "");

            foreach (DirectoryInfo file in dir.GetDirectories())
            {
                String diretorio = file.Name.Substring(4, 2) + "/" + file.Name.Substring(0, 4);
                cb_periodo.Items.Add(diretorio);

                // aqui no caso estou guardando o nome completo do arquivo em em controle ListBox
                // voce faz como quiser
                //                   lbxResultado.Items.Add(file.FullName);
            }
            //C:\\ACBrMonitorPLUS\\Arqs\\SAT\\Vendas

            //   ConfiguracoesBLL entidade = new ConfiguracoesBLL();
            //   entidade.localizar();
            //
            //   EmpresaBLL empresa = new EmpresaBLL();
            //   DataTable dt = empresa.localizarEmTudo("");
            //
            //   empresa.localizarLeave(dt.Rows[0].ItemArray[0].ToString(), "emp_codigo");
            //   // DataTable dt = objEmp.localizarEmTudo("");
            //
            //   string[] diretorios = Directory.GetDirectories(entidade.acbr_path.Trim());
            //   diretorios = Directory.GetDirectories(diretorios[1] + "\\" + empresa.emp_cnpj);
            //
            //   for (int i = (diretorios.Length - 1); i >= 0; i--)
            //   {
            //       String[] aux = diretorios[i].Split('\\');
            //       String x = aux[aux.Length - 1].Substring(0, 4);
            //       String x2 = aux[aux.Length - 1].Substring(4, 2);
            //
            //       x = x2 + "/" + x;
            //
            //       //String x = aux[aux.Length - 1].Substring(0,3) + "/" + aux[aux.Length - 1].Substring(4,5).ToString();
            //       cb_periodo.Items.Add(x);
            //
            //   }
        }
Example #14
0
        public EmpresaForm()
        {
            InitializeComponent();

            empresaBLL = new EmpresaBLL();

            comboUF.DataSource = Enum.GetValues(typeof(Estado));

            LimpaCampos();
        }
Example #15
0
 public ActionResult Edit([Bind(Include = "idservicio,nombre,costo,descripcion,idempresa")] Servicio servicio)
 {
     if (ModelState.IsValid)
     {
         ServicioBLL.Update(servicio);
         return(RedirectToAction("Index"));
     }
     ViewBag.idempresa = new SelectList(EmpresaBLL.List(), "idempresa", "nombre", servicio.idempresa);
     return(View(servicio));
 }
Example #16
0
        protected override bool salvar(object sender, EventArgs e)
        {
            if (epValidaDados.Validar())
            {
                Usuario usuario = new Usuario();
                usuarioBLL = new UsuarioBLL();

                usuario.nome      = txtNome.Text;
                usuario.email     = txtEmail.Text;
                usuario.password  = Crypto.Codificar(txtPassword.Text);
                usuario.Id_perfil = Convert.ToInt64(cbPerfil.SelectedValue);
                usuario.inativo   = chkInativo.Checked ? "S" : "N";
                if (cbFilial.SelectedValue != null)
                {
                    filialBLL = new FilialBLL();
                    Filial filial = filialBLL.Localizar(Convert.ToInt64(cbFilial.SelectedValue));
                    usuario.Id_filial  = filial.Id;
                    usuario.Id_empresa = filial.Id_empresa;
                }
                else
                {
                    EmpresaBLL empresaBLL = new EmpresaBLL();
                    Empresa    empresa    = empresaBLL.getEmpresa().FirstOrDefault();
                    if (empresa != null)
                    {
                        usuario.Id_empresa = empresa.Id;
                    }
                }

                if (Id != null)
                {
                    usuario.Id                = Convert.ToInt32(txtId.Text);
                    usuario.alteracao         = DateTime.Now;
                    usuario.usuario_alteracao = Program.usuario_logado.nome;
                    usuarioBLL.AlterarUsuario(usuario);
                }
                else
                {
                    usuario.inclusao         = DateTime.Now;
                    usuario.usuario_inclusao = Program.usuario_logado.nome;
                    usuarioBLL.AdicionarUsuario(usuario);
                }

                if (usuario.Id != 0)
                {
                    Id         = usuario.Id;
                    txtId.Text = usuario.Id.ToString();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #17
0
        public EmpresaType getEmpresa()
        {
            if (SessionEmpresa == 0)
            {
                Response.Redirect("/Site/Login.aspx");
            }

            EmpresaBLL BLL = new EmpresaBLL();

            return(BLL.selectRecord(SessionEmpresa));
        }
Example #18
0
        public ActionResult CadastrarEmpresa()
        {
            EmpresaBLL     bll    = new EmpresaBLL();
            RetornoEmpresa retEmp = bll.BuscarTodos();

            if (retEmp.sucesso == true)
            {
                retEmp.sucesso = null;
            }
            return(View(retEmp));
        }
Example #19
0
        protected void GrdEmpresas_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            DataTable  dt         = new DataTable();
            EmpresaBLL empresaBLL = new EmpresaBLL();
            Usuario    usuario    = (Usuario)Session["objetoUsuario"];

            dt = empresaBLL.GetEmpresas(usuario);

            GrdEmpresas.DataSource = dt;
            GrdEmpresas.PageIndex  = e.NewPageIndex;
            GrdEmpresas.DataBind();
        }
        private bool EmpresaIsSimples(int nCodigo)
        {
            bool nRet = false;

            Dados.StringDeConexao = ConfigurationManager.ConnectionStrings["GTIEicon"].ToString();
            EmpresaBLL obj = new EmpresaBLL();
            Empresa    reg = new Empresa();

            reg.Codigo = nCodigo;
            nRet       = obj.IsSimples(nCodigo);
            return(nRet);
        }
Example #21
0
 public IHttpActionResult empresaCreate(Empresa empresa)
 {
     try
     {
         EmpresaBLL bll = new EmpresaBLL();
         return(Ok(bll.createEmpresa(empresa)));
     }catch (Exception ex)
     {
         UtilBLL util = new UtilBLL();
         return(Ok(util.getRetornoException(ex)));
     }
 }
Example #22
0
 public IHttpActionResult getEmpresaByName(string nome)
 {
     try
     {
         EmpresaBLL bll = new EmpresaBLL();
         return(Ok(bll.getEmpresaByName(nome)));
     }catch (Exception ex)
     {
         UtilBLL util = new UtilBLL();
         return(Ok(util.getRetornoEmpresaException(ex)));
     }
 }
        public JsonResult ConsultaRUC(string RUC = "", string NRO_DOCUMENTO_REPRESENTANTE_LEGAL = "", int ID_TIPO_DOCUMENTO_REPRESENTANTE_LEGAL = 0, bool Representante = false)
        {
            var           resultado     = new EmpresaBLL().ConsultaRuc(RUC);
            UsuarioModelo representante = new UsuarioModelo();

            if (Representante == true)
            {
                representante = new UsuarioBLL().BuscarRepresentante(RUC, NRO_DOCUMENTO_REPRESENTANTE_LEGAL, ID_TIPO_DOCUMENTO_REPRESENTANTE_LEGAL);
            }

            return(Json(new { modelo = resultado, representante = representante.ResultadoUsuarioVM.Validacion }));
        }
 public IHttpActionResult Delete(int id)
 {
     try
     {
         EmpresaBLL.Delete(id);
         return(Ok("Empresa eliminado correctamente"));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
 public IHttpActionResult Put(Empresa empresa)
 {
     try
     {
         EmpresaBLL.Update(empresa);
         return(Content(HttpStatusCode.OK, "Empresa actualizado correctamente"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
 public IHttpActionResult Get()
 {
     try
     {
         List <Empresa> todos = EmpresaBLL.List();
         return(Content(HttpStatusCode.OK, todos));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
 // GET: Empresas
 public IHttpActionResult Post(Empresa empresa)
 {
     try
     {
         EmpresaBLL.Create(empresa);
         return(Content(HttpStatusCode.Created, "Empresa creado correctamente"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Example #28
0
 public IHttpActionResult empresaDelete([FromBody] int id)
 {
     try
     {
         EmpresaBLL bll = new EmpresaBLL();
         return(Ok(bll.deleteEmpresa(Convert.ToInt32(id))));
     }
     catch (Exception ex)
     {
         UtilBLL util = new UtilBLL();
         return(Ok(util.getRetornoException(ex)));
     }
 }
Example #29
0
        protected void LoadCentroCusto(Usuario usuario)
        {
            EmpresaBLL empresaBLL = new EmpresaBLL();
            DataTable  dt         = new DataTable();

            dt = empresaBLL.GetCentroCusto(usuario);

            DrpCentroCusto.DataSource = dt;
            DrpCentroCusto.DataBind();

            DrpCentroCusto.Items.Insert(0, "Selecione");
            DrpCentroCusto.Items[0].Value = "";
        }
Example #30
0
        public void RemoverItem(GridViewRow row)
        {
            string IdObj = ((Label)row.FindControl("LblIdEmpresa")).Text;

            if (!string.IsNullOrEmpty(IdObj))
            {
                EmpresaBLL empresaBLL = new EmpresaBLL();
                empresaBLL.DeletaEmpresaPorId(Convert.ToInt32(IdObj));
                Usuario usuario = (Usuario)Session["objetoUsuario"];

                CarregaEmpresas(usuario);
            }
        }