コード例 #1
0
        public List<Device> getDevices()
        {
            string sql = "select * from bu_device INNER JOIN bu_type ON bu_device.typeId=bu_type.Id INNER JOIN bu_brand ON bu_device.brandId=bu_brand.Id INNER JOIN bu_cell ON bu_device.cellId=bu_cell.Id";

            DataSet ds = new MySqlDa().fillDataSet(sql);

            List<Device> lstDevice = new List<Device>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                Device device = fillDevice(ds,i);

                Brand brand = new Brand();
                brand.Id=(int)ds.Tables[0].Rows[i]["brandId"];
                brand.Name = ds.Tables[0].Rows[i][9].ToString();
                device.Brand = brand;

                BackupAMSData.Type type = new BackupAMSData.Type();
                type.Id = (int)ds.Tables[0].Rows[i]["typeId"];
                type.Name = ds.Tables[0].Rows[i][7].ToString();
                device.Type = type;

                Cell cell = new Cell();
                cell.Id = (int)ds.Tables[0].Rows[i]["cellId"];
                cell.Name=ds.Tables[0].Rows[i][12].ToString();
                cell.CellNr = (int)ds.Tables[0].Rows[i]["CellNr"];
                device.Cell = cell;

                lstDevice.Add(device);
            }

            return lstDevice;
        }
コード例 #2
0
        public List<BackupAMSData.Brand> GetBrands()
        {
            string sql = "select *from bu_brand";
            DataSet ds = new MySqlDa().fillDataSet(sql);
            List<BackupAMSData.Brand> lstBrands = new List<BackupAMSData.Brand>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                BackupAMSData.Brand brand = new BackupAMSData.Brand();
                brand.Id = (int)ds.Tables[0].Rows[i]["id"];
                brand.Name = ds.Tables[0].Rows[i]["name"].ToString();
                lstBrands.Add(brand);
            }

            return lstBrands;
        }