Beispiel #1
0
        }// end of function

        public ChequeModel SavedDatatoDatabase(ChequeModel _check, string _batch, DateTime _deliveryDate)
        {
            string sql = "INSERT INTO " + databaseName + ".banko_nuestra(Date,Time,DeliveryDate,ChkType,ChequeName,BRSTN,AccountNo,Name1,Name2,Address1,Address2,Address3,Address4,Address5,Address6,Batch,StartingSerial, EndingSerial)VALUES(" +

                         "'" + DateTime.Now.ToString("yyyy-MM-dd") + "'," +
                         "'" + DateTime.Now.ToString("HH:mm:ss") + "'," +
                         "'" + _deliveryDate.ToString("yyyy-MM-dd") + "'," +
                         "'" + _check.ChequeType + "'," +
                         "'" + _check.ChequeName + "'," +
                         "'" + _check.BRSTN + "'," +
                         "'" + _check.AccountNo + "'," +
                         "'" + _check.Name1 + "'," +
                         "'" + _check.Name2 + "'," +
                         "'" + _check.Address1 + "'," +
                         "'" + _check.Address2 + "'," +
                         "'" + _check.Address3 + "'," +
                         "'" + _check.Address4 + "'," +
                         "'" + _check.Address5 + "'," +
                         "'" + _check.Address6 + "'," +
                         "'" + _batch + "'," +
                         "'" + _check.StartingSerial + "'," +
                         "'" + _check.EndingSerial + "')";



            DBConnect();
            MySqlCommand myCommand = new MySqlCommand(sql, myConnect);

            myCommand.ExecuteNonQuery();
            DBClosed();
            return(_check);
        }// end of function
Beispiel #2
0
        }// end of function

        public ChequeModel SaveToTempTable(ChequeModel _check)
        {
            string sql = "INSERT INTO " + databaseName + ".banko_nuestra_temp (BRSTN,AccountNumber,CheckType,ChequeTypeName,Name1,Name2,Quantity,BranchName,Address2, Address3, Address4, StartingSerial, EndingSerial,PcsPerBook)VALUES(" +
                         "'" + _check.BRSTN + "'," +
                         "'" + _check.AccountNo + "'," +
                         "'" + _check.ChequeType + "'," +
                         "'" + _check.ChequeName + "'," +
                         "'" + _check.Name1 + "'," +
                         "'" + _check.Name2 + "'," +
                         "'" + _check.Quantity + "'," +
                         "'" + _check.Address1 + "'," +
                         "'" + _check.Address2 + "'," +
                         "'" + _check.Address3 + "'," +
                         "'" + _check.Address4 + "'," +
                         "'" + _check.StartingSerial + "'," +
                         "'" + _check.EndingSerial + "'," +
                         "'" + _check.PcsPerBook + "')";



            DBConnect();
            MySqlCommand myCommand = new MySqlCommand(sql, myConnect);

            myCommand.ExecuteNonQuery();
            DBClosed();
            return(_check);
        }// end of function
