コード例 #1
0
        private void buscarChequeres(List <ChequerasModel> objetos)
        {
            string[][] orden = new string[4][];

            orden[0] = new string[] { "Numero", "Numero de chequera", "100" };
            orden[1] = new string[] { "FechaRegistro", "Fecha Registro", "150" };
            orden[2] = new string[] { "Cantidad_cheques", "Cantidad de cheques", "150" };
            orden[3] = new string[] { "Estado", "Estado Chequera", "150" };

            if (objetos != null)
            {
                using (Ayuda.FormHelp2 formHelp1 = new Ayuda.FormHelp2())
                {
                    formHelp1.setList(objetos, orden);
                    formHelp1.ShowDialog();

                    if (formHelp1.EstaAceptado())
                    {
                        var dato = formHelp1.getObject <ChequerasModel>();
                        if (dato != null)
                        {
                            this.clearForm();
                            this.gChequera = this.BLChequeras.GetChequerasModel(dato.Numero);
                            this.chequera2gui(this.gChequera);
                            this.modoNuevo();
                            this.modoEdicion();
                        }
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Selects the Single object of ChequerasModel table.
        /// </summary>
        public ChequerasModel GetChequerasModel(int aNumero)
        {
            ChequerasModel ChequerasModel = null;

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

                    SqlCommand command = connection.CreateCommand();

                    command.Parameters.AddWithValue("@Numero", aNumero);


                    command.CommandType = CommandType.StoredProcedure;

                    command.CommandText = "ChequerasModelSelect";

                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int      Numero              = (int)(reader["Numero"]);
                            string   Estado              = (string)(reader["Estado"]);
                            DateTime?FechaRegistro       = reader["FechaRegistro"] as DateTime?;
                            byte     Inicio              = (byte)(reader["Inicio"]);
                            byte     Fin                 = (byte)(reader["Fin"]);
                            string   Id_Cuenta           = (string)(reader["Id_Cuenta"]);
                            DateTime?FECHA_MODIFICACION  = reader["FECHA_MODIFICACION"] as DateTime?;
                            string   USUARIO_CREADOR     = (string)(reader["USUARIO_CREADOR"]);
                            string   USUARIO_MODIFICADOR = (string)(reader["USUARIO_MODIFICADOR"]);
                            DateTime FECHA_CREACION      = (DateTime)(reader["FECHA_CREACION"]);

                            ChequerasModel = new ChequerasModel
                            {
                                Numero              = Numero,
                                Estado              = Estado,
                                Fecharegistro       = FechaRegistro,
                                Inicio              = Inicio,
                                Fin                 = Fin,
                                Id_cuenta           = Id_Cuenta,
                                Fecha_modificacion  = FECHA_MODIFICACION,
                                Usuario_creador     = USUARIO_CREADOR,
                                Usuario_modificador = USUARIO_MODIFICADOR,
                                Fecha_creacion      = FECHA_CREACION,
                            };
                        }
                    }
                }

                return(ChequerasModel);
            }
            catch (Exception)
            {
                return(null);
            }
        }
コード例 #3
0
        private void btnCodigo_Click(object sender, EventArgs e)
        {
            ChequerasModel        chequera  = new ChequerasModel();
            List <ChequerasModel> chequeras = BLChequeras.ChequerasSelectByNumeroDocumento(txtDNI.Text);

            if (chequeras == null && chequeras.Count <= 0)
            {
                return;
            }
            frmLista = new FrmListaDatos();
            frmLista.CrearLista <ChequerasModel>(chequeras);
            if (frmLista.ShowDialog() == DialogResult.OK)
            {
                string idChequera = frmLista.val1;
                this.clearForm();
                txtCodigo.Text = idChequera;
                try
                {
                    gChequera = BLChequeras.GetChequerasModel(Int32.Parse(idChequera));
                }
                catch (Exception)
                {
                    MessageBox.Show("No se selecciono ninguna chequera");
                    return;
                }

                this.chequera2gui(gChequera);
                this.modoEdicion();
                if (cboEstado.SelectedValue.ToString() == "EMITIDA")
                {
                    cboEstado.Enabled = false;
                }
            }
            ;
        }
コード例 #4
0
        private void buttonCrear_Click(object sender, EventArgs e)
        {
            if (!comprobarChequera())
            {
                return;
            }
            var                   objeto    = this.gui2chequera();
            ChequerasModel        chequera  = new ChequerasModel();
            List <ChequerasModel> chequeras = BLChequeras.ChequerasSelectByNumeroDocumento(txtDNI.Text);

            if (chequeras.Count != 0)
            {
                alert1.Show(Controles.MessageType.ERROR, "Esta Cuenta ya tiene una chequera emitida");
                return;
            }


            if (this.BLChequeras.Insert(objeto))
            {
                if (objeto.Estado == "EMITIDA")
                {
                    GenerarCheques(objeto.Fecharegistro);
                }
                this.clearForm();
                this.modoInicial();
                alert1.Show(Controles.MessageType.SUCCESSFUL, "Chequera creada con exito");
            }
        }
