예제 #1
0
        /// <summary>
        /// 门组查询
        /// </summary>
        /// <param name="address"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public static ResponseData doorGroup(string address, string token)
        {
            ResponseData response = new ResponseData();

            string url_doorGroup = address + "/CardSolution/card/accessControl/doorGroup/bycondition/combined";

            try
            {
                var postdata = new
                {
                    token           = token,
                    pageNum         = 1,
                    pageSize        = 20,
                    singleCondition = ""
                };
                var   jsonstr   = JsonConvert.SerializeObject(postdata);
                Group groupdata = JsonConvert.DeserializeObject <Group>(PostGetRequest.HttpPost(url_doorGroup, jsonstr));
                if (groupdata.success == "true")
                {
                    if (groupdata.data.pageData.Count > 0)
                    {
                        response.code = "200";
                        response.msg  = groupdata.data.pageData[0].id.ToString();
                    }
                }
            }
            catch (Exception e)
            {
                response.code = "400";
                response.msg  = e.Message;
            }
            return(response);
        }
예제 #2
0
        public static ResponseData Register(string address)
        {
            ResponseData rd = new ResponseData();
            SubRegister  sr = new SubRegister();

            sr.name            = "";
            sr.callbackAddress = "";
            sr.hasExpir        = 0;
            string registerurl = address + "/register";

            try
            {
                var register          = PostGetRequest.HttpPost(registerurl, JsonConvert.SerializeObject(sr));
                SubRegisterReturn srr = JsonConvert.DeserializeObject <SubRegisterReturn>(register);
                if (srr.code == 200)
                {
                    rd.code = "200";
                    rd.msg  = "成功 " + srr.errMsg;
                    rd.data = srr.data;
                }
                else
                {
                    rd.code = "500";
                    rd.msg  = srr.errMsg;
                }
            }
            catch (Exception e)
            {
                rd.code = "404";
                rd.msg  = e.Message;
            }
            return(rd);
        }
예제 #3
0
        /// <summary>
        /// 刷卡记录条数统计
        /// </summary>
        /// <param name="address"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public static ResponseData CardRecordCount(string address, string token)
        {
            //当天0时0分0秒:
            DateTime start = Convert.ToDateTime(DateTime.Now.ToString("D").ToString());

            //当天23时59分59秒:
            DateTime end = Convert.ToDateTime(DateTime.Now.AddDays(1).ToString("D").ToString()).AddSeconds(-1);

            ResponseData response = new ResponseData();

            string url_CardRecordCount = address + "/CardSolution/card/accessControl/swingCardRecord/bycondition/combinedCount";

            try
            {
                var postdata = new
                {
                    token = token,
                    //pageNum = 1,
                    //pageSize = 20,
                    startSwingTime = start.ToString(),
                    endSwingTime   = end.ToString()
                };
                var         jsonstr   = JsonConvert.SerializeObject(postdata);
                RecordCount countdata = JsonConvert.DeserializeObject <RecordCount>(PostGetRequest.HttpPost(url_CardRecordCount, jsonstr));
                if (countdata.success == "true")
                {
                    response.code = "200";
                    response.msg  = countdata.data.ToString();
                }
            }
            catch (Exception e)
            {
                response.code = "400";
                response.msg  = e.Message;
            }
            return(response);
        }