Beispiel #3
0
        public ActionResult <string> Get(string input)
        {
            var    cheque = new ChequeModel();
            double n;

            if (!double.TryParse(input, out n))
            {
                cheque.Error = Constants.Errors.NumberInputError;
                return(new JsonResult(cheque));
            }
            ;

            if (n == 0)
            {
                cheque.Error = Constants.Errors.ZeroInputError;
                return(new JsonResult(cheque));
            }

            if (n < 0)
            {
                cheque.Error = Constants.Errors.NegitiveNumberError;
                return(new JsonResult(cheque));
            }

            if (n > 9999999999999)
            {
                cheque.Error = Constants.Errors.Over999TrillionError;
                return(new JsonResult(cheque));
            }


            cheque.Cheque = ChequeConverter.ConvertInputToNumberWords(n);
            return(new JsonResult(cheque));
        }
        public string CobroInsert(ChequeModel aChequesModel, string NroCuenta)
        {
            string afectados = "";

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

                    SqlTransaction sqlTran = connection.BeginTransaction();

                    SqlCommand command = connection.CreateCommand();

                    command.Transaction = sqlTran;

                    command.Parameters.AddWithValue("@Numero", aChequesModel.Numero);
                    command.Parameters.AddWithValue("@Monto", aChequesModel.Monto);
                    command.Parameters.AddWithValue("@cuentaReceptora", NroCuenta);
                    command.Parameters.AddWithValue("@Usuario", aChequesModel.Usuario_creacion);
                    command.Parameters.AddWithValue("@DNI", aChequesModel.DOI);

                    command.Parameters.AddWithValue("@RowVerCOrigen", aChequesModel.RowVerCOrigen);
                    command.Parameters.AddWithValue("@RowVerChequera", aChequesModel.RowVerChequera);
                    command.Parameters.AddWithValue("@RowVerCheque", aChequesModel.RowVerCheque);
                    command.Parameters.AddWithValue("@RowverCDestino", aChequesModel.RowverCDestino);


                    command.CommandType = CommandType.StoredProcedure;
                    command.CommandText = "cobroChequesInsert";
                    // command.ExecuteNonQuery();
                    //  afectados = command.ExecuteScalar() == null ? -1 : (int)command.ExecuteScalar();

                    object a = command.ExecuteScalar();
                    if (a != null)
                    {
                        afectados = (string)a;
                    }
                    else
                    {
                        afectados = "Cobrado";
                    }
                    //  afectados = command.ExecuteNonQuery().ExecuteScalar().ToString();

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

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


                    return(afectados);
                }
            }
            catch (Exception e)
            {
                return(e.Message.ToString());
            }
        }
Beispiel #5
0
        }// end of function

        public ChequeModel UpdateTemp(ChequeModel _cheque, Int64 _startingSerial, Int64 _endingSerial, string _accountNo)
        {
            DBConnect();
            string          sql      = "Update " + databaseName + ".banko_nuestra_temp Set StartingSerial = '" + _startingSerial + "' , EndingSerial = '" + _endingSerial + "' where AccountNumber = '" + _accountNo + "'";
            MySqlCommand    cmd      = new MySqlCommand(sql, myConnect);
            MySqlDataReader myReader = cmd.ExecuteReader();

            DBClosed();
            return(_cheque);
        }
 public ActionResult DeleteCheque(ChequeModel model)
 {
     if (ModelState.IsValid)
     {
         MasterDetails    _details = new MasterDetails();
         Enums.CrudStatus status   = _details.SetCheque(model, Enums.CrudType.Delete);
         ReturnAlertMessage(status);
     }
     return(RedirectToAction("GetCheque"));
 }
Beispiel #7
0
        public ActionResult Submit(ChequeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Index());
            }

            var vm = model.MapToViewModel();

            return(View(vm));
        }
        /// <summary>
        /// Updates a record to the ChequesModel table.
        /// returns True if value saved successfully else false
        /// Throw exception with message value EXISTS if the data is duplicate
        /// </summary>
        public bool Update(ChequeModel aChequesModel)
        {
            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    connection.Open();

                    SqlTransaction sqlTran = connection.BeginTransaction();

                    SqlCommand command = connection.CreateCommand();

                    command.Transaction = sqlTran;

                    command.Parameters.AddWithValue("@Numero", aChequesModel.Numero);
                    command.Parameters.AddWithValue("@FechaEmision", aChequesModel.Fechaemision);
                    command.Parameters.AddWithValue("@FechaCobro", aChequesModel.Fechacobro == null ? (object)DBNull.Value : aChequesModel.Fechacobro);
                    command.Parameters.AddWithValue("@Destinatario", aChequesModel.Destinatario);
                    command.Parameters.AddWithValue("@Monto", aChequesModel.Monto);
                    // command.Parameters.AddWithValue("@IDChequesModelra", aChequesModel.IdChequesModelra);
                    command.Parameters.AddWithValue("@Estado", aChequesModel.Estado);
                    command.Parameters.AddWithValue("@FECHA_CREACION", aChequesModel.Fecha_creacion);
                    command.Parameters.AddWithValue("@FECHA_MODIFICACION", aChequesModel.Fecha_modificacion == null ? (object)DBNull.Value : aChequesModel.Fecha_modificacion);
                    command.Parameters.AddWithValue("@USUARIO_CREACION", aChequesModel.Usuario_creacion);
                    command.Parameters.AddWithValue("@USUARIO_MODIFICADOR", aChequesModel.Usuario_modificador == null ? (object)DBNull.Value : aChequesModel.Usuario_modificador);


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

                    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);
            }
        }
