[WebMethod(Description = "Creates A new entry in a DataBase")]
public string NewItem(string AdreseeEmail, string senderEmail, string phoneNum, string boxMachineName, decimal onDeliveryAmount)
{
SqlConnection MyConnection = new SqlConnection(StrConnection);
SqlCommand MyCommand = new SqlCommand("ProCreateDelivery", MyConnection);
MyCommand.CommandType = CommandType.StoredProcedure;
MyCommand.Parameters.AddWithValue("@adreseeEmail",AdreseeEmail);
MyCommand.Parameters.AddWithValue("@senderEmail",senderEmail);
MyCommand.Parameters.AddWithValue("@phoneNum",phoneNum);
MyCommand.Parameters.AddWithValue("@boxMachineName",boxMachineName);
if (onDeliveryAmount == null)
{
MyCommand.Parameters.AddWithValue("@onDeliveryAmount", 0);
}
else
{
MyCommand.Parameters.AddWithValue("@onDeliveryAmount", onDeliveryAmount);
}
try
{
MyConnection.Open();
if (MyCommand.ExecuteNonQuery() != 0)
{
strResult = "Created Successfully ..!";
}
strResult = " Created Successfully ..!";
}
catch(Exception ex)
{
strResult = ex.ToString();
}
MyConnection.Close();
return strResult;
}