public async Task GetFactura_Found()
        {
            // Arrange
            using (context)
            {
                var     controller = new FacturasController(context);
                Reserva reserva    = new Reserva
                {
                    idReserva = 1
                };
                Factura exResult = new Factura
                {
                    idFactura = 1,
                    Reserva   = reserva
                };
                reserva.Factura = exResult;

                // Act
                Factura result = await controller.GetFactura(reserva);

                //Assert
                Assert.IsType <Factura>(result);
                Assert.Equal(exResult, result, Comparer.Get <Factura>((f1, f2) => f1.idFactura == f2.idFactura));
            }
        }
예제 #2
0
        private void FrmFactura_Load(object sender, EventArgs e)
        {
            ClientesController    = new ClientesController();
            LocalidadesController = new LocalidadesController();
            FiscalesController    = new FiscalesController();
            EmpresaController     = new EmpresaController();
            ArticulosController   = new ArticulosController();
            FacturasController    = new FacturasController();

            _CargarControles();
        }
        public async Task GetFactura_ReservaIsNull()
        {
            // Arrange
            using (context)
            {
                var controller = new FacturasController(context);
                // Act
                Factura result = await controller.GetFactura(null);

                //Assert
                Assert.Null(result);
            }
        }
예제 #4
0
        private void _CargarDropDownEstados()
        {
            ddlEstados.Items.Add(new Documentos_Estado
            {
                Descripcion = "Todos",
                idEstado    = 0
            });
            var facturasController = new FacturasController();

            ddlEstados.DisplayMember = "Descripcion";
            ddlEstados.ValueMember   = "IdEstado";
            facturasController.ListarDocumentosEstado().ForEach(est => ddlEstados.Items.Add(est));
            ddlEstados.SelectedIndex = 0;
        }
        public async Task GetFactura_ReservaNotAssociated()
        {
            // Arrange
            using (context)
            {
                var     controller = new FacturasController(context);
                Reserva reserva    = new Reserva
                {
                    idReserva = 1
                };

                // Act
                Factura result = await controller.GetFactura(reserva);

                //Assert
                Assert.Null(result);
            }
        }
        public async Task GetFactura_NotFound()
        {
            // Arrange
            using (context)
            {
                var     controller = new FacturasController(context);
                Reserva reserva    = new Reserva
                {
                    idReserva = 1,
                };
                Factura factura = new Factura
                {
                    idFactura = 2,
                    Reserva   = reserva
                };
                reserva.Factura = factura;

                // Act
                Factura result = await controller.GetFactura(reserva);

                //Assert
                Assert.Null(result);
            }
        }
예제 #7
0
 public FrmListadoFacturas()
 {
     FacturasController = new FacturasController();
     InitializeComponent();
 }
    protected void btnProcesar_Click(object sender, EventArgs e)
    {
        try
        {
            AlertSuccess.Visible   = false;
            lblMessageCreate.Text  = "";
            lblMessageSuccess.Text = "";
            lblMessageError.Text   = "";

            if (lblHideUUIDXML.Text != "")
            {
                SessionInfoModel    session  = new SessionInfoModel();
                List <FacturaModel> facturas = new List <FacturaModel>();

                session = (SessionInfoModel)Session["SessionInfo"];

                foreach (Telerik.Web.UI.GridDataItem dataitem in RadGridPartidas.Items)
                {
                    if ((dataitem.FindControl("CheckBox1") as CheckBox).Checked == true)
                    {
                        facturas.Add(new FacturaModel {
                            DocNumPedido   = 0,
                            DocEntryPedido = int.Parse(dataitem["DocEntryPedido"].Text),
                            DocEntry       = int.Parse(dataitem["DocEntry"].Text),
                            DocNum         = int.Parse(dataitem["DocNum"].Text),
                            SeriesName     = "",
                            DocType        = dataitem["DocType"].Text,
                            CardCode       = session.cardcode,
                            CardName       = session.cardname,
                            DocDate        = "",
                            DocDueDate     = "",
                            NumAtCard      = "",
                            DocCur         = dataitem["Currency"].Text,
                            Rounding       = "",
                            Comments       = "",
                            Address2       = "",
                            RoundDif       = 0,
                            SubTotal       = 0,
                            VatSum         = 0,
                            DocTotal       = 0,
                            LineNum        = int.Parse(dataitem["LineNum"].Text),
                            ItemCode       = dataitem["ItemCode"].Text,
                            Dscription     = dataitem["Dscription"].Text,
                            Quantity       = Convert.ToDouble(dataitem["Quantity"].Text),
                            OpenQty        = 0,
                            OpenCreQty     = Convert.ToDouble(dataitem["OpenCreQty"].Text),
                            Price          = Convert.ToDouble(dataitem["Price"].Text),
                            DiscPrcnt      = Convert.ToDouble(dataitem["DiscPrcnt"].Text),
                            Currency       = dataitem["Currency"].Text,
                            unitMsr        = "",
                            WhsCode        = "",
                            VatPrcnt       = Convert.ToDouble(dataitem["VatPrcnt"].Text),
                            ShipDate       = "",
                            SlpCode        = 0,
                            FreeTxt        = "",
                            LineTotal      = Convert.ToDouble(dataitem["LineTotal"].Text),
                            VatSumLine     = Convert.ToDouble(dataitem["VatSumLine"].Text),
                            lmUUID         = lblHideUUIDXML.Text,
                            lmAttachXML    = lblHidePathXML.Text
                        });
                    }
                }

                if (facturas.Count > 0)
                {
                    FacturasController facturasController = new FacturasController();
                    SAPB1Result        result             = facturasController.CreateOpch(facturas);
                    if (result.Status == "Ok")
                    {
                        lblMessageSuccess.Text = result.Messages;
                        lblMessageCreate.Text  = result.Messages;
                        AlertSuccess.Visible   = true;

                        btnPaso1.Enabled = false;
                        btnPaso2.Enabled = false;
                        btnPaso3.Enabled = false;

                        btnValidar.Enabled  = false;
                        btnProcesar.Enabled = false;
                    }
                    else
                    {
                        lblMessageError.Text = result.Messages;
                    }
                    facturasController = null;
                }
                else
                {
                    lblMessageError.Text = "Ocurrio un problema al intentar recuerar la información de las partidas seleccionadas.";
                }
            }
            else
            {
                lblMessageError.Text = "Ocurrio un problema con la validación del archivo XML.";
            }
        }
        catch (Exception ex)
        {
            lblMessageError.Text = ex.Message;
        }
    }