Beispiel #9
0
        public ChequeModel ValidarCheque(int nroCheque, string nroCuenta)
        {
            ChequeModel ChequeModel = null;

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

                    SqlCommand command = connection.CreateCommand();

                    command.Parameters.AddWithValue("@NroCheque", nroCheque);
                    command.Parameters.AddWithValue("@NroCuenta", nroCuenta);


                    command.CommandType = CommandType.StoredProcedure;

                    command.CommandText = "ValidarCheque";

                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            string NombreLibrador = (string)(reader["Nombres"]);
                            string NroCuenta      = (string)(reader["NroCuenta"]);
                            int    TipoMoneda     = (int)(reader["TipoMoneda"]);
                            bool   EstadoCuenta   = (bool)(reader["EstadoCuenta"]);
                            string EstadoCheque   = (string)(reader["EstadoCheque"]);


                            ChequeModel = new ChequeModel
                            {
                                NombreLibrador = NombreLibrador,
                                NroCuenta      = NroCuenta,
                                TipoMoneda     = TipoMoneda,
                                EstadoCuenta   = EstadoCuenta,
                                Estado         = EstadoCheque
                            };
                        }
                    }
                }

                return(ChequeModel);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Beispiel #10
0
        public void MapToViewModel_WithValidModel_ReturnsChequeViewModel()
        {
            var cm = new ChequeModel
            {
                PayeeName    = "John Doe",
                DollarAmount = 1234.56,
                IssueDate    = DateTime.Now
            };

            var vm = MappingExtensions.MapToViewModel(cm);

            vm.Should().NotBeNull();
        }
Beispiel #11
0
 public ActionResult ChequeView(ChequeModel cheque)
 {
     try
     {
         ChequeDAO Insert = new ChequeDAO();
         Insert.Salvar(cheque);
         return(View());
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", $"{ex}");
         return(View());
     }
 }
        public bool GenerarCheques(ChequeModel aChequesModel, int Cantidad)
        {
            try
            {
                using (var connection = Util.ConnectionFactory.conexion())
                {
                    connection.Open();

                    SqlTransaction sqlTran = connection.BeginTransaction();

                    SqlCommand command = connection.CreateCommand();

                    command.Transaction = sqlTran;

                    command.Parameters.AddWithValue("@IDChequera", aChequesModel.Idchequera);
                    command.Parameters.AddWithValue("@CantidadCheques", Cantidad);
                    command.Parameters.AddWithValue("@FechaEmision", aChequesModel.Fechaemision);
                    command.Parameters.AddWithValue("@FECHA_CREACION", aChequesModel.Fecha_creacion);
                    command.Parameters.AddWithValue("@FECHA_MODIFICACION", aChequesModel.Fecha_modificacion == null ? (object)DBNull.Value : aChequesModel.Fecha_modificacion);
                    command.Parameters.AddWithValue("@USUARIO_CREACION", aChequesModel.Usuario_creacion);
                    command.Parameters.AddWithValue("@USUARIO_MODIFICADOR", aChequesModel.Usuario_modificador == null ? (object)DBNull.Value : aChequesModel.Usuario_modificador);


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

                    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);
            }
        }
