Example #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);
        }
Example #2
0
 public bool Contains(tblEquipment item)
 {
     return(List.Contains(item));
 }
Example #3
0
 public int IndexOf(tblEquipment item)
 {
     return(List.IndexOf(item));
 }
Example #4
0
 public void Insert(int index, tblEquipment item)
 {
     List.Insert(index, item);
     this.OntblEquipmentChanged(EventArgs.Empty);
 }
Example #5
0
 public void Remove(tblEquipment item)
 {
     List.Remove(item);
     this.OntblEquipmentChanged(EventArgs.Empty);
 }
Example #6
0
 public void Add(tblEquipment item)
 {
     List.Add(item);
     this.OntblEquipmentChanged(EventArgs.Empty);
 }