Example #1
0
        /// <summary>
        /// Retorna un LISTA de registros de la Entidad Gestion.Cuota
        /// En la BASE de DATO la Tabla : [Gestion.Cuota]
        /// <summary>
        /// <returns>List</returns>
        public List <TipoPago> Listar()
        {
            List <TipoPago> lstTipoPago = new List <TipoPago>();

            try
            {
                using (DBMLPagosDataContext SQLDC = new DBMLPagosDataContext(conexion))
                {
                    var resul = SQLDC.dsd_mnt_S_TipoPago();

                    foreach (var item in resul)
                    {
                        TipoPago tipoPago = new TipoPago();
                        tipoPago.N_IdTipoPago  = item.N_IdTipoPago;
                        tipoPago.C_Descripcion = item.C_Descripcion;
                        tipoPago.B_Estado      = item.B_Estado;

                        lstTipoPago.Add(tipoPago);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstTipoPago);
        }
Example #2
0
        public IEnumerable <TipoPago> Retrieve(MySqlConnection cn, TipoPago Item)
        {
            List <TipoPago> listapago = null;

            cn = new MySqlConnection(msqlconnection);
            cn.Open();

            MySqlCommand cmd = new MySqlCommand
            {
                CommandText = "uspTipoPagoListar",
                CommandType = CommandType.StoredProcedure,
                Connection  = cn
            };

            using (MySqlDataReader dtr = cmd.ExecuteReader(CommandBehavior.SingleResult))
            {
                if (dtr != null)
                {
                    listapago = new List <TipoPago>();
                    while (dtr.Read())
                    {
                        listapago.Add(new TipoPago
                        {
                            idtipoPago = !dtr.IsDBNull(dtr.GetOrdinal("idtipoPago")) ? dtr.GetInt32(dtr.GetOrdinal("idtipoPago")) : 0,
                            tipoPago   = !dtr.IsDBNull(dtr.GetOrdinal("tipoPago")) ? dtr.GetString(dtr.GetOrdinal("tipoPago")) : ""
                        });
                    }
                }
            }
            return(listapago);
        }
Example #3
0
 protected void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         int idTipoPago = Convert.ToInt32(ViewState["IdTipoPago"].ToString());
         if (tPDAL.ValidateDependencies(idTipoPago))
         {
             TipoPago obj = tPDAL.Find(idTipoPago);
             obj.Estado = 0;
             tPDAL.Edit(obj);
             UserMessage("Este Tipo de Pago ya tiene otros registros asociados. Se ha cambiado el estado a inactivo", "warning");
         }
         else
         {
             tPDAL.Remove(idTipoPago);
             UserMessage("Tipo de Pago Eliminida", "succes");
         }
         GridView1.DataBind();
         Limpiar();
     }
     catch (Exception ex)
     {
         UserMessage(ex.Message, "succes");
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                this.validar();

                Double   cantidad = Convert.ToDouble(cantidadACargar.Value);
                TipoPago tipopago = (TipoPago)tipoPago.SelectedItem;


                if (tipopago.descripcion.ToLower().Equals("crédito"))
                {
                    Form alta = new CargaDeCredito.CargaTarjeta(tipopago.id, cantidad);
                    alta.Show();
                }
                if (tipopago.descripcion.ToLower().Equals("efectivo"))
                {
                    Credito credito = new Credito(null,
                                                  HoraSistema.get(), tipopago.id, cantidad, Session.UserSession.id,
                                                  "", HoraSistema.get(), "");

                    ConectorDB.FuncionesCargaCredito.cargaCredito(credito);
                }
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, ex.ParamName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        public TipoPago sucursalByCodigo(int code)
        {
            TipoPago cl  = null;
            Conexion con = new Conexion();

            try
            {
                string query = "SELECT * FROM tipo_pago WHERE cod_tipo_pago=@cod";
                cmd = new SqlCommand(query, con.getConex());
                cmd.Parameters.AddWithValue("@cod", code);
                con.Dr = cmd.ExecuteReader();
                while (con.Dr.Read())
                {
                    cl = new TipoPago();
                    cl.CodigoTipoPago = con.Dr.GetInt32(0);
                    cl.TipoPaga       = con.Dr.GetString(1);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e);
                cl = null;
            }
            finally
            {
                con.close();
            }
            return(cl);
        }
Example #6
0
        public async Task <IHttpActionResult> PostTipoPago(TipoPago tipoPago)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TipoPagoes.Add(tipoPago);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TipoPagoExists(tipoPago.Codigo))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tipoPago.Codigo }, tipoPago));
        }
