Ejemplo n.º 1
0
        /// <summary>
        /// Selects the Single object of GiroModel table.
        /// </summary>
        public GiroModel GetGiroModel(int aID_GiroModel)
        {
            GiroModel GiroModel = null;

            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();

                    command.Parameters.AddWithValue("@ID_GiroModel", aID_GiroModel);


                    command.CommandType = CommandType.StoredProcedure;

                    command.CommandText = "GiroModelSelect";

                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int      ID_GiroModel             = (int)(reader["ID_GiroModel"]);
                            string   Nombre_GiroModel         = (string)(reader["Nombre_GiroModel"]);
                            string   Descripcion              = (string)(reader["Descripcion"]);
                            string   Nro_Cuenta               = (string)(reader["Nro_Cuenta"]);
                            decimal  Comisiones               = (decimal)(reader["Comisiones"]);
                            bool     GiroModel_Asume_Comision = (bool)(reader["GiroModel_Asume_Comision"]);
                            DateTime FECHA_CREACION           = (DateTime)(reader["FECHA_CREACION"]);
                            DateTime?FECHA_MODIFICACION       = reader["FECHA_MODIFICACION"] as DateTime?;
                            string   USUARIO_CREADOR          = (string)(reader["USUARIO_CREADOR"]);
                            string   USUARIO_MODIFICADOR      = (string)(reader["USUARIO_MODIFICADOR"]);

                            GiroModel = new GiroModel
                            {
                                Id = ID_GiroModel,
                                //Nombre_empresa = Nombre_GiroModel,
                                //Descripcion = Descripcion,
                                //Nro_cuenta = Nro_Cuenta,
                                //Comisiones = Comisiones,
                                //Empresa_asume_comision = GiroModel_Asume_Comision,
                                FECHA_CREACION      = FECHA_CREACION,
                                FECHA_MODIFICACION  = FECHA_MODIFICACION,
                                USUARIO_CREADOR     = USUARIO_CREADOR,
                                USUARIO_MODIFICADOR = USUARIO_MODIFICADOR,
                            };
                        }
                    }
                }

                return(GiroModel);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        private void BTProceder_Click(object sender, EventArgs e)
        {
            if (SetItem())
            {
                girosMethods = new GirosMethods();
                GiroModel   giro = new GiroModel();
                StatusStrip o    = this.TopLevelControl.Controls.Find("stStatus", true).FirstOrDefault() as StatusStrip;//o.Items[1].Text;
                giro.Monto             = monto;
                giro.Clave             = clave;
                giro.Id_PersonaOrigen  = Convert.ToInt32(dni1.TBDni.Text);
                giro.Id_PersonaDestino = Convert.ToInt32(dni2.TBDni.Text);
                giro.USUARIO_CREADOR   = o.Items[1].Text;
                giro.Moneda            = tipoMoneda1.CboMoneda.Text;

                if (girosMethods.EnviarGiro(giro))
                {
                    MessageBox.Show("Giro Enviado");
                    Recibo recibo = new Recibo();
                    recibo.Show();
                }
                else
                {
                    MessageBox.Show("No se pudo realizar giros");
                }
            }
        }
Ejemplo n.º 3
0
        private void BTProceder_Click(object sender, EventArgs e)
        {
            if (Session.Turno == null)
            {
                clayMessage1.Show(MessageType.WARNING, "Ud. no puede hacer operaciones porque no tiene turno o su turno esta inactivo");
                return;
            }
            if (!SetItem())
            {
                return;
            }

            using (GiroServiceClient _giroService = new GiroServiceClient())
            {
                var response = _giroService.EnviarGiro(giro);
                if (response[0].Equals("1"))
                {
                    MostrarRecibo();
                    SelectGirosXPromotor();
                    clayMessage1.Show(MessageType.SUCCESSFUL, response[1].ToString());
                    efectivoNetoEnvioGiros.obtenerEfectivo(Session);
                    this.LimpiarControles();
                    giro = null;
                }
                else
                {
                    clayMessage1.Show(MessageType.ERROR, response[1].ToString());
                }
            }
        }
