Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oBuildLocation = new BuildLocation(intProfile, dsn);
     oZone          = new Zones(intProfile, dsn);
     oLocation      = new Locations(intProfile, dsn);
     oRoom          = new RoomsNew(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intBuildLocationRDP = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         if (intBuildLocationRDP > 0)
         {
             Int32.TryParse(oBuildLocation.GetRDP(intBuildLocationRDP, "addressid"), out intAddress);
             lblName.Text = oLocation.GetFull(intAddress);
         }
         LoadRooms();
     }
 }
Exemple #2
0
        protected void LoadRoom()
        {
            RoomsNew oRooms = new RoomsNew(0, dsn);

            if (hdnRoomId.Value == "")
            {
                hdnRoomId.Value = "0";
            }
            DataSet dsRoom = oRooms.Gets(Int32.Parse(hdnRoomId.Value));

            if (dsRoom.Tables[0].Rows.Count > 0)
            {
                hdnLocationId.Value = dsRoom.Tables[0].Rows[0]["locationid"].ToString();
                txtLocation.Text    = dsRoom.Tables[0].Rows[0]["location"].ToString();
                txtRoom.Text        = dsRoom.Tables[0].Rows[0]["room"].ToString();
                hdnRoomId.Value     = dsRoom.Tables[0].Rows[0]["roomid"].ToString();
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }

            oLocation = new Locations(intProfile, dsn);
            oRoom     = new RoomsNew(intProfile, dsn);
            oRack     = new RacksNew(intProfile, dsn);
            oZone     = new Zones(intProfile, dsn);

            if (!Page.IsPostBack)
            {
                if (Request.QueryString["type"] != null && Request.QueryString["type"] != "")
                {
                    strSelectionType = Request.QueryString["type"].ToString();
                }

                strSelectionType = strSelectionType.ToLower();

                //Get controls to populate on parent page
                if (Request.QueryString["Id"] != null && Request.QueryString["Id"] != "")
                {
                    intSelectionId = Int32.Parse(Request.QueryString["Id"]);
                }
                else
                {
                    chkCommonLocation.Checked = true;
                }

                if (Request.QueryString["hdnId"] != null && Request.QueryString["hdnId"] != "")
                {
                    lblParentCtrlHdnId.Text = Request.QueryString["hdnId"];
                }

                if (Request.QueryString["ctrlLocation"] != null && Request.QueryString["ctrlLocation"] != "")
                {
                    lblParentCtrlLocation.Text = Request.QueryString["ctrlLocation"];
                }

                if (Request.QueryString["ctrlRoom"] != null && Request.QueryString["ctrlRoom"] != "")
                {
                    lblParentCtrlRoom.Text = Request.QueryString["ctrlRoom"];
                }


                if (Request.QueryString["ctrlZone"] != null && Request.QueryString["ctrlZone"] != "")
                {
                    lblParentCtrlZone.Text = Request.QueryString["ctrlZone"];
                }

                if (Request.QueryString["ctrlRack"] != null && Request.QueryString["ctrlRack"] != "")
                {
                    lblParentCtrlRack.Text = Request.QueryString["ctrlRack"];
                }


                SetControls();

                if (intSelectionId > 0)
                {
                    DataSet dsLocation = null;
                    if (strSelectionType == "location")
                    {
                        dsLocation = oLocation.GetAddress(intSelectionId);
                        if (dsLocation.Tables[0].Rows.Count > 0)
                        {
                            DataRow dr            = dsLocation.Tables[0].Rows[0];
                            int     intLocationId = Int32.Parse(dr["id"].ToString());
                            int     intCityId     = Int32.Parse(oLocation.GetAddress(intLocationId, "cityid"));
                            int     intStateId    = Int32.Parse(oLocation.GetCity(intCityId, "stateid"));;
                            LoadState();
                            ddlState.SelectedValue = intStateId.ToString();
                            LoadCity();
                            ddlCity.SelectedValue = intCityId.ToString();
                            LoadAddress();
                            ddlLocation.SelectedValue = intLocationId.ToString();
                        }
                    }
                    else if (strSelectionType == "room")
                    {
                        dsLocation = oRoom.Gets(intSelectionId);
                        if (dsLocation.Tables[0].Rows.Count > 0)
                        {
                            DataRow dr = dsLocation.Tables[0].Rows[0];
                            LoadState();
                            ddlState.SelectedValue = dr["StateId"].ToString();
                            LoadCity();
                            ddlCity.SelectedValue = dr["CityId"].ToString();
                            LoadAddress();
                            ddlLocation.SelectedValue = dr["LocationId"].ToString();
                            LoadRoom();
                            ddlRoom.SelectedValue = dr["RoomId"].ToString();
                        }
                    }
                    else if (strSelectionType == "zone")
                    {
                        dsLocation = oZone.Gets(intSelectionId);
                        if (dsLocation.Tables[0].Rows.Count > 0)
                        {
                            DataRow dr = dsLocation.Tables[0].Rows[0];
                            LoadState();
                            ddlState.SelectedValue = dr["StateId"].ToString();
                            LoadCity();
                            ddlCity.SelectedValue = dr["CityId"].ToString();
                            LoadAddress();
                            ddlLocation.SelectedValue = dr["LocationId"].ToString();
                            LoadRoom();
                            ddlRoom.SelectedValue = dr["RoomId"].ToString();
                            LoadZone();
                            ddlZone.SelectedValue = dr["ZoneId"].ToString();
                        }
                    }
                    else if (strSelectionType == "rack")
                    {
                        dsLocation = oRack.Gets(intSelectionId);

                        if (dsLocation.Tables[0].Rows.Count > 0)
                        {
                            DataRow dr = dsLocation.Tables[0].Rows[0];
                            LoadState();
                            ddlState.SelectedValue = dr["StateId"].ToString();
                            LoadCity();
                            ddlCity.SelectedValue = dr["CityId"].ToString();
                            LoadAddress();
                            ddlLocation.SelectedValue = dr["LocationId"].ToString();
                            LoadRoom();
                            ddlRoom.SelectedValue = dr["RoomId"].ToString();
                            LoadZone();
                            ddlZone.SelectedValue = dr["ZoneId"].ToString();
                            LoadRack();
                            ddlRack.SelectedValue = dr["RackId"].ToString();
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();

            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset, dsn);
            oAssetOrder       = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oSolaris          = new Solaris(intProfile, dsn);
            oRoom             = new RoomsNew(intProfile, dsn);
            oRack             = new RacksNew(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }

            if ((Request.QueryString["assetid"] != null && Request.QueryString["assetid"] != "") &&
                (Request.QueryString["orderid"] != null && Request.QueryString["orderid"] != ""))
            {
                hdnAssetId.Value = oFunction.decryptQueryString(Request.QueryString["assetid"]);
                hdnOrderId.Value = oFunction.decryptQueryString(Request.QueryString["orderid"]);
                //hdnAssetId.Value = "11049";  //Balde"24188";
                if (!IsPostBack)
                {
                    LoadList();
                    LoadAssetInformation();
                    populateLocations();
                }

                ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
                ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");


                btnAddWWPortName.Attributes.Add("onclick", "return ValidateText('" + txtWWPortName.ClientID + "','Please enter a World Wide Port name') && ProcessControlButton()" +
                                                ";");
            }
            else
            {
                pnlAllow.Visible  = false;
                pnlDenied.Visible = true;
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage      = new Pages(intProfile, dsn);
            oLocation  = new Locations(intProfile, dsn);
            oRoomsNew  = new RoomsNew(intProfile, dsn);
            oZone      = new Zones(intProfile, dsn);
            oRacksNew  = new RacksNew(intProfile, dsn);

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }

            if (!IsPostBack)
            {
                if (String.IsNullOrEmpty(Request.QueryString["ra"]) == false)
                {
                    DataSet rec = oRacksNew.Gets(Int32.Parse(Request.QueryString["ra"]));
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        lblRackZone.ToolTip      = rec.Tables[0].Rows[0]["zoneid"].ToString();
                        txtRackName.Text         = rec.Tables[0].Rows[0]["rack"].ToString();
                        txtRackU.Text            = "50";
                        txtRackAmp.Text          = "100";
                        txtRackDescription.Text  = rec.Tables[0].Rows[0]["description"].ToString();
                        chkRackAvailable.Checked = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnRackUpdate.Visible    = true;
                        btnRackUpdate.Attributes.Add("onclick", "return ValidateText('" + txtRackName.ClientID + "','Please enter a name')" +
                                                     " && ProcessButton(this) && LoadWait()" +
                                                     ";");
                        btnRackDelete.Visible = true;
                        btnRackDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item') && ProcessButton(this) && LoadWait();");
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["z"]) == false)
                    {
                        lblRackZone.ToolTip = Request.QueryString["z"];
                        btnRackAdd.Visible  = true;
                        btnRackAdd.Attributes.Add("onclick", "return ValidateText('" + txtRackName.ClientID + "','Please enter a name')" +
                                                  " && ProcessButton(this) && LoadWait()" +
                                                  ";");
                    }
                    lblRackZone.Text = oZone.Get(Int32.Parse(lblRackZone.ToolTip), "zone");
                    btnRackCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                    panRack.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["z"]) == false)
                {
                    DataSet rec = oZone.Gets(Int32.Parse(Request.QueryString["z"]));
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        lblZoneRoom.ToolTip      = rec.Tables[0].Rows[0]["roomid"].ToString();
                        txtZoneName.Text         = rec.Tables[0].Rows[0]["zone"].ToString();
                        txtZoneDescription.Text  = rec.Tables[0].Rows[0]["description"].ToString();
                        chkZoneAvailable.Checked = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnZoneUpdate.Visible    = true;
                        btnZoneUpdate.Attributes.Add("onclick", "return ValidateText('" + txtZoneName.ClientID + "','Please enter a name')" +
                                                     " && ProcessButton(this) && LoadWait()" +
                                                     ";");
                        btnZoneDelete.Visible = true;
                        btnZoneDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item') && ProcessButton(this) && LoadWait();");

                        rptRacks.DataSource = oLocation.GetInventory(null, null, Int32.Parse(Request.QueryString["z"]));
                        rptRacks.DataBind();
                        lblRacks.Visible = (rptRacks.Items.Count == 0);
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["ro"]) == false)
                    {
                        lblZoneRoom.ToolTip = Request.QueryString["ro"];
                        btnZoneAdd.Visible  = true;
                        btnZoneAdd.Attributes.Add("onclick", "return ValidateText('" + txtZoneName.ClientID + "','Please enter a name')" +
                                                  " && ProcessButton(this) && LoadWait()" +
                                                  ";");
                        btnAddRack.Enabled = false;
                    }
                    lblZoneRoom.Text = oRoomsNew.Get(Int32.Parse(lblZoneRoom.ToolTip), "room");
                    btnZoneCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                    panZone.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["ro"]) == false)
                {
                    DataSet rec = oRoomsNew.Gets(Int32.Parse(Request.QueryString["ro"]));
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        lblRoomLocation.ToolTip  = rec.Tables[0].Rows[0]["locationid"].ToString();
                        txtRoomName.Text         = rec.Tables[0].Rows[0]["room"].ToString();
                        txtRoomDescription.Text  = rec.Tables[0].Rows[0]["description"].ToString();
                        chkRoomAvailable.Checked = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnRoomUpdate.Visible    = true;
                        btnRoomUpdate.Attributes.Add("onclick", "return ValidateText('" + txtRoomName.ClientID + "','Please enter a name')" +
                                                     " && ProcessButton(this) && LoadWait()" +
                                                     ";");
                        btnRoomDelete.Visible = true;
                        btnRoomDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item') && ProcessButton(this) && LoadWait();");

                        rptZones.DataSource = oLocation.GetInventory(null, Int32.Parse(Request.QueryString["ro"]), null);
                        rptZones.DataBind();
                        lblZones.Visible = (rptZones.Items.Count == 0);
                    }
                    else if (String.IsNullOrEmpty(Request.QueryString["l"]) == false)
                    {
                        lblRoomLocation.ToolTip = Request.QueryString["l"];
                        btnRoomAdd.Visible      = true;
                        btnRoomAdd.Attributes.Add("onclick", "return ValidateText('" + txtRoomName.ClientID + "','Please enter a name')" +
                                                  " && ProcessButton(this) && LoadWait()" +
                                                  ";");
                        btnAddZone.Enabled = false;
                    }
                    lblRoomLocation.Text = oLocation.GetAddress(Int32.Parse(lblRoomLocation.ToolTip), "commonname");
                    btnRoomCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                    panRoom.Visible = true;
                }
                else if (String.IsNullOrEmpty(Request.QueryString["l"]) == false)
                {
                    DataSet rec = oLocation.GetAddress(Int32.Parse(Request.QueryString["l"]));
                    if (rec.Tables[0].Rows.Count > 0)
                    {
                        txtLocationName.Text         = rec.Tables[0].Rows[0]["commonname"].ToString();
                        txtLocationAddress.Text      = rec.Tables[0].Rows[0]["name"].ToString();
                        txtLocationCode.Text         = rec.Tables[0].Rows[0]["factory_code"].ToString();
                        chkLocationStorage.Checked   = (rec.Tables[0].Rows[0]["storage"].ToString() == "1");
                        chkLocationTSM.Checked       = (rec.Tables[0].Rows[0]["tsm"].ToString() == "1");
                        chkLocationProd.Checked      = (rec.Tables[0].Rows[0]["prod"].ToString() == "1");
                        chkLocationQA.Checked        = (rec.Tables[0].Rows[0]["qa"].ToString() == "1");
                        chkLocationTest.Checked      = (rec.Tables[0].Rows[0]["test"].ToString() == "1");
                        chkLocationDR.Checked        = (rec.Tables[0].Rows[0]["dr"].ToString() == "1");
                        txtLocationBuildingCode.Text = rec.Tables[0].Rows[0]["building_code"].ToString();
                        chkLocationAssignIP.Checked  = (rec.Tables[0].Rows[0]["vmware_ipaddress"].ToString() == "1");
                        chkLocationAvailable.Checked = (rec.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        lblLocationCityID.Text       = rec.Tables[0].Rows[0]["cityid"].ToString();

                        btnLocationUpdate.Visible = true;
                        btnLocationUpdate.Attributes.Add("onclick", "return ValidateText('" + txtRoomName.ClientID + "','Please enter a name')" +
                                                         " && ProcessButton(this) && LoadWait()" +
                                                         ";");
                        btnLocationDelete.Visible = true;
                        btnLocationDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item') && ProcessButton(this) && LoadWait();");

                        rptRooms.DataSource = oLocation.GetInventory(Int32.Parse(Request.QueryString["l"]), null, null);
                        rptRooms.DataBind();
                        lblRooms.Visible = (rptRooms.Items.Count == 0);
                    }
                    else
                    {
                        btnLocationAdd.Visible = true;
                        btnLocationAdd.Attributes.Add("onclick", "return ValidateText('" + txtLocationName.ClientID + "','Please enter a name')" +
                                                      " && ProcessButton(this) && LoadWait()" +
                                                      ";");
                        btnAddRoom.Enabled = false;
                    }
                    btnLocationCancel.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                    panLocation.Visible = true;
                }
                else
                {
                    panLocations.Visible    = true;
                    rptLocations.DataSource = oLocation.GetInventory(null, null, null);
                    rptLocations.DataBind();
                }
            }
        }