protected void RemindForParticipant(int?remindType, SysProcessParticipant part, SysProcessRemindTemplate template) { if (template == null) { throw new ApplicationException("RemindTemplate为空"); } foreach (IUser user in ParticipantHelper.GetUsers(this._context, part, this.PI, this.AI, this.creator.WiOwnerId).Distinct <IUser>()) { string str3; this.AddRemindToken(user); string remindTitleByTemplate = this.creator.GetRemindTitleByTemplate(template, user); string remindContentByTemplate = this.creator.GetRemindContentByTemplate(template, user); int valueOrDefault = remindType.GetValueOrDefault(); if (remindType.HasValue) { switch (valueOrDefault) { case 0: if (this.EmailHandler == null) { throw new ApplicationException("未找到邮件服务,无法发送邮件提醒"); } this.EmailHandler.SendEmail(user, remindTitleByTemplate, remindContentByTemplate, this.Model.AprovePageOuterURL, this.Model.ProcessDetailOuterURL); break; case 1: if (this.ShortMessageHandler == null) { throw new ApplicationException("未找到短信服务,无法发送短信提醒"); } goto Label_00EA; case 2: if (this.CustomRemindHandler == null) { throw new ApplicationException("未找到自定义提醒服务,无法处理自定义提醒"); } goto Label_013F; } } continue; Label_00EA: str3 = null; if (string.IsNullOrEmpty(remindTitleByTemplate)) { str3 = remindContentByTemplate; } else { StringBuilder builder = new StringBuilder(remindTitleByTemplate); builder.AppendLine(); builder.AppendLine(remindContentByTemplate); str3 = builder.ToString(); } this.ShortMessageHandler.SendMessage(user, str3); continue; Label_013F: this.CustomRemindHandler.Execute(user, remindTitleByTemplate, remindContentByTemplate, this.PI, this.AI, this.WorkItem, this.Model); } }
public IHttpActionResult GetParticipantAttendance(int course_id) { var user_id = APIUtils.GetUserFromClaim(ClaimsPrincipal.Current); var attendance = ParticipantHelper.GetParticipantAttendance(user_id, course_id); return(Ok(new ApiCallbackMessage(attendance.ToString(), true))); }
// GET: Courses/Edit/courseId // returns edit view where a teacher can modify the course's data public ActionResult Edit(int?courseId) { if (courseId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } int id = (int)courseId; Course course = CourseHelper.GetById(id); if (course == null) { return(HttpNotFound()); } // check if the user trying to access the course is a supervisor var supervisors = SupervisorHelper.GetSupervisorsForCourse(id); // if he isn't, then return him => denied if (!supervisors.Any(x => x.UserID == CurrentWebContext.CurrentUser.UserID)) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } // create the viewmodel var viewModel = DetailedCourseVM.CreateDetailedCourseVMW(course, supervisors); ViewBag.CountOfPendingStudents = ParticipantHelper.GetCountOfPendingParticipants(id); return(View(viewModel)); }
public override IList <IUser> GetUsers(SysProcessParticipant part, SysProcessInstance pi, SysActivityInstance ai) { List <IUser> source = new List <IUser>(); using (IEnumerator <SysActivityParticipant> enumerator = ai.Activity.ActivityParticipants.GetEnumerator()) { while (enumerator.MoveNext()) { Func <SysProcessParticipant, bool> predicate = null; SysActivityParticipant p = enumerator.Current; if (predicate == null) { predicate = i => i.ParticipantId == p.ParticipantId; } SysProcessParticipant participant = pi.Process.ProcessParticipants.FirstOrDefault <SysProcessParticipant>(predicate); if (participant != null) { int? wiOwnerId = null; List <IUser> collection = ParticipantHelper.GetUsers(base._context, participant, pi, ai, wiOwnerId); source.AddRange(collection); } } } return(source.Distinct <IUser>().ToList <IUser>()); }
public UserParticipantVM(User user, Participant participant) { this.UserID = user.UserID; this.FirstName = user.FirstName; this.LastName = user.LastName; this.Email = user.Email; this.CourseID = participant.CourseID; this.AttendancePercentage = ParticipantHelper.GetParticipantAttendance(UserID, CourseID); }
// GET: Participant public ActionResult Index() { if (Session["Username"] == null) { return(RedirectToAction("Index", "Login")); } var listOfParticipant = ParticipantHelper.GetListAllParticipant(); return(View(listOfParticipant)); }
public ActionResult Delete(string ID) { bool result = ParticipantHelper.DeleteParticipant(ID); if (result) { return(RedirectToAction("Index")); } return(View()); }
public void ApproveParticipant(int userId, int courseId) { var participant = ParticipantHelper.GetById(userId, courseId); if (participant == null) { return; } participant.ParticipantStatus = Participant.STATUS_ACTIVE; participant.Update(); }
public ActionResult Index() { if (Session["Username"] == null) { return(RedirectToAction("Index", "Login")); } ViewBag.TotalEvent = EventHelper.GetTotalEvent(); ViewBag.TotalComingEvent = EventHelper.GetTotalComingEvent(); ViewBag.TotalPastEvent = EventHelper.GetTotalPastEvent(); ViewBag.TotalParticipant = ParticipantHelper.GetTotalParticipant(); var listOfEvent = EventHelper.Get5ComingEvent(); return(View(listOfEvent)); }
public UtilisationEntity() { InitializeComponent(); var task = ParticipantHelper.SelectLoLPlayersAsync(); task.Wait(); List <Participant_NomCompte> data = task.Result; var tupleList = new List <Tuple <string, string> >(); foreach (var p in data) { tupleList.Add(Tuple.Create(p.Participant.matricule, p.NomCompte)); } dgComptes.ItemsSource = tupleList; }
public ActionResult Edit(string id) { if (Session["Username"] == null) { return(RedirectToAction("Index", "Login")); } var listOfType = ParticipantTypeHelper.GetAllListParticipantType(); ViewBag.ParticipantType = listOfType.Select(x => new SelectListItem { Text = x.Name, Value = x.ID.ToString() }).ToList(); var item = ParticipantHelper.GetDetailParticipant(id); if (item.Gender.Equals("Laki-Laki")) { var listOfGender = new List <SelectListItem> { new SelectListItem { Text = "Laki-Laki", Value = "Laki-Laki", Selected = true }, new SelectListItem { Text = "Perempuan", Value = "Perempuan" } }; ViewBag.Gender = listOfGender; } else { var listOfGender = new List <SelectListItem> { new SelectListItem { Text = "Laki-Laki", Value = "Laki-Laki" }, new SelectListItem { Text = "Perempuan", Value = "Perempuan", Selected = true } }; ViewBag.Gender = listOfGender; } return(View(item)); }
public ActionResult Edit(Participant participant) { if (!participant.Password.Equals(participant.ConfirmPassword)) { TempData["msg"] = "<script>alert('Confirm password not match');</script>"; return(RedirectToAction("Edit")); } else { var result = ParticipantHelper.EditParticipant(participant); if (result) { return(RedirectToAction("Index")); } else { TempData["msg"] = "<script>alert('Failed to Insert Data');</script>"; return(RedirectToAction("Edit")); } } }
static void Main(string[] args) { #region Enums DateTime today = DateTime.Now; // example of casting into integer int dayOfWeek = (int)today.DayOfWeek; //Console.WriteLine(dayOfWeek); // this is an edge case, we ussualy compare enum to enum if (dayOfWeek == (int)DaysOfWeek.Friday) { //Console.WriteLine("PARTYYYY !!"); } #endregion // Creating objects from class Participant Participant trainer1 = new Participant("Dejan", "Jovanov", 28, AcademyRole.CoTrainer); // trainer1.Role = AcademyRole.CoTrainer; // trainer1.PrintParticipant(); Participant trainer2 = new Participant("Kristina", "Spasevska", 33, AcademyRole.CoTrainer); Participant student1 = new Participant("Radmila", "Sokolovska", 34, AcademyRole.Student); Participant student2 = new Participant("Blagoja", "Grozdanovski", 30, AcademyRole.Student); Participant[] academyParticipants = new Participant[] { trainer1, trainer2, student1, student2 }; // Using helper method which is defined with STATIC access modifier, and can be // invoked without instanciating object from the class ParticipantHelper.FindParticipantByRole(AcademyRole.CoTrainer, academyParticipants); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Participant trainer = new Participant("Kristina", "Spasevska", 34, AcademyRole.Trainer); Participant assistant = new Participant("Panche", "Manaskov", 21, AcademyRole.Assistant); Participant student01 = new Participant("Ceca", "Vasileva", 18, AcademyRole.Student); Participant student02 = new Participant("Ivan", "Jamandilov", 22, AcademyRole.Student); Participant[] academyParticipants = new Participant[] { trainer, assistant, student01, student02 }; // using helper service class with static method // we do not instantiate with new ParticipantHelper.FindParticipantByRole(AcademyRole.Trainer, academyParticipants); Console.ReadLine(); }
// GET: Courses/SeeDetailedOverview/courseId&studentId // returns detailed overviev view for the specified student and targeted course public ActionResult SeeDetailedOverview(int courseId, int studentId) { Course course = CourseHelper.GetById(courseId); User student = UserHelper.GetById(studentId); if (course == null || student == null) { return(HttpNotFound()); } var isSupervisor = SupervisorHelper.IsUserSupervisor(CurrentWebContext.CurrentUser.UserID, courseId); if (!isSupervisor) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } ViewBag.AttendancePerformance = ParticipantHelper.GetParticipantAttendance(student.UserID, course.CourseID); var vm = DetailedOverviewForStudentVM.CreateDetailedOverviewForStudentVM(student, course); return(View(vm)); }
// GET: Courses/Details/courseId // returns details view with all related data depending on the logged in user public ActionResult Details(int?courseId) { if (courseId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // cast nullable int int id = (int)courseId; Course course = CourseHelper.GetById(id); if (course == null) { return(HttpNotFound()); } DetailedCourseVM viewModel = null; // check if the current user is a student and setup accordingly the view model if (CurrentWebContext.CurrentUser.Type == "student") { ViewBag.IsParticipant = false; viewModel = new DetailedCourseVM(course); viewModel.Lectures = LectureHelper.GetLecturesForCourse(course.CourseID); // get the type of student for this course ViewBag.StatusOfStudent = CourseHelper.GetStudentStatusForCourse(CurrentWebContext.CurrentUser.UserID, course.CourseID); } // check if the current user is a teacher and create the view model for him if (CurrentWebContext.CurrentUser.Type == "teacher") { viewModel = DetailedCourseVM.CreateDetailedCourseVMW(course); ViewBag.CountOfPendingStudents = ParticipantHelper.GetCountOfPendingParticipants(id); } return(View(viewModel)); }
public void DeleteParticipant(int userId, int courseId) { ParticipantHelper.DeleteParticipant(userId, courseId); }
static void Main(string[] args) { Participant participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; participant1.Greetings(); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; participant3.PrintFullName(); var participant4 = new Participant() { FirstName = "Tupac", LastName = "Shakur", Subjects = new Subject[2] }; //Added Subjects with Tools #region MyRegion var cSharBasic = new Subject(); cSharBasic.Title = "C# Basic"; cSharBasic.Semester = 2; cSharBasic.Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" }; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; cSharpAdvanced.Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" }; #endregion participant4.PrintFullName(); var participants = new Participant[4]; participants[0] = participant1; participants[1] = participant2; participants[2] = participant3; participants[3] = participant4; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); //Added more Participant with subjects and tools, from 1st semester #region MyRegion var introductionTrainer = new Participant() { FirstName = "Risto", LastName = "Panchevski", Role = AcademyRole.Trainer, Subjects = new Subject[] { new Subject() { Title = "Introduction to Web Development", Semester = 1 } } }; var htmlCssTrainer = new Participant() { FirstName = "Jane", LastName = "Dimeski", Role = AcademyRole.Trainer, Subjects = new Subject[] { new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } }, new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } } } }; var htmlCssAssistant = new Participant() { FirstName = "Vukashin", LastName = "Obradovikj", Role = AcademyRole.Assistant, Subjects = new Subject[] { new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } }, new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } } } }; var jsBasicCotrainer = new Participant() { FirstName = "Trajan", LastName = "Stevkovski", Role = AcademyRole.Cotrainer, Subjects = new Subject[] { new Subject() { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } } } }; var jsCotrainer = new Participant() { FirstName = "Ivo", LastName = "Kostovski", Role = AcademyRole.Cotrainer, Subjects = new Subject[] { new Subject() { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } }, new Subject() { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } } } }; var jsAdvancedCotrainer = new Participant() { FirstName = "Aleksandar", LastName = "Kocevski", Role = AcademyRole.Cotrainer, Subjects = new Subject[] { new Subject() { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } } } }; var firstSemesterTrainers = new Participant[6]; firstSemesterTrainers[0] = introductionTrainer; firstSemesterTrainers[1] = htmlCssTrainer; firstSemesterTrainers[2] = htmlCssAssistant; firstSemesterTrainers[3] = jsBasicCotrainer; firstSemesterTrainers[4] = jsCotrainer; firstSemesterTrainers[5] = jsAdvancedCotrainer; ParticipantHelper.PrintTrainersAndAssistantsFrom1stSemester(firstSemesterTrainers); #endregion Console.ReadLine(); }
//methods public override void OnStartServer() { ph = this; pm = this.GetComponent <ParticipantManager>(); setBotWalkPointsAndSpawnPoints(); }
static void Main(string[] args) { //var assistant = new Assistant(); //var student = new Student(); Trainer trainer = new Trainer("Miodrag", "Cekikj"); trainer.DateOfBirth = new DateTime(1989, 5, 15); //trainer.Role = AcademyRole.Trainer; int[] numbers = new int[] { 1, 2, 3 }; trainer.Subjects = new Subject[] { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } } }; trainer.Greetings(); var assistant = new Assistant(); assistant.FirstName = "Goce"; assistant.LastName = "Kabov"; assistant.DateOfBirth = new DateTime(1992, 5, 15); assistant.Role = AcademyRole.Assistant; assistant.Greetings(); var student1 = new Participant("Bob", "Marley"); student1.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; student1.PrintFullName(); var student2 = new Participant() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; //participant4.Subjects = new string[] {"C# Basic", "C# Advanced"}; student2.Subjects = new Subject[] { cSharpBasic, cSharpAdvanced }; foreach (var subject in student2.Subjects) { Console.WriteLine(subject.Title); } student2.PrintFullName(); var participants = new Participant[4]; participants[0] = trainer; participants[1] = assistant; participants[2] = student1; participants[3] = student2; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
static void Main(string[] args) { Trainer trainer = new Trainer("Miodrag", "Cekikj"); trainer.DateOfBirth = new DateTime(1989, 5, 15); trainer.Subjects = new List <Subject> { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } } }; trainer.Greetings(); var assistant = new Assistant(); assistant.FirstName = "Goce"; assistant.LastName = "Kabov"; assistant.DateOfBirth = new DateTime(1992, 5, 15); assistant.Greetings(); var bob = new Assistant("Bob", "Marley"); bob.Role = AcademyRole.Assistant; bob.Subjects = new List <Subject> { new Subject { Title = ".NET", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, new Subject { Title = ".NET - Advanced ", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, }; Console.ForegroundColor = ConsoleColor.Yellow; var student = new Student() { FirstName = "Dimitar", LastName = "Risteski", DateOfBirth = new DateTime(1988, 5, 15), }; student.Subjects = new List <Subject> { new Subject { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, new Subject { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, }; student.Greetings(); foreach (var subject in student.Subjects) { Console.WriteLine(subject.Title); } var student2 = new Student() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; student2.Subjects = new List <Subject>(); student2.Subjects.Add(cSharpBasic); student2.Subjects.Add(cSharpAdvanced); foreach (var subject in student2.Subjects) { Console.WriteLine(subject.Title); } var participants = new Queue <Participant>(); participants.Enqueue(trainer); participants.Enqueue(assistant); participants.Enqueue(bob); participants.Enqueue(student); participants.Enqueue(student2); ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Assistant); ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Student); Console.ReadLine(); }
static void Main(string[] args) { var participants = new Participant(); //Filling the list with participants participants.Participants.Add( new Participant() { FirstName = "Goce", LastName = "Kabov", DateOfBirth = new DateTime(1992, 5, 15), Role = AcademyRole.Assistant }); participants.Participants.Add(new Participant() { FirstName = "Vukashin", LastName = "Obradovikj", DateOfBirth = new DateTime(1989, 3, 15), Role = AcademyRole.Assistant }); participants.Participants.Add(new Participant() { FirstName = "Maja", LastName = "Jovanovska", DateOfBirth = new DateTime(1987, 5, 25), Role = AcademyRole.Student }); participants.Participants.Add(new Participant() { FirstName = "Ljupco", LastName = "Kalkov", DateOfBirth = new DateTime(1987, 4, 1), Role = AcademyRole.Student }); participants.Participants.Add(new Participant() { FirstName = "Biljana", LastName = "Davidovska", DateOfBirth = new DateTime(1984, 5, 15), Role = AcademyRole.Student }); var miodrag = new Participant() { FirstName = "Miodrag", LastName = "Cekic", DateOfBirth = new DateTime(1989, 5, 15), Role = AcademyRole.Trainer, }; var jane = new Participant() { FirstName = "Jane", LastName = "Dimeski", DateOfBirth = new DateTime(1989, 2, 15), Role = AcademyRole.Trainer }; var trajan = new Participant() { FirstName = "Trajan", LastName = "Stevkovski", DateOfBirth = new DateTime(1989, 6, 15), Role = AcademyRole.Trainer }; var ivo = new Participant() { FirstName = "Ivo", LastName = "Kostovski", DateOfBirth = new DateTime(1989, 5, 15), Role = AcademyRole.Trainer }; var aleksandar = new Participant() { FirstName = "Aleksandar", LastName = "Kocevski", DateOfBirth = new DateTime(1989, 5, 15), Role = AcademyRole.Assistant }; participants.Participants.AddRange(new List <Participant>() { ivo, trajan, aleksandar, jane }); //Filling the list with Subjects var cSharpBasic = (new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" } }); var cSharpAdvanced = (new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" } }); var jsBasic = (new Subject() { Title = "JS Basic", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } }); var jsAdvanced = (new Subject() { Title = "JS Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } }); var html = (new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "SublimeText3", AlternativeIDE = "SublimeText" } }); var css = (new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "SublimeText3", AlternativeIDE = "SublimeText" } }); participants.Subjects.AddRange(new List <Subject>() { html, css, jsBasic, jsAdvanced, cSharpBasic, cSharpAdvanced }); participants.SubjectTrainers.Add(jane, html); participants.SubjectTrainers.Add(trajan, jsBasic); participants.SubjectTrainers.Add(ivo, jsAdvanced); participants.SubjectTrainers.Add(miodrag, cSharpBasic); ParticipantHelper.PrintAllParticipants(participants.Participants); ParticipantHelper.FindParticipantByRole(participants.Participants, AcademyRole.Student); ParticipantHelper.PrintSubjects(participants.Subjects); ParticipantHelper.PrintTrainersBySubjects(participants.SubjectTrainers); Console.WriteLine(DateTime.Today.Month); Console.WriteLine(DateTime.Today.Day); Console.WriteLine(DateTime.Today); Console.ReadLine(); }
static void Main(string[] args) { Participant participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; participant1.Subjects = new Subject[] { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } } }; participant1.Greetings(); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); participant2.Subjects = new Subject[] { new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime", AlternativeIDE = "N/A", } }, new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime", AlternativeIDE = "N/A", } } }; var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; participant3.PrintFullName(); participant3.Subjects = new Subject[] { new Subject { Title = ".NET", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, new Subject { Title = ".NET - Advanced ", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, }; var participant4 = new Participant() { FirstName = "Dimitar", LastName = "Risteski", Role = AcademyRole.Student, }; participant4.Subjects = new Subject[] { new Subject { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, new Subject { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, }; Console.BackgroundColor = ConsoleColor.Yellow; Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine($"Check: Name {participant4.FirstName} Role:{participant4.Role} " + $"\nTitle: {participant4.Subjects[1].Title} code: {participant4.Subjects[1].Tools.Code} \n" + $"MainIDE {participant4.Subjects[1].Tools.MainIDE}"); Console.ResetColor(); foreach (var subject in participant4.Subjects) { Console.WriteLine(subject.Title); } participant4.PrintFullName(); var participants = new Participant[4]; participants[0] = participant1; participants[1] = participant2; participants[2] = participant3; participants[3] = participant4; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
public IHttpActionResult GetUserAccount([FromBody] LoginModel account) { ParticipantHelper helper = new ParticipantHelper(); return(Ok(helper.GetParticipant(account.Username, account.Password))); }
static void Main(string[] args) { Participant participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; participant1.Subjects = new Subject[] { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } } }; participant1.Greetings(); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; participant3.PrintFullName(); var participant4 = new Participant() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; //participant4.Subjects = new string[] {"C# Basic", "C# Advanced"}; participant4.Subjects = new Subject[] { cSharpBasic, cSharpAdvanced }; foreach (var subject in participant4.Subjects) { Console.WriteLine(subject.Title); } participant4.PrintFullName(); var participants = new Participant[4]; participants[0] = participant1; participants[1] = participant2; participants[2] = participant3; participants[3] = participant4; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
static void Main(string[] args) { var participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; // List of Subjects instead of array----Also in class Participant initiated public List Subject participant1.Subjects = new List <Subject>() { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } } }; participant1.Greetings(); Console.WriteLine("-----------------------------------------------"); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); Console.WriteLine("-----------------------------------------------"); var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.DarkYellow; participant3.PrintFullName(); Console.WriteLine("-----------------------------------------------"); Console.ForegroundColor = ConsoleColor.Yellow; var participant4 = new Participant() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; //List of Subject for participant4 participant4.Subjects = new List <Subject>(); participant4.Subjects.Add(cSharpBasic); participant4.Subjects.Add(cSharpAdvanced); foreach (var subject in participant4.Subjects) { Console.WriteLine(subject.Title); } participant4.PrintFullName(); Console.WriteLine("-----------------------------------------------"); // List of Participants and setting a specific Index List <Participant> participants = new List <Participant>(); participants.Insert(0, participant1); participants.Insert(1, participant2); participants.Insert(2, participant3); participants.Insert(3, participant4); // Corection of the first parameter and appropriatelly in to ParticipantHelper method in Helpers Folder ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
private void ExecuteForManual(SysActivity activity, SysProcess process, Queue <WorkflowMessage> queue) { if ((activity.ActivityParticipants == null) || (activity.ActivityParticipants.Count == 0)) { throw new ApplicationException("未指定参与人"); } Dictionary <SysWorkItemApproveGroup, List <IUser> > dictionary = new Dictionary <SysWorkItemApproveGroup, List <IUser> >(20); List <IUser> list = new List <IUser>(); if (this.AI.UserDefinedApproveUsers.Count > 0) { SysWorkItemApproveGroup key = this.CreateWorkItemGroup(); IOrgProxy orgProxy = OrgProxyFactory.GetProxy(base.Context); List <IUser> users = (from p in this.AI.UserDefinedApproveUsers select orgProxy.GetUserById(p.UserId.Value)).ToList <IUser>(); this.RemoveRepeatedUsers(users); list.AddRange(users); dictionary.Add(key, users); } else { using (IEnumerator <SysActivityParticipant> enumerator = activity.ActivityParticipants.GetEnumerator()) { while (enumerator.MoveNext()) { Func <SysProcessParticipant, bool> predicate = null; SysActivityParticipant activity_part = enumerator.Current; SysWorkItemApproveGroup group = this.CreateWorkItemGroup(activity_part); if (predicate == null) { predicate = p => p.ParticipantId == activity_part.ParticipantId.Value; } SysProcessParticipant part = process.ProcessParticipants.FirstOrDefault <SysProcessParticipant>(predicate); if (part == null) { throw new ApplicationException("参与人为空"); } int? wiOwnerId = null; var users = ParticipantHelper.GetUsers(base.Context, part, base.PI, this.AI, wiOwnerId); List <IUser> targetUsers = users; this.AssertGroupHasUsers(activity_part, group, targetUsers); this.RemoveRepeatedUsers(targetUsers); list.AddRange(targetUsers); dictionary.Add(group, targetUsers); } } } if (list.Count == 0) { bool?isPassedWithNoParticipants = this.AI.Activity.IsPassedWithNoParticipants; if (!(isPassedWithNoParticipants.HasValue ? isPassedWithNoParticipants.GetValueOrDefault() : false)) { throw new ApplicationException("未计算出任何参与人"); } SysActivityInstance aI = this.AI; aI.InstanceStatus = 10; aI.EndTime = new DateTime?(DateTime.Now); aI.ApproveResult = 1; aI.ExpressionValue = 1; aI.Remark = "无人审核,自动通过"; base.PICacheFactory.UpdateActiviyInstance(this.AI); WorkflowMessage item = base.Engine.NewCompleteActivityMessage(this.AI); queue.Enqueue(item); } else { SysActivity activity3 = this.AI.Activity; if (!activity3.PassType.HasValue) { activity3.PassType = 1; if (!activity3.MinPassNum.HasValue) { activity3.MinPassNum = 1; } } foreach (KeyValuePair <SysWorkItemApproveGroup, List <IUser> > pair in dictionary) { SysWorkItemApproveGroup group3 = pair.Key; foreach (IUser user in pair.Value) { this.CreateWorkItem(user, group3); } } } if (this.AI.UserDefinedApproveUsers.Count > 0) { base.PICacheFactory.ClearApproveUsers(this.AI); } }
public IHttpActionResult RegistrationParticipant([FromBody] Participant participant) { ParticipantHelper helper = new ParticipantHelper(); return(Ok(helper.SaveParticipantMobile(participant))); }