Пример #1
0
        public static Service GetByName(string name)
        {
            object[] row        = db.ReaderRow(db.ReturnCommand($"select * from vw_services where ServName = '{name}'"));
            uint     salesCount = Convert.ToUInt32(row[9] + "");
            decimal? starRating = row[10] != DBNull.Value ? Convert.ToDecimal(row[10].ToString().Replace('.', ',') + "") : (decimal?)null;
            Service  service    = new Service((ushort)row[0], (string)row[1], (decimal)row[2], (string)row[3], (string)row[4], CategoryDAO.GetById((byte)row[5]),
                                              TimeSpan.Parse(row[6].ToString()), (byte[])row[7], (string)row[8], salesCount, starRating);

            return(service);
        }
Пример #2
0
        public static List <Service> GetList()
        {
            var list = new List <Service>();

            db.ReaderRows(db.ReturnCommand("select * from vw_services"), row => {
                uint salesCount    = Convert.ToUInt32(row[9] + "");
                decimal?starRating = row[10] != DBNull.Value ? Convert.ToDecimal(row[10].ToString().Replace('.', ',') + "") : (decimal?)null;
                list.Add(new Service((ushort)row[0], (string)row[1], (decimal)row[2], (string)row[3], (string)row[4], CategoryDAO.GetById((byte)row[5]),
                                     TimeSpan.Parse(row[6].ToString()), (byte[])row[7], (string)row[8], salesCount, starRating));
            });
            return(list);
        }