Exemplo n.º 1
0
 private void GetInformation()
 {
     try
     {
         Hashtable ht = new Hashtable();
         ht.Add("serverName", serverName);
         ht.Add("method", "GetUnitVisitLocationByDeptId");
         //string[] strarr = (TokenKey("") + "," + DeptId).Split(',');
         ht.Add("params", (TokenKey() + "," + DeptId));
         string Jsonresult = RZMRequest.Get.QueryGetWebServiceTostring(InterfaceIp, RequestAction, ht);
         LogHelper.WriteLog(Jsonresult);
         Console.WriteLine(Jsonresult);
         List <string>    hst     = new List <string>();
         LitJson.JsonData json    = LitJson.JsonMapper.ToObject(Jsonresult);
         string           saveStr = "{\"position\":[";
         foreach (JsonData item in json["back"])
         {
             saveStr += "{\"positionId\":\"" + item["positionId"] + "\",\"positionName\":\"" + item["positionName"] + "\"},";
         }
         saveStr = saveStr.Remove(saveStr.LastIndexOf(',')) + "],\"updatetime\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"}";
         RedisCacheHelper.Add("GetUnitVisitLocationByDeptId", saveStr, DateTime.Now);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex, "Action:GetUnitVisitLocationByDeptId");
         Console.WriteLine("Action:GetUnitVisitLocationByDeptId    " + ex.Message);
     }
 }
Exemplo n.º 2
0
        private void GetInformation(string Deptid, string CardNo)
        {
            Hashtable   ht = new Hashtable();
            XmlDocument xml;

            ht.Add("token", TokenKey(Deptid));
            ht.Add("DeptId", Deptid);
            xml = RZMRequest.Get.QueryGetWebService("http://192.168.13.97:8080/GxgyService.asmx", "GetUnitVisitLocationByDeptId", ht);

            if (xml.InnerText.Length > 0)
            {
                List <string>    hst        = new List <string>();
                LitJson.JsonData json       = LitJson.JsonMapper.ToObject(xml.InnerText);
                string           updatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                foreach (JsonData item in json["back"])
                {
                    string str = "{\"positionId\":\"" + item["positionId"] + "\",\"positionName\":\"" + item["positionName"] + "\",\"updatetime\":\"" + updatetime + "\"}";
                    hst.Add(str);
                }
                RedisCacheHelper.Add("GetUnitVisitLocationByDeptId", hst, DateTime.Now);
            }

            xml = null;
            ht.Clear();
            ht.Add("token", TokenKey(CardNo + Deptid));
            ht.Add("CardNo", CardNo);
            ht.Add("DeptId", Deptid);
            xml = RZMRequest.Get.QueryGetWebService("http://192.168.13.97:8080/GxgyService.asmx", "GetVisitLocationByCardNo", ht);

            if (xml.InnerText.Length > 0)
            {
                List <string>    hst  = new List <string>();
                LitJson.JsonData json = LitJson.JsonMapper.ToObject(xml.InnerText);
                foreach (JsonData item in json["back"])
                {
                    string str = "{\"positionId\":\"" + item["positionId"] + "\",\"positionName\":\"" + item["positionName"] + "\",\"updatetime\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"}";
                    hst.Add(str);
                }
                RedisCacheHelper.Add("GetVisitLocationByCardNo", hst, DateTime.Now);
            }
        }
Exemplo n.º 3
0
        private void GetInformation(string CardNo)
        {
            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("serverName", serverName);
                ht.Add("method", "GetVisitLocationByCardNo");
                //string[] strarr = (TokenKey("") + "," + CardNo + "," + DeptId).Split(',');
                ht.Add("params", (TokenKey() + "," + CardNo + "," + DeptId));
                string Jsonresult = RZMRequest.Get.QueryGetWebServiceTostring(InterfaceIp, RequestAction, ht);
                LogHelper.WriteLog(Jsonresult);
                Console.WriteLine(Jsonresult);

                LitJson.JsonData json = LitJson.JsonMapper.ToObject(Jsonresult);
                string           str  = "{\"back\":\"" + json["back"] + "\",\"updatetime\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"}";
                RedisCacheHelper.Add("GetVisitLocationByCardNo", str, DateTime.Now);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex, "Action:GetVisitLocationByCardNo");
                Console.WriteLine("Action:GetVisitLocationByCardNo" + ex.Message);
            }
        }