Ejemplo n.º 4
0
        private void ShowListGiros(List <GiroModel> list)
        {
            var frmLista = new FrmListaDatos();

            frmLista.CrearListaCobroGiros(list);
            if (frmLista.ShowDialog() == DialogResult.OK)
            {
                giroModel = frmLista.giroSeleccionado;
            }
            this.SetValuesInUI();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Saves a record to the GiroModel table.
        /// returns True if value saved successfully else false
        /// Throw exception with message value EXISTS if the data is duplicate
        /// </summary>
        public bool Insert(GiroModel aGiroModel)
        {
            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    connection.Open();

                    SqlTransaction sqlTran = connection.BeginTransaction();

                    SqlCommand command = connection.CreateCommand();

                    command.Transaction = sqlTran;

                    command.Parameters.AddWithValue("Id", aGiroModel.Id);
                    command.Parameters.AddWithValue("Id_PersonaOrigen", aGiroModel.Id_PersonaOrigen);
                    command.Parameters.AddWithValue("Id_PersonaDestino", aGiroModel.Id_PersonaDestino);
                    command.Parameters.AddWithValue("Monto", aGiroModel.Monto);
                    command.Parameters.AddWithValue("Estado", aGiroModel.Estado);
                    command.Parameters.AddWithValue("Id_Movimiento", aGiroModel.Id_Movimiento);
                    command.Parameters.AddWithValue("FechaGiro", aGiroModel.FechaGiro);
                    command.Parameters.AddWithValue("FechaRetiro", aGiroModel.FechaRetiro);
                    command.Parameters.AddWithValue("USUARIO_CREADOR", aGiroModel.FECHA_CREACION);
                    command.Parameters.AddWithValue("FECHA_CREACION", aGiroModel.FECHA_CREACION);
                    command.Parameters.AddWithValue("Clave", aGiroModel.Clave);


                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "GiroModelInsert";

                    int afectados = command.ExecuteNonQuery();

                    // Commit the transaction.
                    sqlTran.Commit();

                    connection.Close();
                    connection.Dispose();

                    if (afectados > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        public bool EnviarGiro(GiroModel giro)
        {
            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    connection.Open();

                    SqlTransaction sqlTran = connection.BeginTransaction();

                    SqlCommand command = connection.CreateCommand();

                    command.Transaction = sqlTran;

                    command.Parameters.AddWithValue("@monto", giro.Monto);
                    command.Parameters.AddWithValue("@clave", giro.Clave);
                    command.Parameters.AddWithValue("@NroDocOrigen", giro.Id_PersonaOrigen);
                    command.Parameters.AddWithValue("@NroDocDestino", giro.Id_PersonaDestino);
                    command.Parameters.AddWithValue("@Usuario", giro.USUARIO_CREADOR);
                    command.Parameters.AddWithValue("@Moneda", giro.Moneda);
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "GiroInsert";

                    int afectados = command.ExecuteNonQuery();

                    // Commit the transaction.
                    sqlTran.Commit();

                    connection.Close();
                    connection.Dispose();

                    if (afectados > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception e)
            {
                string qa = e.Message.ToString();
                return(false);
            }
        }
Ejemplo n.º 7
0
        //GiroUpdateById
        public object[] CobrarGiro(GiroModel giro, int idTurUsuario)
        {
            try
            {
                List <GiroModel> giros = new List <GiroModel>();
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    SqlCommand command = new SqlCommand("GiroUpdateById", connection);

                    SqlParameter codGiro = new SqlParameter("@Codigo", giro.Id);
                    codGiro.Direction = ParameterDirection.Input;
                    SqlParameter usuModif = new SqlParameter("@Usuario_modificador", giro.Usuario_modificador);
                    usuModif.Direction = ParameterDirection.Input;
                    SqlParameter idTurUsu = new SqlParameter("@id_turno_usuario", idTurUsuario);
                    idTurUsu.Direction = ParameterDirection.Input;
                    SqlParameter doi = new SqlParameter("@doi", giro.Persona_destino.NroDocumento);
                    doi.Direction = ParameterDirection.Input;
                    SqlParameter sqlIdSalida = new SqlParameter("@id_mensaje", SqlDbType.Int);
                    sqlIdSalida.Direction = ParameterDirection.Output;
                    SqlParameter sqlMensaje = new SqlParameter("@mensaje", SqlDbType.VarChar, 400);
                    sqlMensaje.Direction = ParameterDirection.Output;

                    command.Parameters.Add(codGiro);
                    command.Parameters.Add(usuModif);
                    command.Parameters.Add(idTurUsu);
                    command.Parameters.Add(doi);
                    command.Parameters.Add(sqlIdSalida);
                    command.Parameters.Add(sqlMensaje);

                    connection.Open();
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "GiroUpdateById";

                    int    result     = command.ExecuteNonQuery();
                    string id_mensaje = command.Parameters["@id_mensaje"].Value.ToString();
                    string mensaje    = command.Parameters["@mensaje"].Value.ToString();
                    connection.Close();
                    connection.Dispose();
                    return(new object[] { id_mensaje, mensaje, giros });
                }
            }
            catch (Exception ex)
            {
                return(new object[] { "-1", ex.Message, null });;
            }
        }
Ejemplo n.º 8
0
        private void BTAceptar_Click(object sender, EventArgs e)
        {
            if (DGVlistaDatos.CurrentCell != null)
            {
                if (cuentasRetiro != null) //retiro
                {
                    int indiceTablaSeleccionado = DGVlistaDatos.CurrentCell.RowIndex;
                    cuentaSeleccionada = new CuentasPersona();
                    string nroCuenta = (string)DGVlistaDatos[0, indiceTablaSeleccionado].Value;
                    cuentaSeleccionada = cuentasRetiro.Where(x => x.NroCuenta == nroCuenta).FirstOrDefault();
                }

                if (cuentasCobroCheques != null) //cobro cheques
                {
                    int indiceTablaSeleccionado = DGVlistaDatos.CurrentCell.RowIndex;
                    cuentaSeleccionada = new CuentasPersona();
                    string nroCuenta = (string)DGVlistaDatos[0, indiceTablaSeleccionado].Value;
                    cuentaSeleccionada = cuentasCobroCheques.Where(x => x.NroCuenta == nroCuenta).FirstOrDefault();
                }



                if (girosXPersona != null)//cobro giro
                {
                    int indiceTablaSeleccionado = DGVlistaDatos.CurrentCell.RowIndex;
                    giroSeleccionado = new GiroModel();
                    int idGiro = (int)DGVlistaDatos[0, indiceTablaSeleccionado].Value;
                    giroSeleccionado = girosXPersona.Where(x => x.Id == idGiro).FirstOrDefault();
                }

                int i = DGVlistaDatos.CurrentCell.RowIndex;
                try
                {
                    val1 = DGVlistaDatos[0, i].Value.ToString();
                    val2 = DGVlistaDatos[1, i].Value.ToString();
                    val3 = DGVlistaDatos[2, i].Value.ToString();
                }
                catch (Exception)
                {
                }

                this.Close();
            }
        }
Ejemplo n.º 9
0
 private void BTProceder_Click(object sender, EventArgs e)
 {
     if (GVCobroGiros.Rows.Count > 0)
     {
         GirosMethods girosMethods = new GirosMethods();
         int          i            = GVCobroGiros.CurrentCell.RowIndex;
         GiroModel    giroModel    = new GiroModel();
         giroModel.Id = Convert.ToInt32(GVCobroGiros[0, i].Value);
         StatusStrip o = this.TopLevelControl.Controls.Find("stStatus", true).FirstOrDefault() as StatusStrip;
         giroModel.USUARIO_CREADOR  = o.Items[1].Text;
         giroModel.RowVer           = (byte[])GVCobroGiros[7, i].Value; // giroModel.
         giroModel.Id_PersonaOrigen = Convert.ToInt32(dni2.TBDni.Text);
         int executado = girosMethods.CobrarGiro(giroModel);
         if (executado > 0)
         {
             MessageBox.Show("Giro cobrado");
             Recibo recibo = new Recibo();
             recibo.Show();
         }
     }
 }
Ejemplo n.º 10
0
        public List <GiroModel> SelectTopGirosXPromotor(int idTurnoUsuario, string tipo_giro)
        {
            List <GiroModel> giros = new List <GiroModel>();

            using (var connection = Util.ConnectionFactory.conexion())
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();

                command.Parameters.AddWithValue("@id_turno_usuario", idTurnoUsuario);
                command.Parameters.AddWithValue("@tipo_giro", tipo_giro);

                command.CommandType = CommandType.StoredProcedure;

                command.CommandText = "SelectTopGirosXPromotor";

                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var new_giro = new GiroModel();
                        new_giro.Id = (int)reader["IdGiro"];
                        new_giro.Persona_origen.NroDocumento  = (string)reader["dni1"];
                        new_giro.Persona_origen.Cliente       = (string)reader["origen"];
                        new_giro.Persona_destino.NroDocumento = (string)reader["dni2"];
                        new_giro.Persona_destino.Cliente      = (string)reader["destino"];
                        new_giro.doi         = (string)reader["moneda"];//se guarda en doi mientras
                        new_giro.Monto       = (decimal)reader["monto"];
                        new_giro.FechaGiro   = (DateTime)reader["fechaGiro"];
                        new_giro.FechaRetiro = string.IsNullOrEmpty(reader["fechaRetiro"].ToString())?null: (DateTime?)reader["fechaRetiro"];
                        giros.Add(new_giro);
                    }
                }
                reader.Close();
            }
            return(giros);
        }
