Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        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;
            }
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        public override void Load()
        {
            DBInterface.StoredProcedure("avia_company_select_by_id");
            DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, ID);

            DBInterface.AddOutParameter("@outName", MySql.Data.MySqlClient.MySqlDbType.String);
            DBInterface.AddOutParameter("@outShortName", MySql.Data.MySqlClient.MySqlDbType.String);
            DBInterface.AddOutParameter("@outNote", MySql.Data.MySqlClient.MySqlDbType.String);

            DBInterface.ExecuteTransaction();

            FullName    = Convert.ToString(DBInterface.GetOutParameter("@outName"));
            ICAO        = Convert.ToString(DBInterface.GetOutParameter("@outShortName"));
            Description = Convert.ToString(DBInterface.GetOutParameter("@outNote"));

            aviaCompanyUnionList.Load(this);
            mirror = aviaCompanyUnionList.mirror;

            Changed = false;
        }
Ejemplo n.º 6
0
        public override void Save()
        {
            if (Changed)
            {
                if (ID >= 0)
                {
                    DBInterface.StoredProcedure("avia_company_update");

                    DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, ID);
                    DBInterface.AddParameter("@inName", MySql.Data.MySqlClient.MySqlDbType.String, FullName);
                    DBInterface.AddParameter("@inShortName", MySql.Data.MySqlClient.MySqlDbType.String, ICAO);
                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Description);

                    DBInterface.ExecuteTransaction();

                    RaiseUpdated(false);
                }
                else
                {
                    DBInterface.StoredProcedure("avia_company_insert");

                    DBInterface.AddParameter("@inName", MySql.Data.MySqlClient.MySqlDbType.String, FullName);
                    DBInterface.AddParameter("@inShortName", MySql.Data.MySqlClient.MySqlDbType.String, ICAO);
                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Description);

                    DBInterface.AddOutParameter("@outIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32);

                    DBInterface.ExecuteTransaction();

                    ID = Convert.ToInt32(DBInterface.GetOutParameter("@outIdAviaCompany"));

                    RaiseUpdated(true);
                }

                Changed = false;
            }
        }
