public void Load(AviaCompany ac) { Clear(); if (ac == null) { return; } DBInterface.CommandText = "select " + "aviacompanyunion.idAviaCompanyUnion, " + "aviacompanyunion.UnionName, " + "aviacompanyunion.note " + "from joinaviacompanyunion " + "left join aviacompanyunion " + "on joinaviacompanyunion.idAviaCompanyUnion = aviacompanyunion.idAviaCompanyUnion " + "where joinaviacompanyunion.idAviaCompany = @idAviaCompany"; DBInterface.AddParameter("@idAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, ac.ID); DataTable tab = DBInterface.ExecuteSelection(); foreach (DataRow row in tab.Rows) { AviaCompanyUnion acu = new AviaCompanyUnion(); acu.ID = Convert.ToInt32(row["idAviaCompanyUnion"]); acu.Name = row["UnionName"].ToString(); acu.Note = row["note"].ToString(); this.Add(acu); } UpdateMirror(); }
public void AddElement(AviaCompany ac, AviaCompanyUnion acu) { DBInterface.CommandText = "select * " + "from joinaviacompanyunion " + "where joinaviacompanyunion.idAviaCompany = @idAviaCompany " + "and joinaviacompanyunion.idAviaCompanyUnion = @idAviaCompanyUnion;"; DBInterface.AddParameter("@idAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, ac.ID); DBInterface.AddParameter("@idAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, acu.ID); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count == 0) { DBInterface.StoredProcedure("join_avia_company_union_insert"); DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, acu.ID); DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, ac.ID); DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, ""); DBInterface.AddOutParameter("@outIdJoinAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32); DBInterface.ExecuteTransaction(); } }
public override void Load() { Clear(); DBInterface.CommandText = "select " + "contact.idContact, " + "typecontact.nameContact, " + "contact.value, " + "contact.description " + "from contact " + "left join person " + "on contact.idPerson = person.idPerson " + "left join typecontact " + "on contact.idTypeContact = typecontact.idTypeContact " + "where " + "person.idPerson = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, person.ID); DataTable tab = DBInterface.ExecuteSelection(); foreach (DataRow row in tab.Rows) { Contact item = Contact.Create(Convert.ToString(row["nameContact"])); item.ID = Convert.ToInt32(row["idContact"]); item.Content = Convert.ToString(row["value"]); item.Description = Convert.ToString(row["description"]); Add(item); } }
public void Delete() { DeleteJoin(); DBInterface.StoredProcedure("avia_company_union_delete"); DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.ExecuteTransaction(); }
public void Load(Country country) { Clear(); if (country == null) { return; } DBInterface.CommandText = "select " + "countryunion.idCountryUnion, " + "countryunion.UnionName, " + "countryunion.shortUnionName, " + "countryunion.note " + "from joincountryunion " + "left join countryunion " + "on joincountryunion.idCountryUnion = countryunion.idCountryUnion " + "where joincountryunion.idCountry = @idCountry"; DBInterface.AddParameter("@idCountry", MySql.Data.MySqlClient.MySqlDbType.Int32, country.ID); DataTable tab = DBInterface.ExecuteSelection(); foreach (DataRow row in tab.Rows) { CountryUnion item = Create(); item.ID = Convert.ToInt32(row["idCountryUnion"]); item.Name = row["UnionName"].ToString(); item.ShortName = row["shortUnionName"].ToString(); item.Note = row["note"].ToString(); } UpdateMirror(); }
public void Load() { Changed = false; DBInterface.CommandText = "select ownerName, ownerSurname, number, idCitizen, idCountry, expireDate, note, isActive from passport where idPassport = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DataTable tab = DBInterface.ExecuteSelection(); if ((tab != null) && (tab.Rows.Count == 1)) { PersonName = tab.Rows[0]["ownerName"].ToString(); PersonSurname = tab.Rows[0]["ownerSurname"].ToString(); SerialNumber = tab.Rows[0]["number"].ToString(); ValidTill = Convert.ToDateTime(tab.Rows[0]["expireDate"]); Description = tab.Rows[0]["note"].ToString(); int idCountry = Convert.ToInt32(tab.Rows[0]["idCountry"]); CountryOfEmmitation = new Country(); CountryOfEmmitation.ID = idCountry; CountryOfEmmitation.Load(); int idCitizen = Convert.ToInt32(tab.Rows[0]["idCitizen"]); Citizen = new Country(); Citizen.ID = idCountry; Citizen.Load(); vizaList = null; } }
public void AddElement(Country country, CountryUnion countryUnion) { DBInterface.CommandText = "select * " + "from joincountryunion " + "where joincountryunion.idCountry = @idCountry " + "and joincountryunion.idCountryUnion = @idCountryUnion;"; DBInterface.AddParameter("@idCountry", MySql.Data.MySqlClient.MySqlDbType.Int32, country.ID); DBInterface.AddParameter("@idCountryUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, countryUnion.ID); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count == 0) { DBInterface.StoredProcedure("join_Country_union_insert"); DBInterface.AddParameter("@inIdCountryUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, countryUnion.ID); DBInterface.AddParameter("@inIdCountry", MySql.Data.MySqlClient.MySqlDbType.Int32, country.ID); DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, ""); DBInterface.AddOutParameter("@outIdJoinCountryUnion", MySql.Data.MySqlClient.MySqlDbType.Int32); DBInterface.ExecuteTransaction(); } }
public bool Check() { try { DBInterface.CommandText = "SELECT * FROM sellcontroller.user WHERE login = @name;"; DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, Name); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count == 0) { return(false); } if (tab.Rows.Count > 1) { throw new ArgumentException("User with current id is not unique."); } ID = Convert.ToInt32(tab.Rows[0]["idUser"]); if (tab.Rows[0]["hashcode"].ToString() == PassHash()) { return(true); } else { return(false); } } catch { return(false); } }
public override void Load() { Clear(); DBInterface.CommandText = "select " + "document.name, " + "document.GUID, " + "document.extension, " + "document.idDocument, " + "persondocument.description " + "from persondocument " + "inner join document " + "on document.idDocument = persondocument.idDocument " + "where persondocument.idPerson = @idPerson;"; DBInterface.AddParameter("@idPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, person.ID); DataTable tab = DBInterface.ExecuteSelection(); foreach (DataRow row in tab.Rows) { AttachFilePerson atp = Create(); atp.ID = Convert.ToInt32(row["idDocument"]); atp.Name = Convert.ToString(row["name"]); atp.guid = Convert.ToString(row["GUID"]); atp.Extension = Convert.ToString(row["extension"]); atp.Description = Convert.ToString(row["description"]); Add(atp); } }
public override void Load() { DBInterface.CommandText = "SELECT `people`.`idPeople`," + "`people`.`idPerson`," + "`people`.`firstName`," + "`people`.`middleName`," + "`people`.`lastName`," + "`people`.`birthDate`," + "`people`.`Note`," + "`people`.`itn`" + "FROM `sellcontroller`.`people` WHERE `idPeople` = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count == 1) { FirstName = Convert.ToString(tab.Rows[0]["firstName"]); SecondName = Convert.ToString(tab.Rows[0]["lastName"]); MiddleName = Convert.ToString(tab.Rows[0]["middleName"]); Birth = Convert.ToDateTime(tab.Rows[0]["birthDate"]); Description = Convert.ToString(tab.Rows[0]["Note"]); } else if (tab.Rows.Count > 1) { throw new DuplicateNameException("People table has rows with same id"); } ContactList.Load(); Changed = false; }
public override void Load() { DBInterface.CommandText = "select " + "document.name, " + "document.GUID, " + "document.extension, " + "persondocument.description, " + "from persondocument " + "inner join document " + "on document.idDocument = persondocument.idDocument " + "where document.idDocument = @id and persondocument.idPerson = @idPerson;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.AddParameter("@idPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, person.ID); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count == 1) { Name = Convert.ToString(tab.Rows[0]["name"]); guid = Convert.ToString(tab.Rows[0]["GUID"]); Extension = Convert.ToString(tab.Rows[0]["extension"]); Description = Convert.ToString(tab.Rows[0]["description"]); } else if (tab.Rows.Count > 1) { throw new DuplicateNameException("Attached file to person table has rows with same id"); } Changed = false; }
public void ReAttachFromPerson() { DBInterface.CommandText = "DELETE FROM `sellcontroller`.`personlabel` WHERE `idLabel` = @id and `idPerson` = @idPerson;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.AddParameter("@idPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, person.ID); DBInterface.ExecuteTransaction(); }
public void TableRowsCounterTest2() { DBInterface.CommandText = "SELECT Name FROM person"; DataTable tab = DBInterface.ExecuteSelection(); int numberBefore = tab.Rows.Count; DBInterface.CommandText = "INSERT INTO person (Name) VALUES (@name)"; DBInterface.AddParameter("@name", MySqlDbType.String, "Bob"); DBInterface.ExecuteTransaction(); DBInterface.CommandText = "INSERT INTO person (Name) VALUES (@name)"; DBInterface.AddParameter("@name", MySqlDbType.String, "Alisa"); DBInterface.ExecuteTransaction(); DBInterface.CommandText = "SELECT Name FROM person"; tab = DBInterface.ExecuteSelection(); int numberAfter = tab.Rows.Count; DBInterface.CommandText = "DELETE FROM person where (name = @nameA) OR (name = @nameB)"; DBInterface.AddParameter("@nameA", MySqlDbType.String, "Bob"); DBInterface.AddParameter("@nameB", MySqlDbType.String, "Alisa"); DBInterface.ExecuteTransaction(); Assert.AreEqual(numberAfter - numberBefore, 2, "Number of rows in People table has changed"); }
public void Save() { if (Changed) { if (ID >= 0) { DBInterface.CommandText = "UPDATE `sellcontroller`.`label` SET `name` = @name, " + "`comment` = @comment, `color` = @color, `idParent` = @idParent WHERE `idLabel` = @id;"; DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, Name); DBInterface.AddParameter("@comment", MySql.Data.MySqlClient.MySqlDbType.String, Comment); DBInterface.AddParameter("@color", MySql.Data.MySqlClient.MySqlDbType.VarBinary, GetColor()); if (ParentID > -1) { DBInterface.AddParameter("@idParent", MySql.Data.MySqlClient.MySqlDbType.Int32, ParentID); } else { DBInterface.AddParameter("@idParent", MySql.Data.MySqlClient.MySqlDbType.Int32, null); } DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.ExecuteTransaction(); if (Updated != null) { Updated(this, new DBEventArgs() { ForceUpdate = false }); } } else { InsertRow insertRow = new InsertRow("label"); insertRow.Add("name", MySql.Data.MySqlClient.MySqlDbType.String, Name); insertRow.Add("comment", MySql.Data.MySqlClient.MySqlDbType.String, Comment); insertRow.Add("color", MySql.Data.MySqlClient.MySqlDbType.VarBinary, GetColor()); if (ParentID > -1) { insertRow.Add("idParent", MySql.Data.MySqlClient.MySqlDbType.Int32, ParentID); } insertRow.Execute(); if (Updated != null) { Updated(this, new DBEventArgs() { ForceUpdate = true }); } } Changed = false; } }
public override void Delete() { DBInterface.CommandText = "delete from people where idPeople = @id"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, PersonID); DBInterface.ExecuteTransaction(); base.Delete(); }
public override void Delete() { if (ID >= 0) { DBInterface.CommandText = "DELETE FROM `sellcontroller`.`persondocument` WHERE `idDocument` = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.ExecuteTransaction(); } base.Delete(); }
public override void Save() { if (Changed) { if (ID >= 0) { DBInterface.CommandText = "UPDATE `sellcontroller`.`company` " + "SET " + "`officialCompanyName` = @name, " + "`MFO` = @mfo, " + "`edrpou` = @edrpou, " + "`account` = @account, " + "`bankName` = @bankName, " + "`note` = @desc " + "WHERE `idCompany` = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, CompanyID); DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, FullName); DBInterface.AddParameter("@desc", MySql.Data.MySqlClient.MySqlDbType.String, Description); DBInterface.AddParameter("@mfo", MySql.Data.MySqlClient.MySqlDbType.String, MFO); DBInterface.AddParameter("@edrpou", MySql.Data.MySqlClient.MySqlDbType.String, EDRPOU); DBInterface.AddParameter("@account", MySql.Data.MySqlClient.MySqlDbType.String, Account); DBInterface.AddParameter("@bankName", MySql.Data.MySqlClient.MySqlDbType.String, BankName); DBInterface.ExecuteTransaction(); RaiseUpdated(false); } else { DBInterface.CommandText = "insert into person (isPeople) values (0); " + "insert into company (idPerson, officialCompanyName, note, MFO, edrpou, account, bankName) " + "values (LAST_INSERT_ID(), @name, @desc, @mfo, @edrpou, @account, @bankName);"; DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, FullName); DBInterface.AddParameter("@desc", MySql.Data.MySqlClient.MySqlDbType.String, Description); DBInterface.AddParameter("@mfo", MySql.Data.MySqlClient.MySqlDbType.String, MFO); DBInterface.AddParameter("@edrpou", MySql.Data.MySqlClient.MySqlDbType.String, EDRPOU); DBInterface.AddParameter("@account", MySql.Data.MySqlClient.MySqlDbType.String, Account); DBInterface.AddParameter("@bankName", MySql.Data.MySqlClient.MySqlDbType.String, BankName); CompanyID = Convert.ToInt32(DBInterface.ExecuteTransaction()); DBInterface.CommandText = "select idPerson from company where idCompany = @id"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, CompanyID); DataTable tab = DBInterface.ExecuteSelection(); ID = Convert.ToInt32(tab.Rows[0]["idPerson"]); RaiseUpdated(true); } Changed = false; } }
protected override void SaveExisted() { DBInterface.CommandText = "UPDATE `sellcontroller`.`persondocument` SET `description` = @description " + "WHERE `idDocument` = @id and `idPerson` = @idPerson;"; DBInterface.AddParameter("@idPerson", MySql.Data.MySqlClient.MySqlDbType.String, person.ID); DBInterface.AddParameter("@description", MySql.Data.MySqlClient.MySqlDbType.String, Description); DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.ExecuteTransaction(); }
static public PersonGeneral Create(int PersonID) { PersonGeneral personGen = null; DBInterface.CommandText = "select " + "person.idPerson, " + "people.idPeople, " + "company.idCompany, " + "people.firstName, " + "people.lastName, " + "people.middleName, " + "company.officialCompanyName, " + "person.isPeople " + "from person " + "left join people " + "on people.idPerson = person.idPerson " + "left join company " + "on company.idPerson = person.idPerson " + "where person.idPerson = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, PersonID); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count == 1) { DataRow row = tab.Rows[0]; if (row["isPeople"].ToString() == "1") { personGen = new Person(); Person person = personGen as Person; person.ID = Convert.ToInt32(row["idPerson"]); person.PersonID = Convert.ToInt32(row["idPeople"]); person.FirstName = row["firstName"].ToString(); person.SecondName = row["lastName"].ToString(); person.MiddleName = row["middleName"].ToString(); } else { personGen = new Company(); Company company = personGen as Company; company.ID = Convert.ToInt32(row["idPerson"]); company.CompanyID = Convert.ToInt32(row["idCompany"]); company.FullName = row["officialCompanyName"].ToString(); } } return(personGen); }
public void Load() { DBInterface.CommandText = "SELECT * FROM sellcontroller.user WHERE login = @name;"; DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, Name); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count != 1) { throw new ArgumentException("User with current id is not unique."); } FullName = Convert.ToString(tab.Rows[0]["Name"]); role.SetByInt(Convert.ToInt32(tab.Rows[0]["isAdminRole"])); }
protected override void SaveNew() { DBInterface.CommandText = "insert into document (GUID, name, extension) values (@guid, @name, @extension); " + "insert into persondocument (idDocument, idPerson, description) " + "values (LAST_INSERT_ID(), @idPerson, @description);"; DBInterface.AddParameter("@guid", MySql.Data.MySqlClient.MySqlDbType.String, guid); DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, Name); DBInterface.AddParameter("@extension", MySql.Data.MySqlClient.MySqlDbType.String, Extension); DBInterface.AddParameter("@idPerson", MySql.Data.MySqlClient.MySqlDbType.String, person.ID); DBInterface.AddParameter("@description", MySql.Data.MySqlClient.MySqlDbType.String, Description); ID = Convert.ToInt32(DBInterface.ExecuteTransaction()); }
public override void Load() { Clear(); DBInterface.CommandText = "SELECT * FROM sellcontroller.visa where idPassport = @idPassport;"; DBInterface.AddParameter("@idPassport", MySql.Data.MySqlClient.MySqlDbType.Int32, passport.ID); DataTable tab = DBInterface.ExecuteSelection(); foreach (DataRow row in tab.Rows) { Viza viza = Create(); viza.ID = Convert.ToInt32(row["idVisa"]); viza.Load(); } }
public void Save() { if (Changed) { if (ID >= 0) { DBInterface.StoredProcedure("country_union_update"); DBInterface.AddParameter("@inIdCountryUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.AddParameter("@inUnionName", MySql.Data.MySqlClient.MySqlDbType.String, Name); DBInterface.AddParameter("@inShortUnionName", MySql.Data.MySqlClient.MySqlDbType.String, ShortName); DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Note); DBInterface.ExecuteTransaction(); if (Updated != null) { Updated(this, new DBEventArgs() { ForceUpdate = false }); } } else { DBInterface.StoredProcedure("country_union_insert"); DBInterface.AddParameter("@inUnionName", MySql.Data.MySqlClient.MySqlDbType.String, Name); DBInterface.AddParameter("@inShortUnionName", MySql.Data.MySqlClient.MySqlDbType.String, ShortName); DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Note); DBInterface.AddOutParameter("@outIdCountryUnion", MySql.Data.MySqlClient.MySqlDbType.Int32); DBInterface.ExecuteTransaction(); ID = Convert.ToInt32(DBInterface.GetOutParameter("@outIdCountryUnion")); if (Updated != null) { Updated(this, new DBEventArgs() { ForceUpdate = true }); } } Changed = false; } }
public void Load() { DBInterface.StoredProcedure("avia_company_union_select_by_id"); DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.AddOutParameter("@outUnionName", MySql.Data.MySqlClient.MySqlDbType.String); DBInterface.AddOutParameter("@outUnionShortName", MySql.Data.MySqlClient.MySqlDbType.String); DBInterface.AddOutParameter("@outNote", MySql.Data.MySqlClient.MySqlDbType.String); DBInterface.ExecuteTransaction(); Name = Convert.ToString(DBInterface.GetOutParameter("@outUnionName")); Note = Convert.ToString(DBInterface.GetOutParameter("@outNote")); Changed = false; }
public override void Load() { Clear(); DBInterface.CommandText = "SELECT * FROM sellcontroller.milecard where idOwnerPerson = @idPerson;"; DBInterface.AddParameter("@idPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, personOwner.ID); DataTable tab = DBInterface.ExecuteSelection(); foreach (DataRow row in tab.Rows) { MileCard mc = Create(); mc.ID = Convert.ToInt32(row["idMileCard"]); mc.Load(); this.Add(mc); } }
private int ContactTypeID() { DBInterface.CommandText = "select idTypeContact from typecontact where nameContact = @name"; DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, contactType); DataTable tab = DBInterface.ExecuteSelection(); if ((tab != null) && (tab.Rows.Count == 1)) { return(Convert.ToInt32(tab.Rows[0]["idTypeContact"])); } else { throw new ArgumentException("Unhandled contacy type"); } }
public virtual void Delete() { if (ID >= 0) { DBInterface.CommandText = "DELETE FROM `sellcontroller`.`document` WHERE `idDocument` = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.ExecuteTransaction(); if (Updated != null) { Updated(this, new DBEventArgs() { ForceUpdate = true }); } } }
public void Load() { DBInterface.CommandText = "SELECT `contact`.`idContact`, `contact`.`value` FROM `sellcontroller`.`contact` WHERE `idContact` = @id;"; DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DataTable tab = DBInterface.ExecuteSelection(); if (tab.Rows.Count == 1) { Content = Convert.ToString(tab.Rows[0]["value"]); } else if (tab.Rows.Count > 1) { throw new DuplicateNameException("Contact table has rows with same id"); } Changed = false; }
public void Save() { if (Changed) { if (ID >= 0) { DBInterface.CommandText = "UPDATE `sellcontroller`.`country` SET `nameCountry` = @name, " + "`codeISO2` = @iso2, `codeISO3` = @iso3, `codeCitizen` = @nat WHERE `idCountry` = @id;"; DBInterface.AddParameter("@name", MySql.Data.MySqlClient.MySqlDbType.String, Name); DBInterface.AddParameter("@iso2", MySql.Data.MySqlClient.MySqlDbType.String, ISO); DBInterface.AddParameter("@iso3", MySql.Data.MySqlClient.MySqlDbType.String, ISO3); DBInterface.AddParameter("@nat", MySql.Data.MySqlClient.MySqlDbType.String, Nationality); DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DBInterface.ExecuteTransaction(); if (Updated != null) { Updated(this, new DBEventArgs() { ForceUpdate = false }); } } else { InsertRow insertRow = new InsertRow("country"); insertRow.Add("nameCountry", MySql.Data.MySqlClient.MySqlDbType.String, Name); insertRow.Add("codeISO2", MySql.Data.MySqlClient.MySqlDbType.String, ISO); insertRow.Add("codeISO3", MySql.Data.MySqlClient.MySqlDbType.String, ISO3); insertRow.Add("codeCitizen", MySql.Data.MySqlClient.MySqlDbType.String, Nationality); insertRow.Execute(); if (Updated != null) { Updated(this, new DBEventArgs() { ForceUpdate = true }); } } Changed = false; } }
private void DeleteJoin() { DBInterface.CommandText = "select * " + "from joinaviacompanyunion " + "where joinaviacompanyunion.idAviaCompanyUnion = @idAviaCompanyUnion;"; DBInterface.AddParameter("@idAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, ID); DataTable tab = DBInterface.ExecuteSelection(); foreach (DataRow row in tab.Rows) { DBInterface.StoredProcedure("join_avia_company_union_delete"); DBInterface.AddParameter("@inIdJoinAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, Convert.ToInt32(row["idJoinAviaCompanyUnion"])); DBInterface.ExecuteTransaction(); } }