示例#1
0
        /// <summary>
        /// 给新添加的人员单个分配卡号
        /// </summary>
        private void SetLoadUserCarNo(TemporaryUserEntity Item, string baseUrl, string Key, string Signature)
        {
            var url = "/artemis/api/cis/v1/card/bindings";
            List <cardList1>           cardList = new List <cardList1>();
            List <TemporaryUserEntity> list     = new List <TemporaryUserEntity>();

            list.Add(Item);
            cardList1 entity = new cardList1();
            string    time   = DateTime.Now.ToString("yyyyMMddHHmmss");
            var       no     = Str.PinYin(Item.UserName).ToUpper() + time;//卡号唯一

            if (Item.Istemporary == 0)
            {
                no = Item.Tel.Trim();
            }                                                   //非临时人员
            entity.cardNo   = no;
            entity.personId = Item.USERID;
            entity.cardType = 1;
            cardList.Add(entity);
            var model = new
            {
                startDate = Convert.ToDateTime(Item.startTime).ToString("yyyy-MM-dd"),
                endDate   = Convert.ToDateTime(Item.EndTime).ToString("yyyy-MM-dd"),
                cardList
            };

            HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseUrl, 443, true);
            byte[] result = HttpUtillibKbs.HttpPost(url, JsonConvert.SerializeObject(model), 20);
            if (result != null)
            {
                string msg = System.Text.Encoding.UTF8.GetString(result);
            }
        }
示例#2
0
        /// <summary>
        /// 电厂用户批量分配卡号
        /// </summary>
        private void SetLoadUserCarNo1(List <TemporaryUserEntity> list, string baseUrl, string Key, string Signature)
        {
            var url = "/artemis/api/cis/v1/card/bindings";
            List <cardList1> cardList = new List <cardList1>();

            if (list.Count > 0 && list.Count < 50)
            {
                foreach (var Item in list)
                {//批量开卡最大支持50张卡
                    cardList1 entity = new cardList1();
                    entity.cardNo   = Item.Tel.Trim();
                    entity.personId = Item.USERID;
                    entity.cardType = 1;
                    cardList.Add(entity);
                }
                var model = new
                {
                    startDate = Convert.ToDateTime(list[0].startTime).ToString("yyyy-MM-dd"),
                    endDate   = Convert.ToDateTime(list[0].EndTime).ToString("yyyy-MM-dd"),
                    cardList
                };
                //string msg = SocketHelper.LoadCameraList(model, baseUrl, url, Key, Signature);
                HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseUrl, 443, true);
                byte[] result = HttpUtillibKbs.HttpPost(url, JsonConvert.SerializeObject(model), 20);
                //string msg = System.Text.Encoding.UTF8.GetString(result);
                //parkList2 pl = JsonConvert.DeserializeObject<parkList2>(msg);
                //if (pl != null && pl.code == "0")
                //{
                //    //UploadUserlimits(list, baseUrl, Key, Signature);
                //}
            }
        }
示例#3
0
        /// <summary>
        /// 给新添加的人员分配卡号
        /// </summary>
        private void SetLoadUserCarNo(CarUserFileImgEntity Item, string baseUrl, string Key, string Signature)
        {
            var url = "/artemis/api/cis/v1/card/bindings";
            List <cardList1> cardList = new List <cardList1>();
            cardList1        entity   = new cardList1();
            string           time     = DateTime.Now.ToString("yyyyMMddHHmmss");
            var no = time + Str.PinYin(Item.Username).ToUpper();//卡号唯一

            entity.cardNo   = no.Trim();
            entity.personId = Item.ID;
            entity.cardType = 1;
            cardList.Add(entity);
            var model = new
            {
                startDate = DateTime.Now.ToString("yyyy-MM-dd"),
                endDate   = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"),
                cardList
            };
            string    msg = SocketHelper.LoadCameraList(model, baseUrl, url, Key, Signature);
            parkList2 pl  = JsonConvert.DeserializeObject <parkList2>(msg);
        }