Example #7
0
        public List <TipoPago> Listar()
        {
            AccesoDatos     datos = new AccesoDatos();
            List <TipoPago> Lista = new List <TipoPago>();

            datos.setearQuery("select Id, Nombre from TipoPagos");
            try
            {
                datos.ejecutarLector();
                datos.lector = datos.comando.ExecuteReader();
                while (datos.lector.Read())
                {
                    TipoPago aux = new TipoPago();
                    aux.Id     = (Byte)datos.lector["Id"];
                    aux.Nombre = (string)datos.lector["Nombre"];

                    Lista.Add(aux);
                }
                datos.lector.Close();
                datos.conexion.Close();
                return(Lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #8
0
        internal string ObtenerCodigoFormaPago(TipoPago tipoPago)
        {
            switch (tipoPago)
            {
            case TipoPago.Bonificacion:
                return("99");

            case TipoPago.Cheque:
                return("3");

            case TipoPago.Deposito:
                return("7");

            case TipoPago.Efectivo:
                return("8");

            case TipoPago.TarjetaCrédito:
                return("20");

            case TipoPago.TarjetaDébito:
                return("21");

            default:
                throw new InvalidOperationException($"Error al realizar la facturación. Tipo de forma de pago no reconocido {tipoPago.ToString()}");
            }
        }
Example #9
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (tipoPagoBox.SelectedItem.ToString())
            {
            case "Tarj. Credito":
            {
                panelTarjeta.Show();
                tipoPago = TipoPago.Credito;

                break;
            }

            case "Tarj. Debito":
            {
                panelTarjeta.Show();
                tipoPago = TipoPago.Debito;

                break;
            }

            case "Efectivo":
            {
                panelTarjeta.Hide();
                tipoPago = TipoPago.Efectivo;

                break;
            }
            }
        }
Example #10
0
        public async Task <IActionResult> Edit(int id, [Bind("TipoPagoId,NombreTipoPago")] TipoPago tipoPago)
        {
            if (id != tipoPago.TipoPagoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tipoPago);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TipoPagoExists(tipoPago.TipoPagoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipoPago));
        }
Example #11
0
        // PUT api/TipoPago/5
        public IHttpActionResult PutTipoPago(int Id, TipoPago tipopago)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (Id != tipopago.TipoPagoId)
            {
                return(BadRequest());
            }

            db.Entry(tipopago).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TipoPagoExists(Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #12
0
 public IActionResult SaveDepartamento([FromBody] TipoPago tipoPago)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (tipoPago.idTipoPago == 0)
             {
                 PosUoW.TipoPagoRepository.Add(tipoPago);
             }
             else
             {
                 PosUoW.TipoPagoRepository.Update(tipoPago);
             }
             PosUoW.Save();
             return(Ok(tipoPago));
         }
         else
         {
             return(BadRequest("Los datos del tipo de pago son incorrectos"));
         }
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex));
     }
 }
