Exemplo n.º 1
0
        public static Service GetByName(string name)
        {
            object[] row     = Database.ReaderRow(Database.ReturnCommand($"select * from tbservices where ServName = '{name}'"));
            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]);

            return(service);
        }
Exemplo n.º 2
0
        public static List <Service> GetList()
        {
            var list = new List <Service>();

            Database.ReaderRows(Database.ReturnCommand("select * from tbservices"), row => {
                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]));
            });
            return(list);
        }
Exemplo n.º 3
0
        public static List <Service> GetList(int orderIndex, string category, int?sp, int?ep)
        {
            var    list  = new List <Service>();
            string query = GetQuery(orderIndex, category, sp, ep);

            Database.ReaderRows(Database.ReturnCommand(query), row => {
                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]));
            });
            return(list);
        }
Exemplo n.º 4
0
        public static List <Service> GetListByCategory(ushort id)
        {
            var list = new List <Service>();

            db.ReaderRows(db.ReturnCommand($"select * from vw_services where CategoryId = {id}"), row =>
            {
                decimal?starRating = row[9] != DBNull.Value ? Convert.ToDecimal(row[9] + "") : (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], starRating));
            });
            return(list);
        }
Exemplo n.º 5
0
        public static Service GetByName(string name)
        {
            object[] row        = db.ReaderRow(db.ReturnCommand($"select * from vw_services where ServName = '{name}'"));
            decimal? starRating = row[9] != DBNull.Value ? Convert.ToDecimal(row[9] + "") : (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], starRating);

            return(service);
        }
Exemplo n.º 6
0
        public static List <Service> GetList(int orderIndex, string category, int?sp, int?ep)
        {
            var    list  = new List <Service>();
            string query = GetQuery(orderIndex, category, sp, ep);

            db.ReaderRows(db.ReturnCommand(query), row =>
            {
                decimal?starRating = row[9] != DBNull.Value ? Convert.ToDecimal(row[9] + "") : (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], starRating));
            });
            return(list);
        }