Esempio n. 1
0
        private void ChargerDonnee()
        {
            
            con.Open();
            OracleCommand cmdgetNbRangee = new OracleCommand("select nbrangee from vw_datacenter where dcid=" + dcid, con);
            OracleDataReader drnbRangee = cmdgetNbRangee.ExecuteReader();
            if (drnbRangee.Read())
            {
                nbrangee = drnbRangee.GetInt32(0);
            }
            OracleCommand cmdGetRows = new OracleCommand("select rangeid,rangeenom,dcid from vw_range where dcid = "+dcid,con);
            OracleDataReader drGetRows = cmdGetRows.ExecuteReader();
            while (drGetRows.Read()) {
                List<Rack> racksRange = new List<Rack>();
                OracleCommand cmdgetRacks = new OracleCommand("select rackid,rackname,racksize,rangeeid,rangeeposition from vw_rack where rangeeid=" + drGetRows.GetInt32(0), con);
                OracleDataReader drGetRacks = cmdgetRacks.ExecuteReader();
                while (drGetRacks.Read()) {

                    OracleCommand cmdgetEquip = new OracleCommand("select numero,equipmentname,rackposition from vw_equipment where rackid=" + drGetRacks.GetInt32(0), con);
                    OracleDataReader drGetEquip = cmdgetEquip.ExecuteReader();
                    while (drGetEquip.Read())
                    {
                        equipements.Add(new Equipement(drGetEquip.GetInt32(0), drGetEquip.GetString(1), "", drGetEquip.GetInt32(2)));
                    }
                    Rack rackToAdd = new Rack(drGetRacks.GetInt32(0), drGetRacks.GetString(1), equipements);
                    racksRange.Add(rackToAdd);
                    dcDesign.Controls.Add(rackToAdd.GetRackDesign(),drGetRacks.GetInt32(4)-1, Convert.ToInt32(drGetRows.GetString(1))-1);
                }
                rows.Add(new Row(drGetRows.GetInt32(0),drGetRows.GetInt32(2), racksRange));
            }


            con.Close();

        }
Esempio n. 2
0
 private void CmdAddRack_Click(object sender, EventArgs e)
 {
     FrmAjoutRack f = new FrmAjoutRack();
     f.ShowDialog(dcDesign.Parent);
     Rack r = GestionRack.GetRack();
     if (r != null)
     {
         Button cmdAddRack = (Button)sender;
         TableLayoutPanelCellPosition cellNewRack = dcDesign.GetCellPosition(cmdAddRack);
         dcDesign.ColumnCount++;
         dcDesign.Controls.Remove(cmdAddRack);
         dcDesign.Controls.Add(r.GetRackDesign(), cellNewRack.Column, cellNewRack.Row);
         dcDesign.Controls.Add(cmdAddRack, cellNewRack.Column + 1, cellNewRack.Row);
         rows[cellNewRack.Row].AddRack(r);
     }
 }