예제 #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();
     }
 }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/forecast/build_locations_rdp.aspx";
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }
            oBuildLocation = new BuildLocation(intProfile, dsn);
            oClass         = new Classes(intProfile, dsn);
            oLocation      = new Locations(intProfile, dsn);
            oResiliency    = new Resiliency(intProfile, dsn);

            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                LoopRepeater();
            }
            else
            {
                intID = Int32.Parse(Request.QueryString["id"]);
                if (intID == 0)
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                }
                else
                {
                    panAdd.Visible = true;
                    if (!IsPostBack)
                    {
                        DataSet ds       = oBuildLocation.GetRDP(intID);
                        int     intClass = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["classid"].ToString(), out intClass);
                        ddlClass.SelectedValue        = intClass.ToString();
                        ddlEnvironment.Enabled        = true;
                        ddlEnvironment.DataTextField  = "name";
                        ddlEnvironment.DataValueField = "id";
                        ddlEnvironment.DataSource     = oClass.GetEnvironment(intClass, 0);
                        ddlEnvironment.DataBind();
                        ddlEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        int intEnv = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["environmentid"].ToString(), out intEnv);
                        ddlEnvironment.SelectedValue = intEnv.ToString();
                        hdnEnvironment.Value         = intEnv.ToString();
                        Int32.TryParse(ds.Tables[0].Rows[0]["addressid"].ToString(), out intLocation);
                        txtRDP_Schedule_WS.Text             = ds.Tables[0].Rows[0]["rdp_schedule_ws"].ToString();
                        txtRDP_Computer_WS.Text             = ds.Tables[0].Rows[0]["rdp_computer_ws"].ToString();
                        txtRDP_MDT_WS.Text                  = ds.Tables[0].Rows[0]["rdp_mdt_ws"].ToString();
                        txtJumpstartCGI.Text                = ds.Tables[0].Rows[0]["jumpstart_cgi"].ToString();
                        ddlJumpstartBuildType.SelectedValue = ds.Tables[0].Rows[0]["jumpstart_build_type"].ToString();
                        txtBladeVLAN.Text           = ds.Tables[0].Rows[0]["blade_vlan"].ToString();
                        txtVMwareVLAN.Text          = ds.Tables[0].Rows[0]["vmware_vlan"].ToString();
                        txtVSphereVLAN.Text         = ds.Tables[0].Rows[0]["vsphere_vlan"].ToString();
                        txtDellVLAN.Text            = ds.Tables[0].Rows[0]["dell_vlan"].ToString();
                        txtDellVmwareVLAN.Text      = ds.Tables[0].Rows[0]["dell_vmware_vlan"].ToString();
                        ddlResiliency.SelectedValue = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                        ddlSource.SelectedValue     = ds.Tables[0].Rows[0]["source"].ToString();
                        chkServerAltiris.Checked    = (ds.Tables[0].Rows[0]["server_altiris"].ToString() == "1");
                        chkServerMDT.Checked        = (ds.Tables[0].Rows[0]["server_mdt"].ToString() == "1");
                        chkWorkstation.Checked      = (ds.Tables[0].Rows[0]["workstation"].ToString() == "1");
                        chkZones.Checked            = (ds.Tables[0].Rows[0]["zones"].ToString() == "1");
                        btnZones.Enabled            = chkZones.Checked;

                        chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnAdd.Text        = "Update";
                    }
                }
            }

            strLocation       = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon");
            hdnLocation.Value = intLocation.ToString();
            ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
            ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            btnZones.Attributes.Add("onclick", "return OpenWindow('RDP_ZONES','','" + intID.ToString() + "',false,'650',500);");
        }