Ejemplo n.º 7
0
        public void Save()
        {
            if (Changed)
            {
                int countryID;
                int unionID;
                GetTargetCountryOrUnion(out countryID, out unionID);

                if (ID >= 0)
                {
                    DBInterface.StoredProcedure("visa_update");

                    DBInterface.AddParameter("@inVisa", MySql.Data.MySqlClient.MySqlDbType.Int32, ID);
                    DBInterface.AddParameter("@inIdPassport", MySql.Data.MySqlClient.MySqlDbType.Int32, PassportID);
                    DBInterface.AddParameter("@inName", MySql.Data.MySqlClient.MySqlDbType.String, OwnerName);
                    DBInterface.AddParameter("@inVisaNumber", MySql.Data.MySqlClient.MySqlDbType.String, Number);
                    DBInterface.AddParameter("@inDateOn", MySql.Data.MySqlClient.MySqlDbType.DateTime, DateApproved);
                    DBInterface.AddParameter("@indateFrom", MySql.Data.MySqlClient.MySqlDbType.DateTime, ValidFrom);
                    DBInterface.AddParameter("@inDateUntil", MySql.Data.MySqlClient.MySqlDbType.DateTime, ValidTill);

                    DBInterface.AddIdParameter("@inIdCountry", countryID);
                    DBInterface.AddIdParameter("@inIdCountryUnion", unionID);
                    DBInterface.AddIdParameter("@inIdCountryEsquire", CountryOfEmmitationID);

                    DBInterface.AddParameter("@inTypeVisa", MySql.Data.MySqlClient.MySqlDbType.String, VizaType);
                    DBInterface.AddParameter("@inEntriesNumber", MySql.Data.MySqlClient.MySqlDbType.Int32, EntriesNumber);
                    DBInterface.AddParameter("@inDaysCount", MySql.Data.MySqlClient.MySqlDbType.Int32, DaysCount);
                    DBInterface.AddParameter("@inUsedDays", MySql.Data.MySqlClient.MySqlDbType.Int32, DaysUsed);
                    DBInterface.AddParameter("@inIssuedIn", MySql.Data.MySqlClient.MySqlDbType.String, Issued);
                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Description);
                    DBInterface.AddParameter("@inIdDocument", MySql.Data.MySqlClient.MySqlDbType.Int32, DBNull.Value);

                    DBInterface.ExecuteTransaction();

                    if (Updated != null)
                    {
                        Updated(this, new DBEventArgs()
                        {
                            ForceUpdate = false
                        });
                    }
                }
                else
                {
                    DBInterface.StoredProcedure("visa_insert");

                    DBInterface.AddOutParameter("@outIdVisa", MySql.Data.MySqlClient.MySqlDbType.Int32);

                    DBInterface.AddParameter("@inIdPassport", MySql.Data.MySqlClient.MySqlDbType.Int32, PassportID);
                    DBInterface.AddParameter("@inName", MySql.Data.MySqlClient.MySqlDbType.String, OwnerName);
                    DBInterface.AddParameter("@inVisaNumber", MySql.Data.MySqlClient.MySqlDbType.String, Number);
                    DBInterface.AddParameter("@inDateOn", MySql.Data.MySqlClient.MySqlDbType.DateTime, DateApproved);
                    DBInterface.AddParameter("@indateFrom", MySql.Data.MySqlClient.MySqlDbType.DateTime, ValidFrom);
                    DBInterface.AddParameter("@inDateUntil", MySql.Data.MySqlClient.MySqlDbType.DateTime, ValidTill);

                    DBInterface.AddIdParameter("@inIdCountry", countryID);
                    DBInterface.AddIdParameter("@inIdCountryUnion", unionID);
                    DBInterface.AddIdParameter("@inIdCountryEsquire", CountryOfEmmitationID);

                    DBInterface.AddParameter("@inTypeVisa", MySql.Data.MySqlClient.MySqlDbType.String, VizaType);
                    DBInterface.AddParameter("@inEntriesNumber", MySql.Data.MySqlClient.MySqlDbType.Int32, EntriesNumber);
                    DBInterface.AddParameter("@inDaysCount", MySql.Data.MySqlClient.MySqlDbType.Int32, DaysCount);
                    DBInterface.AddParameter("@inUsedDays", MySql.Data.MySqlClient.MySqlDbType.Int32, DaysUsed);
                    DBInterface.AddParameter("@inIssuedIn", MySql.Data.MySqlClient.MySqlDbType.String, Issued);
                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Description);
                    DBInterface.AddParameter("@inIdDocument", MySql.Data.MySqlClient.MySqlDbType.Int32, DBNull.Value);

                    DBInterface.ExecuteTransaction();

                    ID = DBInterface.GetOutParameterInt("@outIdVisa");

                    if (Updated != null)
                    {
                        Updated(this, new DBEventArgs()
                        {
                            ForceUpdate = true
                        });
                    }
                }
                Changed = false;
            }
        }
Ejemplo n.º 8
0
        public void Save()
        {
            if (Changed)
            {
                if (ID >= 0)
                {
                    DBInterface.StoredProcedure("mile_card_status_update");

                    DBInterface.AddParameter("@inIdMileCardStatus", MySql.Data.MySqlClient.MySqlDbType.Int32, ID);
                    DBInterface.AddParameter("@inStatus", MySql.Data.MySqlClient.MySqlDbType.String, Name);
                    DBInterface.AddParameter("@inMinMiles", MySql.Data.MySqlClient.MySqlDbType.Int32, MinVal);
                    DBInterface.AddParameter("@inMaxMiles", MySql.Data.MySqlClient.MySqlDbType.Int32, MaxVal);

                    if (AviaCompanyID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyID);
                    }

                    if (AviaCompanyUnionID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyUnionID);
                    }


                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Note);

                    DBInterface.ExecuteTransaction();

                    if (Updated != null)
                    {
                        Updated(this, new DBEventArgs()
                        {
                            ForceUpdate = false
                        });
                    }
                }
                else
                {
                    DBInterface.StoredProcedure("mile_card_status_insert");

                    DBInterface.AddParameter("@inStatus", MySql.Data.MySqlClient.MySqlDbType.String, Name);
                    DBInterface.AddParameter("@inMinMiles", MySql.Data.MySqlClient.MySqlDbType.Int32, MinVal);
                    DBInterface.AddParameter("@inMaxMiles", MySql.Data.MySqlClient.MySqlDbType.Int32, MaxVal);

                    if (AviaCompanyID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyID);
                    }

                    if (AviaCompanyUnionID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyUnionID);
                    }

                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Note);

                    DBInterface.AddOutParameter("@outIdMileCardStatus", MySql.Data.MySqlClient.MySqlDbType.Int32);

                    DBInterface.ExecuteTransaction();

                    ID = Convert.ToInt32(DBInterface.GetOutParameter("@outIdMileCardStatus"));

                    if (Updated != null)
                    {
                        Updated(this, new DBEventArgs()
                        {
                            ForceUpdate = true
                        });
                    }
                }

                Changed = false;
            }
        }
