Ejemplo n.º 1
0
        private BindingList <TableModel> generateList()
        {
            var ret    = new BindingList <TableModel>();
            var result = getTableDetails();

            if (result.Rows.Count < 1)
            {
                return(null);
            }
            foreach (DataRow row in result.Rows)
            {
                DateTime timeIn      = (row["TIME STARTED"].ToString().Count() > 0 ? DateTime.Parse(row["TIME STARTED"].ToString()) : DateTime.MinValue);
                DateTime timeEnded   = (row["TIME ENDED"].ToString().Count() > 0 ? DateTime.Parse(row["TIME ENDED"].ToString()) : DateTime.MinValue);
                var      transaction = new TransactionBuilder()
                                       .SetRackRate(Convert.ToInt32(row["GAME RATE"].ToString()))
                                       .SetHourlyRate(Convert.ToInt32(row["HOURLY RATE"].ToString()))
                                       .SetTotalRacks(0)
                                       .SetTimeStarted(timeIn)
                                       .SetTimeEnded(timeEnded).Construct();

                var transType  = TableTransactionFactory.GetTransType(Convert.ToInt32(row["TRANSACTION"].ToString()));
                var tableState = TableStateFactory.getTableStateByCode(Convert.ToInt32(row["STATE"].ToString()));
                var temp       = new DbTableBuilder(transType, tableState, transaction)
                                 .SetTabledId(Convert.ToInt32(row["TABLE"].ToString()))
                                 .SetX(Convert.ToInt32(row["X"].ToString()))
                                 .SetY(Convert.ToInt32(row["Y"].ToString()))
                                 .SetHeight(Convert.ToInt32(row["Height"].ToString()))
                                 .SetWidth(Convert.ToInt32(row["Width"].ToString())).Construct();

                ret.Add(temp);
            }
            return(ret);
        }