public PresentationCollectionHelper(PresentationsPanel parent, ClassroomModel classroom) : base(parent.m_EventQueue, classroom, "Presentations") { this.m_Parent = parent; this.m_Classroom = classroom; base.Initialize(); }
public ModelTest() { sut = new UserModel() { //UserId = 22, Name = "Andy", Username = "******", Password = "******", Quizzes = new List <Quiz>() //ClassroomId = 22 }; sute = new ExhibitModel() { Name = "Andy", Fishes = new List <Fish>(), Trash = new List <Trash>(), Plants = new List <Plant>() }; sutr = new ErrorViewModel() { RequestId = "Andy" }; sutc = new ClassroomModel() { Name = "Andy" }; }
public ActionResult AddOrUpdate(ClassroomModel model) { if (!ModelState.IsValid) { return(View(model)); } var isCreated = model.Id == Guid.Empty; var classroom = new Classrooms(); if (!isCreated) { classroom = ClassroomRepository.GetById(model.Id); } classroom.Title = model.Title; classroom.Establishment_Id = model.Establishment_Id; classroom.Establishments = EstablishmentRepository.GetById(model.Establishment_Id); classroom.User_Id = model.UserId; classroom.Users = UserRepository.GetById(model.UserId); classroom.Year_Id = model.YearId; classroom.Years = YearRepository.GetById(model.YearId); if (isCreated) { ClassroomRepository.Add(classroom); } ClassroomRepository.Save(); return(Redirect(Url.Action("Get", "Classroom", new { id = classroom.Id }))); }
public void Post([FromBody] ClassroomModel value) { var ClassActor = ActorProxy.Create <IClassroom>(new ActorId(value.Id)); // Add to the list of sessions var queryActor = ActorProxy.Create <IQueryActor>(new ActorId("ListActor")); queryActor.AddClassroom(value.Id); // Set the class properties ClassActor.SetPresenter(value.Presenter); ClassActor.SetNumStepsCountAsync(value.NumSteps); // Add the required students and create the student actors var studentCache = ClassActor.GetStudentsAsync(); foreach (var student in value.Students) { if (!studentCache.Result.Contains(student.Username)) { var studentActor = ActorProxy.Create <IStudent>(new ActorId(student.Username)); studentActor.SetCurrentStepAsync(student.CurrentStep); studentActor.SetUsernameAsync(student.Username); ClassActor.RegisterStudentAsync(student.Username); } } }
public TCPMessageReceiver(ITCPReceiver receiver, PresenterModel model, ClassroomModel classroom) { this.m_Model = model; this.m_Classroom = classroom; this.m_Receiver = receiver; this.m_Assembler = new ChunkAssembler(); #if RTP_BUILD //If we are in the public role and the receiver enabled the client-side bridge, start the bridge. bool isPublicRole = false; using (Synchronizer.Lock(m_Model.SyncRoot)) { using (Synchronizer.Lock(m_Model.Participant.SyncRoot)) { if (m_Model.Participant.Role is PublicModel) { isPublicRole = true; } } } if ((isPublicRole) && (receiver is TCPClient) && ((TCPClient)receiver).BridgeEnabled) { m_U2MBridge = new ClientUnicastToMulticastBridge(m_Model); } #endif this.m_Queue = new MessageProcessingQueue(this); Thread thread = new Thread(new ThreadStart(this.ReceiveThread)); thread.Name = "TCPMessageReceiver"; thread.Start(); }
public PresentationCollectionHelper(ManualConnectionMenu mcm, PresentationsMenu parent, ClassroomModel classroom) : base(mcm.m_EventQueue, classroom, "Presentations") { this.m_Parent = parent; this.m_Classroom = classroom; this.m_ManualConnectionMenu = mcm; base.Initialize(); }
public ActionResult DeleteClassroom(ClassroomModel form) { appClassroom = new ClassroomApplication(); try { string msgReturn = appClassroom.DeleteListClassroom(form.idClassroom); int number; bool result = int.TryParse(msgReturn, out number); if (result) { ViewBag.MessageType = MessageType.Success; ViewBag.Message = Message.SuccessDeleteClassroom; } else { ViewBag.MessageType = MessageType.Error; ViewBag.Message = Message.ErrorUnknown; } return(Json(new { msg = ViewBag.Message, type = ViewBag.MessageType }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { msg = ex.Message, type = MessageType.Success }, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> PutClassroomModel([FromRoute] int id, [FromBody] ClassroomModel classroomModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != classroomModel.classroomId) { return(BadRequest()); } _context.Entry(classroomModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassroomModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// 创建教室信息 /// </summary> /// <param name="newUserModel">需要创建的教室信息</param> public ClassroomModel Add(ClassroomModel newClassroomModel) { try { center_classrooms classroom = new center_classrooms(); classroom.center_id = newClassroomModel.CenterId; classroom.classroom_name = newClassroomModel.Name; classroom.upper_limit = newClassroomModel.UpperLimit; _unitOfWork.AddAction(classroom, DataActions.Add); _unitOfWork.Save(); newClassroomModel.Id = classroom.classroom_id; return(newClassroomModel); } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } }
/// <summary> /// 根据中心id查找所有所属教室 /// </summary> /// <param name="centerId"></param> /// <returns></returns> public IList <ClassroomModel> FindClassroomByCenter(int centerId) { try { ClassroomModel classroomModel = new ClassroomModel(); Repository <center_classrooms> classroommoduleDal = _unitOfWork.GetRepository <center_classrooms>(); IEnumerable <center_classrooms> classrooms = classroommoduleDal.Find(cr => cr.center_id == centerId).Entities; if (classrooms != null) { return(BuildModelList(classrooms.ToList())); } return(null); } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } }
/// <summary> /// 更新教室信息 /// </summary> /// <param name="newUserModel">需要更新的教室信息</param> public ClassroomModel Update(ClassroomModel newClassroomModel) { try { Repository <center_classrooms> classroommoduleDal = _unitOfWork.GetRepository <center_classrooms>(); center_classrooms classroom = classroommoduleDal.GetObjectByKey(newClassroomModel.Id).Entity; if (classroom != null) { classroom.center_id = newClassroomModel.CenterId; classroom.classroom_name = newClassroomModel.Name; classroom.upper_limit = newClassroomModel.UpperLimit; } _unitOfWork.AddAction(classroom, DataActions.Update); _unitOfWork.Save(); return(newClassroomModel); } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } }
public PresentationRadioButton(ControlEventQueue dispatcher, PresentationModel presentation, StartupForm stup, PresentationsPanel parent, int i, ClassroomModel classroom) { this.m_EventQueue = dispatcher; this.m_Presentation = presentation; this.Tag = presentation.Owner; this.m_Startup = stup; this.Parent = parent; this.m_PresentationsPanel = parent; this.m_Classroom = classroom; this.Parent.Controls.Add(this); this.FlatStyle = FlatStyle.System; this.Font = Model.Viewer.ViewerStateModel.StringFont1; this.index = i; this.Location = new Point(10, (2 * this.Font.Height) * (this.index + 1)); this.Size = new Size(this.Parent.Width - 14, 2 * this.Font.Height); //If the role changes we should remove ourself from our parent. this.m_ViewerStateRoleListener = new EventQueue.PropertyEventDispatcher(this.m_Startup.m_EventQueue, new PropertyEventHandler(this.HandleViewerStateRoleChanged)); this.m_Startup.m_Model.ViewerState.Changed["iRole"].Add(this.m_ViewerStateRoleListener.Dispatcher); this.m_HumanNameChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleHumanNameChanged)); this.Presentation.Changed["HumanName"].Add(this.m_HumanNameChangedDispatcher.Dispatcher); this.m_HumanNameChangedDispatcher.Dispatcher(this.Presentation, null); this.CheckedChanged += new EventHandler(HandlePresentationSelectionChanged); this.m_ConnectedChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleConnectedChanged)); this.m_Classroom.Changed["Connected"].Add(this.m_ConnectedChangedDispatcher.Dispatcher); this.HandleConnectedChanged(this.m_Classroom, null); }
public IHttpActionResult Update(ClassroomModel classroom) { u = credenciales.getUsuario(); var consulta = ClassroomData.Atualizar(classroom.ClassroomId, classroom.Clave, classroom.Nombre, classroom.Descripcion, classroom.Institucion, classroom.TipoAula, u); return(Ok(consulta)); }
public IHttpActionResult Create([FromBody] ClassroomModel classroom) { u = credenciales.getUsuario(); var consulta = ClassroomData.Crear(classroom.Clave, classroom.Nombre, classroom.Descripcion, classroom.Institucion, classroom.TipoAula, u); return(Ok(consulta)); }
public TCPClientClassroomManager(PresenterModel model, TCPConnectionManager connection, InstructorAdvertisement instructorAdvertisement) { this.m_InstructorAdvertisement = instructorAdvertisement; this.m_Model = model; this.m_ClientConnected = false; this.m_Classroom = new ClassroomModel(connection.Protocol, m_InstructorAdvertisement.HumanName, ClassroomModelType.Dynamic); this.m_Classroom.Changing["Connected"].Add(new PropertyEventHandler(this.HandleConnectedChanging)); }
public TCPServer(IPEndPoint localEP, PresenterModel model, ClassroomModel classroom, InstructorModel instructor) { string portStr = System.Configuration.ConfigurationManager.AppSettings[this.GetType().ToString() + ".TCPListenPort"]; int p; if (Int32.TryParse(portStr, out p)) { TCPListenPort = p; } RestoreConfig(); m_ClientConnected = new ManualResetEvent(false); m_Participant = model.Participant; m_Classroom = classroom; m_ClientCount = 0; this.m_Network = model.Network; m_NetworkStatus = new NetworkStatus(ConnectionStatus.Disconnected, ConnectionProtocolType.TCP, TCPRole.Server, 0); this.m_Network.RegisterNetworkStatusProvider(this, true, m_NetworkStatus); if (localEP != null) { this.m_ListenEP = localEP; } else { IPAddress ip = IPAddress.Any; //Use IPv4 unless it is unavailable. TODO: Maybe this should be a configurable parameter? if ((!Socket.OSSupportsIPv4) && (Socket.OSSupportsIPv6)) { ip = IPAddress.IPv6Any; } this.m_ListenEP = new IPEndPoint(ip, TCPListenPort); } m_AllClients = new Hashtable(); m_ReceiveQueue = new Queue(); this.m_Encoder = new Chunk.ChunkEncoder(); this.m_ServerSender = new TCPServerSender(instructor); //Start bridging if config file says so #if RTP_BUILD m_U2MBridge = null; string enableBridge = System.Configuration.ConfigurationManager.AppSettings[this.GetType().ToString() + ".EnableBridge"]; if (enableBridge != null) { bool enable = false; if (bool.TryParse(enableBridge, out enable) && enable) { Trace.WriteLine("Unicast to Multicast Bridge enabled.", this.GetType().ToString()); m_U2MBridge = new UnicastToMulticastBridge(model); } } #endif }
public TCPClassroomManager(PresenterModel model, TCPConnectionManager connection, string humanName) { this.m_Model = model; this.m_ClientConnected = false; this.m_ServerStarted = false; this.m_ServerEP = null; this.m_Classroom = new ClassroomModel(connection.Protocol, humanName, ClassroomModelType.TCPStatic); this.m_Classroom.Changing["Connected"].Add(new PropertyEventHandler(this.HandleConnectedChanging)); }
private void HandleParticipantsChanged(object sender_, PropertyEventArgs args) { ClassroomModel sender = sender_ as ClassroomModel; using (Synchronizer.Lock(sender.SyncRoot)) { if (sender != null) { this.Text = sender.Participants.Count.ToString(CultureInfo.CurrentCulture); } } }
public async Task <IActionResult> PostClassroomModel([FromBody] ClassroomModel classroomModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ClassroomModel.Add(classroomModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetClassroomModel", new { id = classroomModel.classroomId }, classroomModel)); }
public RTPNackManager(IRTPMessageSender sender, ClassroomModel classroom) { this.m_Sender = sender; this.m_Classroom = classroom; this.m_Classroom.Changed["Participants"].Add(new PropertyEventHandler(this.HandleClassroomParticipantsChanged)); Thread thread = new Thread(new ThreadStart(this.FlusherThread)); thread.Name = "RTPNackManager.FlusherThread"; thread.IsBackground = true; thread.Start(); }
protected override object SetUpMember(int index, object member) { ClassroomModel classroom = ((ClassroomModel)member); ClassroomMenuItem item = new ClassroomMenuItem(this.m_Parent.m_EventQueue, this.m_Parent.m_Model, classroom); this.m_Parent.MenuItems.Add(item); PresentationCollectionHelper helper = new PresentationCollectionHelper(this.m_Parent, this.m_PresentationsMenu, classroom); helper.MenuItem = item; return(helper); }
public ActionResult AddOrUpdate(Guid?id, Guid?establishmentId) { var model = new ClassroomModel(); if (id.HasValue) { model = ClassroomModel.ToModel(ClassroomRepository.GetById(id.Value)); } if (establishmentId.HasValue) { model.Establishment_Id = establishmentId.Value; } return(View(model)); }
public ClassroomsListView(PresenterModel model) { if (model == null) { throw new ArgumentNullException("model"); } this.m_EventQueue = new ControlEventQueue(this); this.m_Model = model; this.View = View.Details; this.FullRowSelect = true; this.GridLines = true; this.Sorting = SortOrder.None; this.CheckBoxes = false; this.MultiSelect = false; this.HideSelection = false; // TODO: Add icons for classrooms. // In the mean time, this serves to make the rows big enough to // be an easy target for a stylus. this.SmallImageList = new ImageList(); this.SmallImageList.ImageSize = new Size(1, 40); // Set the font for list view items this.Font = new Font(this.Font.FontFamily, this.Font.Size * 4 / 3); this.Columns.AddRange(new ColumnHeader[] { new ColumnHeader(), new ColumnHeader(), new ColumnHeader() }); foreach (ColumnHeader column in this.Columns) { column.Width = -1; } this.Columns[0].Text = "Classrooms"; this.Columns[1].Text = "Participants"; this.Columns[2].Text = "Protocol"; // Create a handle immediately so the ListViewItems can marshal event handlers to the creator thread. this.CreateHandle(); // Add a default local classroom to the list defaultClassroomModel = new ClassroomModel(null, "Disconnected", ClassroomModelType.None); defaultClassroom = new ClassroomListViewItem(this.m_EventQueue, defaultClassroomModel); this.Items.Add(defaultClassroom); defaultClassroom.Selected = true; // Set up a helper to add other classrooms this.m_ProtocolCollectionHelper = new ProtocolCollectionHelper(this, this.m_Model.Network); }
public CXPCapabilityMessageSender(PresenterModel model, PresenterCapability capability) { this.m_Model = model; this.m_LocalId = m_Model.Participant.Guid; this.m_Classroom = new ClassroomModel(null, "CXP Capability Classroom", ClassroomModelType.CXPCapability); this.m_Capability = capability; this.m_Participants = new Dictionary <string, ParticipantModel>(); this.m_SsrcToSenderId = new Dictionary <uint, Guid>(); this.m_Receivers = new Dictionary <string, CXPCapabilityMessageReceiver>(); m_Capability.OnStreamAdded += new PresenterCapability.OnStreamAddedHandler(OnStreamAdded); m_Capability.OnStreamRemoved += new PresenterCapability.OnStreamRemovedHandler(OnStreamRemoved); using (Synchronizer.Lock(this)) { // Initialize the message chunking utilities. this.m_Encoder = new Chunk.ChunkEncoder(); // TODO: Make the buffer size dynamic, ie., grow if we send a single very large message. // Make the buffer store up to 5MB worth of data. this.m_FrameBuffer = new FrameBuffer(5 * 1024 * 1024 / this.m_Encoder.MaximumChunkSize); // Create the NackManager which is responsible for sending NACKs on behalf of // our set of RTPMessageReceivers. this.m_NackManager = new RTPNackManager(this, this.m_Classroom); } // Create network services outside of the "lock(this)" so they can lock their own objects // without worrying about locking order. // Create the PresenterNetworkService which will watch for changes to the model and send messages. this.m_PresenterNetworkService = new PresenterNetworkService(this, this.m_Model); // Create the StudentSubmissionsNetworkService which will watch for requests to submit and send messages. this.m_StudentSubmissionNetworkService = new StudentSubmissionNetworkService(this, this.m_Model); // Create the SynchronizationNetworkService which will watch for all synchronization messages. this.m_SynchronizationNetworkService = new SynchronizationNetworkService(this, this.m_Model); // Create the ScriptingNetworkService which will watch for all scripting messages. this.m_ScriptingNetworkService = new ScriptingNetworkService(this, this.m_Model); // Create the BeaconService which will broadcast periodic information about the presentation. this.m_BeaconService = new Beacons.DefaultBeaconService(this, this.m_Model); // Report Network status to the UI m_CapabilityNetworkStatus = new CapabilityNetworkStatus(this.m_Model); m_CapabilityNetworkStatus.Register(); // Send an initial message to announce our node to others in the venue. SendObject(new CapabilityMessageWrapper(null, m_LocalId, Guid.Empty, m_Capability.IsSender)); }
public ClassroomMenuItem(ControlEventQueue dispatcher, PresenterModel model, ClassroomModel classroom) { this.m_EventQueue = dispatcher; this.m_Model = model; this.m_Classroom = classroom; this.m_HumanNameChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleHumanNameChanged)); this.m_ConnectedChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleConnectedChanged)); this.m_Classroom.Changed["HumanName"].Add(this.m_HumanNameChangedDispatcher.Dispatcher); this.m_Classroom.Changed["Connected"].Add(this.m_ConnectedChangedDispatcher.Dispatcher); this.m_HumanNameChangedDispatcher.Dispatcher(this, null); this.m_ConnectedChangedDispatcher.Dispatcher(this, null); }
public ActionResult DeleteClassroom(int idClassroom) { classroomModel = new ClassroomModel(); classroomBusinessModel = new ClassroomModel(); try { classroomModel = classroomBusinessModel.LoadDataClassroom(idClassroom); return(View(classroomModel)); } catch (Exception) { throw; } }
public IActionResult Post([FromBody] ClassroomModel classroom) { var cl = Mapper.Map <Classroom>(classroom); cl.ClassroomId = _classroomRepository.GetMaxId() + 1; cl.SchoolId = classroom.SchoolId; cl.Name = classroom.Name; cl.Teacher = classroom.Teacher; _classroomRepository.Add(cl); var result = _classroomRepository.Fetch(); var results = Mapper.Map <IEnumerable <ClassroomModel> >(result); return(new ObjectResult(results)); }
public ActionResult CreateClassroom() { studentBusinessModel = new StudentModel(); classroomModel = new ClassroomModel(); loginBusinessModel = new LoginModel(); try { classroomModel.idLoginAccess = loginBusinessModel.GetIdLoginAccessWithEmail(User.Identity.Name); ViewBag.listClassroomStudent = new SelectList(studentBusinessModel.ListStudent(classroomModel.idLoginAccess), "idStudent", "nameStudent"); return(View(classroomModel)); } catch (Exception) { throw; } }
private async void UpdateClassroom_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ClassroomModel selectClassroom = gvClassRoomDetail.SelectedItem as ClassroomModel; if (selectClassroom != null) { string strErrorMsg = string.Empty; try { EditClassroomWindow newClassroomWindow = new EditClassroomWindow(); newClassroomWindow.SelectClassroom = gvClassRoomDetail.SelectedItem as ClassroomModel; newClassroomWindow.Om = OperationMode.EditMode; if (newClassroomWindow.ShowDialog() == true) { await bindClassroom(); } } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } catch (Exception ex) { strErrorMsg = ex.Message; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "更新教室信息失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); } } }
public ActionResult ListEvaluateStudent() { evaluateStudentModel = new EvaluateStudentModel(); evaluateStudentBusinessModel = new EvaluateStudentModel(); classroomBusinessModel = new ClassroomModel(); loginBusinessModel = new LoginModel(); try { evaluateStudentModel.idLoginAccess = loginBusinessModel.GetIdLoginAccessWithEmail(User.Identity.Name); ViewBag.listClassroom = new SelectList(classroomBusinessModel.ListClassroom(evaluateStudentModel.idLoginAccess), "idClassroom", "nameClassroom"); return(View(evaluateStudentModel)); } catch (Exception) { throw; } }