Ejemplo n.º 1
0
        /// <summary>
        /// Obains the billCharge that match with the id
        /// </summary>
        /// <param name="id">BillCharge id to be searched</param>
        /// <returns></returns>
        public BillCharge GetById(int idBill, int idCharge)
        {
            BillCharge result = default(BillCharge);

            var billChargeDAC = new BillChargeDAC();

            result = billChargeDAC.ReadBy(idBill, idCharge);
            return(result);
        }
Ejemplo n.º 2
0
        private BillCharge LoadBillCharge(IDataReader dr)
        {
            var bill = new BillCharge();

            bill.IdBill           = GetDataValue <int>(dr, "Id");
            bill.IdCharge         = GetDataValue <int>(dr, "IdUser");
            bill.DateIndex        = GetDataValue <int>(dr, "DateIndex");
            bill.DateCreation     = GetDataValue <DateTime>(dr, "DateCreation");
            bill.DateModification = GetDataValue <DateTime?>(dr, "DateModification");
            bill.Valid            = GetDataValue <bool>(dr, "Valid");
            return(bill);
        }
Ejemplo n.º 3
0
        public BillCharge Create(BillCharge billCharge)
        {
            var db = DatabaseFactory.CreateDatabase(CONNECTION_NAME);

            using (DbCommand cmd = db.GetStoredProcCommand(SqlQuerys.AddNewBillCharge))
            {
                db.AddInParameter(cmd, "@IdBill", DbType.AnsiString, billCharge.IdBill);
                db.AddInParameter(cmd, "@IdCharge", DbType.AnsiString, billCharge.IdCharge);
                db.AddInParameter(cmd, "@DateIndex", DbType.Int32, DateFormatHelper.DateToIntFormat(DateTime.Now));
                Convert.ToInt32(db.ExecuteNonQuery(cmd));
            }

            return(billCharge);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Asociates a bill with a charge in table BillCharge
        /// </summary>
        /// <param name="bill"></param>
        /// <param name="charge"></param>
        /// <returns></returns>
        public BillCharge Add(Bill bill, Charge charge)
        {
            var billChargeDAC = new BillChargeDAC();

            var billBillCharge = new BillCharge()
            {
                IdBill   = bill.Id,
                IdCharge = charge.Id
            };

            billBillCharge = billChargeDAC.Create(billBillCharge);

            return(billBillCharge);
        }
Ejemplo n.º 5
0
        public BillCharge ReadBy(int idBill, int idCharge)
        {
            BillCharge billCharge = null;

            var db = DatabaseFactory.CreateDatabase(CONNECTION_NAME);

            using (DbCommand cmd = db.GetStoredProcCommand(SqlQuerys.GetBillById))
            {
                db.AddInParameter(cmd, "@IdBill", DbType.Int32, idBill);
                db.AddInParameter(cmd, "@IdCharge", DbType.Int32, idCharge);
                using (IDataReader dr = db.ExecuteReader(cmd))
                {
                    if (dr.Read())
                    {
                        billCharge = LoadBillCharge(dr);
                    }
                }
            }
            return(billCharge);
        }
Ejemplo n.º 6
0
 public void Update(BillCharge entity)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Edit the billCharge that match with the current idBill and idCharge
        /// </summary>
        /// <param name="billCharge">Data to be edited</param>
        public void Edit(BillCharge billCharge)
        {
            var billChargeDAC = new BillChargeDAC();

            billChargeDAC.Update(billCharge);
        }