Beispiel #13
0
        public static ChequeViewModel MapToViewModel(this ChequeModel source)
        {
            if (source == null)
            {
                return(null);
            }

            return(new ChequeViewModel
            {
                PayeeName = source.PayeeName,
                DollarAmountInCurrency = $"${source.DollarAmount.ToString("N")}",
                DollarAmountInWords = source.DollarAmount.ToEnglishWords(),
                IssueDate = source.IssueDate.ToString("dd/MM/yyyy")
            });
        }
 public ActionResult Agregar(ChequeModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (CPMEntities datos = new CPMEntities())
             {
                 datos.sp_AgregarCheque((int)Session["User"], model.IdCuenta, model.Idproveedor, model.Valor);
             }
             return(Redirect("~/Cheque/"));
         }
         return(View(model));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #15
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);
        }
Beispiel #16
0
        private void BTProceder_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TBNroCheque.Text.Trim()))
            {
                return;
            }
            if (string.IsNullOrEmpty(monto1.TBMonto.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(dni2.TBDni.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(nroCuenta1.TBNroCuenta.Text))
            {
                return;
            }

            CobroChequeMethods cobroCheque = new CobroChequeMethods();
            ChequeModel        cheque      = new ChequeModel();
            StatusStrip        o           = this.TopLevelControl.Controls.Find("stStatus", true).FirstOrDefault() as StatusStrip;

            cheque.Numero           = Convert.ToInt32(TBNroCheque.Text);
            cheque.Monto            = Convert.ToInt32(monto1.TBMonto.Text);
            cheque.Usuario_creacion = o.Items[1].Text;
            cheque.DOI            = dni2.TBDni.Text;
            cheque.RowverCDestino = nroCuenta1.VersionCuenta;
            cheque.RowVerCOrigen  = Versiones.Version3;
            cheque.RowVerCheque   = Versiones.Version1;
            cheque.RowVerChequera = Versiones.Version2;
            string result = cobroCheque.CobroInsert(cheque, nroCuenta1.TBNroCuenta.Text);

            MessageBox.Show(result);
            if (result.Equals("Cobrado"))
            {
                Recibo recibo = new Recibo();
                recibo.Show();
            }
        }
Beispiel #17
0
        public IHttpActionResult Post([FromBody] ChequeModel model)
        {
            if (ModelState.IsValid) // Make sure the model state is valid
            {
                decimal amount = decimal.Parse(model.Amount);

                // Get the printed text of the cheque amount
                string printedAmount = _printer.PrintChequeAmount(amount);

                ChequePrintModel result = new ChequePrintModel()
                {
                    Name          = model.Name,
                    PrintedAmount = printedAmount
                };

                return(Ok(result));
            }
            else
            {
                return(BadRequest());
            }
        }
Beispiel #18
0
        public async Task <IActionResult> CloseCheque([FromBody] ChequeModel model)
        {
            var order = await _context.Orders.Include(o => o.Table).FirstOrDefaultAsync(o => o.Id == model.OrderId);

            if (order == null)
            {
                return(NotFound(new { status = "error", message = "Order was not found" }));
            }
            if (GetUserId() != order.UserId)
            {
                return(BadRequest(new { staus = "error", message = "You can only close own orders" }));
            }
            if (order.OrderStatus == OrderStatus.Active || order.OrderStatus == OrderStatus.MealCooked || order.OrderStatus == OrderStatus.BarCooked)
            {
                var mealOrders = _context.MealOrders.Where(mo => mo.OrderId == model.OrderId).Select(mo => new
                {
                    meal     = mo.Meal,
                    quantity = mo.FinishedQuantity
                });
                decimal sum = 0;
                foreach (var item in mealOrders)
                {
                    var itemPrice      = item.meal.Price;
                    var itemQuantity   = item.quantity;
                    var itemTotalPrice = itemPrice * itemQuantity;
                    sum += itemTotalPrice;
                }
                order.TotalPrice            = sum;
                order.DateTimeClosed        = DateTime.Now;
                order.Table.Status          = TableStatus.Free;
                order.OrderStatus           = OrderStatus.NotActive;
                _context.Entry(order).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(CreatedAtAction("getOrder", new { id = order.Id }, order));
            }
            return(BadRequest(new { status = "error", message = "Order is not active" }));
        }
Beispiel #19
0
        public List <ChequeModel> GetNameifExisting(List <ChequeModel> check)
        {
            DBConnect();
            string sql = "Select BRSTN, ChkType, AccountNo,Name1,Name2,Address1,ChequeName from captive_database.banko_nuestra";


            MySqlCommand cmd = new MySqlCommand(sql, myConnect);

            MySqlDataReader dr = cmd.ExecuteReader();

            // List<CheckModel> check = new List<CheckModel>();

            while (dr.Read())
            {
                ChequeModel model = new ChequeModel
                {
                    BRSTN      = dr.GetString(0),
                    ChequeType = dr.GetString(1),
                    AccountNo  = dr.GetString(2),
                    Name1      = dr.GetString(3),
                    Name2      = dr.GetString(4),
                    Address1   = dr.GetString(5),
                    ChequeName = dr.GetString(6)
                                 // BranchName = dr.GetString(5),
                                 //Address2 = dr.GetString(6),
                                 //   ChkTypeName = dr.GetString(6),
                                 // BranchName = dr.GetString(8),
                                 // StartSeries = dr.GetString(7),
                                 // EndSeries = dr.GetString(8)
                };

                check.Add(model);
            }

            DBClosed();
            return(check);
        }// end of function
Beispiel #20
0
        }// end of function

        public List <ChequeModel> GetAllData(List <ChequeModel> check, string _batch)
        {
            DBConnect();
            string sql = "SELECT A.BRSTN,AccountNumber,CheckType,ChequeTypeName,Name1,Name2,Quantity,BranchName,"
                         + "B.Address2, B.Address3, B.Address4, StartingSerial, EndingSerial, PcsPerBook FROM " + databaseName + ".banko_nuestra_temp as A left join " + databaseName + ".banko_nuestra_branches as B on  A.BRSTN = B.BRSTN";
            MySqlCommand    cmd = new MySqlCommand(sql, myConnect);
            MySqlDataReader dr  = cmd.ExecuteReader();

            // List<CheckModel> check = new List<CheckModel>();

            while (dr.Read())
            {
                ChequeModel model = new ChequeModel
                {
                    BRSTN          = dr.GetString(0),
                    AccountNo      = dr.GetString(1),
                    ChequeType     = dr.GetString(2),
                    ChequeName     = dr.GetString(3),
                    Name1          = dr.GetString(4),
                    Name2          = dr.GetString(5),
                    Quantity       = int.Parse(dr.GetString(6)),
                    Address1       = dr.GetString(7),
                    Address2       = dr.GetString(8),
                    Address3       = dr.GetString(9),
                    Address4       = dr.GetString(10),
                    StartingSerial = dr.GetString(11),
                    EndingSerial   = dr.GetString(12),
                    PcsPerBook     = dr.GetInt16(13),
                };

                check.Add(model);
            }

            DBClosed();
            return(check);
        }// end of function
