public ConferenceModel GetConferenceById(int id) { string commandText = "select ConferenceName, LocationName, ConferencePeriod from vwConferenceDetails where ConferenceId = @Id "; SqlCommand sqlCommand = new SqlCommand(commandText, _sqlConnection); sqlCommand.Parameters.Add("@Id", SqlDbType.Int); sqlCommand.Parameters["@Id"].Value = id; SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); ConferenceModel conference = new ConferenceModel(); //Console.WriteLine(sqlDataReader); sqlDataReader.Read(); conference.ConferenceName = sqlDataReader.GetString("ConferenceName"); conference.Location = sqlDataReader.GetString("LocationName"); conference.Period = sqlDataReader.GetString("ConferencePeriod"); sqlDataReader.Close(); return(conference); }
/// <summary> /// 查询内部与会人员信息 /// </summary> private void InQuery() { try { dgvInConMember.Rows.Clear(); ExecutorBLL InConMember = new ExecutorBLL(); List <EmployeeModel> EmployeeList = new List <EmployeeModel>(); ConferenceModel Conid = new ConferenceModel(); Conid.ConId = Convert.ToInt32(conid); EmployeeList = InConMember.GetInConMemberInfo(Conid); int n = 0; foreach (EmployeeModel employee in EmployeeList) { dgvInConMember.Rows.Add(); dgvInConMember.Rows[n].Cells["ColumnEmId"].Value = employee.EmId; dgvInConMember.Rows[n].Cells["ColumnEmName"].Value = employee.EmName; dgvInConMember.Rows[n].Cells["ColumnEmPermission"].Value = employee.EmPermission; dgvInConMember.Rows[n].Cells["ColumnEmSex"].Value = employee.EmSex; dgvInConMember.Rows[n].Cells["ColumnEmDepart"].Value = employee.EmDepart; dgvInConMember.Rows[n].Cells["ColumnEmPhone"].Value = employee.EmPhone; dgvInConMember.Rows[n].Cells["ColumnEmEmail"].Value = employee.EmEmail; dgvInConMember.Rows[n].Cells["ColumnEmCompany"].Value = employee.EmCompany; dgvInConMember.Rows[n].Cells["ColumnEmDuties"].Value = employee.EmDuties; n++; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
}//function IsConExist /// <summary> /// 判断会议室当前时段是否存在会议 /// </summary> /// <param name="bdrId">会议室ID</param> /// <param name="bdrId">开始时间</param> /// <param name="bdrId">结束时间</param> /// <returns>操作成功返回true,失败返回false</returns> /// 作者:王宇昊 /// 创建时间:2014-09-19 /// 修改时间: public bool IsConExist(int bdrId,DateTime start ,DateTime end) { try { string strSqlCmd; // sql命令存放语句 strSqlCmd = string.Format("select * from Conference where ConPlace='{0}' and ConStartTime < '{2}' and ConEndTime > '{1}'", bdrId, start.ToString("yyyy-MM-dd HH:mm:ss"), end.ToString("yyyy-MM-dd HH:mm:ss")); DataSet data = SqlHelperDB.GetDataSet(DB.SqlHelperDB.ConnectionString, strSqlCmd, "Conference"); List<ConferenceModel> ConferenceList = new List<ConferenceModel>(); foreach (DataRow row in data.Tables["Conference"].Rows) { ConferenceModel Conference = new ConferenceModel(); ConferenceList.Add(Conference); } if (ConferenceList.Count > 0) { return true ; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } }//function IsConExist
public void EditConference(ConferenceModel conference) { Conference EFconference = context.Conference.Include(conf => conf.Location) .ThenInclude(location => location.DictionaryCity) .Include(conf => conf.ConferenceXdictionarySpeaker) .Where(conf => conf.ConferenceId == conference.ConferenceId) .FirstOrDefault(); EFconference.ConferenceName = conference.ConferenceName; EFconference.OrganizerEmail = conference.OrganizerEmail; EFconference.OrganizerName = conference.OrganizerName; EFconference.Location.AdressDetails = conference.AdressDetails; EFconference.StartDate = conference.StartDate; EFconference.EndDate = conference.EndDate; EFconference.DictionaryConferenceCategoryId = conference.DictionaryConferenceCategoryId; EFconference.DictionaryConferenceTypeId = conference.DictionaryConferenceTypeId; EFconference.Location.DictionaryCityId = conference.DictionaryCityId; EFconference.ConferenceXdictionarySpeaker = conference.Speakers.Select(confSpeaker => new ConferenceXdictionarySpeaker { DictionarySpeakerId = confSpeaker.DictionarySpeakerId, IsMainSpeaker = confSpeaker.IsMainSpeaker, }).ToList(); context.SaveChanges(); }
public Task Add(ConferenceModel model) { model.Id = conferences.Max(c => c.Id) + 1; conferences.Add(model); return(Task.CompletedTask); }
protected virtual ConferenceModel PopulateModel(DynamicContent conference) { var images = conference.GetRelatedItems <Image>("Images"); var imagesModels = new List <ImageModel>(); foreach (var img in images) { var model = new ImageModel(); model.Title = img.Title; model.AlternativeText = img.AlternativeText; model.ThumbnailUrl = img.ResolveThumbnailUrl(); imagesModels.Add(model); } var sessions = conference.GetRelatedItems <DynamicContent>("Sessions"); var sessionsModels = new List <SessionModel>(); foreach (var session in sessions) { var model = new SessionModel(); model.Title = session.GetValue <Lstring>("Title"); model.Duration = session.GetValue <decimal?>("Duration"); model.DetailUrl = session.GetDefaultUrl(); sessionsModels.Add(model); } var conferenceModel = new ConferenceModel(); conferenceModel.Images = imagesModels; conferenceModel.Sessions = sessionsModels; return(conferenceModel); }
public List <ConferenceModel> getConferences() { DBConnection testconn = new DBConnection(); string query = "SELECT title, start_date, end_date, isLive, conference_code, tagline, processing_fee, members_only FROM Conference WHERE getdate() < start_date AND isLive = 1 AND max_attendees > attendees"; SqlDataReader dataReader = testconn.ReadFromTest(query); List <ConferenceModel> conferences = new List <ConferenceModel>(); if (dataReader.HasRows) { while (dataReader.Read()) { string title = dataReader.GetValue(0).ToString(); string start_date = dataReader.GetValue(1).ToString(); string end_date = dataReader.GetValue(2).ToString(); bool isLive = (bool)dataReader.GetValue(3); int conference_code = Int32.Parse(dataReader.GetValue(4).ToString()); string tagline = dataReader.GetValue(5).ToString(); string processing_fee = dataReader.GetValue(6).ToString(); bool members_only = (bool)dataReader.GetValue(7); ConferenceModel conference = new ConferenceModel(title, start_date, end_date, isLive, conference_code); conference.tagline = tagline; conference.tickets = getAssociatedTickets(conference_code); conference.location = getAssociatedLocation(conference_code); conference.processing_fee = processing_fee; conference.members_only = members_only; conferences.Add(conference); } } testconn.CloseDataReader(); testconn.CloseConnection(); return(conferences); }
public Task <int> Add(ConferenceModel model) { var entity = Conference.FromModel(model); dbContext.Conferences.Add(entity); return(dbContext.SaveChangesAsync()); }
public void EditConference(ConferenceModel conference) { try { SqlCommand sqlCommand = _sqlConnection.CreateCommand(); sqlCommand.Connection = _sqlConnection; sqlCommand.Parameters.AddWithValue("@ConferenceId", conference.ConferenceId); sqlCommand.Parameters.AddWithValue("@ConferenceName", conference.ConferenceName); sqlCommand.Parameters.AddWithValue("@OrganizerEmail", conference.OrganizerEmail); sqlCommand.Parameters.AddWithValue("@OrganizerName", conference.OrganizerName); sqlCommand.Parameters.AddWithValue("@StartDate", conference.StartDate); sqlCommand.Parameters.AddWithValue("@EndDate", conference.EndDate); sqlCommand.Parameters.AddWithValue("@DictionaryConferenceCategoryId", conference.DictionaryConferenceCategoryId); sqlCommand.Parameters.AddWithValue("@DictionaryConferenceTypeId", conference.DictionaryConferenceTypeId); sqlCommand.Parameters.AddWithValue("@LocationId", conference.LocationId); sqlCommand.CommandText = "UPDATE Conference" + " SET ConferenceName = @ConferenceName," + " OrganizerEmail = @OrganizerEmail," + " OrganizerName = @OrganizerName," + " StartDate = @StartDate," + " EndDate = @EndDate," + " DictionaryConferenceCategoryId = @DictionaryConferenceCategoryId," + " DictionaryConferenceTypeId = @DictionaryConferenceTypeId," + " LocationId = @LocationId)" + " WHERE ConferenceId = @ConferenceId"; int rowsEdited = sqlCommand.ExecuteNonQuery(); } catch (Exception e) { Debug.WriteLine(e.Message); } }
public void UpdateConference(ConferenceModel conference) { Conference c = ConvertToConference(conference); db.Entry(c).State = EntityState.Modified; db.SaveChanges(); }
private ConferenceModel GetConSort(List <ConferenceModel> list) { ConferenceModel Result = new ConferenceModel(); //排序 List <ConferenceModel> AfterNow = new List <ConferenceModel>(); foreach (ConferenceModel con in list) { if (con.ConEndTime > DateTime.Now) { AfterNow.Add(con); } } if (AfterNow.Count != 0) { for (int i = 0; i < AfterNow.Count; i++) { for (int j = 0; j < i; j++) { if (AfterNow[j].ConEndTime > AfterNow[j + 1].ConEndTime) { ConferenceModel temp = AfterNow[j]; AfterNow[j] = AfterNow[j + 1]; AfterNow[j + 1] = temp; } } } } else { throw new Exception("您接下来没有任何会议"); } Result = AfterNow[0]; return(Result); }
public async Task <IActionResult> Put(ConferenceModel model) { if (model == null || string.IsNullOrEmpty(model.Data.Id)) { return(BadRequest()); } var streamId = _conferenceService.GetConferenceId(model); if (model.Data.Seats > 0) { var availableSeats = _conferenceService.GetAvailableSeats(streamId); if (model.Event.Equals("Conference.SeatsRemoved") && model.Data.Seats > availableSeats) { return(BadRequest("Not enough seats available")); } } var sequence = _conferenceService.GetNext(streamId); var insertedEntity = await _conferenceService.InsertEntityAsync(streamId, sequence, model); await _conferenceService.InsertQueueMessageAsync(streamId, sequence); return(Ok(insertedEntity)); }
private void OrganizerDataGrid_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == OrganizerDataGrid.Columns["edit_column"].Index) { int id = (int)OrganizerDataGrid.Rows[e.RowIndex].Cells["ConferenceId"].Value; var t = Task.Run(() => GetConferenceById(id)); t.Wait(); ConferenceModel conference = t.Result; var varAddConf = new AddConf(conference, _conferenceRepository, _countryRepository, _countyRepository, _speakerRepository, _typeRepository, _cityRepository, _categoryRepository); varAddConf.ShowDialog(); } if (e.ColumnIndex == OrganizerDataGrid.Columns["delete_column"].Index) { int id = (int)OrganizerDataGrid.Rows[e.RowIndex].Cells["ConferenceId"].Value; var varDeleteConference = new AreYouSure(_conferenceRepository, id); varDeleteConference.ShowDialog(); } }
public string GetConferenceId(ConferenceModel model) { var id = !string.IsNullOrEmpty(model.Data.Id) ? model.Data.Id : Guid.NewGuid().ToString(); model.Data.Id = id; return($"conference-{id}"); }
public Task Add(ConferenceModel model) { model.Id = conferences.Max(c => c.Id) + 1; model.EncryptedId = protector.Protect(model.Id.ToString()); conferences.Add(model); return(Task.CompletedTask); }
}// function InConMemberRegister /// <summary> /// 生成外部人员签到表 /// </summary> /// <param name="conference"></param> /// <returns></returns> /// 作者:王宇昊 /// 创建时间:2014-09-19 /// 修改时间: public List <OutConMemberModel> GetOutConMemberRegisterInfo(ConferenceModel conference) { List <OutConMemberModel> list = new List <OutConMemberModel>(); OutConMemberDAL OCMDAL = new OutConMemberDAL(); list = OCMDAL.GetConRecord(conference.ConId); return(list); }// function GetOutConMemberRegisterInfo
public async Task <IActionResult> Add([FromBody] ConferenceModel conference) { return(await Task.Run(async() => { ConferenceModel model = await this._repository.Add(conference).ConfigureAwait(false); return model != null ? await Task.FromResult <IActionResult>(new ObjectResult(model)) : NotFound(conference); })); }
public async Task <IActionResult> Index(int conferenceId) { ConferenceModel conference = await conferenceService.GetById(conferenceId); ViewBag.Title = $"Proposals for Conference {conference.Name} {conference.Location}"; ViewBag.ConferenceId = conferenceId; return(View(await proposalService.GetAll(conferenceId))); }
public async Task <ConferenceModel> Add(ConferenceModel model) { return(await Task.Run(async() => { HttpResponseMessage message = await this._client.PostAsJsonAsync("v1/Conference", model); return await message.Content.ReadAsAsync <ConferenceModel>().ConfigureAwait(false); }).ConfigureAwait(false)); }
}// function GetInConMemberInfo /// <summary> /// 生成内部与会人员签到表 /// </summary> /// <param name="conference">会议的实体类</param> /// <returns>一组内部与会人员状态</returns> /// 作者:王宇昊 /// 创建时间:2014-09-22 /// 修改时间: public List <InConMemberModel> GetInConMemberRegisterInfo(ConferenceModel conference) { List <InConMemberModel> list = new List <InConMemberModel>(); InConMemberDAL ICMDAL = new InConMemberDAL(); list = ICMDAL.GetInConRecord(conference.ConId); return(list); }// function GetInConMemberRegisterInfo
public async Task <IActionResult> Add(ConferenceModel conferenceModel) { if (ModelState.IsValid) { await ConferenceService.Add(conferenceModel); } return(RedirectToAction("index")); }
public async Task <IActionResult> Add(ConferenceModel model) { if (this.ModelState.IsValid) { await this._service.Add(model).ConfigureAwait(false); } return(RedirectToAction("Index")); }
public Task <ConferenceModel> Add(ConferenceModel model) { return(Task.Run(() => { model.Id = _conferences.Max(c => c.Id) + 1; _conferences.Add(model); return model; })); }
public ActionResult Delete(int id, ConferenceModel REM) { Conference RE = resEvSer.GetById(id); resEvSer.Delete(RE); resEvSer.Commit(); return(RedirectToAction("Index")); }
public static Conference FromModel(ConferenceModel model) { return(new Conference { Location = model.Location, Name = model.Name, Start = model.Start }); }
public IActionResult Add(ConferenceModel model) { if (ModelState.IsValid) { repo.Add(model); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Add(ConferenceModel model) { if (ModelState.IsValid) { await _conferenceService.Add(model); } return(RedirectToAction(nameof(Index))); }
public async Task <ActionResult> Create() { ConferenceModel newConference = new ConferenceModel(); newConference.ProfileId = await GetCurrentProfileId(); newConference.Date = new DateTime(2016, 01, 01); return(View(newConference)); }
public async Task <IActionResult> Add(ConferenceModel model) { if (ModelState.IsValid) { await repo.Add(model); } return(RedirectToAction("Index")); }
[HttpPost]/*, ValidateAntiForgeryToken]*/ public ActionResult ConferenceSave(ConferenceModel model) { if (ModelState.IsValid && MainObject.CheckUserHasWriteAccess(model.MainId)) { model.Save(); } return(null); }