public ActionResult RegistrationConfirmationPrint(int id) { ParticipantQuery participantQuery = new ParticipantQuery(); ParticipantDTO participantDTO = new ParticipantDTO(); EventQuery eventQuery = new EventQuery(); EventDTO eventDTO = new EventDTO(); UserDTO userDTO = new UserDTO(); UserQuery userQuery = new UserQuery(); ParticipantsViewModel vm = new ParticipantsViewModel(); participantDTO = participantQuery.FindParticipant(id); eventDTO = eventQuery.FindEvent(participantDTO.eventId); userDTO = userQuery.FindCurrentUser(); vm.EventName = eventDTO.Name; vm.NumberOfTicket = participantDTO.NumberOfTicket; vm.EventStartDate = eventDTO.TimeStart; ViewBag.NumberOfTickets = participantDTO.NumberOfTicket; ViewBag.Username = userDTO.Username.Replace("@", "").Replace(".com", ""); ViewBag.UserId = userDTO.Id; ViewBag.EventName = eventDTO.Name; ViewBag.EventId = eventDTO.Id; return(View(vm)); }
public static List <ParticipantDTO> getProcessParticipants(string id_process) { List <ParticipantDTO> participants = new List <ParticipantDTO>(); using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionRRHHDatabase"].ConnectionString)) { SqlCommand command = new SqlCommand("usp_get_process_participants", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@id_processManagment", SqlDbType.Int); command.Parameters["@id_processManagment"].Value = id_process; command.Connection.Open(); SqlDataReader rdr = command.ExecuteReader(); while (rdr.Read()) { ParticipantDTO participant = new ParticipantDTO(); participant.processManagment_id = rdr["processManagment_id"].ToString(); participant.name = rdr["name"].ToString(); participant.user_id = rdr["user_id"].ToString(); participant.sLastName = rdr["sLastName"].ToString(); participant.fLastName = rdr["fLastName"].ToString(); participant.userName = rdr["userName"].ToString(); participant.email = rdr["email"].ToString(); byte[] photo = (byte[])rdr["photoData"]; participant.photoData = Convert.ToBase64String(photo); participants.Add(participant); } }; return(participants); }
public ActionResult Reminders(int id, [Bind(Include = "Reminder, emailNotificationOn, SMSNotificationOn, EventStartDate, PhoneNumber")] RemindersViewModel remindersViewModel) { if (id <= 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (ModelState.IsValid) { ParticipantQuery pq = new ParticipantQuery(); ParticipantDTO pDTO = new ParticipantDTO(); ParticipantDTO pdt = pq.FindParticipant(id); ParticipantsViewModel pvm = new ParticipantsViewModel(); EventQuery eq = new EventQuery(); EventDTO edto = eq.FindEvent(pdt.eventId); pDTO.Reminder = remindersViewModel.Reminder; pDTO.emailNotificationOn = remindersViewModel.emailNotificationOn; pDTO.SMSNotificationOn = remindersViewModel.SMSNotificationOn; pDTO.Id = id; pDTO.Phone = remindersViewModel.PhoneNumber; pq.UpdateParticipantReminders(pDTO); return(RedirectToAction("ReminderConfirmation", "Participants")); } return(View(remindersViewModel)); }
public static Participant ToParticipantDC(ParticipantDTO participantDTO) { Participant participantDC = new Participant() { Id = participantDTO.Id, }; return(participantDC); }
public static ParticipantDTO[] getDTO(Participant[] participants) { ParticipantDTO[] participantDTO = new ParticipantDTO[participants.Length]; for (int i = 0; i < participants.Length; i++) { participantDTO[i] = getDTO(participants[i]); } return(participantDTO); }
public ParticipantDTOBind(ParticipantDTO dto) { Participant = dto.Participant; Probe = ""; foreach (var proba in dto.Probe) { Probe = Probe + proba + ", "; } }
public ActionResult CheckIn(string rawBarcode) { EventQuery eq = new EventQuery(); ParticipantQuery pq = new ParticipantQuery(); ParticipantDTO pDTO = new ParticipantDTO(); CheckInQuery ciq = new CheckInQuery(); CheckInDTO ciDTO = new CheckInDTO(); CheckInRules ciRules = new CheckInRules(); BarcodeQuery bcq = new BarcodeQuery(); bool isValidBarcode = bcq.isValidBarcode(rawBarcode); int CheckInTimeCode = 0; bool isDuplicate = false; string colorCode = ""; if (isValidBarcode) { pDTO = pq.FindParticipantByBarcode(rawBarcode); CheckInTimeCode = ciRules.IsValidCheckInTime(eq.QueryEventTimes(pDTO.eventId)); isDuplicate = ciRules.IsDuplicateCheckIn(ciq.QueryCheckInTimes(rawBarcode)); } if (ModelState.IsValid && CheckInTimeCode == 0 && isDuplicate == false && isValidBarcode) { ciDTO.BarcodeId = bcq.GetBarcodeId(rawBarcode); ciq.CreateCheckIn(ciDTO); colorCode = "green"; return(Json(new { errorColor = colorCode, error = "Checkin is Successful!" })); } string errorMessage = ""; if (CheckInTimeCode == -1) { errorMessage += "The checkin period has not started"; colorCode = "red"; } else if (CheckInTimeCode == 1) { errorMessage += "The checkin period has ended"; colorCode = "red"; } else if (isDuplicate == true) { errorMessage += "This participant has already checked in"; colorCode = "yellow"; } else if (!isValidBarcode) { errorMessage += "This is not a valid barcode"; colorCode = "red"; } return(Json(new { errorColor = colorCode, error = errorMessage })); }
public static ParticipantDTO ToParticipantDTO(Participant participant) { ParticipantDTO participantDTO = new ParticipantDTO() { Id = participant.Id, }; return(participantDTO); }
public static Participant ConvertToEntity(this ParticipantDTO dto) { return(new Participant { Id = dto.Id, User = dto.User?.ConvertToEntity(), StudyId = dto.StudyId, Role = dto.Role, UserId = dto.User?.Id ?? 0 }); }
public async Task <IActionResult> UpdateParticipantAsync(ParticipantDTO participantDTO) { if (!ModelState.IsValid) { return(Ok(ModelState)); } await participantService.UpdateParticipantAsync(participantDTO); return(Ok()); }
public static Participant getFromDTO(ParticipantDTO participantdto) { int idParticipant = participantdto.Id; int idCursa = participantdto.IdCursa; int? idEchipa = participantdto.IdEchipa; string numeParticipant = participantdto.NumeParticipant; string capCilindrica = participantdto.CapCilindrica; string numeEchipa = participantdto.NumeEchipa; return(new Participant(idParticipant, idCursa, idEchipa, numeParticipant, capCilindrica, numeEchipa)); }
public async Task <IActionResult> AddstudyUser([FromBody] ParticipantDTO studyUser) { if (!ModelState.IsValid || studyUser.Id != 0) { return(BadRequest(ModelState)); } var create = await _userLogic.AddUserToStudy(studyUser); return(Ok(create)); }
public async Task <IActionResult> CreateParticipantAsync(ParticipantDTO participantDTO) { if (!ModelState.IsValid) { return(Ok(ModelState)); } var id = await participantService.CreateParticipantAsync(participantDTO); return(Ok(id)); }
private async Task UpdateNameChat(int FolderId, ParticipantDTO participant) { var newName = participant.NewName; var oldName = participant.PersonName; var toUpdate = await _context.Chats.Where(c => c.PersonName == oldName && c.FolderId == FolderId).ToListAsync(); foreach (var item in toUpdate) { item.PersonName = newName; } await _context.SaveChangesAsync(); }
private static async Task UpdateParticipantNo3Async() { var participantNew = new ParticipantDTO { Id = 3, FIO = "Rabindranat Tagor", Birthdate = new DateTime(1890, 12, 11), Email = "qqeq", Phone = "1000 00 000" }; var command = new CreateOrUpdateParticipantCommand(participantNew); await command.ExecuteAsync(); }
private static void UpdateParticipantNo3() { var participantNew = new ParticipantDTO { Id = 3, FIO = Guid.NewGuid().ToString(), Birthdate = new DateTime(1991, 11, 11), Email = "xxxxxx", Phone = "1000 00 000" }; var command = new CreateOrUpdateParticipantCommand(participantNew); command.Execute(); }
public ParticipantDTO[] getParticipantsAndScore() { Console.WriteLine("Get participants and score"); IList <ParticipantDTO> participants = new List <ParticipantDTO>(); foreach (var participant in participantRepo.FindAll()) { Double score = participantRepo.getParticipantScore(participant.Id); ParticipantDTO p = new ParticipantDTO(participant.Id, participant.FirstName, participant.LastName, score); participants.Add(p); } return(participants.ToArray()); }
public async Task <IActionResult> UpdateUserRole([FromBody] ParticipantDTO participant) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var update = await _userLogic.UpdateUserRole(participant); if (update) { return(NoContent()); } return(NotFound()); }
public CreateUpdateParticipantForm(BaseForm form, CUFormDTO <ViewConferencesWithParticipant> formDTO) { caller = form; //form.Hide(); InitializeComponent(); this.db = formDTO.contex; participantDTO = new ParticipantDTO(); crud = new ParticipantCrud(db); subjectCrud = new SubjectCrud(db); currentCrudOp = formDTO.op; this.formDTO = formDTO; isChecked = false; }
public ActionResult RegistrationConfirmation(int id) { ParticipantQuery participantQuery = new ParticipantQuery(); ParticipantDTO participantDTO = new ParticipantDTO(); EventQuery eventQuery = new EventQuery(); EventDTO eventDTO = new EventDTO(); ParticipantsViewModel vm = new ParticipantsViewModel(); //Gary added to give payment confirmation string confirmCode = ""; if (TempData.ContainsKey("ConfirmationCode")) { confirmCode = TempData["ConfirmationCode"].ToString(); } if (confirmCode == "") { ViewBag.Confirmation = ""; } else { ViewBag.Confirmation = "The payment processed successfully. " + "Your confirmation number is " + confirmCode; } participantDTO = participantQuery.FindParticipant(id); eventDTO = eventQuery.FindEvent(participantDTO.eventId); vm.EventName = eventDTO.Name; vm.NumberOfTicket = participantDTO.NumberOfTicket; vm.EventStartDate = eventDTO.TimeStart; vm.Barcodes = participantDTO.Barcodes; vm.Address = eventDTO.Address; vm.City = eventDTO.City; vm.State = eventDTO.State; vm.Zip = eventDTO.Zip; ViewBag.EventId = eventDTO.Id; ViewBag.Location = ($"{vm.Address}, {vm.City}, {vm.State} {vm.Zip}"); return(View(vm)); }
public DialogsPanelViewModel(List <DialogDTO> dialogs, int currentUserId) { Dialogs = new List <DialogViewModel>(); foreach (var dialog in dialogs) { ParticipantDTO anotherUser = GetAnotherUser(dialog.Participants, currentUserId); string body = dialog.Messages.Count > 0 ? dialog.Messages.Last().Body : string.Empty; var dialogViewModel = new DialogViewModel() { DialogId = dialog.Id, UnreadMessagesCount = dialog.Messages.Where(m => !m.Read && m.ToId.Equals(currentUserId)).Count(), UserId = anotherUser.ProfileId, Avatar100 = $"/File/{anotherUser.Profile.Avatar.Square_100Id}", FullName = $"{anotherUser.Profile.FirstName} {anotherUser.Profile.LastName}", TrimmedBody = body.Length > 60 ? body.Substring(0, 60) : body }; Dialogs.Add(dialogViewModel); } }
public ActionResult _AddProcessGroup(string process_id, List <string> selected_groups_id) { if (ModelState.IsValid) { List <ParticipantDTO> groups = new List <ParticipantDTO>(); foreach (var group_id in selected_groups_id) { ParticipantDTO groupParticipantDTO = new ParticipantDTO(); groupParticipantDTO.processManagment_id = process_id; groupParticipantDTO.user_id = group_id; groupParticipantDTO.userLog = Request.Cookies["user_id"].Value; groups.Add(groupParticipantDTO); } List <ParticipantDTO> addedParticipants = processManagmentProvider.postGroups(groups).Result; var result = new { usersAdded = selected_groups_id.Count, viewHtml = PartialView("/Views/Templates/_Template/_Participants/_TemplateParticipantsList.cshtml", new Model.ParticipantsModel(process_id)).RenderToString() }; return(Json(result)); } return(new HttpStatusCodeResult(404, "Can't find that")); }
public async Task <List <ParticipantDTO> > GetChatParticipants(int id) { var participantsDTO = new List <ParticipantDTO>(); var totalMessages = 0; var totalWords = 0; //bring everything already grouped by user var participantsStep1 = await _context.Chats .Where(c => c.FolderId == id) .ToListAsync(); var participants = participantsStep1 .GroupBy(c => c.PersonName); foreach (var participant in participants) { var tFirstMessage = participant.Min(c => c.MessageTime); var tLastMessage = participant.Max(c => c.MessageTime); var tMessages = participant.Select(c => c.Message); var tMessageCount = tMessages.Count(); var tWordCount = 0; foreach (var message in tMessages) { tWordCount = tWordCount + message.Split(new char[] { '.', '?', '!', ' ', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries).Count(); } totalMessages = totalMessages + tMessageCount; totalWords = totalWords + tWordCount; var participantDto = new ParticipantDTO(participant.Key, tFirstMessage, tLastMessage, tMessageCount, tWordCount); participantsDTO.Add(participantDto); } foreach (var participant in participantsDTO) { decimal tMessageCountPercentage = Math.Round((decimal)(participant.MessageCounter * 100) / totalMessages); decimal tWordCountPercentage = Math.Round((decimal)(participant.WordsCounter * 100) / totalWords); participant.AddMessageAndWordPercentage(tMessageCountPercentage, tWordCountPercentage); } return(participantsDTO.OrderBy(c => c.PersonName).ToList()); }
public ActionResult Reminders(int id) { ViewBag.PhoneValidation = ConstantValues.phoneValidation; RemindersViewModel rvm = new RemindersViewModel(); ParticipantQuery pq = new ParticipantQuery(); EventQuery eq = new EventQuery(); ParticipantDTO pDTO = pq.FindParticipant(id); EventDTO evDTO = eq.FindEvent(pDTO.eventId); //Map DTO fields to rvm rvm.EventStartDate = evDTO.TimeStart; rvm.Reminder = pDTO.Reminder; rvm.emailNotificationOn = pDTO.emailNotificationOn; rvm.SMSNotificationOn = pDTO.SMSNotificationOn; return(View(rvm)); }
// This method returns the single Supplier Participant in the particular quote public QuoteParticipantBase GetQuoteParticipant(int companyId, int quoteId) { using (var context = new RFQEntities()) { QuoteParticipant quoteParticipant = new QuoteParticipant(); quoteParticipant = (from participant in context.QuoteParticipants where participant.QuoteID == quoteId && participant.CompanyID == companyId select participant).FirstOrDefault(); QuoteParticipantBase participantToReturn = new ParticipantDTO() { QuoteParticipantID = quoteParticipant.QuoteParticipantID, CompanyID = quoteParticipant.CompanyID, QuoteID = quoteParticipant.QuoteID }; return participantToReturn; } }
public ActionResult _AddProcessUser(string process_id, List <string> selected_userParticipants_id) { if (ModelState.IsValid) { List <ParticipantDTO> participants = new List <ParticipantDTO>(); foreach (var participant_id in selected_userParticipants_id) { ParticipantDTO participantDTO = new ParticipantDTO(); participantDTO.processManagment_id = process_id; participantDTO.user_id = participant_id; participantDTO.userLog = Request.Cookies["user_id"].Value; participants.Add(participantDTO); } List <ParticipantDTO> addedParticipants = processManagmentProvider.postParticipants(participants).Result; int addedCount = addedParticipants.Count; int errorCount = participants.Count - addedCount; var result = new { usersAdded = addedCount, usersError = errorCount, viewHtml = PartialView("/Views/Templates/_Template/_Participants/_TemplateParticipantsList.cshtml", new Model.ParticipantsModel(process_id)).RenderToString() }; return(Json(result)); } return(new HttpStatusCodeResult(404, "Can't find that")); }
public IList <ParticipantDTO> CautaParticipantiByProba(int idPr) { Proba proba = probaRepository.FindOne(idPr); IList <ParticipantDTO> participantDTOs = new List <ParticipantDTO>(); var ids = inscriereRepository.FindParticipantByProba(proba.ID); foreach (int id in ids) { Participant participant = participantRepository.FindOne(id); var idProbe = inscriereRepository.FindProbaByParticipant(id); IList <Proba> probe = new List <Proba>(); foreach (var idProba in idProbe) { Proba findProba = probaRepository.FindOne(idProba); probe.Add(findProba); } ParticipantDTO dto = new ParticipantDTO(participant, probe); participantDTOs.Add(dto); } return(participantDTOs); }
public static bool insertGroup(ParticipantDTO pParticipantDTO) { using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionRRHHDatabase"].ConnectionString)) { SqlCommand command = new SqlCommand("usp_insert_processGroup", connection); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add("@id_processManagment", SqlDbType.Int); command.Parameters["@id_processManagment"].Value = pParticipantDTO.processManagment_id; command.Parameters.Add("@group_id", SqlDbType.NVarChar); command.Parameters["@group_id"].Value = pParticipantDTO.user_id; command.Parameters.Add("@userLog", SqlDbType.Int); command.Parameters["@userLog"].Value = pParticipantDTO.userLog; command.Connection.Open(); int result = command.ExecuteNonQuery(); if (result != 0) { return(true); } return(false); }; }
public async Task <bool> UpdateUserRole(ParticipantDTO participant) { var update = await _participantRepo.UpdateAsync(participant); return(update); }
private Task <SimpleParticipantPersonDTO> DoCreateOrUpdateParticipantPersonAsync(int projectId, ParticipantDTO participant) { var model = new UpdatedParticipantPersonBindingModel { HomeInstitutionAddressId = null, HomeInstitutionId = null, HostInstitutionAddressId = null, HostInstitutionId = null, ParticipantStatusId = participant.StatusId, ParticipantId = participant.ParticipantId, ParticipantTypeId = participant.ParticipantTypeId, }; return(DoCreateOrUpdateParticipantPersonAsync(projectId, model)); }
public void AddParticapant(ParticipantDTO participantDTO) { var participant = Mapper.Map <ParticipantDTO, Participant>(participantDTO); repository.Create(participant); }