Beispiel #21
0
        public List <ChequeModel> GetBatchFile(List <ChequeModel> check) //Checking if the batch is already exists
        {
            DBConnect();

            MySqlCommand myCommand = new MySqlCommand("SELECT Distinct( Batch) FROM " + databaseName + ".banko_nuestra", myConnect);

            MySqlDataReader myReader = myCommand.ExecuteReader();

            // List<CheckModel> check = new List<CheckModel>();

            while (myReader.Read())
            {
                ChequeModel refe = new ChequeModel
                {
                    BatchFile = myReader.GetString(0)
                };

                check.Add(refe);
            }

            DBClosed();

            return(check);
        }
        /// <summary>
        /// Selects the Single object of ChequesModel table.
        /// </summary>
        public ChequeModel GetChequesModel(int aNumero)
        {
            ChequeModel ChequesModel = 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 = "ChequesModelSelect";

                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int      Numero              = (int)(reader["Numero"]);
                            DateTime FechaEmision        = (DateTime)(reader["FechaEmision"]);
                            DateTime?FechaCobro          = reader["FechaCobro"] as DateTime?;
                            string   Destinatario        = (string)(reader["Destinatario"]);
                            decimal  Monto               = (decimal)(reader["Monto"]);
                            int      IDChequesModelra    = (int)(reader["IDChequesModelra"]);
                            string   Estado              = (string)(reader["Estado"]);
                            DateTime FECHA_CREACION      = (DateTime)(reader["FECHA_CREACION"]);
                            DateTime?FECHA_MODIFICACION  = reader["FECHA_MODIFICACION"] as DateTime?;
                            string   USUARIO_CREACION    = (string)(reader["USUARIO_CREACION"]);
                            string   USUARIO_MODIFICADOR = (string)(reader["USUARIO_MODIFICADOR"]);

                            ChequesModel = new ChequeModel
                            {
                                Numero       = Numero,
                                Fechaemision = FechaEmision,
                                Fechacobro   = FechaCobro,
                                Destinatario = Destinatario,
                                Monto        = Monto,
                                //  IdChequesModelra = IDChequesModelra,
                                Estado              = Estado,
                                Fecha_creacion      = FECHA_CREACION,
                                Fecha_modificacion  = FECHA_MODIFICACION,
                                Usuario_creacion    = USUARIO_CREACION,
                                Usuario_modificador = USUARIO_MODIFICADOR,
                            };
                        }
                    }
                }

                return(ChequesModel);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Beispiel #23
