示例#1
0
        protected void btn_guardarEstrato_Click(object sender, EventArgs e)
        {
            try
            {
                Estrato estrato = new Estrato();
                estrato.NivelEstrato  = char.Parse(txt_estrato.Text);
                estrato.NombreEstrato = "Estrato " + estrato.NivelEstrato;
                estrato.ValorEstrato  = decimal.Parse(txtValorEstrato.Text.Trim());
                estrato.CargoFijo     = decimal.Parse(txtCargoFijo.Text.Trim());
                FactureandoBL factureandoBL = new FactureandoBL();

                if (factureandoBL.InsertarEstrato(ref estrato, decimal.Parse(txtValorTv.Text),
                                                  decimal.Parse(txtValorTel.Text),
                                                  decimal.Parse(txtValorInt.Text)))
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Registro del estrato exitoso', 1); limpiarCampos();});</script>";
                }
                else
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Error almacenando la información', 2);});</script>";
                }
            }
            catch (Exception ex)
            {
                litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Error almacenando la información', 2);});</script>";
            }
        }
示例#2
0
        protected void btn_registrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (int.Parse(ddlClientes.SelectedValue) == -1)
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Debe seleccionar un cliente', 2);});</script>";

                    return;
                }


                Factura factura = new Factura();

                factura.Cliente = (Cliente)(Consultas.ConsultarID("ManejadorCliente", new object[] { int.Parse(ddlClientes.SelectedValue) }));
                factura.Fecha   = DateTime.Now;

                DetalleFactura detalleTelevision = new DetalleFactura();
                detalleTelevision.Servicio = new Servicio()
                {
                    IdServicio = 1
                };
                detalleTelevision.CantidadConsumo = int.Parse(txtValorTv.Text);

                DetalleFactura detalleTelefono = new DetalleFactura();
                detalleTelefono.Servicio = new Servicio()
                {
                    IdServicio = 2
                };
                detalleTelefono.CantidadConsumo = int.Parse(txtValorTel.Text);

                DetalleFactura detalleInternet = new DetalleFactura();
                detalleInternet.Servicio = new Servicio()
                {
                    IdServicio = 3
                };
                detalleInternet.CantidadConsumo = int.Parse(txtValorInt.Text);

                factura.DetalleFactura = new List <DetalleFactura>();
                factura.DetalleFactura.Add(detalleTelevision);
                factura.DetalleFactura.Add(detalleTelefono);
                factura.DetalleFactura.Add(detalleInternet);


                FactureandoBL factureando = new FactureandoBL();

                if (factureando.InsertarFactura(ref factura))
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Registro exitoso', 1); limpiarCampos(); visualizarFactura(" + factura.IdFactura + ");});</script>";
                }
                else
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Error almacenando la información', 2);});</script>";
                }
            }
            catch (Exception ex)
            {
                litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Error Inesperado', 2);});</script>";
            }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            litNotificaciones.Text = "";
            if (!IsPostBack)
            {
                try
                {
                    int idFactura = int.Parse(Request.QueryString["IdFactura"]);

                    Factura factura = (Factura)Consultas.ConsultarID("ManejadorFactura", new object[] { idFactura });


                    if (factura != null)
                    {
                        lit_razonsocial.Text      = factura.Cliente.RazonSocial;
                        lit_id.Text               = factura.Cliente.NumeroIdentificacion;
                        lit_estrato.Text          = factura.Cliente.Estrato.NombreEstrato;
                        lit_fecha.Text            = factura.Fecha.ToShortDateString();
                        lit_consecutivo.Text      = factura.Consecutivo;
                        lit_cargobasico.Text      = "20000";
                        lit_valorbaseestrato.Text = factura.Cliente.Estrato.ValorEstrato.ToString();


                        DetalleFactura dttv  = ((List <DetalleFactura>)(factura.DetalleFactura.Where(x => x.Servicio.IdServicio == 1).ToList()))[0];
                        DetalleFactura dtTel = ((List <DetalleFactura>)(factura.DetalleFactura.Where(x => x.Servicio.IdServicio == 2).ToList()))[0];
                        DetalleFactura dtInt = ((List <DetalleFactura>)(factura.DetalleFactura.Where(x => x.Servicio.IdServicio == 3).ToList()))[0];

                        lit_cantidadtelevision.Text = dttv.CantidadConsumo.ToString();
                        lit_cantidadtelefonia.Text  = dtTel.CantidadConsumo.ToString();
                        lit_cantidadinternet.Text   = dtInt.CantidadConsumo.ToString();

                        lit_valortelevision.Text = dttv.Servicio.TarifaServicio.ValorServicio.ToString();
                        lit_valortelefonia.Text  = dtTel.Servicio.TarifaServicio.ValorServicio.ToString();
                        lit_valorinternet.Text   = dtInt.Servicio.TarifaServicio.ValorServicio.ToString();


                        lit_subtotaltelevision.Text = dttv.ValorConsumo.ToString();
                        lit_subtotaltelefonia.Text  = dtTel.ValorConsumo.ToString();
                        lit_subtotalinternet.Text   = dtInt.ValorConsumo.ToString();

                        decimal subtotalsc     = (dttv.ValorConsumo + dtTel.ValorConsumo + dtInt.ValorConsumo);
                        decimal cargo_variable = FactureandoBL.ObtenerCargoVariableFactura(factura, dttv.ValorConsumo, dtTel.ValorConsumo, dtInt.ValorConsumo);
                        lit_subtotal.Text      = subtotalsc.ToString();
                        lit_cargovariable.Text = Math.Round(cargo_variable, 2).ToString();
                        lit_total.Text         = Math.Round((subtotalsc + cargo_variable + 20000), 2).ToString();
                    }
                }

                catch (Exception ex)
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Error cargando la página', 2);});</script>";
                }
            }
        }
        protected void btn_registrar_Click(object sender, EventArgs e)
        {
            try
            {
                Cliente clienteA = new Cliente();
                clienteA.TipoIdentificacion   = tipoIde.Value;
                clienteA.NumeroIdentificacion = txt_numeroide.Text;
                clienteA.PrimerNombre         = txt_pnombre.Text.Trim();
                clienteA.SegundoNombre        = txt_snombre.Text.Trim();
                clienteA.PrimerApellido       = txt_papellido.Text.Trim();
                clienteA.SegundoApellido      = txt_sapellido.Text.Trim();

                if (tipoIde.Value == "NIT")
                {
                    clienteA.RazonSocial = txt_razonsocial.Text;
                }
                else
                {
                    clienteA.RazonSocial = clienteA.PrimerNombre + " " + clienteA.SegundoNombre + " " + clienteA.PrimerApellido + " " + clienteA.SegundoApellido;
                    clienteA.RazonSocial = clienteA.RazonSocial.Replace("  ", " ");
                }

                clienteA.Estrato           = new Estrato();
                clienteA.Estrato.IdEstrato = byte.Parse(ddlEstratos.SelectedValue);

                FactureandoBL factureandoBL = new FactureandoBL();
                if (factureandoBL.InsertarCliente(ref clienteA))
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Registro del cliente exitoso', 1); limpiarCampos(); $('select').val('CC'); });</script>";
                    CleanForm();
                }
                else
                {
                    litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Error almacenando la información', 2);});</script>";
                }
            }
            catch (Exception ex)
            {
                litNotificaciones.Text = "<script> $(document).ready(function () {alertarTexto('Error almacenando la información', 2);});</script>";
            }
        }