//ATUALIZAR
        public static void Atualizar(MEmpresa item)
        {
            if (item == null)
            {
                throw new Exception("Empresa digitada esta inválida");
            }

            //NÃO SALVAR CAMPO EM BRANCO OU COM MAIS DE 50 CHARS
            if (item.NomeEmpresa.Trim() == "" || item.NomeEmpresa.Length > 50)
            {
                throw new Exception("O Nome da empresa não pode esta vazia ou conter mais de 50 caracteres");
            }

            //NÃO SALVAR NUMEROS
            Regex validarNumero = new Regex(@"^\d+$");

            if (validarNumero.IsMatch(item.NomeEmpresa))
            {
                throw new Exception("Nome da Empresa não pode conter somente numeros");
            }

            try
            {
                DEmpresa.Atualizar(item);
            }
            catch
            {
                throw;
            }
        }
Exemple #2
0
        public static string Editar(string cod_empresa, string cod_empresav, string cod_moneda, string cod_pais, string cod_islr, string desc_empresa, string rif, string replegal, string direccion, string telefono, string movil, string codigo_postal, string web, string email, bool fiscal, decimal montofiscal, string campo1, string campo2, string campo3, string campo4, string campo5, string campo6, byte[] logo1, byte[] logo2, byte[] logo3)
        {
            DEmpresa Obj = new DEmpresa
            {
                Dcod_empresa   = cod_empresa,
                Dcod_empresav  = cod_empresav,
                Dcod_moneda    = cod_moneda,
                Dcod_pais      = cod_pais,
                Dcod_islr      = cod_islr,
                Ddesc_empresa  = desc_empresa,
                Drif           = rif,
                Dreplegal      = replegal,
                Ddireccion     = direccion,
                Dtelefono      = telefono,
                Dmovil         = movil,
                Dcodigo_postal = codigo_postal,
                Dweb           = web,
                Demail         = email,
                Dfiscal        = fiscal,
                Dmontofiscal   = montofiscal,
                Dcampo1        = campo1,
                Dcampo2        = campo2,
                Dcampo3        = campo3,
                Dcampo4        = campo4,
                Dcampo5        = campo5,
                Dcampo6        = campo6,
                Dlogo1         = logo1,
                Dlogo2         = logo2,
                Dlogo3         = logo3,
            };

            return(Obj.Editar(Obj));
        }
Exemple #3
0
        //buscar empresa
        public static DataTable BuscarEmpresa(string nome)
        {
            DEmpresa Obj = new DEmpresa();

            Obj.Nome = nome;
            return(Obj.BuscarEmpresa(Obj));
        }
Exemple #4
0
        public DataTable mostrarmiPerfilE(Int32 idperfil)
        {
            DataTable muestraPE = new DataTable();
            DEmpresa  miperfile = new DEmpresa();

            muestraPE = miperfile.EmpresaMiPerfil(idperfil);
            return(muestraPE);
        }
Exemple #5
0
        public DataTable mostrarmisOfertas(int idO)
        {
            DataTable muestraO   = new DataTable();
            DEmpresa  misofertas = new DEmpresa();

            muestraO = misofertas.obtenermisOfertas(idO);
            return(muestraO);
        }
Exemple #6
0
        public static string Eliminar(string cod_empresa)
        {
            DEmpresa Obj = new DEmpresa
            {
                Dcod_empresa = cod_empresa,
            };

            return(Obj.Eliminar(Obj));
        }
Exemple #7
0
        public static string GenerarCod(string cod_empresa)
        {
            DEmpresa Obj = new DEmpresa
            {
                Dcod_empresa = cod_empresa
            };

            return(Obj.GenerarCod(Obj));
        }
Exemple #8
0
        public static DataSet Siguiente(string cod_empresa)
        {
            DEmpresa Obj = new DEmpresa()
            {
                Dcod_empresa = cod_empresa
            };

            return(Obj.Siguiente(Obj));
        }
Exemple #9
0
        public static DataSet Anterior(string cod_empresa)
        {
            DEmpresa Obj = new DEmpresa()
            {
                Dcod_empresa = cod_empresa
            };

            return(Obj.Anterior(Obj));
        }
Exemple #10
0
        public UEmpresa modificarEmp(Int32 Idemp)
        {
            DEmpresa  datosE         = new DEmpresa();
            DataTable modificarDatos = datosE.obtenerEmpresa(Idemp);
            UEmpresa  datosEmpresa   = new UEmpresa();

            datosEmpresa.Url = "Modificar_H_Empresa.aspx";
            return(datosEmpresa);
        }
Exemple #11
0
        public static DataTable Buscar(string buscar, string btipo)
        {
            DEmpresa Obj = new DEmpresa()
            {
                Dbuscar = buscar,
                Dbtipo  = btipo,
            };

            return(Obj.Buscar(Obj));
        }