0
        private void btnValidarCheque_Click(object sender, EventArgs e)
        {
            using (CobroChequeServiceClient chequeService = new CobroChequeServiceClient())
            {
                if (String.IsNullOrEmpty(TBNroCheque.Text.Trim()))
                {
                    epValidarCampos.SetError(TBNroCheque, "Debe ingresar un número de cheque para la validacion.");
                    return;
                }
                else
                {
                    epValidarCampos.SetError(TBNroCheque, "");
                }

                if (String.IsNullOrEmpty(txtNroCuenta.Text.Trim()))
                {
                    epValidarCampos.SetError(txtNroCuenta, "Debe ingresar un número de cuenta para la validacion.");
                    return;
                }
                else
                {
                    epValidarCampos.SetError(txtNroCuenta, "");
                }



                if (!String.IsNullOrEmpty(TBNroCheque.Text))
                {
                    CobroChequeMethods validarCheque  = new CobroChequeMethods();
                    ChequeModel        chequeValidado = new ChequeModel();


                    //chequeValidado = chequeService.CobroCheque_ValidarCheque(Convert.ToInt32(TBNroCheque.Text));
                    chequeValidado = validarCheque.ValidarCheque(Convert.ToInt32(TBNroCheque.Text), txtNroCuenta.Text);
                    if (chequeValidado == null)
                    {
                        lblExistenciaCheque.Visible = true;

                        //monto1.TBMonto.Text = "";
                        txtLibrador.Text = "";
                        //txtNroCuenta.Text = "";
                        //lblExistenciaCheque.Text = "";
                        lblMonedaValor.Text       = "";
                        lblEstadoCuentaValor.Text = "";
                        lblEstadoChequeValor.Text = "";
                    }
                    else
                    {
                        lblExistenciaCheque.Visible = false;
                        gbDatosCheque.Size          = new Size(470, 195);

                        //////
                        gbDatosPersonaRetiro.Location = new Point(26, 250);

                        ////

                        dgvChequesCobrados.Location = new Point(27, 423);
                        dgvChequesCobrados.Size     = new Size(804, 130);
                        lblBuscarOperacion.Location = new Point(24, 390);
                        txtBuscarOperacion.Location = new Point(123, 387);

                        txtLibrador.Text  = chequeValidado.NombreLibrador;
                        txtNroCuenta.Text = chequeValidado.NroCuenta; //////////////////////////////
                        if (chequeValidado.EstadoCuenta == true)
                        {
                            lblEstadoCuentaValor.Text = "Activo";
                        }
                        else
                        {
                            lblEstadoCuentaValor.Text = "Inactivo";
                        }
                        if (chequeValidado.TipoMoneda == 0)
                        {
                            lblMonedaValor.Text = "Soles";
                        }
                        if (chequeValidado.TipoMoneda == 1)
                        {
                            lblMonedaValor.Text = "Dólares";
                        }


                        lblEstadoChequeValor.Text = chequeValidado.Estado;
                    }
                }
            }
        }