コード例 #5
0
        /// <summary>
        /// Saves a record to the chequera table.
        /// returns True if value saved successfully else false
        /// Throw exception with message value EXISTS if the data is duplicate
        /// </summary>
        public bool Insert(ChequerasModel achequera)
        {
            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    connection.Open();

                    SqlTransaction sqlTran = connection.BeginTransaction();

                    SqlCommand command = connection.CreateCommand();

                    command.Transaction = sqlTran;

                    // command.Parameters.AddWithValue("@Numero", achequera.Numero);
                    command.Parameters.AddWithValue("@Estado", achequera.Estado);
                    command.Parameters.AddWithValue("@FechaRegistro", achequera.Fecharegistro == null ? (object)DBNull.Value : achequera.Fecharegistro);
                    command.Parameters.AddWithValue("@Cantidad_cheques", achequera.Cantidad_cheques);
                    command.Parameters.AddWithValue("@Inicio", achequera.Inicio);
                    command.Parameters.AddWithValue("@Fin", achequera.Fin);
                    command.Parameters.AddWithValue("@Id_Cuenta", achequera.Id_cuenta == null ? (object)DBNull.Value : achequera.Id_cuenta);
                    command.Parameters.AddWithValue("@FECHA_MODIFICACION", achequera.Fecha_modificacion == null ? (object)DBNull.Value : achequera.Fecha_modificacion);
                    command.Parameters.AddWithValue("@USUARIO_CREADOR", achequera.Usuario_creador);
                    command.Parameters.AddWithValue("@USUARIO_MODIFICADOR", achequera.Usuario_modificador == null ? (object)DBNull.Value : achequera.Usuario_modificador);
                    command.Parameters.AddWithValue("@FECHA_CREACION", achequera.Fecha_creacion);


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

                    int afectados = command.ExecuteNonQuery();

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

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

                    if (afectados > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception)
            {
                throw;
                return(false);
            }
        }
コード例 #6
0
        private void chequera2gui(ChequerasModel achequera)
        {
            this.gCuenta = this.BLCuenta.Getcuenta(achequera.Id_cuenta);
            if (gCuenta == null)
            {
                return;
            }

            this.txtCodigo.Text                   = achequera.Numero.ToString();
            this.txtCuenta.Text                   = this.gCuenta.Nrocuenta.ToString();
            this.dtpFechaRegistro.Value           = (DateTime)achequera.Fecharegistro;
            this.cboCantidadCheques.SelectedValue = achequera.Cantidad_cheques;
            this.nudChequeInicial.Value           = achequera.Inicio;
            this.cboEstado.SelectedValue          = achequera.Estado;

            this.SlblUsuario_creador.Text     = achequera.Usuario_creador;
            this.SlblFecha_creacion.Text      = achequera.Fecha_creacion.ToLongDateString();
            this.SlblUsuario_modificador.Text = achequera.Usuario_modificador;
            this.SlblFecha_modificacion.Text  = achequera.Fecha_modificacion.ToString();
        }
コード例 #7
0
        public void GenerarCheques(DateTime?fecha)
        {
            ChequeModel           cheque    = new ChequeModel();
            ChequerasModel        chequera  = new ChequerasModel();
            List <ChequerasModel> chequeras = BLChequeras.chequeraSelectbyCuenta(txtCuenta.Text);//.Where(x => x.Fecharegistro == fecha).ToList();

            if (chequeras == null && chequeras.Count <= 0)
            {
                return;
            }
            var contador = chequeras.Count();

            chequera                   = chequeras[contador - 1];
            cheque.Idchequera          = chequera.Numero;
            cheque.Fechaemision        = chequera.Fecha_creacion;
            cheque.Fecha_creacion      = chequera.Fecha_creacion;
            cheque.Fecha_modificacion  = chequera.Fecha_modificacion;
            cheque.Usuario_creacion    = chequera.Usuario_creador;
            cheque.Usuario_modificador = chequera.Usuario_modificador;
            BLCheques.GenerarCheques(cheque, chequera.Cantidad_cheques);
        }
コード例 #8
0
 public bool Actualizar(ChequerasModel aChequerasModel)
 {
     return(this.chequerasManager.Update(aChequerasModel));
 }
コード例 #9
0
 public bool Ingresar(ChequerasModel aChequerasModel)
 {
     return(this.chequerasManager.Insert(aChequerasModel));
 }
コード例 #10
0
 public bool Update(ChequerasModel achequera)
 {
     return(this.managerChequera.Update(achequera));
 }
コード例 #11
0
        public bool Insert(ChequerasModel achequera)
        {
            achequera.Fin = achequera.Inicio + achequera.Cantidad_cheques - 1;

            return(this.managerChequera.Insert(achequera));
        }