Exemple #12
0
        public UEmpresa modificarEmpresa(Int32 IdEmp, String nombreE, String forma, String direccionE, String telefonoE, String sector, String empleados, String nit, String tipo, String id_empresa, String nombre_empresa, String forma_juridica, String direccion_empresa, String telefono_empresa, String sector_economico, String num_empleados, String tipo_empresa)
        {
            DEmpresa  datosE         = new DEmpresa();
            DataTable modificarDatos = datosE.EditarEmpresa(IdEmp, nombreE, forma, direccionE, telefonoE, sector, empleados, nit, tipo, id_empresa, nombre_empresa,
                                                            forma_juridica, direccion_empresa, telefono_empresa, sector_economico, num_empleados, tipo_empresa);
            UEmpresa datosEmpresa = new UEmpresa();

            datosEmpresa.Url = "Modificar_H_.Empresa.aspx";
            return(datosEmpresa);
        }
Exemple #13
0
        public static DataTable RepBuscar(string buscard, string buscarh, string btipo)
        {
            DEmpresa Obj = new DEmpresa()
            {
                Dbuscard = buscard,
                Dbuscarh = buscarh,
                Dbtipo   = btipo,
            };

            return(Obj.Buscar(Obj));
        }
        //OBTER
        public static MEmpresa Obter(MEmpresa item)
        {
            MEmpresa retorno = null;

            if (item != null)
            {
                retorno = DEmpresa.Obter(item);
            }

            return(retorno);
        }
        //EXCLUIR
        public static void Excluir(MEmpresa item)
        {
            if (item.NomeEmpresa.Trim() == "")
            {
                throw new Exception("Nome da Empresa Inválida");
            }

            try
            {
                DEmpresa.Excluir(item);
            }
            catch
            {
                throw;
            }
        }
        //PESQUISAR
        public static List <MEmpresa> Pesquisar(MEmpresa item)
        {
            List <MEmpresa> retorno = null;

            if (item.NomeEmpresa != null && item.NomeEmpresa.Length <= 50)
            {
                retorno = DEmpresa.Pesquisar(item);

                //RETORNO SE NÃO HOUVER NENHUM CADASTRO
                if (retorno == null)
                {
                    throw new Exception("A Pesquisa não retornou nenhum cadastro!");
                }
            }

            return(retorno);
        }
        protected void btPrint_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(RAZAOSOCIAL.Text))
            {
                lblMsg.Text = "Selecione uma empresa para imprimir";
            }
            else
            {
                lblMsg.Text = "";

                List <DEmpresa> aLista = new List <DEmpresa>();
                int             nSid   = gtiCore.GetRandomNumber();
                DEmpresa        reg    = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Inscrição Municipal";
                reg.valor = IM.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Razão Social";
                reg.valor = RAZAOSOCIAL.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "CNPJ/CPF";
                reg.valor = CNPJ.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Data de Abertura";
                reg.valor = DATAABERTURA.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Data de Encerramento";
                reg.valor = DATAENCERRAMENTO.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Inscrição Estadual";
                reg.valor = IE.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Situação";
                reg.valor = SITUACAO.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Endereço";
                reg.valor = ENDERECO.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Email";
                reg.valor = EMAIL.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Telefone";
                reg.valor = TELEFONE.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Regime de ISS";
                reg.valor = REGIMEISS.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Vigilância Sanitária";
                reg.valor = VIGSANIT.Text;
                aLista.Add(reg);
                reg                  = new DEmpresa();
                reg.sid              = nSid;
                reg.nome             = "Taxa de Licença";
                reg.valor            = TAXALICENCA.Text;
                aLista.Add(reg); reg = new DEmpresa();
                reg.sid              = nSid;
                reg.nome             = "Optante do Simples";
                reg.valor            = SIMPLES.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Micro Emp. Individual";
                reg.valor = MEI.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Área";
                reg.valor = AREA.Text;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Proprietário";
                reg.valor = sSocio2;
                aLista.Add(reg);
                reg       = new DEmpresa();
                reg.sid   = nSid;
                reg.nome  = "Atividades";
                reg.valor = sCnae2;
                aLista.Add(reg);
                clsEmpresa empresa_class = new clsEmpresa();
                empresa_class.Grava_DEmp(aLista);

                List <DEmpresa> ListaEmp = empresa_class.ListaDEmpresa(nSid);
                DataTable       dt       = gtiCore.ConvertToDatatable(ListaEmp);

                Warning[] warnings;
                string[]  streamIds;
                string    mimeType  = string.Empty;
                string    encoding  = string.Empty;
                string    extension = string.Empty;

                DataSet          Ds     = gtiCore.ToDataSet(ListaEmp);
                ReportDataSource rdsAct = new ReportDataSource("dsDadosEmpresa", Ds.Tables[0]);
                ReportViewer     viewer = new ReportViewer();
                viewer.LocalReport.Refresh();
                viewer.LocalReport.ReportPath = Server.MapPath("~/Report/rptDadosEmpresa.rdlc");
                //viewer.LocalReport.ReportPath = "Report/rptDadosEmpresa.rdlc";
                //ReportParameter[] param = new ReportParameter[5];
                //param[0] = new ReportParameter("Report_Parameter_0", "1st Para", true);
                viewer.LocalReport.DataSources.Add(rdsAct); // Add  datasource here
                byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
                empresa_class.Delete_DEmpresa(nSid);
                Response.Buffer = true;
                Response.Clear();
                Response.ContentType = mimeType;
                Response.AddHeader("content-disposition", "attachment; filename= guia_pmj" + "." + extension);
                Response.OutputStream.Write(bytes, 0, bytes.Length);
                Response.Flush();
                Response.End();
            }
        }