Beispiel #24
0
 public bool Insert(ChequeModel acheque)
 {
     return(this.managerCheque.Insert(acheque));
 }
        public ActionResult <string> PageNotFound()
        {
            var cheque = new ChequeModel(error: Constants.Errors.NotFoundError);

            return(this.NotFound(cheque));
        }
Beispiel #26
0
 public bool Update(ChequeModel acheque)
 {
     return(this.managerCheque.Update(acheque));
 }
Beispiel #27
0
        private void checkToolStripMenuItem_Click(object sender, EventArgs e)
        {
            deliveryDate = dateTimePicker1.Value;
            if (deliveryDate == dateTime)
            {
                MessageBox.Show("Please set Delivery Date!");
            }

            else
            {
                if (txtBatch.Text == "")
                {
                    MessageBox.Show("Please Enter Batch Number!!!");
                }
                else
                {
                    batchfile = txtBatch.Text;


                    if (Directory.GetFiles(Application.StartupPath + "\\Head\\").Length == 0) // if the path folder is empty
                    {
                        MessageBox.Show("No files found in directory path", "***System Error***");
                    }
                    else
                    {
                        string[] list = Directory.GetFiles(Application.StartupPath + "\\Head\\");

                        for (int i = 0; i < list.Length; i++)
                        {
                            // _fileName = Path.GetFileName(list[i]);
                            Excel.Application xlApp      = new Excel.Application();
                            Excel.Workbook    xlWorkbook = xlApp.Workbooks.Open(list[i], 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

                            int SheetsCount = xlWorkbook.Sheets.Count;
                            for (int b = 0; b < SheetsCount; b++)
                            {
                                Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[b + 1];
                                Excel.Range      xlRange     = xlWorksheet.UsedRange;

                                int    rowCount  = xlRange.Rows.Count;
                                int    colCount  = xlRange.Columns.Count;
                                string SheetName = xlWorksheet.Name.ToUpper();
                                //  int rowCounter = 0;
                                string chequeName  = xlWorksheet.Name;
                                string accountname = "";
                                //  MessageBox.Show();
                                string SN = "";
                                //  string EN = "";

                                string qty = "";
                                for (int a = 0; a < rowCount; a++)
                                {
                                    string cell = xlRange.Cells[a + 8, 1].Text;
                                    if (cell.Trim() == "")
                                    {
                                        a++;
                                    }

                                    else
                                    {
                                        qty = xlRange.Cells[a + 8, 4].Text;
                                        ChequeModel check = new ChequeModel();
                                        check.AccountNoHypen = xlRange.Cells[a + 8, 1].Text;
                                        check.AccountNoHypen = check.AccountNoHypen.Trim();
                                        check.AccountNo      = check.AccountNoHypen.Replace("-", "");
                                        accountname          = xlRange.Cells[a + 8, 2].Text;
                                        accountname          = accountname.Trim();
                                        //   if(accountname.Length > 50)
                                        // For OR
                                        if (accountname.Length > 36)
                                        {
                                            int LoopCount5 = accountname.Length;
                                            while (LoopCount5 > 0)
                                            {
                                                if (check.Name1 == null && check.Name2 == null && LoopCount5 < accountname.Length - 6)
                                                {
                                                    if (accountname.Substring(LoopCount5, 4) == " Or " || accountname.Substring(LoopCount5, 4) == " or " || accountname.Substring(LoopCount5, 5) == " AND ")
                                                    {
                                                        if (accountname.Substring(LoopCount5, 5) != " AND ")
                                                        {
                                                            check.Name1 = accountname.Substring(0, LoopCount5 + 3).ToUpper();
                                                            check.Name2 = accountname.Substring(LoopCount5 + 4, accountname.Length - LoopCount5 - 4).ToUpper();
                                                        }
                                                        else
                                                        {
                                                            check.Name1 = accountname.Substring(0, LoopCount5 + 4).ToUpper();
                                                            check.Name2 = accountname.Substring(LoopCount5 + 5, accountname.Length - LoopCount5 - 5).ToUpper();
                                                        }
                                                    }
                                                    //else
                                                    //{
                                                    //    check.Name1 = accountname;
                                                    //    check.Name2 = "";
                                                    //}
                                                }
                                                LoopCount5 = LoopCount5 - 1;
                                            }
                                        }
                                        else
                                        {
                                            check.Name1 = accountname.ToUpper();
                                            check.Name2 = "";
                                        }
                                        // End For OR


                                        //  check.Name1 = accountname;
                                        SN                   = xlRange.Cells[a + 8, 3].Text;
                                        SN                   = SN.Trim();
                                        check.BRSTN          = "061370012";
                                        check.Address1       = "SAN SIMON PAMPANGA BRANCH";
                                        check.Address2       = "678 MACARTHUR HIGHWAY, STA. MONICA,";
                                        check.Address3       = "SAN SIMON, PAMPANGA";
                                        check.StartingSerial = SN.Substring(0, 5);
                                        check.EndingSerial   = SN.Substring(6, 5);
                                        check.Quantity       = int.Parse(xlRange.Cells[a + 8, 4].Text);
                                        check.ChequeName     = xlWorksheet.Name;
                                        if (chequeName.Contains("PERSONAL"))
                                        {
                                            check.ChequeName = "Personal Check";
                                            check.ChequeType = "A";
                                            check.PcsPerBook = 50;
                                            filename         = "BNU" + batchfile.Substring(0, 4) + "P";
                                            totalA++;
                                            outputFolder = "Regular_Checks";
                                        }
                                        else
                                        {
                                            check.ChequeName = "Commercial Check";
                                            check.ChequeType = "B";
                                            check.PcsPerBook = 100;
                                            filename         = "BNU" + batchfile.Substring(0, 4) + "C";
                                            outputFolder     = "Regular_Checks";
                                            totalB++;
                                        }

                                        checks.Add(check);
                                        // MessageBox.Show(qty);
                                    }
                                }

                                //string rbBrstn;
                            }
                        }
                        //BindingSource checkBind = new BindingSource();
                        //checkBind.DataSource = checks;
                        //dataGridView1.DataSource = checkBind;
                        lblQtyC.Text  = totalB.ToString();
                        lblQtyP.Text  = totalA.ToString();
                        lblTotal.Text = (totalA + totalB).ToString();
                        MessageBox.Show("No Errors found!!!");
                        generateToolStripMenuItem.Enabled = true;
                    }
                }
            }
        }
Beispiel #28
0
 public bool GenerarCheques(ChequeModel acheque, int cantidad)
 {
     return(this.managerCheque.GenerarCheques(acheque, cantidad));
 }
 public string CobroInsert(ChequeModel aCobroCheque, string NroCuenta)
 {
     return(ADCobroChqueManager.CobroInsert(aCobroCheque, NroCuenta));
 }
 //2019-2
 public Tuple <string, DateTime, int> CobroCheque_CobroInsert(ChequeModel aCobroCheque, string NroCuenta, int idUsuario, string usuario)
 {
     return(BLCobroCheque.CobroInsert(aCobroCheque, NroCuenta, idUsuario, usuario));
 }