コード例 #1
0
        //格式化卡
        public Ret FormatGasCard(
            string factory,     //厂家
            string kmm,         //卡密码,写卡后返回新密码
            string kh,          //卡号
            string dqdm         //地区代码,从气表管理里取
            )
        {
            Log.Debug("FormatGasCard(string kmm, string kh, string dqdm)=(" + kmm + "," + kh + "," + dqdm + ")");
            Ret ret = new Ret();

            try
            {
                ICard card = GetCard(factory);
                int   r    = card.FormatGasCard(Port, Baud, kmm, kh, dqdm);
                if (r < 0)
                {
                    if (r <= -19)
                    {
                        ret.Err = GetCardSpecificError(card, r);
                    }
                    else
                    {
                        ret.Err = Errors[-r - 1];
                    }
                }
                Log.Debug("FormatGasCard(string kmm, string kh, string dqdm)=(" + kmm + "," + kh + "," + dqdm + ")=" + r);
                return(ret);
            }
            catch (Exception e)
            {
                Log.Debug("FormatGasCard(string kmm, string kh, string dqdm)=" + e.Message);
                ret.Exception = e.Message;
                return(ret);
            }
        }
コード例 #2
0
 //航天解锁
 public Ret OpenCard(
  string factory,     //厂家
  string kmm,         //卡密码,写卡后返回新密码
  string kh,          //卡号
  string dqdm         //地区代码,从气表管理里取
  )
 {
     Log.Debug("OpenCard(string factory, string kmm, string kh, string dqdm)=(" 
         + factory + "," + kmm + "," + kh + "," + dqdm + ")");
     Ret ret = new Ret();
     try
     {
         ICard card = GetCard(factory);
         int r = card.OpenCard(Port, Baud);
         if (r < 0)
         {
             if (r <= -20)
             {
                 ret.Err = GetCardSpecificError(card, r);
             }
             else
             {
                 ret.Err = Errors[-r - 1];
             }
         }
         Log.Debug("OpenCard(string factory, string kmm, string kh, string dqdm)=("
             + factory + "," + kmm + "," + kh + "," + dqdm + ")=" + r);
         return ret;
     }
     catch (Exception e)
     {
         ret.Exception = e.Message;
         Log.Debug("OpenCard(string factory, string kmm, string kh, string dqdm)=" + e.Message);
         return ret;
     }
 }