Esempio n. 1
0
        private void LoadRooms()
        {
            DataSet ds = oRoom.Gets(intAddress, 1);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TreeNode oNode = new TreeNode();
                oNode.Text         = dr["room"].ToString();
                oNode.ToolTip      = dr["room"].ToString();
                oNode.Value        = dr["roomid"].ToString();
                oNode.SelectAction = TreeNodeSelectAction.Expand;
                oTree.Nodes.Add(oNode);
                Load(oNode, Int32.Parse(dr["roomid"].ToString()));
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 3
0
        protected void LoadRoom()
        {
            ddlRoom.Items.Clear();
            ddlRoom.ClearSelection();
            if (Int32.Parse(ddlLocation.SelectedValue.ToString()) > 0)
            {
                ddlRoom.DataTextField  = "Room";
                ddlRoom.DataValueField = "RoomId";
                ddlRoom.DataSource     = oRoom.Gets(Int32.Parse(ddlLocation.SelectedValue.ToString()), 1);
                ddlRoom.DataBind();
                ddlRoom.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                ddlRoom.Enabled = true;
            }
            else
            {
                ddlRoom.Enabled = false;
                ddlRoom.Items.Insert(0, new ListItem("-- SELECT ADDRESS --", "0"));
            }

            ddlRoom.Items.FindByValue("0").Selected = true;
        }
Esempio n. 4
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();
                        }
                    }
                }
            }
        }
Esempio n. 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();
                }
            }
        }