public int WriteNewCard(short com, int baud, ref string kmm, short kzt, string kh, string dqdm, string yhh, string tm, int ql, int csql, int ccsql, short cs, int ljgql, short bkcs, int ljyql, int bjql, int czsx, int tzed, string sqrq, string cssqrq, int oldprice, int newprice, string sxrq, string sxbj)
{
byte[] mm = new byte[10];
byte[] cardNO = System.Text.Encoding.GetEncoding(1252).GetBytes(kh);
byte[] bdqdm = System.Text.Encoding.GetEncoding(1252).GetBytes(dqdm);
byte[] byhh = System.Text.Encoding.GetEncoding(1252).GetBytes("0000000001");
byte[] btm = new byte[10];
byte[] bsqrq = new byte[10];
byte[] bsxrq = new byte[10];
byte[] bsxbj = new byte[10];
Int32 boldprice = 0;
Int32 bnewprice = 0;
short Buytimes;
Log.Debug("start write new card");
//发卡前先格式化卡
int ret = StaticFormatGasCard(com, baud, mm, 1, cardNO, bdqdm);
Log.Debug("format card end ret=" + ret);
//发卡购气
if (0 == kzt)
{
//次数一定是1
Buytimes = 1;
}
//换表补气
else
{
Buytimes = cs;
}
ret = StaticWriteNewCard(com, baud, mm, 1, kzt, cardNO, bdqdm, byhh, btm,
ql, Buytimes, ljgql, bkcs, ljyql, bjql, czsx, tzed, bsqrq, ref boldprice, ref bnewprice, bsxrq, bsxbj);
Log.Debug("write card end ret=" + ret);
return ret;
}