public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml) { new Log(@"Agent\CardPassword").Write(string.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", new object[] { AgentID, TimeStamp, Sign, CardsXml })); DataSet ds = new DataSet(); short state = 0; DataTable table = _Convert.XMLToDataTable(CardsXml); if ((table == null) || (table.Rows.Count < 1)) { this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return(ds); } if (this.Valid(ref ds, ref state, AgentID, TimeStamp, Sign, new object[] { CardsXml }) >= 0) { Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase); CardsXml = "<Cards>"; CardPassword password = new CardPassword(); int agentID = -1; foreach (DataRow row in table.Rows) { string input = row["Number"].ToString(); if (!regex.IsMatch(input)) { this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return(ds); } long num3 = password.GetCardPasswordID(PF.GetCallCert(), input, ref agentID); if ((num3 < 0L) || (agentID != AgentID)) { this.BuildReturnDataSetForError(-5, "卡号不存在", ref ds); return(ds); } CardsXml = CardsXml + "<Card ID=\"" + num3.ToString() + "\" />"; } CardsXml = CardsXml + "</Cards>"; int returnValue = -1; string returnDescription = ""; this.BuildReturnDataSet(0L, ref ds); if (Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref returnValue, ref returnDescription) < 0) { this.BuildReturnDataSetForError(-9999, "未知错误", ref ds); return(ds); } if (returnValue < 0) { this.BuildReturnDataSetForError(returnValue, returnDescription, ref ds); return(ds); } DataTable table2 = ds.Tables[1]; table2.Columns.Add("Number", typeof(string)); for (int i = 0; i < table2.Rows.Count; i++) { table2.Rows[i]["Number"] = password.GenNumber(PF.GetCallCert(), AgentID, _Convert.StrToLong(table2.Rows[i]["ID"].ToString(), -1L)); table2.AcceptChanges(); } table2.Columns.Remove(table2.Columns[0]); } return(ds); }
public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml) { new Log(@"Agent\CardPassword").Write(string.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", new object[] { AgentID, TimeStamp, Sign, CardsXml })); DataSet ds = new DataSet(); short state = 0; DataTable table = _Convert.XMLToDataTable(CardsXml); if ((table == null) || (table.Rows.Count < 1)) { this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return ds; } if (this.Valid(ref ds, ref state, AgentID, TimeStamp, Sign, new object[] { CardsXml }) >= 0) { Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase); CardsXml = "<Cards>"; CardPassword password = new CardPassword(); int agentID = -1; foreach (DataRow row in table.Rows) { string input = row["Number"].ToString(); if (!regex.IsMatch(input)) { this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return ds; } long num3 = password.GetCardPasswordID(PF.GetCallCert(), input, ref agentID); if ((num3 < 0L) || (agentID != AgentID)) { this.BuildReturnDataSetForError(-5, "卡号不存在", ref ds); return ds; } CardsXml = CardsXml + "<Card ID=\"" + num3.ToString() + "\" />"; } CardsXml = CardsXml + "</Cards>"; int returnValue = -1; string returnDescription = ""; this.BuildReturnDataSet(0L, ref ds); if (Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref returnValue, ref returnDescription) < 0) { this.BuildReturnDataSetForError(-9999, "未知错误", ref ds); return ds; } if (returnValue < 0) { this.BuildReturnDataSetForError(returnValue, returnDescription, ref ds); return ds; } DataTable table2 = ds.Tables[1]; table2.Columns.Add("Number", typeof(string)); for (int i = 0; i < table2.Rows.Count; i++) { table2.Rows[i]["Number"] = password.GenNumber(PF.GetCallCert(), AgentID, _Convert.StrToLong(table2.Rows[i]["ID"].ToString(), -1L)); table2.AcceptChanges(); } table2.Columns.Remove(table2.Columns[0]); } return ds; }
public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml) { new Log("Agent\\CardPassword").Write(String.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", AgentID, TimeStamp, Sign, CardsXml)); DataSet ds = new DataSet(); short State = 0; DataTable dtCardsXml = Shove._Convert.XMLToDataTable(CardsXml); if ((dtCardsXml == null) || (dtCardsXml.Rows.Count < 1)) { BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return ds; } if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, CardsXml) < 0) { return ds; } Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase); CardsXml = "<Cards>"; CardPassword cp = new CardPassword(); int _AgentID = -1; foreach (DataRow dr in dtCardsXml.Rows) { string Number = dr["Number"].ToString(); if (!regex.IsMatch(Number)) { BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return ds; } long CardPasswordID = cp.GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID); if ((CardPasswordID < 0) || (_AgentID != AgentID)) { BuildReturnDataSetForError(-5, "卡号不存在", ref ds); return ds; } CardsXml += "<Card ID=\"" + CardPasswordID.ToString() + "\" />"; } CardsXml += "</Cards>"; int ReturnValue = -1; string ReturnDescription = ""; BuildReturnDataSet(0, ref ds); int Results = -1; Results = DAL.Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref ReturnValue, ref ReturnDescription); if (Results < 0) { BuildReturnDataSetForError(-9999, "未知错误", ref ds); return ds; } if (ReturnValue < 0) { BuildReturnDataSetForError(ReturnValue, ReturnDescription, ref ds); return ds; } // 置换ID为卡号 DataTable dt = ds.Tables[1]; dt.Columns.Add("Number", typeof(string)); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["Number"] = cp.GenNumber(PF.GetCallCert(), AgentID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1)); dt.AcceptChanges(); } dt.Columns.Remove(dt.Columns[0]); return ds; }
public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml) { new Log("Agent\\CardPassword").Write(String.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", AgentID, TimeStamp, Sign, CardsXml)); DataSet ds = new DataSet(); short State = 0; DataTable dtCardsXml = Shove._Convert.XMLToDataTable(CardsXml); if ((dtCardsXml == null) || (dtCardsXml.Rows.Count < 1)) { BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return(ds); } if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, CardsXml) < 0) { return(ds); } Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase); CardsXml = "<Cards>"; CardPassword cp = new CardPassword(); int _AgentID = -1; foreach (DataRow dr in dtCardsXml.Rows) { string Number = dr["Number"].ToString(); if (!regex.IsMatch(Number)) { BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds); return(ds); } long CardPasswordID = cp.GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID); if ((CardPasswordID < 0) || (_AgentID != AgentID)) { BuildReturnDataSetForError(-5, "卡号不存在", ref ds); return(ds); } CardsXml += "<Card ID=\"" + CardPasswordID.ToString() + "\" />"; } CardsXml += "</Cards>"; int ReturnValue = -1; string ReturnDescription = ""; BuildReturnDataSet(0, ref ds); int Results = -1; Results = DAL.Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref ReturnValue, ref ReturnDescription); if (Results < 0) { BuildReturnDataSetForError(-9999, "未知错误", ref ds); return(ds); } if (ReturnValue < 0) { BuildReturnDataSetForError(ReturnValue, ReturnDescription, ref ds); return(ds); } // 置换ID为卡号 DataTable dt = ds.Tables[1]; dt.Columns.Add("Number", typeof(string)); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["Number"] = cp.GenNumber(PF.GetCallCert(), AgentID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1)); dt.AcceptChanges(); } dt.Columns.Remove(dt.Columns[0]); return(ds); }