Ejemplo n.º 9
0
        public void Save()
        {
            if (Changed)
            {
                if (ID >= 0)
                {
                    DBInterface.StoredProcedure("mile_card_update");

                    DBInterface.AddParameter("@inIdMileCard", MySql.Data.MySqlClient.MySqlDbType.Int32, ID);

                    if (mileCardStatus.ID >= 0)
                    {
                        DBInterface.AddParameter("@inIdMileCardStatus", MySql.Data.MySqlClient.MySqlDbType.Int32, mileCardStatus.ID);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdMileCardStatus", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }

                    DBInterface.AddParameter("@inNumber", MySql.Data.MySqlClient.MySqlDbType.String, Number);
                    DBInterface.AddParameter("@inPassword", MySql.Data.MySqlClient.MySqlDbType.String, Password);
                    DBInterface.AddParameter("@inMilesCount", MySql.Data.MySqlClient.MySqlDbType.Int32, MilesCount);

                    if (AviaCompanyID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyID);
                    }

                    if (AviaCompanyUnionID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyUnionID);
                    }

                    if (PersonRespondedID < 0)
                    {
                        DBInterface.AddParameter("@inIdRespondedPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdRespondedPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, PersonRespondedID);
                    }

                    DBInterface.AddParameter("@inIdOwnerPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, personOwner.ID);
                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Note);

                    DBInterface.ExecuteTransaction();

                    if (Updated != null)
                    {
                        Updated(this, new DBEventArgs()
                        {
                            ForceUpdate = false
                        });
                    }
                }
                else
                {
                    DBInterface.StoredProcedure("mile_card_insert");

                    if (mileCardStatus.ID >= 0)
                    {
                        DBInterface.AddParameter("@inIdMileCardStatus", MySql.Data.MySqlClient.MySqlDbType.Int32, ID);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdMileCardStatus", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }

                    DBInterface.AddParameter("@inNumber", MySql.Data.MySqlClient.MySqlDbType.String, Number);
                    DBInterface.AddParameter("@inPassword", MySql.Data.MySqlClient.MySqlDbType.String, Password);
                    DBInterface.AddParameter("@inMilesCount", MySql.Data.MySqlClient.MySqlDbType.Int32, MilesCount);

                    if (AviaCompanyID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompany", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyID);
                    }

                    if (AviaCompanyUnionID < 0)
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdAviaCompanyUnion", MySql.Data.MySqlClient.MySqlDbType.Int32, AviaCompanyUnionID);
                    }

                    if (PersonRespondedID < 0)
                    {
                        DBInterface.AddParameter("@inIdRespondedPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, null);
                    }
                    else
                    {
                        DBInterface.AddParameter("@inIdRespondedPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, PersonRespondedID);
                    }

                    DBInterface.AddParameter("@inIdOwnerPerson", MySql.Data.MySqlClient.MySqlDbType.Int32, personOwner.ID);
                    DBInterface.AddParameter("@inNote", MySql.Data.MySqlClient.MySqlDbType.String, Note);

                    DBInterface.AddOutParameter("@outIdMileCard", MySql.Data.MySqlClient.MySqlDbType.Int32);

                    DBInterface.ExecuteTransaction();

                    ID = DBInterface.GetOutParameterInt("@outIdMileCard");

                    if (Updated != null)
                    {
                        Updated(this, new DBEventArgs()
                        {
                            ForceUpdate = true
                        });
                    }
                }
                Changed = false;
            }
        }