public void Update(ConferenceInfo conferenceInfo) { IDataParameter[] parms = null; var SQL_UPDATE = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(conferenceInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); ExecuteNonQuery(SQL_UPDATE, parms); }
public ConferenceInfo Put(ConferenceInfo conference) { _tracer.Info(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, "ConferenceController: PUT"); if (_user == null) { _tracer.Info(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, "User not found returning 404"); this.NotFound(); } if (conference.PublishNow) { try { this.service.Publish(conference.Id); } catch (System.Exception exc) { _tracer.Error(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, exc); throw; } } return(conference); }
public int Insert(ConferenceInfo conferenceInfo) { var conferenceID = 0; IDataParameter[] parms = null; var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(conferenceInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, SQL_INSERT, parms); conferenceID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(conferenceID); }
public int Insert(ConferenceInfo conferenceInfo) { var conferenceId = 0; IDataParameter[] parms = null; var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(conferenceInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { conferenceId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(conferenceId); }
public void Update(ConferenceInfo conferenceInfo) { IDataParameter[] parms = null; var sqlUpdate = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(conferenceInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); ExecuteNonQuery(sqlUpdate, parms); }
public List <ConferenceInfo> GetConferenceInfoListByKeywordId(int publishmentSystemId, int keywordId) { var conferenceInfoList = new List <ConferenceInfo>(); string sqlWhere = $"WHERE {ConferenceAttribute.PublishmentSystemId} = {publishmentSystemId} AND {ConferenceAttribute.IsDisabled} <> '{true}'"; if (keywordId > 0) { sqlWhere += $" AND {ConferenceAttribute.KeywordId} = {keywordId}"; } var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var conferenceInfo = new ConferenceInfo(rdr); conferenceInfoList.Add(conferenceInfo); } rdr.Close(); } return(conferenceInfoList); }
public List <ConferenceInfo> GetConferenceInfoListByKeywordID(int publishmentSystemID, int keywordID) { var conferenceInfoList = new List <ConferenceInfo>(); string SQL_WHERE = $"WHERE {ConferenceAttribute.PublishmentSystemID} = {publishmentSystemID} AND {ConferenceAttribute.IsDisabled} <> '{true}'"; if (keywordID > 0) { SQL_WHERE += $" AND {ConferenceAttribute.KeywordID} = {keywordID}"; } var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var conferenceInfo = new ConferenceInfo(rdr); conferenceInfoList.Add(conferenceInfo); } rdr.Close(); } return(conferenceInfoList); }
public static ConferenceInfo ToViewModel(this ConferenceDTO dto) { if (dto == null) { return(null); } var model = new ConferenceInfo(); model.Id = dto.Id; model.Name = dto.Name; model.Description = dto.Description; model.Location = dto.Location; model.Tagline = dto.Tagline; model.TwitterSearch = dto.TwitterSearch; model.StartDate = dto.StartDate; model.EndDate = dto.EndDate; model.AccessCode = dto.AccessCode; model.OwnerName = dto.OwnerName; model.OwnerEmail = dto.OwnerEmail; model.Slug = dto.Slug; model.IsPublished = dto.IsPublished; model.WasEverPublished = dto.WasEverPublished; return(model); }
/// <summary> /// We receive the slug value as a kind of cross-cutting value that /// all methods need and use, so we catch and load the conference here, /// so it's available for all. Each method doesn't need the slug parameter. /// </summary> protected override void OnActionExecuting(ActionExecutingContext filterContext) { var slug = (string)this.ControllerContext.RequestContext.RouteData.Values["slug"]; if (!string.IsNullOrEmpty(slug)) { this.ViewBag.Slug = slug; this._conference = _conferenceQueryService.FindConference(slug).ToViewModel(); if (this._conference != null) { // check access var accessCode = (string)this.ControllerContext.RequestContext.RouteData.Values["accessCode"]; if (accessCode == null || !string.Equals(accessCode, this._conference.AccessCode, StringComparison.Ordinal)) { filterContext.Result = new HttpUnauthorizedResult("Invalid access code."); } else { this.ViewBag.OwnerName = this._conference.OwnerName; this.ViewBag.WasEverPublished = this._conference.WasEverPublished; } } } base.OnActionExecuting(filterContext); }
public void GivenTheSelectedOrderItems(Table table) { conferenceInfo = ScenarioContext.Current.Get <ConferenceInfo>(); registrationController = RegistrationHelper.GetRegistrationController(conferenceInfo.Slug); orderViewModel = RegistrationHelper.GetModel <OrderViewModel>(registrationController.StartRegistration().Result); Assert.NotNull(orderViewModel); registration = new RegisterToConference { ConferenceId = conferenceInfo.Id, OrderId = orderViewModel.OrderId }; foreach (var row in table.Rows) { var orderItemViewModel = orderViewModel.Items.FirstOrDefault(s => s.SeatType.Description == row["seat type"]); Assert.NotNull(orderItemViewModel); int qt; if (!row.ContainsKey("quantity") || !Int32.TryParse(row["quantity"], out qt)) { qt = orderItemViewModel.SeatType.Quantity; } registration.Seats.Add(new SeatQuantity(orderItemViewModel.SeatType.Id, qt)); } // Store for sharing between steps implementations ScenarioContext.Current.Set(registration); ScenarioContext.Current.Set(registrationController.ConferenceAlias); }
public void when_creating_conference_and_seat_then_does_not_publish_seat_created() { var conference = new ConferenceInfo { OwnerEmail = "*****@*****.**", OwnerName = "test owner", AccessCode = "qwerty", Name = "test conference", Description = "test conference description", Location = "redmond", Slug = "test", StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.Add(TimeSpan.FromDays(2)), }; service.CreateConference(conference); var seat = new SeatType { Name = "seat", Description = "description", Price = 100, Quantity = 100 }; service.CreateSeat(conference.Id, seat); Assert.Empty(busEvents.OfType <SeatCreated>()); }
public void when_creating_conference_and_seat_then_publishes_seat_created_on_publish() { var conference = new ConferenceInfo { OwnerEmail = "*****@*****.**", OwnerName = "test owner", AccessCode = "qwerty", Name = "test conference", Description = "test conference description", Location = "redmond", Slug = "test", StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.Add(TimeSpan.FromDays(2)), }; service.CreateConference(conference); var seat = new SeatType { Name = "seat", Description = "description", Price = 100, Quantity = 100 }; service.CreateSeat(conference.Id, seat); service.Publish(conference.Id); var e = busEvents.OfType <SeatCreated>().FirstOrDefault(); Assert.NotNull(e); Assert.Equal(e.SourceId, seat.Id); }
// TODO: Locate and Create are the ONLY methods that don't require authentication/location info. /// <summary> /// We receive the slug value as a kind of cross-cutting value that /// all methods need and use, so we catch and load the conference here, /// so it's available for all. Each method doesn't need the slug parameter. /// </summary> protected override void OnActionExecuting(ActionExecutingContext filterContext) { var slug = (string)this.ControllerContext.RequestContext.RouteData.Values["slug"]; if (!string.IsNullOrEmpty(slug)) { this.ViewBag.Slug = slug; this.Conference = this.Service.FindConference(slug); if (this.Conference != null) { // check access var accessCode = (string)this.ControllerContext.RequestContext.RouteData.Values["accessCode"]; if (accessCode == null || !string.Equals(accessCode, this.Conference.AccessCode, StringComparison.Ordinal)) { filterContext.Result = new HttpUnauthorizedResult("Invalid access code."); } else { this.ViewBag.OwnerName = this.Conference.OwnerName; this.ViewBag.WasEverPublished = this.Conference.WasEverPublished; } } } base.OnActionExecuting(filterContext); }
protected void dgEquipment_ItemDataBound(object sender, DataGridItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: { ConferenceInfo arg_35_0 = (ConferenceInfo)e.Item.DataItem; e.Item.Attributes["onclick"] = "OnRecord(this);;clickTenderRow('" + e.Item.ItemIndex + "');"; e.Item.Attributes["onmouseout"] = "OnMouseOverRecord(this);"; e.Item.Attributes["onmouseover"] = "OnMouseOverRecord(this);"; return; } case ListItemType.SelectedItem: break; case ListItemType.EditItem: { ConferenceInfo arg_AF_0 = (ConferenceInfo)e.Item.DataItem; e.Item.Attributes["onclick"] = "OnRecord(this);;clickTenderRow('" + e.Item.ItemIndex + "');"; e.Item.Attributes["onmouseout"] = "OnMouseOverRecord(this);"; e.Item.Attributes["onmouseover"] = "OnMouseOverRecord(this);"; break; } default: return; } }
public async Task UpdateConference(ConferenceInfo conference) { if (!await _conferenceRepository.CheckExistenceById(conference.Id)) { throw new ApplicationException("Conference record wasn't found!"); } await _conferenceRepository.UpdateConference(conference); }
public void CreateConferenceTest() { var conferenceId = Guid.NewGuid(); var conference = new ConferenceInfo("测试会议", "测试", "测试地址", 40, DateTime.Now, DateTime.Now.AddDays(10), conferenceId); conference.CreateConference("测试会议", "测试", "测试地址", 40, DateTime.Now, DateTime.Now.AddDays(10), conferenceId); Assert.NotNull(conference); }
public static T Put <T>(string url, ConferenceInfo conferenceInfo, out HttpStatusCode responseCode) { var client = new HttpClient(); var response = client.PutAsJsonAsync(url, conferenceInfo).Result; responseCode = response.StatusCode; return(response.Content.ReadAsAsync <T>().Result); }
public void GivenTheListOfTheAvailableOrderItemsForTheCqrsSummit2012Conference(Table table) { // Populate Conference data conferenceInfo = ConferenceHelper.PopulateConfereceData(table); // Store for being used by external step classes ScenarioContext.Current.Set(conferenceInfo); }
public void Setup() { // 初始化会议数据库 using (var context = new ConferenceContext(this._dbName)) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } // 模拟事件总线 this._busEvents = new List <IEvent>(); var busMock = new Mock <IEventBus>(); busMock.Setup(b => b.Publish(It.IsAny <Envelope <IEvent> >())) .Callback <Envelope <IEvent> >(e => this._busEvents.Add(e.Body)); busMock.Setup(b => b.Publish(It.IsAny <IEnumerable <Envelope <IEvent> > >())) .Callback <IEnumerable <Envelope <IEvent> > >(es => this._busEvents.AddRange(es.Select(e => e.Body))); this._service = new ConferenceService(busMock.Object, this._dbName); this._conference = new ConferenceInfo() { OwnerEmail = "*****@*****.**", OwnerName = "test owner", AccessCode = "qwerty", Name = "test conference", Description = "test conference description", Location = "redmond", Slug = "test", StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.Add(TimeSpan.FromDays(2)), Seats = { new SeatType() { Name = "general", Description = "general description", Price = 100, Quantity = 10 } } }; this._service.CreateConference(this._conference); this._placed = new OrderPlaced() { ConferenceId = Guid.NewGuid(), SourceId = Guid.NewGuid(), AccessCode = "asdf" }; this._eventHandler = new OrderEventHandler(() => new ConferenceContext(_dbName)); this._eventHandler.Handle(_placed); }
public static AddSeatType ToAddSeatTypeCommand(this SeatType model, ConferenceInfo conference) { var command = new AddSeatType(conference.Id); command.Name = model.Name; command.Description = model.Description; command.Price = model.Price; command.Quantity = model.Quantity; return(command); }
public void InsertOrUpdate(ConferenceInfo conferenceinfo) { if (conferenceinfo.Id == default(int)) { // New entity context.ConferenceInfoes.Add(conferenceinfo); } else { // Existing entity context.Entry(conferenceinfo).State = EntityState.Modified; } }
internal static void SelectOrderItems(Browser browser, ConferenceInfo conferenceInfo, Table table, bool navigateToRegPage = true) { if (navigateToRegPage) { browser.GoTo(Constants.RegistrationPage(conferenceInfo.Slug)); browser.WaitForComplete((int)Constants.UI.WaitTimeout.TotalSeconds); } foreach (var row in table.Rows) { browser.SelectListInTableRow(row["seat type"], row["quantity"]); } }
public void should_unit_the_conference_service_to_return_the_conference_data() { var theConferenceInfo = new ConferenceInfo(); var conferenceService = new Mock <IConferenceService>(); conferenceService.Setup(x => x.ConferenceInfo()).Returns(theConferenceInfo); var controller = new ConferenceController(conferenceService.Object); var result = controller.Get(); Assert.IsType <ConferenceInfo>(result); Assert.Equal(result, theConferenceInfo); }
public async Task HandleAsync(CreateConferenceCommand command) { try { var conference = new ConferenceInfo(Guid.NewGuid()); conference.CreateConference(command.ConferenceName, command.ConferenceContent, command.ConferenceAddress, command.ConferenceParticipantNum, command.ConferenceStartTime, command.ConferenceEndTime, command.CustomerId); await _publishDomainEvent.PublishEventAsync(conference); } catch (Exception e) { e.ToExceptionless().Submit(); throw; } }
public ActionResult Locate(string email, string accessCode) { ConferenceInfo conference = this.Service.FindConference(email, accessCode); if (conference == null) { ModelState.AddModelError(string.Empty, "邮箱或密码不正确。"); ViewBag.Email = email; return(this.View()); } return(RedirectToAction("Index", new { slug = conference.Slug, accessCode })); }
public void UpdateConference(ConferenceInfo conference) { var existing = this.conferenceRepository.GetByKey(conference.Id); if (existing == null) { throw new ObjectNotFoundException(); } this.Context.RegisterModified(conference); this.Context.Commit(); this.PublishConferenceEvent <ConferenceUpdated>(conference); }
//会议详情(根据ID反填) public ConferenceInfo ConferenceInfo(int cid) { DapperHelper <ConferenceShow> ShowConferenceDapper = new DapperHelper <ConferenceShow>(); ConferenceInfo info = new ConferenceInfo(); //会议详情 info.con = ShowConferenceDapper.Query($"select * from ConferenceTable join ConferenceTypeTable ct on Con_TypeId=ct.Id join ProductTable p on p.Id=Con_ProductId where ConferenceTable.ID={cid}").First(); //记录会议id 通过会议id找到参会医生行id 通过行id 找到参会医生邀请并且通过审批的人员数量 using (SqlConnection conn = new SqlConnection(@"Data Source=192.168.43.93;Initial Catalog=Practial;User ID=sa;Pwd=12345")) { info.concomenum = Convert.ToInt32(conn.ExecuteScalar($"select count(1) from InvitationTable where Inviter_User_Id in (select id from QuotaTable where QRelation_ConferenceId = {info.con.Id}) and Invitation_State = 1")); } return(info); }
/// <summary> /// Creates and adds a few ItemViewModel objects into the Items collection. /// </summary> public void LoadData() { #region load data var ci = new ConferenceInfo { Code = "monkeyspace13", DisplayLocation = "Chicago", DisplayName = "MonkeySpace" , StartDate = new DateTime(2013, 07, 22), EndDate = new DateTime(2013, 07, 25) }; App.ViewModel.ConfItem = ci; // HACK: would prefer to get this data from the server var ml = new List <MapLocation>(); ml.Add(new MapLocation() { Title = "MonkeySpace", Subtitle = "NERD Center", Location = new Core.Point(-71.08363940740965, 42.36100515974955) }); MapLocations = ml; var json = App.LoadText(@"monkeyspace12\sessions.json"); MonkeySpace.Core.ConferenceManager.LoadFromString(json); Speakers = MonkeySpace.Core.ConferenceManager.Speakers.Values.ToList(); NotifyPropertyChanged("Speakers"); Sessions = MonkeySpace.Core.ConferenceManager.Sessions.Values.ToList(); NotifyPropertyChanged("Sessions"); string currentConf = ""; if (IsolatedStorageSettings.ApplicationSettings.Contains("LastConferenceCode")) { currentConf = (string)IsolatedStorageSettings.ApplicationSettings["LastConferenceCode"]; // // ###### Load 'favorites' #### // FavoriteSessions = App.Load <ObservableCollection <MonkeySpace.Core.Session> >(currentConf + "\\Favorites.xml"); LoadWhatsOn(currentConf); } #endregion this.IsDataLoaded = true; }
public ConferenceCreated(ConferenceInfo conference) { CorrelationId = conference.Id; Name = conference.Name; Description = conference.Description; Location = conference.Location; Slug = conference.Slug; Tagline = conference.Tagline; TwitterSearch = conference.TwitterSearch; StartDate = conference.StartDate; EndDate = conference.EndDate; Owner = new Owner(conference.OwnerName, conference.OwnerEmail); Id = NewId.NextGuid(); TimeStamp = DateTimeOffset.UtcNow; Version = 1; }
public void GetPublishTest() { var conferenceId = Guid.NewGuid(); var conference = new ConferenceInfo("测试会议", "测试", "测试地址", 40, DateTime.Now, DateTime.Now.AddDays(10), conferenceId); //List<SeatType> seatTypeList = new List<SeatType>(); //var seatType = new SeatType("舒适型", 60, 30, conferenceId); //var seatType1 = new SeatType("豪华型", 80, 10, conferenceId); //seatTypeList.Add(seatType); //seatTypeList.Add(seatType1); //conference.AddSeatType(seatTypeList); conference.CreateConference("测试会议", "测试", "测试地址", 40, DateTime.Now, DateTime.Now.AddDays(10), conferenceId); //_publishDomainEvent.PublishEvent(conference); }
public async Task CreateConference(ConferenceInfo conference) { if (await _conferenceRepository.CheckExistenceBySlug(conference.Slug)) { throw new DuplicateNameException("The chosen conference slug is already taken."); } // Conference publishing is explicit. if (conference.IsPublished) { conference.IsPublished = false; } await _conferenceRepository.Create(conference); _hostServiceBus.Publish <IConferenceCreated>(new ConferenceCreated(conference)); }
public ActionResult Create([Bind(Exclude = "Id,AccessCode,Seats,WasEverPublished")] ConferenceInfo conference) { if (ModelState.IsValid) { try { conference.Id = GuidUtil.NewSequentialId(); Service.CreateConference(conference); } catch (DuplicateNameException e) { ModelState.AddModelError("Slug", e.Message); return(View(conference)); } return(RedirectToAction("Index", new { slug = conference.Slug, accessCode = conference.AccessCode })); } return(View(conference)); }
public void GivenTheSelectedOrderItems(Table table) { conferenceInfo = ScenarioContext.Current.Get<ConferenceInfo>(); registrationController = RegistrationHelper.GetRegistrationController(conferenceInfo.Slug); var orderViewModel = RegistrationHelper.GetModel<OrderViewModel>(registrationController.StartRegistration()); Assert.NotNull(orderViewModel); registration = new RegisterToConference { ConferenceId = conferenceInfo.Id, OrderId = registrationController.ViewBag.OrderId }; foreach (var row in table.Rows) { var orderItemViewModel = orderViewModel.Items.FirstOrDefault(s => s.SeatType.Description == row["seat type"]); Assert.NotNull(orderItemViewModel); registration.Seats.Add(new SeatQuantity(orderItemViewModel.SeatType.Id, Int32.Parse(row["quantity"]))); } // Store for sharing between steps implementations ScenarioContext.Current.Set(registration); ScenarioContext.Current.Set(registrationController.ConferenceAlias); }
public ConferenceInfo Put(ConferenceInfo conference) { _tracer.Info(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, "ConferenceController: PUT"); if (_user == null) { _tracer.Info(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, "User not found returning 404"); this.NotFound(); } if (conference.PublishNow) { try { this.service.Publish(conference.Id); } catch (System.Exception exc) { _tracer.Error(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, exc); throw; } } return conference; }
private static ConferenceInfo BuildInternalConferenceInfo(Table seats) { string conferenceSlug = Slug.CreateNew().Value; var conference = new ConferenceInfo() { Description = Constants.UI.ConferenceDescription + " (" + conferenceSlug + ")", Name = conferenceSlug, Slug = conferenceSlug, Location = Constants.UI.Location, Tagline = Constants.UI.TagLine, TwitterSearch = Constants.UI.TwitterSearch, StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(1), OwnerName = "test", OwnerEmail = "*****@*****.**", IsPublished = true, WasEverPublished = true }; return conference; }
public static Guid ReserveSeats(ConferenceInfo conference, Table table) { var seats = new List<SeatQuantity>(); foreach (var row in table.Rows) { var seatInfo = conference.Seats.FirstOrDefault(s => s.Name == row["seat type"]); if (seatInfo == null) throw new InvalidOperationException("seat type not found"); int qt; if (!row.ContainsKey("quantity") || !Int32.TryParse(row["quantity"], out qt)) qt = seatInfo.Quantity; seats.Add(new SeatQuantity(seatInfo.Id, qt)); } var seatReservation = new MakeSeatReservation { ConferenceId = conference.Id, ReservationId = Guid.NewGuid(), Seats = seats }; var commandBus = BuildCommandBus(); commandBus.Send(seatReservation); // Wait for the events to be processed Thread.Sleep(Constants.WaitTimeout); return seatReservation.ReservationId; }
public ActionResult Edit(ConferenceInfo conference) { if (this.Conference == null) { return HttpNotFound(); } if (ModelState.IsValid) { this.Service.UpdateConference(conference); return RedirectToAction("Index", new { slug = conference.Slug, accessCode = conference.AccessCode }); } return View(conference); }
public ActionResult Create(ConferenceInfo conference) { if (ModelState.IsValid) { try { conference.Id = Guid.NewGuid(); this.Service.CreateConference(conference); } catch (DuplicateNameException e) { ModelState.AddModelError("Slug", e.Message); return View(conference); } return RedirectToAction("Index", new { slug = conference.Slug, accessCode = conference.AccessCode }); } return View(conference); }
public given_an_existing_conference_with_a_seat() { using (var context = new ConferenceContext(dbName)) { if (context.Database.Exists()) context.Database.Delete(); context.Database.CreateIfNotExists(); } this.bus = new MemoryEventBus(); this.service = new ConferenceService(this.bus, this.dbName); this.conference = new ConferenceInfo { OwnerEmail = "*****@*****.**", OwnerName = "test owner", AccessCode = "qwerty", Name = "test conference", Description = "test conference description", Location = "redmond", Slug = "test", StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.Add(TimeSpan.FromDays(2)), IsPublished = true, Seats = { new SeatType { Name = "general", Description = "general description", Price = 100, Quantity = 10, } } }; service.CreateConference(this.conference); }
public void GivenThisConferenceInformation(Table table) { conference = ConferenceHelper.BuildConferenceInfo(table); }
private static ConferenceInfo BuildConferenceInfo(Table seats, string conferenceSlug) { var conference = new ConferenceInfo() { Description = Constants.UI.ConferenceDescription + " (" + conferenceSlug + ")", Name = conferenceSlug, Slug = conferenceSlug, Location = Constants.UI.Location, Tagline = Constants.UI.TagLine, TwitterSearch = Constants.UI.TwitterSearch, StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(1), OwnerName = "test", OwnerEmail = "*****@*****.**", IsPublished = true, WasEverPublished = true }; foreach (var row in seats.Rows) { var seat = new SeatType() { Id = Guid.NewGuid(), Description = row["seat type"], Name = row["seat type"], Price = Convert.ToDecimal(row["rate"].Replace("$", "")), Quantity = Convert.ToInt32(row["quota"]) }; conference.Seats.Add(seat); } return conference; }
public given_an_existing_conference_with_a_seat() { using (var context = new ConferenceContext(dbName)) { if (context.Database.Exists()) context.Database.Delete(); context.Database.CreateIfNotExists(); } this.busEvents = new List<IEvent>(); var busMock = new Mock<IEventBus>(); busMock.Setup(b => b.Publish(It.IsAny<Envelope<IEvent>>())).Callback<Envelope<IEvent>>(e => busEvents.Add(e.Body)); busMock.Setup(b => b.Publish(It.IsAny<IEnumerable<Envelope<IEvent>>>())).Callback<IEnumerable<Envelope<IEvent>>>(es => busEvents.AddRange(es.Select(e => e.Body))); this.service = new ConferenceService(busMock.Object, this.dbName); this.conference = new ConferenceInfo { OwnerEmail = "*****@*****.**", OwnerName = "test owner", AccessCode = "qwerty", Name = "test conference", Description = "test conference description", Location = "redmond", Slug = "test", StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.Add(TimeSpan.FromDays(2)), IsPublished = true, Seats = { new SeatType { Name = "general", Description = "general description", Price = 100, Quantity = 10, } } }; service.CreateConference(this.conference); }
public void when_creating_conference_and_seat_then_publishes_seat_created_on_publish() { var conference = new ConferenceInfo { OwnerEmail = "*****@*****.**", OwnerName = "test owner", AccessCode = "qwerty", Name = "test conference", Description = "test conference description", Location = "redmond", Slug = "test", StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.Add(TimeSpan.FromDays(2)), }; service.CreateConference(conference); var seat = new SeatType { Name = "seat", Description = "description", Price = 100, Quantity = 100 }; service.CreateSeat(conference.Id, seat); service.Publish(conference.Id); var e = busEvents.OfType<SeatCreated>().FirstOrDefault(); Assert.NotNull(e); Assert.Equal(e.SourceId, seat.Id); }
public void when_creating_conference_and_seat_then_does_not_publish_seat_created() { var conference = new ConferenceInfo { OwnerEmail = "*****@*****.**", OwnerName = "test owner", AccessCode = "qwerty", Name = "test conference", Description = "test conference description", Location = "redmond", Slug = "test", StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.Add(TimeSpan.FromDays(2)), }; service.CreateConference(conference); var seat = new SeatType { Name = "seat", Description = "description", Price = 100, Quantity = 100 }; service.CreateSeat(conference.Id, seat); Assert.Empty(busEvents.OfType<SeatCreated>()); }
internal static void SelectOrderItems(Browser browser, ConferenceInfo conferenceInfo, Table table) { // Navigate to Registration page browser.GoTo(Constants.RegistrationPage(conferenceInfo.Slug)); foreach (var row in table.Rows) { browser.SelectListInTableRow(row["seat type"], row["quantity"]); } }
public ConferenceInfo Post(ConferenceInfo conference) { _tracer.Info(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, "ConferenceController: POST"); if (_user == null) { _tracer.Info(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, "User not found returning 404"); this.NotFound(); } try { conference.Id = GuidUtil.NewSequentialId(); this.service.CreateConference(conference); } catch (System.Exception exc) { _tracer.Error(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, exc); throw; } return conference; }