Ejemplo n.º 11
0
        public List <GiroModel> SelectGirosbyDocClave(string aValue, int clave)
        {
            List <GiroModel> giros = new List <GiroModel>();

            using (var connection = Util.ConnectionFactory.conexion())
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();

                command.Parameters.AddWithValue("@NroDocumento", aValue);
                command.Parameters.AddWithValue("@Clave", clave);

                command.CommandType = CommandType.StoredProcedure;

                command.CommandText = "GiroPersonaSelectByDocClave";

                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var giro = new GiroModel();
                        giro.Id = Convert.ToInt32(reader["IdGiro"].ToString());
                        giro.Persona_destino.NroDocumento = reader["DniDestino"].ToString();
                        giro.Persona_destino.Cliente      = reader["NombresDestino"].ToString();
                        giro.Persona_origen.NroDocumento  = reader["DniOrigen"].ToString();
                        giro.Persona_origen.Cliente       = reader["NombresOrigen"].ToString();
                        giro.TipoMoneda.Id     = Convert.ToInt32(reader["IdMoneda"].ToString());
                        giro.TipoMoneda.Nombre = reader["DescripcionMoneda"].ToString();
                        giro.Monto             = Convert.ToDecimal(reader["MontoGiro"].ToString());
                        giro.FechaGiro         = Convert.ToDateTime(reader["FechaGiro"].ToString());
                        giros.Add(giro);
                    }
                }
            }
            return(giros);
        }
