Beispiel #1
0
        /// <summary>
        /// 从Eqp表的多个数据行生成设备类集合的实例
        /// </summary>
        /// <param name="tableEquipment">Eqp表</param>
        /// <returns></returns>
        public static EQAEquipmentCollection CreateEQAEquipments(DataRow[] rowsEQAEquipment)
        {
            if (rowsEQAEquipment == null)
            {
                throw new System.ArgumentNullException("from function CreateEQAEquipments", "Parameter rowsEQAEquipment equals to null");
            }

            EQAEquipmentCollection equipments = new EQAEquipmentCollection();

            if (rowsEQAEquipment.Length <= 0)
            {
                return(equipments);
            }

            lock (rowsEQAEquipment) {
                try {
                    foreach (DataRow rowEquipment in rowsEQAEquipment)
                    {
                        equipments.Add(CreateEQAEquipment(rowEquipment));
                    }
                } catch (DataException ex) {
                    MessageBoxWinForm.Info("数据访问错误", ex.Message, "");
                }
            }

            return(equipments);
        }
Beispiel #2
0
        /// <summary>
        /// Deep Clone
        /// </summary>
        /// <returns></returns>
        public EQAEquipmentCollection Copy()
        {
            EQAEquipmentCollection equipments = new EQAEquipmentCollection();

            if (this.Count <= 0)
            {
                return(equipments);
            }
            else
            {
                foreach (EQAEquipment equipment in this)
                {
                    equipments.Add(equipment.Copy());
                }
                return(equipments);
            }
        }