Example #13
0
        public Dictionary <Object, dynamic> insertPaymentMethodFromMaintenance()
        {
            if (String.IsNullOrEmpty(data["description"]))
            {
                return(result(Result.Failed, Result.Empty, null));
            }

            try
            {
                string oldContent, newContent;

                TipoPago paymentMethod = CreatePaymentMethod();
                oldContent = "";
                newContent = paymentMethod.toString();

                Bitacora paymentMethodLog = createLog(Log.Insert, Log.PaymentMethods, oldContent, newContent);

                db.TipoPago.Add(paymentMethod);
                db.Bitacora.Add(paymentMethodLog);
                db.SaveChanges();

                return(result(Result.Processed, Result.Inserted, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Se ha generado un error: " + ex.Message, null));
            }
        }
Example #14
0
        public List <TipoPago> allSucursales()
        {
            List <TipoPago> lstTipos = null;
            TipoPago        cl       = null;
            Conexion        con      = new Conexion();

            try
            {
                string query = "SELECT * FROM tipo_pago";
                cmd      = new SqlCommand(query, con.getConex());
                con.Dr   = cmd.ExecuteReader();
                lstTipos = new List <TipoPago>();
                while (con.Dr.Read())
                {
                    cl = new TipoPago();
                    cl.CodigoTipoPago = con.Dr.GetInt32(0);
                    cl.TipoPaga       = con.Dr.GetString(1);
                    lstTipos.Add(cl);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e);
                lstTipos = null;
            }
            finally
            {
                con.close();
            }
            return(lstTipos);
        }
Example #15
0
 public TipoPagoInsertResponse()
 {
     ResponseStatus         = new ResponseStatus();
     ResponseStatus.Message = "OK";
     Success  = false;
     TipoPago = new TipoPago();
 }
Example #16
0
        public TipoPago Buscar(int codTipoPago)
        {
            TipoPago tipoPago = new TipoPago();
            try
            {

                using (DBMLPagosDataContext SQLDC = new DBMLPagosDataContext(CadenaConexionSQL))
                {
                    var resul = SQLDC.dsd_mnt_S_TipoPagoId(codTipoPago);
                    foreach (var item in resul)
                    {
                        tipoPago =new TipoPago()
                        {
                            N_IdTipoPago = item.N_IdTipoPago,
                            C_Descripcion = item.C_Descripcion,
                            B_Estado = item.B_Estado
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return tipoPago;
        }
Example #17
0
        public void Remove(int id)
        {
            TipoPago p = Find(id);

            nowBDEntities.TipoPago.Remove(p);
            nowBDEntities.SaveChanges();
        }
Example #18
0
 public Venta()
 {
     Evaluacion      = new Evaluacion();
     LineaTelefonica = new LineaTelefonica();
     Contrato        = new Contrato();
     TipoPago        = new TipoPago();
 }
Example #19
0
        public TipoPago Add(TipoPago p)
        {
            TipoPago obj = nowBDEntities.TipoPago.Add(p);

            nowBDEntities.SaveChanges();
            return(obj);
        }
Example #20
0
        public Pago(TipoPago tipoPago, string tarjeta, int numeroCuotas, decimal porcentajeRecargo, int[] numeroOrdenCheques, CuentaBancaria cuentaBancaria, decimal monto, decimal montoRestante, decimal descuento, decimal cft, decimal iva, bool habilitado = true) : base(true)
        {
            if ((tipoPago == TipoPago.TarjetaCrédito || tipoPago == TipoPago.TarjetaDébito) && string.IsNullOrEmpty(tarjeta))
            {
                throw new NegocioException("Error al crear el pago. La trajeta no puede ser vacia.");
            }

            if (tipoPago == TipoPago.TarjetaCrédito && numeroCuotas == 0)
            {
                throw new NegocioException("Error al crear el pago. La cantidad de cuotas debe ser mayor a cero.");
            }

            TipoPago           = tipoPago;
            PorcentajeRecargo  = porcentajeRecargo;
            MontoPago          = new MontoPago(monto, descuento, cft, iva);
            Tarjeta            = tarjeta;
            NumeroCuotas       = numeroCuotas;
            NumeroOrdenCheques = numeroOrdenCheques;
            FechaEdicion       = DateTime.Now;
            MontoRestante      = montoRestante;
            Habilitado         = habilitado;

            if (tipoPago == TipoPago.Deposito)
            {
                IdCuentaBancaria = cuentaBancaria.Id;
                CuentaBancaria   = cuentaBancaria;
            }
        }
Example #21
0
    public static TipoPago ActualizarTipoPago(string nombre, string id)
    {
        TipoPagoBLL.Update(nombre, Convert.ToInt32(id));
        TipoPago objTipoPago = TipoPagoBLL.SelectById(Convert.ToInt32(id));

        return(objTipoPago);
    }
        private void modBtnSavePaymentChanges_Click(object sender, EventArgs e)
        {
            this.controller = new PaymentMethodController();
            Dictionary <string, dynamic> data = new Dictionary <string, dynamic>();

            TipoPago modifiedPaymentMethod = new TipoPago()
            {
                IdTipoPago    = registeredPaymentMethod.IdTipoPago,
                Descripcion   = txtDescription.Text.TrimStart().TrimEnd(),
                FechaAgrega   = registeredPaymentMethod.FechaAgrega,
                FechaElimina  = registeredPaymentMethod.FechaElimina,
                UsuarioAgrega = registeredPaymentMethod.UsuarioAgrega,
                Eliminado     = registeredPaymentMethod.Eliminado,
                IdEstado      = registeredPaymentMethod.IdEstado
            };


            data["user"]    = Session.getInstance().session["identification"];
            controller.data = data;

            Dictionary <Object, dynamic> result = controller.modifyPaymentMethod(registeredPaymentMethod, modifiedPaymentMethod);

            if (result["code"] == Result.Processed)
            {
                this.loadCombos();
            }

            MessageBox.Show(result["msg"]);
        }
Example #23
0
        private void cboTipoPago_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cboTipoPago.SelectedIndex)
            {
            case 0:
                btnInfoPago.Visible = false;
                t           = TipoPago.Efectivo;
                configurado = true;
                break;

            case 1:
                btnInfoPago.Visible = true;
                t           = TipoPago.Cheque;
                configurado = false;
                break;

            case 2:
                btnInfoPago.Visible = true;
                t           = TipoPago.Crédito;
                configurado = false;
                break;

            case 3:
                btnInfoPago.Visible = true;
                t           = TipoPago.Débito;
                configurado = false;
                break;

            case 4:
                btnInfoPago.Visible = true;
                t           = TipoPago.Transferencia;
                configurado = false;
                break;
            }
        }
Example #24
0
        public Dictionary <Object, dynamic> modifyPaymentMethod(TipoPago registeredPayment, TipoPago modifiedPayment)
        {
            if (String.IsNullOrEmpty(modifiedPayment.Descripcion))
            {
                return(result(Result.Failed, Result.Empty, null));
            }

            if (registeredPayment.Descripcion.Equals(modifiedPayment.Descripcion))
            {
                return(result(Result.Failed, Result.Same, null));
            }

            try
            {
                string oldContent = registeredPayment.toString();
                string newContent = modifiedPayment.toString();

                TipoPago newPayment = db.TipoPago.Find(modifiedPayment.IdTipoPago);
                db.Entry(newPayment).CurrentValues.SetValues(modifiedPayment);
                db.Entry(newPayment).State = System.Data.Entity.EntityState.Modified;

                Bitacora paymentLog = createLog(Log.Modify, Log.PaymentMethods, oldContent, newContent);
                db.Bitacora.Add(paymentLog);

                db.SaveChanges();

                return(result(Result.Processed, Result.Modified, null));
            }
            catch (Exception ex)
            {
                return(result(Result.Failed, "Error al modificar el registro: " + ex.Message, null));
            }
        }
Example #25
0
        public async Task <IHttpActionResult> PutTipoPago(int id, TipoPago tipoPago)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tipoPago.Codigo)
            {
                return(BadRequest());
            }

            db.Entry(tipoPago).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TipoPagoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #26
0
        public TipoPago Buscar(int codTipoPago)
        {
            TipoPago tipoPago = new TipoPago();

            try
            {
                using (DBMLPagosDataContext SQLDC = new DBMLPagosDataContext(conexion))
                {
                    var resul = SQLDC.dsd_mnt_S_TipoPagoId(codTipoPago);
                    foreach (var item in resul)
                    {
                        tipoPago = new TipoPago()
                        {
                            N_IdTipoPago  = item.N_IdTipoPago,
                            C_Descripcion = item.C_Descripcion,
                            B_Estado      = item.B_Estado
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(tipoPago);
        }
Example #27
0
        public void Edit(TipoPago p)
        {
            TipoPago tipoPago = nowBDEntities.TipoPago.FirstOrDefault(obj => obj.IdTipoPago == p.IdTipoPago);

            tipoPago.Descripcion = p.Descripcion;
            tipoPago.Estado      = p.Estado;
            nowBDEntities.SaveChanges();
        }
Example #28
0
 public InformeVentaPorTipoPago(TipoPago tipoPago, TipoCliente tipoCliente, int cantidadCuotas, decimal montoTotal, int cantidadTotal)
 {
     TipoPago       = tipoPago;
     TipoCliente    = tipoCliente;
     MontoTotal     = montoTotal;
     CantidadCuotas = cantidadCuotas;
     CantidadTotal  = cantidadTotal;
 }
Example #29
0
        public ActionResult DeleteConfirmed(int id)
        {
            TipoPago tipoPago = db.TipoPago.Find(id);

            db.TipoPago.Remove(tipoPago);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #30
0
        public async Task <TipoPago> savePayment(TipoPago tipoPago)
        {
            string   webApiUrl      = WebApiMethods.SavePayment;
            TipoPago tipoPagoResult = await App.
                                      HttpTools.HttpPostObjectWithResponseDataAsync <TipoPago, TipoPago>(webApiUrl, tipoPago, "Hubo un error en el guardado del metodo de pago").ConfigureAwait(false);

            return(tipoPagoResult);
        }
Example #31
0
        public ActionResult DeleteConfirmed(int id)
        {
            TipoPago tipoPago = _UnityOfWork.TipoPagos.Get(id);

            _UnityOfWork.TipoPagos.Remove(tipoPago);
            _UnityOfWork.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #32
0
        public void CrearTipoPago()
        {
            TipoPago tp = new TipoPago()
            {
                Descripcion = "Efectivo",
                Estado = TipoEstado.Activo
            };

            TipoPagoBusiness.Guardar(tp);
        }
Example #33
0
 public int Registrar(TipoPago tipoPago)
 {
     int? codigoRetorno = null;
     try
     {
         using (DBMLPagosDataContext SQLDC = new DBMLPagosDataContext(conexion))
         {
             SQLDC.dsd_mnt_I_TipoPago(ref codigoRetorno, tipoPago.C_Descripcion, tipoPago.B_Estado);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return codigoRetorno == null ? 0 : codigoRetorno.Value;
 }
        public TipoPago RegistrarTipoPago(string Descripcion)
        {
            TipoPago tipoPago = new TipoPago();
            tipoPago.B_Estado = true;
            tipoPago.C_Descripcion = Descripcion;

            return tipoPagoBL.Registrar(tipoPago);
        }
Example #35
0
 public Cuota()
 {
     objTipoPago = new TipoPago();
     objVivienda = new Vivienda();
 }
Example #36
0
        public void TipoPagoCrearTest()
        {
            SOAPagosService.PagosServiceClient proxy = new SOAPagosService.PagosServiceClient();
            TipoPago tipoPago = new TipoPago();
            string strDescripcion = "CONTADO";
            tipoPago = proxy.RegistrarTipoPago(strDescripcion);

            Assert.AreEqual(tipoPago.C_Descripcion, strDescripcion);
            /* */
        }
Example #37
0
        /// <summary>
        /// Retorna un LISTA de registros de la Entidad Gestion.Cuota
        /// En la BASE de DATO la Tabla : [Gestion.Cuota]
        /// <summary>
        /// <returns>List</returns>
        public List<TipoPago> Listar()
        {
            List<TipoPago> lstTipoPago = new List<TipoPago>();
            try
            {
                using (DBMLPagosDataContext SQLDC = new DBMLPagosDataContext(conexion))
                {
                    var resul = SQLDC.dsd_mnt_S_TipoPago();

                    foreach (var item in resul)
                    {
                        TipoPago tipoPago = new TipoPago();
                        tipoPago.N_IdTipoPago = item.N_IdTipoPago;
                        tipoPago.C_Descripcion = item.C_Descripcion;
                        tipoPago.B_Estado = item.B_Estado;

                        lstTipoPago.Add(tipoPago);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return lstTipoPago;
        }