Ejemplo n.º 12
0
        private void RealizarCobroGiro()
        {
            using (GiroServiceClient giroService = new GiroServiceClient())
            {
                GirosMethods girosMethods = new GirosMethods();
                var          response     = girosMethods.CobrarGiro(giroModel, Session.Turno.IdTurUsu);
                //var response = giroService.CobrarGiro(giroModel, Session.Turno.IdTurUsu);
                if (response[0].Equals("1"))
                {
                    SelectGirosXPromotor();
                    clayMessage.Show(MessageType.SUCCESSFUL, response[1].ToString());
                    MostrarRecibo();
                    efectivoNetoCobroGiros.obtenerEfectivo(Session);

                    this.ClearControls();
                    giroModel = null;
                }
                else
                {
                    clayMessage.Show(MessageType.ERROR, response[1].ToString());
                }
            }
        }
Ejemplo n.º 13
0
        //GiroUpdateById
        public int CobrarGiro(GiroModel giro)
        {
            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    connection.Open();

                    SqlTransaction sqlTran = connection.BeginTransaction();

                    SqlCommand command = connection.CreateCommand();

                    command.Transaction = sqlTran;

                    command.Parameters.AddWithValue("@Codigo", giro.Id);
                    command.Parameters.AddWithValue("@Usuario", giro.USUARIO_CREADOR);
                    command.Parameters.AddWithValue("@doi", giro.Id_PersonaOrigen);
                    command.Parameters.AddWithValue("@RowVersion", giro.RowVer);
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "GiroUpdateById";

                    int result = command.ExecuteNonQuery();

                    // Commit the transaction.
                    sqlTran.Commit();

                    connection.Close();
                    connection.Dispose();
                    return(result);
                }
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Ejemplo n.º 14
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Session.Turno == null)
            {
                clayMessage.Show(MessageType.WARNING, "Ud. no puede hacer operaciones porque no tiene turno o su turno esta inactivo");
                return;
            }
            if (!ValidarDNIyClave())
            {
                return;
            }
            using (GiroServiceClient giroService = new GiroServiceClient())
            {
                giros = giroService.SelectGirosbyDocClave(txtDniDestino.Text, Convert.ToInt32(clave1.Text)).ToList();
            }
            if (giros.Count > 1)
            {
                this.ShowListGiros(giros);
            }
            else
            {
                if (giros.Count == 0)
                {
                    clayMessage.Show(MessageType.WARNING, "DNI/Clave incorrectas o la persona no tiene giros");
                    txtMonto.Text = string.Empty;

                    txtDniOrigen.Text     = string.Empty;
                    txtNombresOrigen.Text = string.Empty;
                    tipoMoneda1.SetTipoMoneda(0);
                    return;
                }
                dniDestino = txtDniDestino.Text;
                giroModel  = giros[0];
                this.SetValuesInUI();
            }
        }
