예제 #1
0
        public async Task <ActionResult> ListarSondagemPortugues(ClassRoomModel classRoomModel)
        {
            try
            {
                var classRoomDataTransfer = new ClassRoomFilter()
                {
                    classroomCodeEol = classRoomModel.classroomCodeEol,
                    dreCodeEol       = classRoomModel.dreCodeEol,
                    schoolCodeEol    = classRoomModel.schoolCodeEol,
                    schoolYear       = classRoomModel.schoolYear,
                    yearClassroom    = classRoomModel.yearClassroom
                };

                var BusinessPoll = new PollPortuguese(_config);
                var ListStudentPollPortuguese = await BusinessPoll.ListStudentPollPortuguese(classRoomDataTransfer);

                if (ListStudentPollPortuguese != null)
                {
                    return(Ok(ListStudentPollPortuguese));
                }

                else
                {
                    return(NoContent());
                }
            }
            catch (System.Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
예제 #2
0
        public ClassRoomModel CreateOrUpdate(ClassRoomModel model)
        {
            Logger.Debug($"{model}");

            if (model == null)
            {
                throw new System.ArgumentNullException("model");
            }

            ClassRoom room = null;

            if (model.Id == null || model.Id == System.Guid.Empty)
            {
                room = this.UnitOfWork.ClassRoomRepository.CreateClassRoom(model.ClassGroupId.Value, model.Name, model.Code, model.HighlightColor, model.LogoUrl, model.IsActive);
            }
            else
            {
                room = this.UnitOfWork.ClassRoomRepository.UpdateClassRoom(model.Id, model.ClassGroupId.Value, model.Name, model.Code, model.HighlightColor, model.LogoUrl, model.IsActive);
            }

            this.UnitOfWork.SaveChanges();

            ClassRoomModel roomModel = Mapper.Map <Models.ClassRoom, Models.ClassRoomModel>(room);

            return(roomModel);
        }
예제 #3
0
        public ActionResult Edit(int id)
        {
            if (!_permissionService.Authorize("ManageClassRoom"))
            {
                return(AccessDeniedView());
            }

            if (id == 0)
            {
                throw new ArgumentNullException("id");
            }

            var model        = new ClassRoomModel();
            var objClassRoom = _smsService.GetClassRoomById(id);

            if (objClassRoom != null)
            {
                model = objClassRoom.ToModel();
            }

            model.AvailableAcadmicYears = _smsService.GetAllAcadmicYears().Select(x => new SelectListItem()
            {
                Text     = x.Name.Trim(),
                Value    = x.Id.ToString(),
                Selected = x.IsActive
            }).ToList();
            return(View(model));
        }
예제 #4
0
        public void SaveClassroom(string ClassRoomName, int CenterID, int SittingCapacity)
        {
            ClassRoomModel CentObj1 = new ClassRoomModel();

            SqlParameter[] SParam = new SqlParameter[4];
            SParam[0]       = new SqlParameter("@ClassRoomName", SqlDbType.VarChar);
            SParam[0].Value = ClassRoomName;
            SParam[1]       = new SqlParameter("@CenterID", SqlDbType.Int);
            SParam[1].Value = CenterID;
            SParam[2]       = new SqlParameter("@SittingCapacity", SqlDbType.Int);
            SParam[2].Value = SittingCapacity;
            SParam[3]       = new SqlParameter("@LastUsedCommand", SqlDbType.Int);
            SParam[3].Value = "";
            //SParam[4] = new SqlParameter("@Auth", SqlDbType.VarChar);

            //string auth = SessionMgmtController.createRandomKey(10);
            //SParam[4].Value = auth;

            try
            {
                CentObj1.SaveClassRoom(SParam);
            }
            catch (Exception ex)
            {
            }
        }
예제 #5
0
        public ActionResult List()
        {
            if (!_permissionService.Authorize("ManageClassRoom"))
            {
                return(AccessDeniedView());
            }

            var model = new ClassRoomModel();

            return(View(model));
        }
예제 #6
0
 //[Authorize(Roles = "Administrator")]
 public ActionResult Edit(ClassRoomModel classRoomModel)
 {
     if (ModelState.IsValid)
     {
         lock (_lock)
         {
             _classRoomService.Update(classRoomModel);
             return(Json(new { success = true }));
         }
     }
     return(Json(new { success = false }));
 }
예제 #7
0
        /// <summary>
        ///  删除教室
        /// </summary>
        /// <returns></returns>
        public bool DeleteClassRoom(ClassRoomModel Model, int System_Station_ID)
        {
            W_ClassRoom ClassRoomModel = Orm.Single <W_ClassRoom>(x => x.ID == Model.ID && x.System_Station_ID == System_Station_ID);

            if (ClassRoomModel == null)
            {
                throw new ApiException("操作失败,您要删除的教室不存在");
            }
            if (Orm.Delete(ClassRoomModel) <= 0)
            {
                throw new ApiException("删除失败,请重试");
            }
            return(true);
        }
예제 #8
0
        public ClassRoomModel GetClassRoom(ClassRoomModel model)
        {
            Logger.Debug($"{model}");

            if (model == null || model.Id == null || model.Id == System.Guid.Empty)
            {
                throw new System.ArgumentNullException("model");
            }

            ClassRoom room = this.UnitOfWork.ClassRoomRepository.GetById(model.Id);

            ClassRoomModel roomModel = Mapper.Map <Models.ClassRoom, Models.ClassRoomModel>(room);

            return(roomModel);
        }
예제 #9
0
        /// <summary>
        /// 启用禁用教室
        /// </summary>
        /// <returns></returns>
        public dynamic UpdateClassRoomValid(ClassRoomModel Model, int System_Station_ID)
        {
            W_ClassRoom ClassRoomModel = Orm.Single <W_ClassRoom>(x => x.ID == Model.ID && x.System_Station_ID == System_Station_ID);

            if (ClassRoomModel == null)
            {
                throw new ApiException("操作失败,请稍后再试");
            }
            ClassRoomModel.Valid = Model.Valid;
            if (Orm.Update(ClassRoomModel) <= 0)
            {
                throw new ApiException("修改失败");
            }
            return(true);
        }
예제 #10
0
        public void DeleteClassroom(int ClassRoomID)
        {
            ClassRoomModel CentObj1 = new ClassRoomModel();

            SqlParameter[] SParam = new SqlParameter[1];
            SParam[0]       = new SqlParameter("@ClassRoomID", SqlDbType.Int);
            SParam[0].Value = ClassRoomID;

            try
            {
                CentObj1.DeleteClassRoom(SParam);
            }
            catch (Exception ex)
            {
            }
        }
예제 #11
0
        public ActionResult Edit(ClassRoomModel model, FormCollection frm, bool continueEditing)
        {
            if (!_permissionService.Authorize("ManageClassRoom"))
            {
                return(AccessDeniedView());
            }

            var user = _userContext.CurrentUser;
            // Check for duplicate classroom, if any
            var checkClassRoom = _smsService.CheckClassRoomExists(model.Number, model.Id);

            if (checkClassRoom)
            {
                ModelState.AddModelError("Number", "A ClassRoom with the same name already exists. Please choose a different name.");
            }

            if (ModelState.IsValid)
            {
                var objClassRoom = _smsService.GetClassRoomById(model.Id);
                if (objClassRoom != null)
                {
                    model.CreatedOn         = objClassRoom.CreatedOn;
                    objClassRoom            = model.ToEntity(objClassRoom);
                    objClassRoom.ModifiedOn = DateTime.Now;
                    _smsService.UpdateClassRoom(objClassRoom);
                }
            }
            else
            {
                model.AvailableAcadmicYears = _smsService.GetAllAcadmicYears().Select(x => new SelectListItem()
                {
                    Text     = x.Name.Trim(),
                    Value    = x.Id.ToString(),
                    Selected = x.IsActive
                }).ToList();
                return(View(model));
            }

            SuccessNotification("ClassRoom updated successfully.");
            if (continueEditing)
            {
                return(RedirectToAction("Edit", new { id = model.Id }));
            }
            return(RedirectToAction("List"));
        }
예제 #12
0
        public ActionResult Create()
        {
            if (!_permissionService.Authorize("ManageClassRoom"))
            {
                return(AccessDeniedView());
            }

            var model = new ClassRoomModel();

            model.AvailableAcadmicYears = _smsService.GetAllAcadmicYears().Select(x => new SelectListItem()
            {
                Text     = x.Name.Trim(),
                Value    = x.Id.ToString(),
                Selected = x.IsActive
            }).ToList();

            return(View(model));
        }
예제 #13
0
 public ActionResult AdditionalInfo(ClassRoomModel classRoomModel)
 {
     return(PartialView("AdditionalInfo", classRoomModel));
 }
예제 #14
0
 public dynamic DeleteClassRoom(ClassRoomModel model)
 {
     return(Success(mapper.DeleteClassRoom(model, this.System_Station_ID)));
 }
예제 #15
0
 public dynamic UpdateClassRoomValid(ClassRoomModel Model)
 {
     return(Success(mapper.UpdateClassRoomValid(Model, this.System_Station_ID)));
 }
예제 #16
0
 /// <summary>
 /// 根据对应条件查询教室数据总条数
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public int GetClassRoomListTotalCount(ClassRoomModel model, int System_Station_ID)
 {
     return(SqlMapper.QueryForObject <int>("GetClassRoomListTotalCount", new { ClassRoomType_ID = model.ClassRoomType_ID, CampusID = model.CampusID, Name = model.Name, Valid = model.Valid, System_Station_ID = System_Station_ID, pageStatus = 0 }));
 }
예제 #17
0
 public static ClassRoom ToEntity(this ClassRoomModel model, ClassRoom destination)
 {
     return(model.MapTo(destination));
 }
예제 #18
0
 public static ClassRoom ToEntity(this ClassRoomModel model)
 {
     return(model.MapTo <ClassRoomModel, ClassRoom>());
 }
예제 #19
0
 /// <summary>
 /// 根据对应条件查询教室数据
 /// </summary>
 /// <returns></returns>
 ///
 public dynamic GetClassRoomList(ClassRoomModel model, int System_Station_ID)
 {
     return(QueryForList("GetClassRoomList", new { ClassRoomType_ID = model.ClassRoomType_ID, CampusID = model.CampusID, Name = model.Name, Valid = model.Valid, System_Station_ID = System_Station_ID, pageIndex = (model.PageIndex - 1) * model.PageSize, pageSize = model.PageSize, pageStatus = model.PageStatus }));
 }
예제 #20
0
 public dynamic GetClassRoomList([FromUri] ClassRoomModel model)
 {
     return(Success(mapper.GetClassRoomList(model, this.System_Station_ID), model.PageIndex == 1 ? mapper.GetClassRoomListTotalCount(model, this.System_Station_ID) : 0));
 }