public int addImpXpayAgent(XObjs.XAgent x) { SqlConnection connection = new SqlConnection(hf.ConnectXpay()); SqlCommand command = new SqlCommand("INSERT INTO xagent (addressID,sys_ID,xname,cname,xpassword,nationality,xreg_date,xvisible,xsync) VALUES ('" + x.addressID + "','" + x.sys_ID + "','" + x.xname + "','" + x.cname + "','" + x.xpassword + "','" + x.nationality + "','" + x.xreg_date + "','" + x.xvisible + "','" + x.xsync + "') SELECT SCOPE_IDENTITY()", connection); connection.Open(); int num = Convert.ToInt32(command.ExecuteScalar()); connection.Close(); return(num); }
public int addXpayAgent(XObjs.XAgent x) { string str = "0"; SqlConnection connection = new SqlConnection(hf.ConnectXpay()); SqlCommand command = new SqlCommand("INSERT INTO xagent (addressID,sys_ID,xname,cname,xpassword,nationality,xreg_date,xvisible,xsync) VALUES ('" + x.addressID + "','" + x.sys_ID + "','" + x.xname + "','" + x.cname + "','" + x.xpassword + "','" + x.nationality + "','" + x.xreg_date + "','" + x.xvisible + "','" + x.xsync + "') SELECT SCOPE_IDENTITY()", connection); connection.Open(); int num = Convert.ToInt32(command.ExecuteScalar()); connection.Close(); if (num > 0) { str = "CLD/RA/" + num.ToString().PadLeft(5, '0'); updateXpayAgent(num.ToString(), str); } return(num); }