public bool IsRemoved()
 {
     try
     {
         mysqlConnectie.Open();
         var RemoveLicense = new MySqlCommand("DELETE FROM license WHERE licenseID= " + LicenseID, mysqlConnectie);
         mysqlConnectie.Close();
         return(true);
     }
     catch (MySqlException ex)
     {
         var exep = new MySqlExceptionHandler(ex, "License");
         throw new Exception(exep.ReturnMessage());
     }
 }
Exemple #2
0
 /// <summary>
 /// Binds the event ID with hardware.
 /// </summary>
 public void BindEventID()
 {
     try
     {
         MySqlConnection mysqlConnectie = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
         mysqlConnectie.Open();
         MySqlCommand bindEventIDWithHardware = new MySqlCommand("UPDATE hardware SET eventID = '" + EventID + "' WHERE internalNr LIKE '" +
                                                                 InternalNr + "'", mysqlConnectie);
         bindEventIDWithHardware.ExecuteNonQuery();
         bindEventIDWithHardware.Dispose();
         mysqlConnectie.Close();
     }
     catch (MySqlException ex)
     {
         var handler = new MySqlExceptionHandler(ex, "Hardware");
         throw new Exception(handler.ExceptionType);
     }
 }
Exemple #3
0
 /// <summary>
 /// Returns the datatable of searched hardware .
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="searchValue">The search value.</param>
 /// <returns>System.Data.DataTable. searched hardware</returns>
 public DataTable ReturnSearchDatatable(string searchType, string searchValue)
 {
     try
     {
         MySqlConnection mysqlConnectie = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
         mysqlConnectie.Open();
         MySqlCommand searchItem   = new MySqlCommand("SELECT pictureLocation, DATE_FORMAT(purchaseDate, '%Y-%m-%d') 'purchaseDate', type, manufacturerName , serialNr, internalNr , warranty , extraInfo , DATE_FORMAT(addedDate, '%Y-%m-%d') 'addedDate', attachmentLocation, modelNr FROM hardware WHERE " + searchType + " COLLATE UTF8_GENERAL_CI LIKE '%" + searchValue + "%';", mysqlConnectie);
         var          searchReader = searchItem.ExecuteReader();
         DataTable    dt           = new DataTable();
         dt.Load(searchReader);
         mysqlConnectie.Close();
         return(dt);
     }
     catch (MySqlException ex)
     {
         var handler = new MySqlExceptionHandler(ex, "Hardware");
         throw new Exception(handler.ExceptionType);
     }
 }
Exemple #4
0
 /// <summary>
 /// Returns the datatable hardware from the internal number.
 /// </summary>
 /// <returns>DataTable internal nr corresponsing hardware.</returns>
 public DataTable ReturnDatatableHardwareFromInternal()
 {
     try
     {
         MySqlConnection mysqlConnectie = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
         mysqlConnectie.Open();
         MySqlCommand getCorrespondingPeople = new MySqlCommand("SELECT pictureLocation, DATE_FORMAT(purchaseDate, '%Y-%m-%d') 'purchaseDate', type , manufacturerName, serialNr , internalNr, warranty, extraInfo , DATE_FORMAT(addedDate, '%Y-%m-%d') 'addedDate', attachmentLocation, modelNr FROM hardware WHERE internalNr = '" + InternalNr + "'", mysqlConnectie);
         var          dataReader             = getCorrespondingPeople.ExecuteReader();
         var          dt = new DataTable();
         dt.Load(dataReader);
         mysqlConnectie.Close();
         return(dt);
     }
     catch (MySqlException ex)
     {
         var handler = new MySqlExceptionHandler(ex, "Hardware");
         throw new Exception(handler.ExceptionType);
     }
 }
Exemple #5
0
 /// <summary>
 /// Archives the assigned hardware.
 /// </summary>
 /// <param name="strSerialNr">The string serial nr.</param>
 /// <param name="strInternalNr">The string internal nr.</param>
 /// <param name="intEventID">The int event identifier.</param>
 public void ArchiveAssignedHardware(String strSerialNr, String strInternalNr, int intEventID)
 {
     try
     {
         MySqlConnection mysqlConnectie  = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
         String          dteAssignedDate = DateTime.Today.ToString("yyyy-MM-dd");
         mysqlConnectie.Open();
         MySqlCommand archiveAssigned = new MySqlCommand("Insert into archive ( assignedDate, serialNr, internalNr, eventID ) values (@assignedDate, @serialNr, @internalNr, @eventID)", mysqlConnectie);
         archiveAssigned.Parameters.AddWithValue("@assignedDate", dteAssignedDate);
         archiveAssigned.Parameters.AddWithValue("@serialNr", strSerialNr);
         archiveAssigned.Parameters.AddWithValue("@internalNr", strInternalNr);
         archiveAssigned.Parameters.AddWithValue("@eventID", intEventID);
         archiveAssigned.ExecuteNonQuery();
         archiveAssigned.Dispose();
         mysqlConnectie.Close();
     }
     catch (MySqlException ex)
     {
         var handler = new MySqlExceptionHandler(ex, "Hardware");
         throw new Exception(handler.ExceptionType);
     }
 }