//Delete contact , stored procedure :sp_update_contact_D public static bool DBDeleteContact(int contactID) { bool result = true; SqlCommand objCommand = new SqlCommand("sp_update_contact_D"); objCommand.CommandType = CommandType.StoredProcedure; SqlParameter prmContactID = new SqlParameter("@ContactID", SqlDbType.BigInt); prmContactID.Value = contactID; objCommand.Parameters.Add(prmContactID); if (DBInteraction.ExecuteSQL(ref objCommand)) { result = true; } else { result = false; } if (objCommand != null) { objCommand.Dispose(); } return(result); }
//update contact by contact ID, stored procedure :sp_update_contact_U public static bool DBUpdateContact(clsContact Contact) { bool result = true; SqlCommand objCommand = new SqlCommand("sp_update_contact_U"); objCommand.CommandType = CommandType.StoredProcedure; SqlParameter prmContactID = new SqlParameter("@ContactID", SqlDbType.BigInt); prmContactID.Value = Contact.ContactId; objCommand.Parameters.Add(prmContactID); SqlParameter prmFirstName = new SqlParameter("@FirstName", SqlDbType.VarChar); prmFirstName.Value = Contact.FirstName; objCommand.Parameters.Add(prmFirstName); SqlParameter prmLastName = new SqlParameter("@LastName", SqlDbType.VarChar); prmLastName.Value = Contact.LastName; objCommand.Parameters.Add(prmLastName); SqlParameter prmEmailID = new SqlParameter("@EmailID", SqlDbType.VarChar); prmEmailID.Value = Contact.EmailID; objCommand.Parameters.Add(prmEmailID); SqlParameter prmMobileNumber = new SqlParameter("@MobileNumber", SqlDbType.VarChar); prmMobileNumber.Value = Contact.MobileNumber; objCommand.Parameters.Add(prmMobileNumber); SqlParameter prmStatus = new SqlParameter("@Status", SqlDbType.Bit); prmStatus.Value = Contact.Status; objCommand.Parameters.Add(prmStatus); if (DBInteraction.ExecuteSQL(ref objCommand)) { result = true; } else { result = false; } if (objCommand != null) { objCommand.Dispose(); } return(result); }