Ejemplo n.º 1
0
        public EquipmentCollection GetAllEquipments()
        {
            EquipmentCollection equipments = null;

            if (this.TryConnection())
            {
                DatabaseParameters keyParameters = new DatabaseParameters();
                DataTable          table         = this.QueryData(keyParameters, this.DataStructrure.Tables.MasterEquipment.ActualTableName);
                if (table == null)
                {
                    return(equipments);
                }
                equipments = new EquipmentCollection();
                foreach (DataRow row in table.Rows)
                {
                    EquipmentObj obj2 = new EquipmentObj(row[this.DataStructrure.Tables.MasterEquipment.EquipmentID.ActualFieldName].ToString())
                    {
                        Description        = row[this.DataStructrure.Tables.MasterEquipment.EquipmentDescription.ActualFieldName].ToString(),
                        EquipmentObject    = row[this.DataStructrure.Tables.MasterEquipment.EquipmentObject.ActualFieldName].ToString(),
                        EquipmentSNR       = row[this.DataStructrure.Tables.MasterEquipment.Equipmentsnr.ActualFieldName].ToString(),
                        EquipmentLocation  = row[this.DataStructrure.Tables.MasterEquipment.EquipmentLocation.ActualFieldName].ToString(),
                        EquipmentProfileID = row[this.DataStructrure.Tables.MasterEquipment.EquipmentProfile.ActualFieldName].ToString()
                    };
                    equipments.Add(obj2);
                }
            }
            return(equipments);
        }
Ejemplo n.º 2
0
        public static EquipmentCollection GetEquipmentCollection(string deptId, string equipmentCode, string equipmentName, string equipmentType)
        {
            EquipmentCollection equipments = new EquipmentCollection();
            string sqlWhere = "";

            sqlWhere = "(State=1)";
            if (deptId.ToString() != "")
            {
                sqlWhere = sqlWhere + " and (LocateDeptID = " + deptId + ") ";
            }
            if (equipmentCode.Trim() != "")
            {
                sqlWhere = sqlWhere + " and (EquipmentManualCode like '%" + equipmentCode.Trim() + "%') ";
            }
            if (equipmentName.Trim() != "")
            {
                sqlWhere = sqlWhere + " and (EquipmentName like '%" + equipmentName.Trim() + "%') ";
            }
            if (equipmentType.Trim() != "")
            {
                sqlWhere = sqlWhere + " and (EquipmentType='" + equipmentType + "') ";
            }
            using (DataTable table = publicDbOpClass.GetPageData(sqlWhere, "Ent_Ept_Equipments", "NoteSequenceID desc"))
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    equipments.Add(GetEquipmentInfoFromDataRow(table.Rows[i]));
                }
            }
            return(equipments);
        }
Ejemplo n.º 3
0
        private EquipmentCollection _getEquipments(string sql, int pPageIndex, int pPageSize)
        {
            EquipmentCollection retobjs = new EquipmentCollection();
            SqlDataReader       sdr     = null;
            Equipment           obj     = null;

            m_db.RunSql(sql, out sdr);
            if (null == sdr)
            {
                return(null);
            }
            int _curRecPos = 0;
            //计算页记录///
            long _startpos = 0;
            long _endpos   = 0;

            if (pPageIndex > -1)
            {
                _startpos = pPageIndex * pPageSize;
                _endpos   = _startpos + pPageSize;
            }
            while (sdr.Read())
            {
                if (_curRecPos > _endpos)
                {
                    break;
                }
                if (_curRecPos >= _startpos && _curRecPos < _endpos)
                {
                    obj = this._buildEquipment(ref sdr);
                    if (null != obj)
                    {
                        retobjs.Add(obj);
                    }
                }
                _curRecPos++;
            }
            sdr.Close();
            if (retobjs.Count > 0)
            {
                return(retobjs);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        private EquipmentCollection _getEquipments(string sql)
        {
            EquipmentCollection retobjs = new EquipmentCollection();
            SqlDataReader       sdr     = null;

            m_db.RunSql(sql, out sdr);
            if (null == sdr)
            {
                return(null);
            }
            while (sdr.Read())
            {
                retobjs.Add(this._buildEquipment(ref sdr));
            }
            sdr.Close();
            return(retobjs);
        }
Ejemplo n.º 5
0
        public EquipmentCollection GetAllEquipmentProfiles()
        {
            EquipmentCollection equipments = null;

            if (this.TryConnection())
            {
                DataTable table = base.CurDBEngine.SelectQuery("SELECT DISTINCT " + this.DataStructrure.Tables.MasterEquipment.EquipmentProfile.ActualFieldName + " FROM " + this.DataStructrure.Tables.MasterEquipment.ActualTableName);
                if (table == null)
                {
                    return(equipments);
                }
                equipments = new EquipmentCollection();
                foreach (DataRow row in table.Rows)
                {
                    EquipmentObj obj2 = new EquipmentObj(row[this.DataStructrure.Tables.MasterEquipment.EquipmentProfile.ActualFieldName].ToString())
                    {
                        EquipmentSNR       = row[this.DataStructrure.Tables.MasterEquipment.EquipmentProfile.ActualFieldName].ToString(),
                        EquipmentProfileID = row[this.DataStructrure.Tables.MasterEquipment.EquipmentProfile.ActualFieldName].ToString()
                    };
                    equipments.Add(obj2);
                }
            }
            return(equipments);
        }