Пример #1
0
 public MyComplexeResponse Handle(MyQuestion <MyComplexeResponse> request)
 {
     return(new MyComplexeResponse()
     {
         Info1 = "info1", Info2 = "info2"
     });
 }
Пример #2
0
 /// <summary>
 /// 新增咨询
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public string Add(MyQuestion model)
 {
     if (model == null)
     {
         return(string.Empty);
     }
     using (DbContext db = new CRDatabase())
     {
         db.Set <CTMS_MYQUESTION>().Add(ModelToEntity(model));
         //待办
         db.Set <CTMS_USEREVENT>().Add(new CTMS_USEREVENT()
         {
             EVENTID      = Guid.NewGuid().ToString(),
             USERAPPLYID  = "",
             ACTIONTYPE   = "1",
             ACTIONINFO   = string.Format("您收到了{0}的咨询,请回复", model.LoginName),
             RECEIPTTIME  = model.CreateDateTime,
             ACTIONSTATUS = "1",
             FROMUSER     = model.UserID,
             TOUSER       = model.ObjectUserID,
             CREATETIME   = model.CreateDateTime,
             MODELID      = model.ID,
             LINKURL      = "MyQuestion"
         });
         db.SaveChanges();
         return(model.ID);
     }
 }
Пример #3
0
        private CTMS_MYQUESTION ModelToEntity(MyQuestion model)
        {
            if (model == null)
            {
                return(null);
            }
            return(new CTMS_MYQUESTION()
            {
                ID = string.IsNullOrEmpty(model.ID) ? Guid.NewGuid().ToString() : model.ID,
                LOGINNAME = model.LoginName,
                OBJECTLOGINNAME = model.ObjectLoginName,
                OBJECTTYPE = model.ObjectType,
                OBJECTUSERID = model.ObjectUserID,
                USERID = model.UserID,
                QUESTION = model.Question,
                ANSWER = model.Answer,

                CREATEDATETIME = model.CreateDateTime,
                CREATEUSERID = model.CreateUserID,
                CREATEUSERNAME = model.CreateUserName,
                EDITDATETIME = model.EditTime,
                EDITUSERID = model.EditUserID,
                EDITUSERNAME = model.EditUserName,
                OWNERID = model.OwnerID,
                OWNERNAME = model.OwnerName,
                ISDELETED = model.IsDeleted
            });
        }
Пример #4
0
 public IHttpActionResult Post([FromBody] Request <MyQuestion> request)
 {
     try
     {
         Response <MyQuestion> response = new Response <MyQuestion>();
         MyQuestion            model    = request.Data as MyQuestion;
         if (model == null)
         {
             return(NotFound());
         }
         if (string.IsNullOrEmpty(model.ID))
         {
             model.CreateDateTime = DateTime.Now;
             model.ID             = Guid.NewGuid().ToString();
             string ID = bll.Add(model);
         }
         else
         {
             model.EditTime = DateTime.Now;
             bool isEditSuccess = bll.Edit(model);
         }
         response.Data = model;
         return(Ok(response));
     }
     catch (Exception ex)
     {
         LogService.WriteErrorLog("MetaDataController[Post]", ex.ToString());
         return(BadRequest(ex.Message));
     }
 }
Пример #5
0
    void SetQuestion(MyQuestion question)
    {
        currentQuestion   = question;
        questionText.text = currentQuestion.question;

        //解答欄を表示する
        ClearChoices();
        ShowChoices();
        titleText.text = "質問" + (currentQuestionIndex + 1).ToString();

        //ボタンのチェック

        //あるべき姿
        backButton.gameObject.SetActive(true);
        nextButton.text = "次へ";

        if (currentQuestionIndex + 1 >= workSheetData.questionList.Count)
        {
            //最後の問題
            nextButton.text = "回答する";
        }
        if (currentQuestionIndex <= 0)
        {
            //最初の問題
            backButton.gameObject.SetActive(false);
        }
    }
Пример #6
0
        public void MyResponseToMyQuestion()
        {
            var myQuestion = new MyQuestion <string>();

            var mediator = _kernel.Get <IMediator>();

            var myResponse = mediator.Request(myQuestion);

            Assert.That(myResponse.Data, Is.EqualTo("This the response corresponding to MyQuestion"));
            Assert.That(myResponse.HasException(), Is.False);
        }
Пример #7
0
        public void MyComplexeResponseToMyQuestion()
        {
            var myQuestion = new MyQuestion <MyComplexeResponse>();

            var mediator = _kernel.Get <IMediator>();

            var myResponse = mediator.Request(myQuestion);

            Assert.That(myResponse.Data.Info1, Is.EqualTo("info1"));
            Assert.That(myResponse.Data.Info2, Is.EqualTo("info2"));
            Assert.That(myResponse.HasException(), Is.False);
        }
Пример #8
0
        /// <summary>
        /// 删除咨询
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                LogService.WriteInfoLog(logTitle, "试图删除为空的MyQuestion实体!");
                throw new KeyNotFoundException();
            }
            MyQuestion model = Get(id);

            if (model != null)
            {
                model.IsDeleted = true;
                return(Edit(model));
            }
            return(false);
        }
Пример #9
0
 /// <summary>
 /// 修改咨询
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Edit(MyQuestion model, string eventID = "")
 {
     if (string.IsNullOrEmpty(model.ID))
     {
         LogService.WriteInfoLog(logTitle, "试图修改为空的MyQuestion实体!");
         throw new KeyNotFoundException();
     }
     using (DbContext db = new CRDatabase())
     {
         db.Entry(ModelToEntity(model)).State = EntityState.Modified;
         if (!string.IsNullOrEmpty(eventID))
         {
             CTMS_USEREVENT userEvent = db.Set <CTMS_USEREVENT>().Find(eventID);
             if (userEvent != null)
             {
                 userEvent.ACTIONSTATUS    = "3";
                 userEvent.ENDTIME         = model.EditTime;
                 db.Entry(userEvent).State = EntityState.Modified;
             }
         }
         return(db.SaveChanges() > 0);
     }
 }
Пример #10
0
 public string Handle(MyQuestion <string> request)
 {
     return("This the response corresponding to MyQuestion");
 }