Esempio n. 1
0
        /// <summary>
        /// 事件之扫码推事件且弹出“消息接收中”提示框(scancode_waitmsg)
        /// </summary>
        /// <param name="requestMessage"></param>
        /// <returns></returns>
        public override IResponseMessageBase OnEvent_ScancodeWaitmsgRequest(RequestMessageEvent_Scancode_Waitmsg requestMessage)
        {
            var message = "";

            if (requestMessage.EventKey == "rselfmenu_0_1")
            {
                message = ControlProcess.Process(requestMessage.ScanCodeInfo.ScanResult);
            }
            var responseMessage = base.CreateResponseMessage <ResponseMessageText>();

            responseMessage.Content = "事件之扫码推事件且弹出“消息接收中”提示框" + message;
            return(responseMessage);
        }
Esempio n. 2
0
        // POST api/<controller>
        public HttpResponseMessage Post([FromBody] DiseasePestData pestdata)
        {
            var query = db.Pests.FirstOrDefault(c => c.P_ID == pestdata.ID);
            List <ControlResult> pestcontrols = ControlProcess.PestControls(pestdata.ID);
            DiseasePestResult    pest         = new DiseasePestResult()
            {
                About    = query.About,
                Controls = pestcontrols,
                Name     = query.Name,
                Spread   = query.Spread,
                Symptoms = SymptomProcess.Symptoms(SymptomProcess.SymptomsFromPest(query.P_ID))
            };

            return(Request.CreateResponse(HttpStatusCode.OK, pest));
        }
Esempio n. 3
0
        // POST api/<controller>
        public HttpResponseMessage Post([FromBody] DiseasePestData diseasedata)
        {
            var query = db.Diseases.FirstOrDefault(c => c.D_ID == diseasedata.ID);
            List <ControlResult> pestcontrols = ControlProcess.DiseaseControls(diseasedata.ID);
            DiseasePestResult    disease      = new DiseasePestResult()
            {
                About    = query.About,
                Controls = pestcontrols,
                Name     = query.Name,
                Spread   = query.Transmision,
                Symptoms = SymptomProcess.Symptoms(SymptomProcess.SymptomsFromDisease(query.D_ID))
            };

            return(Request.CreateResponse(HttpStatusCode.OK, disease));
        }
Esempio n. 4
0
        // POST api/<controller>
        public HttpResponseMessage Post([FromBody] ResponseData responsedata)
        {
            List <Disease> diseases = DiseaseProcess.FinalDiseases(responsedata.Selected_symptoms);
            List <Pest>    pests    = PestProcess.FinalPests(responsedata.Selected_symptoms);
            List <Result>  final    = new List <Result>();

            try
            {
                foreach (var disease in diseases)
                {
                    Result dis = new Result()
                    {
                        Item      = "Disease",
                        Name      = disease.Name,
                        Solutions = ControlProcess.DiseaseControls(disease.D_ID)
                    };
                    final.Add(dis);
                }
            }
            catch
            {
            }
            try
            {
                foreach (var pest in pests)
                {
                    Result pes = new Result()
                    {
                        Item      = "Pest",
                        Name      = pest.Name,
                        Solutions = ControlProcess.PestControls(pest.P_ID)
                    };
                    final.Add(pes);
                }
            }
            catch
            {
            }
            if (diseases == null && pests == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Diagnosis found"));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.OK, final));
            }
        }