コード例 #1
0
        //
        // POST: /Journal/Query

        public void Query()
        {
            // Receive and process the POST data
            string res = HttpContext.Request.Method.ToString();

            Encoding     enc            = System.Text.Encoding.GetEncoding("utf-8");
            StreamReader responseStream = new StreamReader(HttpContext.Request.Body, enc);
            string       body           = responseStream.ReadToEnd();

            Query qu = JsonConvert.DeserializeObject <Query>(body);

            // Get the result
            Journal       J     = new Journal();
            List <string> opers = J.query(qu.Id);

            // Create a Result Object
            QueryRes qures = new QueryRes();

            qures.Operations = new List <string> {
            };
            qures.Operations = opers;

            // Serialize it
            string param = JsonConvert.SerializeObject(qures);

            // Send it back using POST
            HttpContext.Response.ContentType = "application/json";
            using (var streamWriter = new StreamWriter(HttpContext.Response.Body, enc))
            {
                streamWriter.Write(param);
                streamWriter.Flush();
                streamWriter.Close();
            }

            var logger = NLog.LogManager.GetCurrentClassLogger();

            logger.Info($"Query operation (Id {qu.Id})");
        }
コード例 #2
0
        /// <summary>
        /// 按设备名称查询,得到多条记录
        /// </summary>
        /// <param name="sbmc"></param>
        public void QueryEntities(string sbmc)
        {
            var commonlist = DBManager.Instance.GetEntities <Common_n>(o => !string.IsNullOrEmpty(o.SBMC) && o.SBMC.Contains(sbmc)).OrderBy(o => o.SBMC);

            if (commonlist != null && commonlist.Any())
            {
                DeviceMohuLable.Text = string.Empty;
                List <QueryRes> queryResList = new List <QueryRes>();
                int             index        = 1;
                foreach (var common in commonlist)
                {
                    var queryRes = new QueryRes
                    {
                        SerialNum   = index,
                        G3E_FID     = common.G3E_FID,
                        FeatureType = PublicMethod.Instance.GetDeviceType(common.G3E_FNO),
                        SDKX        = common.CD_SSXL,
                        State       = common.CD_SMZQ,
                        Sbmc        = common.SBMC
                    };
                    queryResList.Add(queryRes);
                    index++;
                }
                if (queryResList.Count <= 0)
                {
                    DeviceMohuLable.Text = "当前沿布图查询不到该名称对应的设备";
                }
                else
                {
                    AddColumnData(queryResList, "根据名称查询设备", lvSMQuery);
                }
            }
            else
            {
                DeviceMohuLable.Text = "数据库没有与之匹配的设备!!!";
            }
        }
コード例 #3
0
ファイル: QueryCtrl.cs プロジェクト: phs008/xingapi_bridge
 public void SetResFilename(QueryRes res)
 {
     m_query.ResFileName = "\\res\\" + res.ToString() + ".res";
 }