Ejemplo n.º 15
0
        private bool SetItem()
        {
            try
            {
                //validacion de  remitente
                if (string.IsNullOrEmpty(dni1.TbNombre.Text.Trim()))
                {
                    Error.SetError(dni1.TbNombre, "El campo no puede estar vacío");
                    return(false);
                }
                else
                {
                    Error.SetError(dni1.TbNombre, "");
                }
                if (string.IsNullOrEmpty(dni1.TBDni.Text.Trim()))
                {
                    Error.SetError(dni1.TBDni, "El campo no puede estar vacío");
                    return(false);
                }
                else
                {
                    Error.SetError(dni1.TBDni, "");
                }
                if (dni1.TbNombre.Text.Trim().Length < 7)
                {
                    Error.SetError(dni1.TbNombre, "El campo no puede ser menor a 7 carácteres");
                    return(false);
                }
                else
                {
                    Error.SetError(dni1.TbNombre, "");
                }
                if (dni1.TBDni.Text.Length != 8 && dni1.TBDni.Text.Length != 11)
                {
                    Error.SetError(dni1.TBDni, "El campo permite 8 ó 11 carácteres númericos");
                    return(false);
                }
                else
                {
                    Error.SetError(dni1.TBDni, "");
                }
                //validacion de beneficiario
                if (string.IsNullOrEmpty(dni2.TbNombre.Text.Trim()))
                {
                    Error.SetError(dni2.TbNombre, "El campo no puede estar vacío");
                    return(false);
                }
                else
                {
                    Error.SetError(dni2.TbNombre, "");
                }
                if (string.IsNullOrEmpty(dni2.TBDni.Text.Trim()))
                {
                    Error.SetError(dni2.TBDni, "El campo no puede estar vacío");
                    return(false);
                }
                else
                {
                    Error.SetError(dni2.TBDni, "");
                }
                if (dni2.TbNombre.Text.Trim().Length < 7)
                {
                    Error.SetError(dni2.TbNombre, "El campo no puede ser menor a 7 carácteres");
                    return(false);
                }
                else
                {
                    Error.SetError(dni2.TbNombre, "");
                }
                if (dni2.TBDni.Text.Length != 8 && dni2.TBDni.Text.Length != 11)
                {
                    Error.SetError(dni2.TBDni, "El campo permite 8 ó 11 carácteres númericos");
                    return(false);
                }
                else
                {
                    Error.SetError(dni2.TBDni, "");
                }
                //------------
                if (string.IsNullOrEmpty(monto1.TBMonto.Text.Trim()))
                {
                    Error.SetError(monto1, "El campo no puede estar vacío");
                    return(false);
                }
                else
                {
                    Error.SetError(monto1, "");
                }
                if (string.IsNullOrEmpty(txtClave.Text.Trim()))
                {
                    Error.SetError(txtClave, "El campo no puede estar vacío");
                    return(false);
                }
                else
                {
                    Error.SetError(txtClave, "");
                }
                if (Convert.ToDecimal(monto1.TBMonto.Text) == 0)
                {
                    Error.SetError(monto1, "El monto debe ser menor a 0");
                    return(false);
                }
                else
                {
                    Error.SetError(monto1, "");
                }

                if (txtClave.Text.Length != 4)
                {
                    Error.SetError(txtClave, "La clave debe ser de 4 dígitos");
                    return(false);
                }
                else
                {
                    Error.SetError(txtClave, "");
                }


                giro       = new GiroModel();
                giro.Monto = Convert.ToDecimal(monto1.TBMonto.Text);
                giro.Clave = Convert.ToInt32(txtClave.Text);

                giro.Persona_origen.Id           = dni1.Id;
                giro.Persona_origen.NroDocumento = dni1.TBDni.Text;
                giro.Persona_origen.Cliente      = dni1.TbNombre.Text;

                giro.Persona_destino.Id           = dni2.Id;
                giro.Persona_destino.NroDocumento = dni2.TBDni.Text;
                giro.Persona_destino.Cliente      = dni2.TbNombre.Text;

                giro.Usuario_creador  = Session.UserName;
                giro.Moneda           = tipoMoneda1.IdMoneda;
                giro.Id_turno_usuario = Session.Turno.IdTurUsu;
                giro.doi = dni1.TBDni.Text;

                if (giro.Moneda == 0)
                {
                    simboloMoneda = "S/";
                    monedaLetras  = "Soles";
                }

                else if (giro.Moneda == 1)
                {
                    simboloMoneda = "$";
                    monedaLetras  = "Dólares";
                }
                montoLetras = ConvertirALetras(monto1.TBMonto.Text).ToUpper();

                return(true);
            }
            catch (Exception e)
            {
                clayMessage1.Show(MessageType.ERROR, "Error en la validación de información");
                return(false);
            }
        }
