Beispiel #1
0
 public JsonResult Add_organizor(AddMeetingModel addMeetingModel)
 {
     if (ModelState.IsValid)
     {
         MeetingInfo     meeting         = addMeetingModel.meeting;
         MeetingService  service         = new MeetingService();
         DelegateService delegateService = new DelegateService();
         Status          status          = Status.SUCCESS;
         //调用服务
         if ((status = service.create(ref meeting)) == Status.SUCCESS)
         {
             DeviceService            deviceService = new DeviceService();
             List <DeviceForDelegate> devices       = null;
             status = deviceService.getAllForDelegate(
                 meeting.meetingToStartTime,
                 meeting.meetingStartedTime,
                 out devices);
             status = delegateService.createMultiple(devices, meeting.meetingID, addMeetingModel.delegates);
             if (status != Status.SUCCESS)
             {
                 service.deleteMultipe(meeting.meetingID);
             }
         }
         return(Json(new RespondModel(status, ""), JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(
                    new RespondModel(
                        Status.ARGUMENT_ERROR,
                        ModelStateHelper.errorMessages(ModelState)),
                    JsonRequestBehavior.AllowGet));
     }
 }
Beispiel #2
0
 public JsonResult UpdateDevice(UpdateDevice device)
 {
     if (ModelState.IsValid)
     {
         //调用设备服务
         Status status = new DeviceService().update(device);
         return(Json(new RespondModel(status, ""), JsonRequestBehavior.AllowGet));
     }
     return(Json(new RespondModel(Status.ARGUMENT_ERROR, ModelStateHelper.errorMessages(ModelState)), JsonRequestBehavior.AllowGet));
 }
Beispiel #3
0
        public JsonResult CreateRole(CreateRole role)
        {
            if (ModelState.IsValid)
            {
                //调用角色服务
                Status status = new RoleService().create(role);
                return(Json(new RespondModel(status, ""), JsonRequestBehavior.AllowGet));
            }

            return(Json(new RespondModel(Status.ARGUMENT_ERROR, ModelStateHelper.errorMessages(ModelState)), JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public JsonResult Add_organizor(CreateUserForDelegate user)
        {
            if (ModelState.IsValid)
            {
                //调用用户服务
                Status status = new UserService().createForDelegate(user);
                return(Json(new RespondModel(status, ""), JsonRequestBehavior.AllowGet));
            }

            return(Json(new RespondModel(Status.ARGUMENT_ERROR, ModelStateHelper.errorMessages(ModelState)), JsonRequestBehavior.AllowGet));
        }
        public JsonResult CreateMeetingPlace(CreateMeetingPlace meetingPlace)
        {
            if (ModelState.IsValid)
            {
                //调用会场服务
                int    meetingPlaceID;
                Status status = new MeetingPlaceService().create(meetingPlace, out meetingPlaceID);
                return(Json(new RespondModel(status, meetingPlaceID), JsonRequestBehavior.AllowGet));
            }

            return(Json(new RespondModel(Status.ARGUMENT_ERROR, ModelStateHelper.errorMessages(ModelState)), JsonRequestBehavior.AllowGet));
        }
Beispiel #6
0
        public ActionResult Edit_organizor(UpdateVote updateAgenda)
        {
            Status status = Status.SUCCESS;

            if (ModelState.IsValid)
            {
                VoteService voteService = new VoteService();
                status = voteService.update(updateAgenda);
                return(Json(new RespondModel(status, ""), JsonRequestBehavior.AllowGet));
            }

            return(Json(
                       new RespondModel(
                           Status.ARGUMENT_ERROR,
                           ModelStateHelper.errorMessages(ModelState)),
                       JsonRequestBehavior.AllowGet));
        }
Beispiel #7
0
        public JsonResult Edit_organizor(MeetingInfo meeting)
        {
            if (ModelState.IsValid)
            {
                //调用服务
                Status status = new MeetingService().update(meeting);

                return(Json(new RespondModel(status, ""), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(
                           new RespondModel(
                               Status.ARGUMENT_ERROR,
                               ModelStateHelper.errorMessages(ModelState)),
                           JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #8
0
        public JsonResult Add_organizor(CreateDelegate model)
        {
            Status status = Status.SUCCESS;

            if (ModelState.IsValid)
            {
                DelegateService delegateService = new DelegateService();
                status = delegateService.create(model);

                return(Json(new RespondModel(status, ""), JsonRequestBehavior.AllowGet));
            }

            return(Json(
                       new RespondModel(
                           Status.ARGUMENT_ERROR,
                           ModelStateHelper.errorMessages(ModelState)),
                       JsonRequestBehavior.AllowGet));
        }
Beispiel #9
0
        public JsonResult Login(LoginModel model)
        {
            if (ModelState.IsValid)
            {
                if (!Forms.Verigy(model.userName, model.password))
                {
                    RespondModel respond = new RespondModel();
                    respond.Code    = -1;
                    respond.Message = "用户名或密码出错,请重新输入";
                    return(Json(respond, JsonRequestBehavior.AllowGet));
                }

                Session["userName"] = model.userName;

                return(Json(new RespondModel(Status.SUCCESS, ""), JsonRequestBehavior.AllowGet));
            }

            return(Json(new RespondModel(Status.ARGUMENT_ERROR, ModelStateHelper.errorMessages(ModelState)), JsonRequestBehavior.AllowGet));
        }