private static string CheckIfExists(USBKey usbkey, string ID, bool WithID) { DataAccessLayer dal = new DataAccessLayer(); string error = ""; string addID = ""; if (WithID) { dal.AddParameter("@ID", ID, System.Data.DbType.String); addID = " AND [ID] <> @ID"; } dal.AddParameter("@Serialnumber", usbkey.Serialnumber, System.Data.DbType.String); error = dal.ExecuteScalar("IF EXISTS (SELECT * FROM [USBKey] WHERE [Deleted] = 0 AND UPPER([Serialnumber]) = UPPER(@Serialnumber)" + addID + ") SELECT '1' ELSE SELECT ''").ToString(); dal.ClearParameters(); return(error); }
public static string CheckIfExists(USBKey usbkey, string ID) { return(CheckIfExists(usbkey, ID, true)); }
/// <summary> /// Check if USBKey exists /// </summary> /// <param name="usbkey">USBKey to check</param> /// <returns></returns> public static string CheckIfExists(USBKey usbkey) { return(CheckIfExists(usbkey, "", false)); }