Ejemplo n.º 16
0
 public string[] EnviarGiro(GiroModel giro)
 {
     return(ADGirosPersonaManager.EnviarGiro(giro));
 }
Ejemplo n.º 17
0
 public object[] CobrarGiro(GiroModel giro, int idTurnoUsu) => ADGirosPersonaManager.CobrarGiro(giro, idTurnoUsu);
Ejemplo n.º 18
0
 public int CobrarGiro(GiroModel giro) => ADGirosPersonaManager.CobrarGiro(giro);
Ejemplo n.º 19
0
 public bool EnviarGiro(GiroModel giro)
 {
     return(ADGirosPersonaManager.EnviarGiro(giro));
 }
Ejemplo n.º 20
0
 public bool Editar(GiroModel aEmpresaModel)
 {
     return(ADGirosPersonaManager.Update(aEmpresaModel));
 }
Ejemplo n.º 21
0
 public bool Crear(GiroModel aEmpresaModel)
 {
     return(ADGirosPersonaManager.Insert(aEmpresaModel));
 }
Ejemplo n.º 22
0
 public string[] EnviarGiro(GiroModel giro)
 {
     return(BLGiros.EnviarGiro(giro));
 }
Ejemplo n.º 23
0
 public object[] CobrarGiro(GiroModel giro, int idTurnoUsu)
 {
     return(BLGiros.CobrarGiro(giro, idTurnoUsu));
 }
