WebService Method in App Code folder with a [WebMethod] attribute. Just a normal C# method with [WebMethod] attribute. @RecordCount is an output parameter returned by the stored procedure.
[WebMethod]
public static Int64 VerifyDuplicateActivation(Int64 DetailsId)
{
Int64 RecordsCount = 0;
string connString = ConfigurationManager.AppSettings["DatabaseAnalyzeUAT1"].ToString();
SqlConnection oConn = new SqlConnection(connString);
SqlCommand oCommand = new SqlCommand();
oCommand.Connection = oConn;
oCommand.CommandText = "VerifyTeamActivation";
oCommand.CommandType = CommandType.StoredProcedure;
oCommand.Parameters.AddWithValue("@DetailsID", DetailsId);
oCommand.Parameters.Add("@RecordCount", SqlDbType.BigInt);
oCommand.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
oConn.Open();
oCommand.ExecuteScalar();
RecordsCount = (Int64)oCommand.Parameters["@RecordCount"].Value;
return RecordsCount;
}
[WebMethod]
public static Int64 VerifyDuplicateActivation(Int64 DetailsId)
{
Int64 RecordsCount = 0;
string connString = ConfigurationManager.AppSettings["DatabaseAnalyzeUAT1"].ToString();
SqlConnection oConn = new SqlConnection(connString);
SqlCommand oCommand = new SqlCommand();
oCommand.Connection = oConn;
oCommand.CommandText = "VerifyTeamActivation";
oCommand.CommandType = CommandType.StoredProcedure;
oCommand.Parameters.AddWithValue("@DetailsID", DetailsId);
oCommand.Parameters.Add("@RecordCount", SqlDbType.BigInt);
oCommand.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
oConn.Open();
oCommand.ExecuteScalar();
RecordsCount = (Int64)oCommand.Parameters["@RecordCount"].Value;
return RecordsCount;
}
Consuming WebService is just a method call if it is from Server Side.
Int64 RecCount = VerifyForDuplicate(details.DetailsId);
No comments:
Post a Comment