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

            try
            {
                ICard card = GetCard(factory);
                int   r    = card.FormatGasCard(Port, Baud, kmm, kh, dqdm);
                if (r < 0)
                {
                    ret.Err = Errors[-r - 1];
                }
                return(ret);
            }
            catch (Exception e)
            {
                Log.Debug("FormatCard exception");
                ret.Exception = e.Message;
                return(ret);
            }
        }
Esempio n. 2
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);
            }
        }