Ejemplo n.º 24
0
        public string[] EnviarGiro(GiroModel giro)
        {
            string[] response = null;
            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    //connection.Open();

                    //SqlCommand command = connection.CreateCommand();
                    SqlCommand command = new SqlCommand("GiroInsert", connection);

                    SqlParameter sqlMoneda = new SqlParameter("@id_moneda", giro.Moneda);
                    sqlMoneda.Direction = ParameterDirection.Input;
                    SqlParameter sqlIdTurnoUsu = new SqlParameter("@id_turno_usuario", giro.Id_turno_usuario);
                    sqlIdTurnoUsu.Direction = ParameterDirection.Input;
                    SqlParameter sqlMonto = new SqlParameter("@monto_giro", giro.Monto);
                    sqlMonto.Direction = ParameterDirection.Input;
                    SqlParameter sqlDoi = new SqlParameter("@doi", giro.doi);
                    sqlDoi.Direction = ParameterDirection.Input;
                    //persona origen
                    SqlParameter sqlIdPerOrigen = new SqlParameter("@id_persona_origen", giro.Persona_origen.Id);
                    sqlIdPerOrigen.Direction = ParameterDirection.Input;
                    SqlParameter sqlNroDocPerOrigen = new SqlParameter("@nro_doc_origen", giro.Persona_origen.NroDocumento);
                    sqlNroDocPerOrigen.Direction = ParameterDirection.Input;
                    SqlParameter sqlNombresPerOrigen = new SqlParameter("@nombres_origen", giro.Persona_origen.Cliente);
                    sqlNombresPerOrigen.Direction = ParameterDirection.Input;
                    //persona destino
                    SqlParameter sqlIdPerDestino = new SqlParameter("@id_persona_destino", giro.Persona_destino.Id);
                    sqlIdPerDestino.Direction = ParameterDirection.Input;
                    SqlParameter sqlNroDocPerDestino = new SqlParameter("@nro_doc_destino", giro.Persona_destino.NroDocumento);
                    sqlNroDocPerDestino.Direction = ParameterDirection.Input;
                    SqlParameter sqlNombresPerDestino = new SqlParameter("@nombres_destino", giro.Persona_destino.Cliente);
                    sqlNombresPerDestino.Direction = ParameterDirection.Input;

                    SqlParameter sqlClave = new SqlParameter("@clave_giro", giro.Clave);
                    sqlClave.Direction = ParameterDirection.Input;
                    SqlParameter sqlUsuCreador = new SqlParameter("@usuario_creador", giro.Usuario_creador);
                    sqlUsuCreador.Direction = ParameterDirection.Input;
                    SqlParameter sqlIdSalida = new SqlParameter("@id_mensaje", SqlDbType.Int);
                    sqlIdSalida.Direction = ParameterDirection.Output;
                    SqlParameter sqlMensaje = new SqlParameter("@mensaje", SqlDbType.VarChar, 400);
                    sqlMensaje.Direction = ParameterDirection.Output;

                    command.Parameters.Add(sqlMoneda);
                    command.Parameters.Add(sqlIdTurnoUsu);
                    command.Parameters.Add(sqlMonto);
                    command.Parameters.Add(sqlDoi);
                    command.Parameters.Add(sqlIdPerOrigen);
                    command.Parameters.Add(sqlIdPerDestino);
                    command.Parameters.Add(sqlClave);
                    command.Parameters.Add(sqlUsuCreador);
                    command.Parameters.Add(sqlIdSalida);
                    command.Parameters.Add(sqlMensaje);

                    command.Parameters.Add(sqlNroDocPerOrigen);
                    command.Parameters.Add(sqlNombresPerOrigen);
                    command.Parameters.Add(sqlNroDocPerDestino);
                    command.Parameters.Add(sqlNombresPerDestino);

                    connection.Open();
                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "GiroInsert";

                    int    cantidadRegistros = command.ExecuteNonQuery();
                    string id_mensaje        = command.Parameters["@id_mensaje"].Value.ToString();
                    string mensaje           = command.Parameters["@mensaje"].Value.ToString();
                    // Commit the transaction.
                    connection.Close();
                    connection.Dispose();

                    response = new string[] { id_mensaje, mensaje };
                }
            }
            catch (Exception e)
            {
                response = new string[] { "-1", e.Message };
            }
            return(response);
        }