protected void Page_Load(object sender, EventArgs e) { if (Session["usuarioValido"] != null) { if (!Session["usuarioValido"].Equals("valido")) { Server.Transfer("Login.aspx", true); } } else { Server.Transfer("Login.aspx", true); } if (!IsPostBack) { var d = new Datos.Datos(); List <TipoReclamo> tipoReclamos = d.GetTipoReclamo(); type.DataTextField = "nombre"; type.DataValueField = "id"; type.DataSource = tipoReclamos; type.DataBind(); type.Items.Insert(0, new System.Web.UI.WebControls.ListItem("<Ingrese Tipo de Reclamo>", "0")); } }
protected void btnEnviar_Click(object sender, EventArgs e) { var info = "Error al entrar"; var v = new Validadores(); var d = new Datos.Datos(); try { var identi = Convert.ToInt32(ide.Text); var nom = firstname.Text; var ape = lastname.Text; var rut = this.rut.Text; var email = this.email.Text; var tel = int.Parse(this.tel.Text); var type = this.type.Text; var com = comment.Text; var fec = Convert.ToDateTime(this.fec.Text); var rec = new Reclamo(identi, nom, ape, rut, email, tel, type, com, fec); d.CerrarReclamo(identi); } catch (Exception ex) { Server.Transfer("Error.aspx?error=" + ex.Message, true); } Server.Transfer("Exito.aspx?", true); }
public static ReportClass GenerarPDF(ref string error, Modelo.Factura factura, Logger logger) { try { var facturaReporte = (ReportClass)Activator.CreateInstance(Type.GetType(factura.Formato.NombreFormato)); //var facturaReporte = new Reportes.FacturaNormalLila(); Datos.Datos datos = new Datos.Datos(); var _colores = factura.Sucursal.ColorReporte.Split(','); datos.Cliente.AddClienteRow( factura.Cliente.Descripcion, factura.Cliente.Rfc, factura.Cliente.Calle, factura.Cliente.CodigoPostal, factura.Cliente.Ciudad, factura.Cliente.Colonia, factura.Cliente.Municipio, factura.Cliente.Estado, factura.Cliente.Pais ); datos.Sucursal.AddSucursalRow( factura.Sucursal.Descripcion, factura.Sucursal.Rfc, factura.Sucursal.Calle, factura.Sucursal.CodigoPostal, factura.Sucursal.Ciudad, factura.Sucursal.Colonia, factura.Sucursal.Municipio, factura.Sucursal.Estado, factura.Sucursal.Pais, factura.Sucursal.LogoBytes, factura.Regimen.Descripcion, "", factura.Sucursal.Telefono, factura.Sucursal.Celular, int.Parse(_colores[0]), int.Parse(_colores[1]), int.Parse(_colores[2]) ); if (factura.Complementos.Count > 0) { try { Ine ine = JsonConvert.DeserializeObject <Ine>(factura.Complementos.ElementAt(0).Detalle); datos.Ine.AddIneRow(ine.TipoProceso, ine.TipoComite, ine.ContabilidadId, ine.Ambito, ine.ClaveEntidad, ine.Version); } catch { } } datos.Factura.AddFacturaRow( factura.Id, factura.Serie, factura.Folio, factura.Tipoventa, factura.Fecha, factura.CantidadEnLetra, factura.MetodoPago.Descripcion, factura.FormaPago.Descripcion, factura.Banco, factura.NoCuentaPago, factura.SubtotalE, factura.SubtotalG, factura.Iva, factura.RetIva, factura.RetIsr, factura.Descuento, factura.Total, factura.SelloCfd, factura.SelloSat, factura.NoCertificadoSat, factura.NoCertificadoEmisor, factura.FechaTimbrado, factura.VersionTimbrado, factura.CadenaOriginal, factura.Tipo, "A", factura.ImagenCbbBytes, factura.FolioFiscal, factura.Ieps, (bool)factura.EsCredito, factura.Observacion ); datos.RegimenFiscal.AddRegimenFiscalRow(factura.Regimen.Codigo, factura.Regimen.Descripcion); datos.FormaPago.AddFormaPagoRow(factura.FormaPago.Codigo, factura.FormaPago.Descripcion); datos.MetodoPago.AddMetodoPagoRow(factura.MetodoPago.Codigo, factura.MetodoPago.Descripcion); datos.UsoCFDI.AddUsoCFDIRow(factura.UsoCFDI.Codigo, factura.UsoCFDI.Descripcion); foreach (var det in factura.Detalles) { datos.CatalogoSat.AddCatalogoSatRow(det.CatSatProducto.Codigo, det.CatSatProducto.Descripcion); datos.FactDetalle.AddFactDetalleRow(det.CatSatProducto.Codigo, det.CuentaPredial, det.Codigo, det.Descripcion, det.CatSatUnidad.Descripcion, det.TasaIva, det.TasaIeps, det.Precio, det.Cantidad, det.TasaDesc, det.Total, det.Lote, det.FechaCaducidad, det.CatSatUnidad.Codigo); } facturaReporte.SetDataSource(datos); return(facturaReporte); } catch (Exception e) { error = e.ToString(); logger.EscribirError(e.ToString()); return(null); } }
protected int userId() { var d = new Datos.Datos(); var username = inputRut.Text; var password = inputPassword.Text; int userId = d.GetUserIdByUsernameAndPassword(username, password); return(userId); }
public static ReportClass GenerarPDF(ref string error, Cotizacion cotizacion, Logger logger) { try { Datos.Datos datos = new Datos.Datos(); var _colores = cotizacion.Sucursal.ColorReporte.Split(','); datos.Cliente.AddClienteRow( cotizacion.Cliente.Descripcion, cotizacion.Cliente.Rfc, cotizacion.Cliente.Calle, cotizacion.Cliente.CodigoPostal, cotizacion.Cliente.Ciudad, cotizacion.Cliente.Colonia, cotizacion.Cliente.Municipio, cotizacion.Cliente.Estado, cotizacion.Cliente.Pais ); datos.Sucursal.AddSucursalRow( cotizacion.Sucursal.Descripcion, cotizacion.Sucursal.Rfc, cotizacion.Sucursal.Calle, cotizacion.Sucursal.CodigoPostal, cotizacion.Sucursal.Ciudad, cotizacion.Sucursal.Colonia, cotizacion.Sucursal.Municipio, cotizacion.Sucursal.Estado, cotizacion.Sucursal.Pais, cotizacion.Sucursal.LogoBytes, cotizacion.Regimen.Descripcion, "", cotizacion.Sucursal.Telefono, cotizacion.Sucursal.Celular, int.Parse(_colores[0]), int.Parse(_colores[1]), int.Parse(_colores[2]) ); datos.Factura.AddFacturaRow( cotizacion.Id, cotizacion.Serie, cotizacion.Folio, "", cotizacion.Fecha, cotizacion.CantidadEnLetra, cotizacion.MetodoPago.Descripcion, cotizacion.FormaPago.Descripcion, cotizacion.Banco, cotizacion.NoCuentaBanco, cotizacion.SubtotalE, cotizacion.SubtotalG, cotizacion.Iva, cotizacion.RetIva, cotizacion.RetIsr, cotizacion.Descuento, cotizacion.Total, "", "", "", "", "", "", "", "", "Guardada", null, "", cotizacion.Ieps, cotizacion.EsCredito, cotizacion.Observacion ); datos.RegimenFiscal.AddRegimenFiscalRow(cotizacion.Regimen.Codigo, cotizacion.Regimen.Descripcion); //datos.FormaPago.AddFormaPagoRow(factura.FormaPago.Codigo, factura.FormaPago.Descripcion); //datos.MetodoPago.AddMetodoPagoRow(factura.MetodoPago.Codigo, factura.MetodoPago.Descripcion); //datos.UsoCFDI.AddUsoCFDIRow(factura.UsoCFDI.Codigo, factura.UsoCFDI.Descripcion); foreach (var det in cotizacion.Detalles) { logger.EscribirError(det.CatSatProducto.Descripcion); if (det.CatSatProducto != null) { datos.CatalogoSat.AddCatalogoSatRow(det.CatSatProducto.Codigo, det.CatSatProducto.Descripcion); } datos.FactDetalle.AddFactDetalleRow(det.CatSatProducto.Codigo, "", det.Codigo, det.Descripcion, det.CatSatUnidad != null ? det.CatSatUnidad.Descripcion: "", det.TasaIva, det.TasaIeps, det.Precio, det.Cantidad, det.TasaDesc, det.Total, det.Lote, det.FechaCaducidad, det.CatSatUnidad.Codigo); } var _cotizacion = (ReportClass)Activator.CreateInstance(Type.GetType(cotizacion.Formato.NombreFormato)); _cotizacion.SetDataSource(datos); return(_cotizacion); } catch (Exception e) { error = e.ToString(); logger.EscribirError(e.ToString()); return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuarioValido"] != null) { if (!Session["usuarioValido"].Equals("valido")) { Server.Transfer("Login.aspx", true); } } else { Server.Transfer("Login.aspx", true); } int id = int.Parse(Request.QueryString["id"]); var v = new Validadores(); var d = new Datos.Datos(); var rec = d.GetReclamo(id); this.ide.Text = rec.Id.ToString(); this.ide.Enabled = false; this.firstname.Text = rec.Nombre; this.lastname.Text = rec.Apellido; this.rut.Enabled = false; this.rut.Text = rec.Rut; this.email.Text = rec.Email; if (rec.Tipo == "Atención al cliente") { this.type.SelectedIndex = 1; } else if (rec.Tipo == "Comercial") { this.type.SelectedIndex = 2; } else { this.type.SelectedIndex = 3; } this.tel.Text = rec.Telefono.ToString(); this.comment.Text = rec.Comentarios; this.fec.Text = rec.Fecha.ToString("s"); this.fec.Enabled = false; }
protected void btnEnviar_Click(object sender, EventArgs e) { var d = new Datos.Datos(); try { var user = usuario.Text; var contraseña = password.Text; var resultado = d.AddUser(user, contraseña); if (resultado) { } } catch (Exception ex) { Server.Transfer("Error.aspx?error=" + ex.Message, true); } Server.Transfer("Exito.aspx", true); }
protected void btnEnviar_Click(object sender, EventArgs e) { var v = new Validadores(); var d = new Datos.Datos(); Reclamo rec = new Reclamo(); try { var nom = firstname.Text; var ape = lastname.Text; var rut = this.rut.Text; if (v.validarRut(rut) == false) { throw new Exception("Rut inválido"); } rut = rut.ToUpper(); rut = rut.Replace(".", ""); rut = rut.Replace("-", ""); var email = this.email.Text; var tel = int.Parse(this.tel.Text); var type = this.type.SelectedIndex.ToString(); var com = comment.Text; var fec = DateTime.Now; rec = new Reclamo(d.GetLastReclamo() + 1, nom, ape, rut, email, tel, type, com, fec); var IP = GetIP(); var pdf = GeneratePdf(rec); var SLA = fec.AddHours(int.Parse(this.slaHoras.Text)); d.IngresoReclamo(rec, pdf, SLA, IP); } catch (Exception ex) { Server.Transfer("Error.aspx?error=" + ex.Message, true); } Server.Transfer("Exito.aspx", true); }