public virtual bool SaveData(int sectionid, string fid = null, string cardid = null, string dbcontrolstr = null) { bool result = true; if (_driver is ReaderM1S50Method) { string msg; ReaderM1S50Method reader = _driver as ReaderM1S50Method; byte[] data = reader.HexToBin(this.GetData()); result = reader.MifareWrite(sectionid * 4 + BlockNo, data, out msg); } HasChanged = false;; //return string.Empty; return(result); }
public override bool Read(string Password, out Dictionary <string, object> param, out string msg) { bool result = false; param = new Dictionary <string, object>(); if (!LoadData(out msg)) { _ReaderMethod.Halt(out msg); return(result); } if (string.IsNullOrEmpty(Password)) { Password = System.Text.Encoding.GetEncoding("ASCII").GetString(_ReaderMethod.HexToBin(this.Section2.Block0.Password)); } msg = string.Empty; //results = new Dictionary<string, object>(); param.Add("ErrCounter", 1); param.Add("OrgID", this.Section1.Block0.CardID.Substring(0, 6)); string type = this.Section1.Block1.CardType; switch (type) { case ("04"): { param.Add("CardType", "0301"); break; } default: { param.Add("CardType", "0200"); break; } } //results.Add("CardType", str1.Remove(4)); param.Add("PasswordCounter", this.Section2.Block1.CardState); param.Add("UserNO", this.Section1.Block0.CardID.Substring(12, 8).TrimStart(new char[] { '0' })); //param.Add("MinLimit", str1.Substring(64, 4)); param.Add("StationNO", this.Section1.Block0.CardID.Substring(6, 6)); //param.Add("AreaID", str1.Substring(12, 6)); param.Add("UserPassword", System.Text.Encoding.GetEncoding("ASCII").GetString(_ReaderMethod.HexToBin(this.Section2.Block0.Password))); param.Add("Remain", Convert.ToString(Convert.ToInt32(this.Section2.Block0.Bal * 100), 16)); //param.Add("OilType", ""); //param.Add("CarNo", str1.Substring(72, 16)); //param.Add("CheckBCC", str1.Substring(94, 2)); _ReaderMethod.Halt(out msg); _ReaderMethod.DevBeep(1, 1, 1); result = true; return(result); }