Example #1
0
        private static GasPurchase GetGasPurchaseFromRow(DataRow purchaceRow)
        {
            int      id       = (int)purchaceRow[DB.PurchaseTable.ID];
            DateTime date     = (DateTime)purchaceRow[DB.PurchaseTable.Date];
            decimal  price    = (decimal)purchaceRow[DB.PurchaseTable.Price];
            int      amount   = (int)purchaceRow[DB.PurchaseTable.Amount];
            int      distance = (int)purchaceRow[DB.PurchaseTable.Distance];

            GasPurchase.Grade grade   = (GasPurchase.Grade)purchaceRow[DB.PurchaseTable.Grade];
            string            note    = string.Empty;
            object            noteObj = purchaceRow[DB.PurchaseTable.Note];

            if (!(noteObj is System.DBNull))
            {
                note = (string)noteObj;
            }

            return(new GasPurchase(id, date, price, amount, distance, grade, note));
        }
Example #2
0
 public int GradeToIndex(GasPurchase.Grade gradeInt)
 {
     GasPurchase.Grade grade = (GasPurchase.Grade)gradeInt;
     return(_gradeToIndex[grade]);
 }