Example #1
0
        public string UpdatePassengerInfoToDevice(string ids, string cardid, string idcard, string phone, string pass, string starttime, string endtime, string type)
        {
            //type 1-增加卡号,2-删除卡号,3-增加密码,4-删除密码,5-启用电子门锁,6-停用电子门锁,7-增加身份证,8-删除身份证
            LockServices.IhzbAttenServiceservice client = new LockServices.IhzbAttenServiceservice();
            string str = ids.PadRight(16, ' ') + cardid.PadRight(10, ' ') + idcard.PadRight(18, ' ') + phone.PadRight(13, ' ') + pass.PadRight(6, ' ') + starttime + endtime + type;
            string ret = client.hzb_SetPassengerInfo(99, "02500262", str);

            retStatus1 = ret;

            //if (ret.Substring(0,1) == "1")
            //{
            //    //statusRet = client.hzb_GetOprateResult(99, "02500262", ret.Substring(1));


            //    t1.Elapsed += new System.Timers.ElapsedEventHandler(theout1);//到达时间的时候执行事件;
            //    t1.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
            //    t1.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;

            //    while (isLoop1)
            //    {
            //        //statusRet = client.hzb_GetOprateResult(99, "02500262", ret.Substring(1));

            //    }

            //    AddLockLog(ids, str);
            //}

            return(retStatus1);
        }
Example #2
0
        public string GetDeviceStatus(string ids)
        {
            LockServices.IhzbAttenServiceservice client = new LockServices.IhzbAttenServiceservice();
            string ret = client.hzb_GetLockerStatus(99, "02500262", ids);

            AddLockLog(ids, "Status");
            return(ret);
        }
Example #3
0
        public void DeleteICCard(string id)
        {
            string    sql = "select * from Rent_Locks_ICCards where ID=" + id;
            DataTable dt  = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0];

            sql = "update Rent_Locks_ICCards set IsValid='0' where ID=" + id;
            MySQLHelper.ExecuteNonQuery(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));
            string s = string.Empty;

            LockServices.IhzbAttenServiceservice client = new LockServices.IhzbAttenServiceservice();
            string str = dt.Rows[0]["LockID"].ToString().PadRight(16, ' ') + dt.Rows[0]["ICCard"].ToString().PadRight(10, ' ') + s.PadRight(18, ' ') + s.PadRight(13, ' ') + s.PadRight(6, ' ') + DateTime.Parse(dt.Rows[0]["StartDate"].ToString()).ToString("yyyyMMddHHmm").Substring(2, 10) + DateTime.Parse(dt.Rows[0]["EndDate"].ToString()).ToString("yyyyMMddHHmm").Substring(2, 10) + "2";
            string ret = client.hzb_SetPassengerInfo(99, "02500262", str);
        }
Example #4
0
        public void UnFreezeLock(string ID)
        {
            LockServices.IhzbAttenServiceservice client = new LockServices.IhzbAttenServiceservice();
            string cardid    = string.Empty;
            string idcard    = string.Empty;
            string phone     = string.Empty;
            string pass      = string.Empty;
            string starttime = DateTime.Now.ToString("yyyyMMddHHmm").Substring(2, 10);
            string endtime   = DateTime.Now.ToString("yyyyMMddHHmm").Substring(2, 10);
            string str       = ID.PadRight(16, ' ') + cardid.PadRight(10, ' ') + idcard.PadRight(18, ' ') + phone.PadRight(13, ' ') + pass.PadRight(6, ' ') + starttime + endtime + "5";
            string ret       = client.hzb_SetPassengerInfo(99, "02500262", str);

            AddLockLog(ID, "UnFreeze");

            string sql = "update Rent_Locks set status='0' where DeviceID='" + ID + "'";

            MySQLHelper.ExecuteNonQuery(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));
        }
Example #5
0
        private void theout(object source, System.Timers.ElapsedEventArgs e)
        {
            LockServices.IhzbAttenServiceservice client = new LockServices.IhzbAttenServiceservice();
            string statusRet = client.hzb_GetOprateResult(99, "02500262", retStatus.Substring(1));

            if (statusRet.Substring(0, 1).Equals("0"))
            {
                isLoop    = false;
                retStatus = statusRet;
            }
            else
            {
                if (retCount >= 10)
                {
                    isLoop    = false;
                    t.Enabled = false;
                    retStatus = string.Empty;
                }
            }
            retCount++;
        }
Example #6
0
        public string UnLockDevice(string id)
        {
            string userId = "hzb_yskj".PadRight(30, ' ');

            //string doorId = "0201075500100001"; //Test
            LockServices.IhzbAttenServiceservice client = new LockServices.IhzbAttenServiceservice();
            string ret = client.hzb_SetDoorOpen(99, "02500262", userId + id);

            retStatus = ret;
            string returnStr = ret.Substring(0, 1);
            string doorId    = ret.Substring(1, 16);
            string serialNo  = ret.Substring(17, 12);
            string statusRet = string.Empty;

            //System.Timers.Timer t = new System.Timers.Timer(1000);
            if (returnStr == "1")
            {
                //statusRet = client.hzb_GetOprateResult(99, "02500262", ret.Substring(1));


                t.Elapsed  += new System.Timers.ElapsedEventHandler(theout); //到达时间的时候执行事件;
                t.AutoReset = true;                                          //设置是执行一次(false)还是一直执行(true);
                t.Enabled   = true;                                          //是否执行System.Timers.Timer.Elapsed事件;

                while (isLoop)
                {
                    //statusRet = client.hzb_GetOprateResult(99, "02500262", ret.Substring(1));
                }

                AddLockLog(id, "Open");
            }
            else
            {
                return("3");
            }
            return(retStatus);
        }