public void findAll() { db = new Database(); brands.Clear(); brandQuery = new MySqlCommand(); brandQuery.Connection = db.Connection(); brandQuery.CommandText = "SELECT * FROM brand ORDER BY brandname ASC"; this.brandResult = brandQuery.ExecuteReader(); while (brandResult.Read()) { if (!brandResult.IsDBNull(0)) { idbrand = brandResult.GetInt32(0); } if (!brandResult.IsDBNull(1)) { brandname = brandResult.GetString(1); } brands.Add(new Brand { idbrand = this.idbrand, brandname = this.brandname}); } db.Close(); }
public void create() { db = new Database(); if (officeVerification()) { try { officeQuery = new MySqlCommand(); officeQuery.Connection = db.Connection(); officeQuery.CommandText = "INSERT INTO office(officedescription) VALUES(@Description)"; officeQuery.Prepare(); officeQuery.Parameters.AddWithValue("@Description", officedescription); officeQuery.ExecuteNonQuery(); MessageBox.Show("A Descrição Cargo Assinatura " + officedescription + " foi criada com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void create() { db = new Database(); space = new Space(); try { pathQuery = new MySqlCommand(); pathQuery.Connection = db.Connection(); pathQuery.CommandText = "INSERT INTO path(path) VALUES(@Path)"; pathQuery.Prepare(); pathQuery.Parameters.AddWithValue("@Path", path); pathQuery.ExecuteNonQuery(); MessageBox.Show("O Caminho " + path + " foi criado com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } }
public void create() { db = new Database(); if (vendorVerification()) { try { vendorQuery = new MySqlCommand(); vendorQuery.Connection = db.Connection(); vendorQuery.CommandText = "INSERT INTO vendor(vendorname) VALUES(@Name)"; vendorQuery.Prepare(); vendorQuery.Parameters.AddWithValue("@Name", vendorname); vendorQuery.ExecuteNonQuery(); MessageBox.Show("O fornecedor " + vendorname + " foi criado com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void create() { db = new Database(); if (categoryVerification()) { try { actiontypeQuery = new MySqlCommand(); actiontypeQuery.Connection = db.Connection(); actiontypeQuery.CommandText = "INSERT INTO actiontype(actiontypedescription) VALUES(@Description)"; actiontypeQuery.Prepare(); actiontypeQuery.Parameters.AddWithValue("@Description", actiontypedescription); actiontypeQuery.ExecuteNonQuery(); MessageBox.Show("O tipo de ação " + actiontypedescription + " foi criado com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void create() { db = new Database(); if (userVerification()) { try { userQuery = new MySqlCommand(); userQuery.Connection = db.Connection(); userQuery.CommandText = "INSERT INTO user(username,useremail,iddepartment) VALUES(@Name,@Email,@Department)"; userQuery.Prepare(); userQuery.Parameters.AddWithValue("@Name", username); userQuery.Parameters.AddWithValue("@Email", useremail); userQuery.Parameters.AddWithValue("@Department", department.iddepartment); userQuery.ExecuteNonQuery(); MessageBox.Show("O Utilizador " + username + " foi criado com sucesso."); } catch (MySqlException ex) { if (ex.Message.Contains("Duplicate")) { MessageBox.Show("Já existe um Utilizador com o email " + useremail + "."); Console.WriteLine("Error: {0}", ex.ToString()); } else { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } } finally { db.Close(); } } }
public void findByOfficeDescription() { db = new Database(); officeQuery = new MySqlCommand(); officeQuery.Connection = db.Connection(); officeQuery.CommandText = "SELECT * FROM salutation WHERE salutationdescription = @Description"; officeQuery.Prepare(); officeQuery.Parameters.AddWithValue("@Description", officedescription); officeResult = officeQuery.ExecuteReader(); while (officeResult.Read()) { idoffice = officeResult.GetInt32(0); officedescription = officeResult.GetString(1); } db.Close(); }
public void edit() { db = new Database(); if (categoryVerification()) { try { actiontypeQuery = new MySqlCommand(); actiontypeQuery.Connection = db.Connection(); actiontypeQuery.CommandText = "UPDATE actiontype SET actiontypedescription = @Description WHERE idactiontype = @IDActionType"; actiontypeQuery.Prepare(); actiontypeQuery.Parameters.AddWithValue("@Description", actiontypedescription); actiontypeQuery.Parameters.AddWithValue("@IDActiontype", idactiontype); actiontypeQuery.ExecuteNonQuery(); MessageBox.Show("O tipo de ação " + actiontypedescription + " foi editado com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void findAll() { db = new Database(); actiontypes.Clear(); actiontypeQuery = new MySqlCommand(); actiontypeQuery.Connection = db.Connection(); actiontypeQuery.CommandText = "SELECT * FROM actiontype ORDER BY actiontypedescription ASC"; this.actiontypeResult = actiontypeQuery.ExecuteReader(); while (actiontypeResult.Read()) { if (!actiontypeResult.IsDBNull(0)) { idactiontype = actiontypeResult.GetInt32(0); } if (!actiontypeResult.IsDBNull(1)) { actiontypedescription = actiontypeResult.GetString(1); } actiontypes.Add(new ActionType { idactiontype = this.idactiontype, actiontypedescription = this.actiontypedescription }); } db.Close(); }
public void findBySignatureName() { db = new Database(); signatureQuery = new MySqlCommand(); signatureQuery.Connection = db.Connection(); signatureQuery.CommandText = "SELECT * FROM signature WHERE signaturename = @Name"; signatureQuery.Prepare(); signatureQuery.Parameters.AddWithValue("@Name", signaturename); signatureResult = signatureQuery.ExecuteReader(); while (signatureResult.Read()) { idsignature = signatureResult.GetInt32(0); signaturename = signatureResult.GetString(1); } db.Close(); }
public void findAll() { db = new Database(); signatures = new List<Signature>(); signatureQuery = new MySqlCommand(); signatureQuery.Connection = db.Connection(); signatureQuery.CommandText = "SELECT * FROM signature ORDER BY signaturename ASC"; signatureResult = signatureQuery.ExecuteReader(); while (signatureResult.Read()) { if (!signatureResult.IsDBNull(0)) { idsignature = signatureResult.GetInt32(0); } if (!signatureResult.IsDBNull(1)) { signaturename = signatureResult.GetString(1); } signatures.Add(new Signature { idsignature = this.idsignature, signaturename = this.signaturename }); } db.Close(); }
public void create() { db = new Database(); if (computerVerification()) { try { computerQuery = new MySqlCommand(); computerQuery.Connection = db.Connection(); computerQuery.CommandText = "INSERT INTO computer(idcomputer) VALUES(@ID)"; computerQuery.Prepare(); computerQuery.Parameters.AddWithValue("@ID", idcomputer); computerQuery.ExecuteNonQuery(); MessageBox.Show("O computador com o número " + idcomputer + " foi criado com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void create() { db = new Database(); if (personVerification()) { try { personQuery = new MySqlCommand(); personQuery.Connection = db.Connection(); personQuery.CommandText = "INSERT INTO person(personname,personemail,personstate) VALUES(@Name,@Email,@State)"; personQuery.Prepare(); personQuery.Parameters.AddWithValue("@Name", personname); personQuery.Parameters.AddWithValue("@Email", personemail); personQuery.Parameters.AddWithValue("@State", personstate.ToString()); personQuery.ExecuteNonQuery(); MessageBox.Show("A pessoa " + personname + " foi criada com sucesso."); } catch (MySqlException ex) { if (ex.Message.Contains("Duplicate")) { MessageBox.Show("Já existe uma Pessoa com o email " + personemail + "."); Console.WriteLine("Error: {0}", ex.ToString()); } else { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } } finally { db.Close(); } } }
public void findByPersonnameAndPersonemail() { db = new Database(); personQuery = new MySqlCommand(); personQuery.Connection = db.Connection(); personQuery.CommandText = "SELECT * FROM person WHERE personname = @Name AND personemail = @Email"; personQuery.Prepare(); personQuery.Parameters.AddWithValue("@Name", personname); personQuery.Parameters.AddWithValue("@Email", personemail); personResult = personQuery.ExecuteReader(); while (personResult.Read()) { if (!personResult.IsDBNull(0)) { idperson = personResult.GetInt32(0); } if (!personResult.IsDBNull(1)) { personname = personResult.GetString(1); } if (!personResult.IsDBNull(2)) { personemail = personResult.GetString(2); } else { personemail = null; } if (!personResult.IsDBNull(3)) { personstate = personResult.GetBoolean(3); } } db.Close(); }
public void findAll() { db = new Database(); persons.Clear(); personQuery = new MySqlCommand(); personQuery.Connection = db.Connection(); personQuery.CommandText = "SELECT * FROM person ORDER BY personname ASC"; personResult = personQuery.ExecuteReader(); while (personResult.Read()) { if (!personResult.IsDBNull(0)) { idperson = personResult.GetInt32(0); } if (!personResult.IsDBNull(1)) { personname = personResult.GetString(1); } if (!personResult.IsDBNull(2)) { personemail = personResult.GetString(2); } else { personemail = null; } if (!personResult.IsDBNull(3)) { personstate = personResult.GetBoolean(3); } persons.Add(new Person { idperson = this.idperson, personname = this.personname, personemail = this.personemail, personstate = this.personstate }); } db.Close(); }
public void edit() { db = new Database(); if (personVerification()) { try { personQuery = new MySqlCommand(); personQuery.Connection = db.Connection(); personQuery.CommandText = "UPDATE person SET personname = @Name , personemail = @Email , personstate = @State WHERE idperson = @IDPerson"; personQuery.Prepare(); personQuery.Parameters.AddWithValue("@Name", personname); personQuery.Parameters.AddWithValue("@Email", personemail); personQuery.Parameters.AddWithValue("@State", personstate.ToString()); personQuery.Parameters.AddWithValue("@IDPerson", idperson); personQuery.ExecuteNonQuery(); MessageBox.Show("A pessoa " + personname + " foi editada com sucesso."); } catch (MySqlException ex) { if (ex.Message.Contains("Duplicate")) { MessageBox.Show("Já existe uma Pessoa com o email " + personemail + "."); Console.WriteLine("Error: {0}", ex.ToString()); } else { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } } finally { db.Close(); } } }
public void edit() { db = new Database(); if (vendorVerification()) { try { vendorQuery = new MySqlCommand(); vendorQuery.Connection = db.Connection(); vendorQuery.CommandText = "UPDATE vendor SET vendorname = @Name WHERE idvendor = @IDVendor"; vendorQuery.Prepare(); vendorQuery.Parameters.AddWithValue("@Name", vendorname); vendorQuery.Parameters.AddWithValue("@IDVendor", idvendor); vendorQuery.ExecuteNonQuery(); MessageBox.Show("O fornecedor " + vendorname + " foi editado com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
private void countBySignatureName() { db = new Database(); signatureQuery = new MySqlCommand(); signatureQuery.Connection = db.Connection(); signatureQuery.CommandText = "SELECT COUNT(*) FROM signature WHERE signaturename = @Name"; signatureQuery.Prepare(); signatureQuery.Parameters.AddWithValue("@Name", signaturename); signatureResult = signatureQuery.ExecuteReader(); while (signatureResult.Read()) { countSignature = signatureResult.GetInt32(0); } db.Close(); }
public void findByPath() { db = new Database(); space = new Space(); paths.Clear(); pathQuery = new MySqlCommand(); pathQuery.Connection = db.Connection(); pathQuery.CommandText = "SELECT * FROM path WHERE path = @Path"; pathQuery.Prepare(); pathQuery.Parameters.AddWithValue("@Path", path); pathResult = pathQuery.ExecuteReader(); while (pathResult.Read()) { if (!pathResult.IsDBNull(0)) { idpath = pathResult.GetInt32(0); } if (!pathResult.IsDBNull(1)) { path = pathResult.GetString(1); } } db.Close(); }
public void create() { db = new Database(); if (signatureVerification()) { try { signatureQuery = new MySqlCommand(); signatureQuery.Connection = db.Connection(); signatureQuery.CommandText = "INSERT INTO signature(signaturename) VALUES(@Name)"; signatureQuery.Prepare(); signatureQuery.Parameters.AddWithValue("@Name", signaturename); signatureQuery.ExecuteNonQuery(); MessageBox.Show("A assinatura " + signaturename + " foi criada com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void findAll() { db = new Database(); space = new Space(); paths.Clear(); pathQuery = new MySqlCommand(); pathQuery.Connection = db.Connection(); pathQuery.CommandText = "SELECT * FROM path ORDER BY path ASC"; pathResult = pathQuery.ExecuteReader(); while (pathResult.Read()) { if (!pathResult.IsDBNull(0)) { idpath = pathResult.GetInt32(0); } if (!pathResult.IsDBNull(1)) { path = pathResult.GetString(1); } paths.Add(new Path { idpath = this.idpath, path = this.path }); } db.Close(); }
public void edit() { db = new Database(); if (signatureVerification()) { try { signatureQuery = new MySqlCommand(); signatureQuery.Connection = db.Connection(); signatureQuery.CommandText = "UPDATE signature SET signaturename = @Name WHERE idsignature = @IDSignature"; signatureQuery.Prepare(); signatureQuery.Parameters.AddWithValue("@Name", signaturename); signatureQuery.Parameters.AddWithValue("@IDSignature", idsignature); signatureQuery.ExecuteNonQuery(); MessageBox.Show("A assinatura " + signaturename + " foi editada com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void findAll() { db = new Database(); salutations.Clear(); salutationQuery = new MySqlCommand(); salutationQuery.Connection = db.Connection(); salutationQuery.CommandText = "SELECT * FROM salutation ORDER BY salutationdescription ASC"; salutationResult = salutationQuery.ExecuteReader(); while (salutationResult.Read()) { if (!salutationResult.IsDBNull(0)) { idsalutation = salutationResult.GetInt32(0); } if (!salutationResult.IsDBNull(1)) { salutationdescription = salutationResult.GetString(1); } salutations.Add(new Salutation { idsalutation = this.idsalutation, salutationdescription = this.salutationdescription }); } db.Close(); }
public void edit() { db = new Database(); if (salutationVerification()) { try { salutationQuery = new MySqlCommand(); salutationQuery.Connection = db.Connection(); salutationQuery.CommandText = "UPDATE salutation SET salutationdescription = @Description WHERE idsalutation = @IDSalutation"; salutationQuery.Prepare(); salutationQuery.Parameters.AddWithValue("@Description", salutationdescription); salutationQuery.Parameters.AddWithValue("@IDSalutation", idsalutation); salutationQuery.ExecuteNonQuery(); MessageBox.Show("A Descrição Saudação Assinatura " + salutationdescription + " foi editada com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void findAll() { db = new Database(); officeQuery = new MySqlCommand(); officeQuery.Connection = db.Connection(); officeQuery.CommandText = "SELECT * FROM office ORDER BY officedescription ASC"; officeResult = officeQuery.ExecuteReader(); while (officeResult.Read()) { if (!officeResult.IsDBNull(0)) { idoffice = officeResult.GetInt32(0); } if (!officeResult.IsDBNull(1)) { officedescription = officeResult.GetString(1); } offices.Add(new Office { idoffice = this.idoffice, officedescription = this.officedescription }); } db.Close(); }
public void findAll() { db = new Database(); models.Clear(); modelQuery = new MySqlCommand(); modelQuery.Connection = db.Connection(); modelQuery.CommandText = "SELECT * FROM model ORDER BY modeldescription ASC"; this.modelResult = modelQuery.ExecuteReader(); while (modelResult.Read()) { if (!modelResult.IsDBNull(0)) { idmodel = modelResult.GetInt32(0); } if (!modelResult.IsDBNull(1)) { modeldescription = modelResult.GetString(1); } if (!modelResult.IsDBNull(2)) { idbrand = modelResult.GetInt32(2); } models.Add(new Model { idmodel = this.idmodel, modeldescription = this.modeldescription}); } db.Close(); }
private void countBySalutationDescripiton() { db = new Database(); officeQuery = new MySqlCommand(); officeQuery.Connection = db.Connection(); officeQuery.CommandText = "SELECT COUNT(*) FROM salutation WHERE salutationdescription = @Description"; officeQuery.Prepare(); officeQuery.Parameters.AddWithValue("@Description", officedescription); officeResult = officeQuery.ExecuteReader(); while (officeResult.Read()) { countOffice = officeResult.GetInt32(0); } db.Close(); }
public void findAll() { db = new Database(); vendors.Clear(); vendorQuery = new MySqlCommand(); vendorQuery.Connection = db.Connection(); vendorQuery.CommandText = "SELECT * FROM vendor ORDER BY vendorname ASC"; this.vendorResult = vendorQuery.ExecuteReader(); while (vendorResult.Read()) { if (!vendorResult.IsDBNull(0)) { idvendor = vendorResult.GetInt32(0); } if (!vendorResult.IsDBNull(1)) { vendorname = vendorResult.GetString(1); } vendors.Add(new Vendor { idvendor = this.idvendor, vendorname = this.vendorname }); } db.Close(); }
public void edit() { db = new Database(); if (officeVerification()) { try { officeQuery = new MySqlCommand(); officeQuery.Connection = db.Connection(); officeQuery.CommandText = "UPDATE office SET officedescription = @Description WHERE idoffice = @IDOffice"; officeQuery.Prepare(); officeQuery.Parameters.AddWithValue("@Description", officedescription); officeQuery.Parameters.AddWithValue("@IDOffice", idoffice); officeQuery.ExecuteNonQuery(); MessageBox.Show("A Descrição Cargo Assinatura " + officedescription + " foi editada com sucesso."); } catch (MySqlException ex) { MessageBox.Show("Ocurreu um erro"); Console.WriteLine("Error: {0}", ex.ToString()); } finally { db.Close(); } } }
public void findByUsername() { db = new Database(); userQuery = new MySqlCommand(); userQuery.Connection = db.Connection(); userQuery.CommandText = "SELECT * FROM user WHERE username = @Name"; userQuery.Prepare(); userQuery.Parameters.AddWithValue("@Name", username); userResult = userQuery.ExecuteReader(); while (userResult.Read()) { if (!userResult.IsDBNull(0)) { iduser = userResult.GetInt32(0); } if (!userResult.IsDBNull(1)) { username = userResult.GetString(1); } if (!userResult.IsDBNull(2)) { useremail = userResult.GetString(2); } else { useremail = null; } if (!userResult.IsDBNull(3)) { iddepartment = userResult.GetInt32(3); } } db.Close(); }