public BookingModule() : base("api/booking") { _roomBookingDataAdapter = new RoomBookingDataAdapter(TheDatabase.Instance()); _roomTypeDefinitionDataAdapter = new RoomTypeDefinitionDataAdapter(TheDatabase.Instance()); Get[""] = parameters => { var bookings = _roomBookingDataAdapter.ReadAll(); return(Response.AsJson(bookings)); }; Get["/{bookingId}"] = parameters => { Guid bookingId = parameters.bookingId; var roomBooking = _roomBookingDataAdapter.Read(bookingId); if (roomBooking != null) { return(Response.AsJson( MapToRoomBookingInfo(roomBooking))); } return(HttpStatusCode.NotFound); }; Post[""] = parameters => { var bookingToCreate = this.Bind <RoomBookingInfo>(); var roomBooking = MapToRoomBooking(bookingToCreate); var newBookingId = Guid.NewGuid(); roomBooking.Id = newBookingId; roomBooking.Price = _roomTypeDefinitionDataAdapter.Read(roomBooking.RoomType).PricePerNight *roomBooking.Duration; roomBooking.Status = RoomBookingStatus.Draft; _roomBookingDataAdapter.Create(roomBooking); return(Response.AsJson(new IdWrapper(newBookingId))); }; Put["/{bookingId}/confirm"] = parameters => { Guid bookingId = parameters.bookingId; var roomBooking = _roomBookingDataAdapter.Read(bookingId); if (roomBooking != null) { roomBooking.Status = RoomBookingStatus.ConfirmedByCustomer; _roomBookingDataAdapter.Update(roomBooking); return(HttpStatusCode.OK); } return(HttpStatusCode.NotFound); }; }
public TestingModule() : base("api/testing") { Post["/dropDatabase"] = parameters => { TheDatabase.Instance().Drop(); return(HttpStatusCode.OK); }; }
public void Send_command_Action() { if (MessageBox.Show("Send the Command?", "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { int b = 0; if (First_Text.Equals(" ")) { MessageBox.Show("Please select the Hour "); } else { b++; } if (Second_Text.Equals(" ")) { MessageBox.Show("Please select the Minute "); } else { b++; } if (b == 2) { string[] something = Total_Text.Split(':'); int anotheryear = year; String stringmonth; if (month >= 10) { stringmonth = "" + month; } else { stringmonth = "0" + month; } String stringday; if (day >= 10) { stringday = "" + day; } else { stringday = "0" + day; } string Hour_Minute_Seconds = something[0] + ":" + something[1] + ":00"; string Data_Comanda_Finalizata = anotheryear + "/" + stringday + "/" + stringmonth + " " + Hour_Minute_Seconds; String Data_Prezenta = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); TheDatabase.AddCommadDB(Data_Prezenta, Data_Comanda_Finalizata, ArrayFood, Price); } } }
public void Filing_Table() { for (int i = 0; i < TheDatabase.GetCommandDB().Count; i++) { Command_Data.Add(new ComandTabel() { IdComanda = TheDatabase.GetCommandDB()[i].IdComanda, Price = TheDatabase.GetCommandDB()[i].Price, CommandSent = TheDatabase.GetCommandDB()[i].CommandSent }); } }
public void AllPrimaryKeyConstraintsMustBeNamedConventionalSpecification_Success() { ExecuteSqlScriptFromResource("AllPrimaryKeyConstraintsMustBeNamedConventionalSpecification_Success.sql"); TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllPrimaryKeyConstraintsMustBeNamed) .IsSatisfied .Should() .BeTrue(); }
public void AllDefaultConstraintsMustBeNamedConventionalSpecification_Fail() { ExecuteSqlScriptFromResource("AllDefaultConstraintsMustBeNamedConventionalSpecification_Fail.sql"); var result = TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllDefaultConstraintsMustBeNamed); result.IsSatisfied.Should().BeFalse(); result.Failures.Should().HaveCount(1); }
public void AllIdentityColumnsMustBeNamedTableNameIdConventionSpecification_Success() { ExecuteSqlScriptFromResource("AllIdentityColumnsMustBeNamedTableNameIdConventionSpecificationSuccess.sql"); TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllIdentityColumnsMustBeNamedTableNameId) .IsSatisfied .Should() .BeTrue(); }
public void AllNamedColumnsMustBeNullableConventionSpecification_Fails() { ExecuteSqlScriptFromResource("AllNamedColumnsMustBeNullableConventionalSpecification_Fail.sql"); var result = TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllNamedColumnsMustBeNullable("UpdatedDateTime")); result.IsSatisfied.Should().BeFalse(); result.Failures.Should().HaveCount(1); }
public void AllTablesMustHaveAClusteredIndex_Success() { ExecuteSqlScriptFromResource("TablesWithoutClusteredIndexSuccess.sql"); TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllTablesMustHaveAClusteredIndex) .IsSatisfied .Should() .BeTrue(); }
public void AllIdentityColumnsMustBeNamedTableNameIdConventionSpecification_FailsWhenIdentityColumnIsNotNamedId() { ExecuteSqlScriptFromResource("AllIdentityColumnsMustBeNamedTableNameIdConventionSpecificationFailure.sql"); var result = TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllIdentityColumnsMustBeNamedTableNameId); result.IsSatisfied.Should().BeFalse(); result.Failures.Should().HaveCount(1); }
public void AllTablesMustHaveAClusteredIndex_Failure() { ExecuteSqlScriptFromResource("TablesWithoutClusteredIndexFailure.sql"); var result = TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllTablesMustHaveAClusteredIndex); result.IsSatisfied.Should().BeFalse(); result.Failures.Should().HaveCount(1); }
public void AllTablesMustHaveAClusteredIndex_Failure() { ExecuteSqlScriptFromResource("TablesWithoutClusteredIndexFailure.sql"); TheDatabase .WithConnectionString(TestDbConnectionString) .MustConformTo(Convention.AllTablesMustHaveAClusteredIndex) .IsSatisfied .Should() .BeFalse(); }
public void EachRowMustHaveACorrespondingEnum_Success() { ExecuteSqlScriptFromResource("EachRowMustHaveACorrespondingEnum_Success.sql"); TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.EachRowMustHaveACorrespondingEnum <CloudServiceEnum>("dbo.CloudService", "CloudServiceId")) .IsSatisfied .Should() .BeTrue(); }
public void AllNamedColumnsMustBeNonNullableConventionSpecification_Success() { ExecuteSqlScriptFromResource("AllNamedColumnsMustBeNullableConventionalSpecification_Success.sql"); TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.AllNamedColumnsMustBeNonNullable("CreatedDateTime")) .IsSatisfied .Should() .BeTrue(); }
public void EachRowMustHaveACorrespondingEnum_Fail() { ExecuteSqlScriptFromResource("EachRowMustHaveACorrespondingEnum_Fail.sql"); var result = TheDatabase .WithConnectionString(_settings.ConnectionString) .MustConformTo(Convention.EachRowMustHaveACorrespondingEnum <CloudServiceEnum>("dbo.CloudService", "CloudServiceId")); result.IsSatisfied.Should().BeFalse(); result.Failures.Should().HaveCount(1); }
public void Delete() { if (rowindex == -1) { MessageBox.Show("Please Select Something"); } else { int b = TheDatabase.GetCommandDB()[rowindex].IdComanda; TheDatabase.Delete_FromTable(b); Command_Data.RemoveAt(rowindex); int k = Product_Data.Count; for (int i = 0; i < k; i++) { Product_Data.RemoveAt(0); } } }
public RoomTypeModule() : base("api/roomtypes") { _roomTypeDefinitionDataAdapter = new RoomTypeDefinitionDataAdapter(TheDatabase.Instance()); Get[""] = parameters => { var roomTypeViewModels = (from roomTypeDefinition in _roomTypeDefinitionDataAdapter.ReadAll() select new RoomTypeInfo { Id = Convert.ToInt32(roomTypeDefinition.RoomType), Title = roomTypeDefinition.RoomType.ToString(), PricePerNight = roomTypeDefinition.PricePerNight }) .ToArray(); return Response.AsJson(roomTypeViewModels); }; }
public void Delete_All() { if (MessageBox.Show("Delete all commands?", "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { TheDatabase.Delete_All_From_User(); int k = Command_Data.Count; for (int i = 0; i < k; i++) { Command_Data.RemoveAt(0); } int p = Product_Data.Count; for (int i = 0; i < p; i++) { Product_Data.RemoveAt(0); } } }
public Boolean Log() { if (UserNamePasswordisfull()) { if (TheDatabase.Login_DB(username, password) == false) { alert_password = "******"; onepropretychanged("alert_password"); alert_username = "******"; onepropretychanged("alert_username"); return(false); } else { return(true); } } else { return(false); } }
protected QueryIntegrationTest(TheDatabase requirements) { this.requirements = requirements; }
public RoomTypeDefinitionDataAdapter(TheDatabase database) { _database = database; }
public void CreareCont() { int i = 0; if (firstname.Length == 0) { alert_firstname = "Error,Please write something"; onepropretychanged("alert_firstname"); } else { i++; alert_firstname = ""; onepropretychanged("alert_firstname"); } if (lastname.Length == 0) { alert_lastname = "Error,Please write something"; onepropretychanged("alert_lastname"); } else { i++; alert_lastname = ""; onepropretychanged("alert_lastname"); } if (username.Length == 0) { alert_username = "******"; onepropretychanged("alert_username"); } else { i++; alert_username = ""; onepropretychanged("alert_username"); } if (email.Length == 0) { alert_email = "Error,Please write something"; onepropretychanged("alert_email"); } else { i++; alert_email = ""; onepropretychanged("alert_email"); } if (password1.Length == 0) { alert_password1 = "Error,Please write something"; onepropretychanged("alert_password1"); } else { i++; alert_password1 = ""; onepropretychanged("alert_password1"); } if (password2.Length == 0) { alert_password2 = "Error,Please write something"; onepropretychanged("alert_password2"); } else { i++; alert_password2 = ""; onepropretychanged("alert_password2"); } if ((password1.Length != 0) && (password2.Length != 0)) { if (password1.Equals(password2)) { alert_password1 = ""; onepropretychanged("alert_password1"); alert_password2 = ""; onepropretychanged("alert_password2"); i++; } else { alert_password1 = "No match between Passwords"; onepropretychanged("alert_password1"); alert_password2 = "No match between Passwords"; onepropretychanged("alert_password2"); } } if (i == 7) { int k = TheDatabase.Create_Account(firstname, lastname, username, email, password1); if (k == 1) { alert_email = "Email already exists"; onepropretychanged("alert_email"); alert_username = "******"; onepropretychanged("alert_username"); } else if (k == 2) { alert_username = "******"; onepropretychanged("alert_username"); alert_email = ""; onepropretychanged("alert_email"); } else if (k == 3) { alert_email = "Email already exists"; onepropretychanged("alert_email"); alert_username = ""; onepropretychanged("alert_username"); } else if (k == 4) { MessageBox.Show("You have account"); } else if (k == 0) { MessageBox.Show("idk"); } } }
public override void SetUp() { TheDatabase.Instance().Drop(); Given(); When(); }
private void Button_Click(object sender, RoutedEventArgs e) { Environment.Exit(0); TheDatabase.Close_Connection(); }
public RoomBookingDataAdapter(TheDatabase database) { _database = database; }