Esempio n. 1
0
        public override bool Load()
        {
            bool        ret    = true;
            List <long> idlist = new List <long>();

            if (Common.Conn == null)
            {
                Common.Conn = new SQLiteConnection(Common.ConnectionString);
                Common.Conn.Open();
            }
            SQLiteDataReader myReader  = null;
            SQLiteCommand    myCommand = new SQLiteCommand();

            try
            {
                myReader = null;

                myCommand.CommandText = @"SELECT * FROM [tblEquipment]  WHERE [PlantStructureID]= " + m_ID_tblPlantStructure.ID + " ;";

                myCommand.Connection = Common.Conn;
                myReader             = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    idlist.Add(myReader.GetInt64(myReader.GetOrdinal("ID")));
                }

                myReader.Close();
                myCommand.Dispose();
                //_SqlConnectionConnection.Close();

                foreach (long id in idlist)// (int i = 0; i < count ; i++)
                {
                    tblEquipment tblequipment = new tblEquipment();
                    tblequipment.ID = id;
                    tblequipment.m_ID_tblPlantStructure = this.m_ID_tblPlantStructure;
                    tblequipment.Select();

                    Add(tblequipment);
                }
            }
            catch (SQLiteException ae)
            {
                System.Windows.Forms.MessageBox.Show(ae.Message);
                return(false);
            }



            return(ret);
        }
Esempio n. 2
0
 public bool Contains(tblEquipment item)
 {
     return(List.Contains(item));
 }
Esempio n. 3
0
 public int IndexOf(tblEquipment item)
 {
     return(List.IndexOf(item));
 }
Esempio n. 4
0
 public void Insert(int index, tblEquipment item)
 {
     List.Insert(index, item);
     this.OntblEquipmentChanged(EventArgs.Empty);
 }
Esempio n. 5
0
 public void Remove(tblEquipment item)
 {
     List.Remove(item);
     this.OntblEquipmentChanged(EventArgs.Empty);
 }
Esempio n. 6
0
 public void Add(tblEquipment item)
 {
     List.Add(item);
     this.OntblEquipmentChanged(EventArgs.Empty);
 }