public int GetServicesIdAndInsertDB(string servicesName) { Services services = new Services() { services_id = selectServices.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestServicesID()), services_name = servicesName }; return(insertServices.InsertObjectToDB(services)); }
public int GetEmployeeIdAndInsertToDB(string employeeName) { int employeID = -1; employeID = selectEmployee.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestEmployeeID()); Employee employee = new Employee() { employee_id = employeID, employee_name = employeeName }; return(insertEmployee.InsertObjectToDB(employee)); }
public int GetClientIdAndInsertToDB(string clientName, string clientSName, string clientPhone, string clientDescription) { Client client = new Client() { client_id = selectClient.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestClientID()), client_name = clientName, client_sname = clientSName, client_phone = clientPhone, client_description = clientDescription }; return(insertClient.InsertObjectToDB(client)); }
public void ShouldAddNewServices_ReturnNewID() { SqlLiteDB.SqlLiteDBCreateTableIFNotExist(); int servicesID = selectServices.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestServicesID()); Services services = new Services() { services_id = servicesID, services_name = "trwała" }; int lastIndex = addServices.InsertObjectToDB(services); Assert.AreEqual(lastIndex, servicesID); }
public void ShouldAddNewReservation_ReturnNewID() { SqlLiteDB.SqlLiteDBCreateTableIFNotExist(); int reservationID = selectReservation.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestReservationID()); Reservation reservation = new Reservation() { reservation_id = reservationID, reservation_date = new DateTime(2020, 7, 17, 12, 1, 1), reservation_time = new TimeSpan(11, 5, 0), client_id = 2, services_id = 2 }; int lastIndex = addReservation.InsertObjectToDB(reservation); Assert.AreEqual(lastIndex, reservationID); }
public void ShouldAddNewClient_ReturnNewID() { SqlLiteDB.SqlLiteDBCreateTableIFNotExist(); int clientID = selectClient.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestClientID()); Client client = new Client() { client_id = clientID, client_name = "Julian", client_sname = "Krol", client_phone = "123456789", client_description = "test kolejny" }; int lastIndex = addClient.InsertObjectToDB(client); Assert.AreEqual(lastIndex, clientID); }
public bool GetReservationIdAndInsertToDB(DateTime reservationDate, int reservationHour, int reservationMinute, int clientID, int servicesID, int employeeID) { int reservationID = selectReservation.GetNextTabletId(SGetIdFromSpecificTable.queryGetLatestReservationID()); Reservation reservation = new Reservation() { reservation_id = reservationID, reservation_date = reservationDate, reservation_time = new TimeSpan(reservationHour, reservationMinute, 0), client_id = clientID, services_id = servicesID, employee_id = employeeID }; if (selectReservation.GetRowsForTable(SGetAllRowsFromSpecificTable.ReservationSelectAllRowsQuery()) .Any(x => x.reservation_date == reservation.reservation_date && x.reservation_time == reservation.reservation_time && x.employee_id == reservation.employee_id)) { return(false); } SLogToFile.SaveDataTebleInToFile("reservation", reservation.ToString()); insertReservation.InsertObjectToDB(reservation); return(true); }