save class
public static int Save(string Name, string Emailid, string PhoneNo, string LaptopBrand, string Model, string SerialNo, string Description, DateTime DOE, string Coupon)
{
int n;
SqlCommand cmd = new SqlCommand();
try
{
cmd.Connection = DataConnection.Con;
cmd.CommandText = "Sp_Register_Save";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@rowId", 0);
cmd.Parameters.AddWithValue("@Name", Name);
cmd.Parameters.AddWithValue("@Emailid", Emailid);
cmd.Parameters.AddWithValue("@PhoneNo", PhoneNo);
cmd.Parameters.AddWithValue("@LaptopBrand", LaptopBrand);
cmd.Parameters.AddWithValue("@Model", Model);
cmd.Parameters.AddWithValue("@SerialNo", SerialNo);
cmd.Parameters.AddWithValue("@Description", Description);
cmd.Parameters.AddWithValue("@DOE", DOE);
cmd.Parameters.AddWithValue("@Coupon", Coupon);
cmd.Parameters.Add("@flag", SqlDbType.Int).Direction = ParameterDirection.Output;
if (cmd.Connection.State == ConnectionState.Closed)
{
cmd.Connection.Open();
}
cmd.ExecuteNonQuery();
n = Convert.ToInt32(cmd.Parameters["@flag"].Value);
if (cmd.Connection.State == ConnectionState.Open)
{
cmd.Connection.Close();
}
return n;
}
catch (Exception ex)
{
return 0;
}
}
{
int n;
SqlCommand cmd = new SqlCommand();
try
{
cmd.Connection = DataConnection.Con;
cmd.CommandText = "Sp_Register_Save";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@rowId", 0);
cmd.Parameters.AddWithValue("@Name", Name);
cmd.Parameters.AddWithValue("@Emailid", Emailid);
cmd.Parameters.AddWithValue("@PhoneNo", PhoneNo);
cmd.Parameters.AddWithValue("@LaptopBrand", LaptopBrand);
cmd.Parameters.AddWithValue("@Model", Model);
cmd.Parameters.AddWithValue("@SerialNo", SerialNo);
cmd.Parameters.AddWithValue("@Description", Description);
cmd.Parameters.AddWithValue("@DOE", DOE);
cmd.Parameters.AddWithValue("@Coupon", Coupon);
cmd.Parameters.Add("@flag", SqlDbType.Int).Direction = ParameterDirection.Output;
if (cmd.Connection.State == ConnectionState.Closed)
{
cmd.Connection.Open();
}
cmd.ExecuteNonQuery();
n = Convert.ToInt32(cmd.Parameters["@flag"].Value);
if (cmd.Connection.State == ConnectionState.Open)
{
cmd.Connection.Close();
}
return n;
}
catch (Exception ex)
{
return 0;
}
}