public static Employee GetByRG(string rg) { var row = db.ReaderRow(db.ReturnCommand($"select * from tbEmployee where emprg = '{rg}'")); byte[] bytes = row[5] == DBNull.Value ? new byte[0] : (byte[])row[5]; return(new Employee(CustomerDAO.GetById((uint)row[0]), row[1] + "", (string)row[2], (decimal)row[3], Convert.ToChar(row[4]), bytes, GetServices((uint)row[0]))); }
public static List <Review> GetList(ushort serviceId) { var list = new List <Review>(); db.ReaderRows(db.ReturnProcedure("sp_SelectCommentsService", serviceId), row => { list.Add(new Review((decimal)row[0], (string)row[1], CustomerDAO.GetById(Convert.ToUInt32(row[2])))); }); return(list); }
public static List <Employee> GetList() { var list = new List <Employee>(); string query = "select * from tbEmployee"; db.ReaderRows(db.ReturnCommand(query), row => { byte[] bytes = row[5] == DBNull.Value ? new byte[0] : (byte[])row[5]; list.Add(new Employee(CustomerDAO.GetById((uint)row[0]), row[1] + "", row[2] + "", (decimal)row[3], Convert.ToChar(row[4]), bytes, GetServices((uint)row[0]))); }); return(list); }
public static List <Sale> GetList() { var sales = new List <Sale>(); db.ReaderRows(db.ReturnCommand($"select * from tbsale where loginid = '{Authentication.GetUser().Account.Id}'"), row => { var items = new List <ItemSale>(); db.ReaderRows(db.ReturnCommand($"select * from tbitemsale where SaleId = '{(uint)row[0]}'"), data => items.Add(new ItemSale((uint)data[0], (string)data[1], (decimal)data[3]))); sales.Add(new Sale((uint)row[0], row[1] + "", CustomerDAO.GetById((uint)row[2]), items)); }); return(sales); }
public static List <Schedule> GetList() { var list = new List <Schedule>(); db.ReaderRows(db.ReturnCommand("select * from vw_schedulescustomer order by scheddatetime desc"), row => { uint id = Convert.ToUInt32(row[0]); Employee employee = EmployeeDAO.GetById(Convert.ToUInt32(row[1])); Customer customer = CustomerDAO.GetById(Convert.ToUInt32(row[2])); Service service = ServiceDAO.GetById(Convert.ToUInt16(row[3])); string date = row[4] + ""; bool boolean = Convert.ToBoolean(row[5]); list.Add(new Schedule(id, employee, customer, service, date, boolean)); }); return(list); }
public static Schedule GetById(uint id) { object[] row = db.ReaderRow(db.ReturnCommand($"select * from vw_SchedulesCustomer where SchedId = '{id}'")); Schedule schedule = new Schedule(Convert.ToUInt32(row[0]), EmployeeDAO.GetById(Convert.ToUInt32(row[1])), CustomerDAO.GetById(Convert.ToUInt32(row[2])), ServiceDAO.GetById(Convert.ToUInt16(row[3])), row[4] + "", Convert.ToBoolean(row[5])); return(schedule); }