Exemple #1
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();
            }
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        public MileCardStatus()
        {
            ID      = -1;
            Changed = false;

            aviacompany      = new AviaCompany();
            aviacompanyunion = new AviaCompanyUnion();
        }
Exemple #4
0
        public MileCard(PersonGeneral personOwner)
        {
            ID      = -1;
            Changed = false;
            Silent  = false;

            this.personOwner = personOwner;
            personResponded  = null;

            aviacompany      = new AviaCompany();
            aviacompanyunion = new AviaCompanyUnion();
            mileCardStatus   = new MileCardStatus();
        }
Exemple #5
0
        public void RemoveElement(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();


            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();
            }
        }