private void RemoveIPAddress_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            if (btn != null)
            {
                string IP = btn.CommandParameter as string;
                if (!string.IsNullOrEmpty(IP))
                {
                    int idx = 0;
                    while (IP == SelectedIPAddress && idx < IPAddresses.Count)
                    {
                        SelectedIPAddress = IPAddresses[idx++];
                    }
                    IPAddresses.Remove(IP);
                    using (StreamWriter sw = new StreamWriter(Locations.IPAddressListFile, false))
                    {
                        foreach (string ipAddr in IPAddresses)
                        {
                            sw.WriteLine(ipAddr);
                        }
                    }
                }
            }
        }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/ip_networks.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");
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadClasses();
         btnParent.Attributes.Add("onclick", "return OpenWindow('IPVLANBROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         txtMin1.Attributes.Add("onkeyup", "CopyTextBox('" + txtMin1.ClientID + "','" + txtMax1.ClientID + "');");
         txtMin2.Attributes.Add("onkeyup", "CopyTextBox('" + txtMin2.ClientID + "','" + txtMax2.ClientID + "');");
         txtMin3.Attributes.Add("onkeyup", "CopyTextBox('" + txtMin3.ClientID + "','" + txtMax3.ClientID + "');");
         btnRelations.Attributes.Add("onclick", "return OpenWindow('NETWORKSRELATED','" + hdnId.ClientID + "','',false,'500',500);");
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile   = Int32.Parse(Request.Cookies["adminid"].Value);
         oClass       = new Classes(intProfile, dsn);
         oEnvironment = new Environments(intProfile, dsn);
         oLocation    = new Locations(intProfile, dsn);
         oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
         oVMWare      = new VMWare(intProfile, dsn);
         btnClose.Attributes.Add("onclick", "return HidePanel();");
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             intID = Int32.Parse(Request.QueryString["id"]);
         }
         if (!IsPostBack)
         {
             if (intID > 0)
             {
                 lblName.Text = oVMWare.GetVlan(intID, "name");
             }
             LoadClasses();
         }
     }
     else
     {
         btnSave.Enabled = false;
     }
 }
示例#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
     {
         Reload();
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intNetwork = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         LoadClasses();
         if (intNetwork > 0)
         {
             lblName.Text = oIPAddresses.GetNetworkName(intNetwork);
         }
         // Expand Nodes
         foreach (TreeNode oChild in oTree.Nodes)
         {
             if (Expand(oChild) == true)
             {
                 oChild.Expand();
             }
         }
     }
 }
        private void RemoveIPAddress_Click(object sender, RoutedEventArgs e)
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            Button btn = sender as Button;

            if (btn != null)
            {
                string IP = btn.CommandParameter as string;
                if (!string.IsNullOrEmpty(IP))
                {
                    int idx = 0;
                    while (IP == SelectedIPAddress && idx < IPAddresses.Count)
                    {
                        SelectedIPAddress = IPAddresses[idx++];
                    }
                    IPAddresses.Remove(IP);
                    using (StreamWriter sw = new StreamWriter(Locations.IPAddressListFile, false))
                    {
                        foreach (string ipAddr in IPAddresses)
                        {
                            sw.WriteLine(ipAddr);
                        }
                    }
                }
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }
示例#6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/albert_ip.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");
     }
     oIPAddresses = new IPAddresses(0, dsnIP, dsn);
     oEnvironment = new Environments(0, dsn);
     oClass       = new Classes(0, dsn);
     oServer      = new Servers(0, dsn);
     if (!IsPostBack)
     {
         if (Request.QueryString["done"] != null)
         {
             panDone.Visible = true;
             lblImport.Text  = Request.QueryString["done"];
         }
         LoadClasses();
         btnImport.Attributes.Add("onclick", "return ValidateHidden0('" + hdnVLAN.ClientID + "','" + txtVLAN.ClientID + "','Please select a Network') && ValidateText('" + oFile.ClientID + "','Please select a file');");
     }
 }
示例#7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/ip_vlans.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");
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     oLocation    = new Locations(intProfile, dsn);
     oResiliency  = new Resiliency(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadLists();
         LoadClasses();
         oTreeview.ExpandDepth = 0;
         btnParent.Attributes.Add("onclick", "return OpenWindow('LOCATION_BROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
         ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
     }
 }
        /// <summary>LoadContent
        /// </summary>
        public override void LoadContent(ClusterConfiguration configuration, byte[] data)
        {
            int bytesRead = 0;

            byte[] groupNameBuffer = new byte[Consts.FDFS_GROUP_NAME_MAX_LEN];
            Array.Copy(data, bytesRead, groupNameBuffer, 0, Consts.FDFS_GROUP_NAME_MAX_LEN);
            GroupName = EndecodeUtil.DecodeString(groupNameBuffer, configuration.Charset);
            //Util.ByteToString(option.Charset, groupNameBuffer).TrimEnd('\0');
            bytesRead += Consts.FDFS_GROUP_NAME_MAX_LEN;

            byte[] ipAddressBuffer = new byte[Consts.IP_ADDRESS_SIZE - 1];
            Array.Copy(data, bytesRead, ipAddressBuffer, 0, Consts.IP_ADDRESS_SIZE - 1);
            IPAddresses.Add(EndecodeUtil.DecodeString(ipAddressBuffer, configuration.Charset));
            //IPAddresses.Add(new string(option.Charset.GetChars(ipAddressBuffer)).TrimEnd('\0'));
            bytesRead += Consts.IP_ADDRESS_SIZE - 1;

            byte[] portBuffer = new byte[Consts.FDFS_PROTO_PKG_LEN_SIZE];
            Array.Copy(data, bytesRead, portBuffer, 0, Consts.FDFS_PROTO_PKG_LEN_SIZE);
            Port       = (int)ByteUtil.BufferToLong(portBuffer, 0);
            bytesRead += Consts.FDFS_PROTO_PKG_LEN_SIZE;

            while (data.Length - bytesRead >= Consts.IP_ADDRESS_SIZE - 1)
            {
                ipAddressBuffer = new byte[Consts.IP_ADDRESS_SIZE - 1];
                Array.Copy(data, bytesRead, ipAddressBuffer, 0, Consts.IP_ADDRESS_SIZE - 1);
                IPAddresses.Add(EndecodeUtil.DecodeString(ipAddressBuffer, configuration.Charset));
                // IPAddresses.Add(new string(option.Charset.GetChars(ipAddressBuffer)).TrimEnd('\0'));
                bytesRead += Consts.IP_ADDRESS_SIZE - 1;
            }
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);

            if (Request.QueryString["u"] != null && Request.QueryString["u"] == "GET")
            {
                XmlDocument oDoc = new XmlDocument();
                oDoc.Load(Request.InputStream);
                Response.ContentType = "application/xml";
                StringBuilder sb             = new StringBuilder("<values>");
                string        strValue       = Server.UrlDecode(oDoc.FirstChild.InnerXml);
                int           intApplication = Int32.Parse(strValue);
                DataSet       ds             = oIPAddresses.GetNetworksList(intApplication);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    sb.Append("<value>");
                    sb.Append(dr["id"].ToString());
                    sb.Append("</value><text>");
                    sb.Append(dr["name"].ToString());
                    sb.Append("</text>");
                }
                sb.Append("</values>");
                Response.Write(sb.ToString());
                Response.End();
            }
        }
示例#10
0
 public override int GetHashCode()
 {
     unchecked
     {
         var addressesHash = IPAddresses?.Aggregate(0, (current, address) => (current * 397) ^ address.GetHashCode()) ?? 0;
         return(((Id != null ? Id.GetHashCode() : 0) * 397) ^ addressesHash);
     }
 }
示例#11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
     oPage             = new Pages(intProfile, dsn);
     oAsset            = new Asset(intProfile, dsnAsset);
     oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
     oOrder            = new Orders(intProfile, dsnAsset);
     oModelsProperties = new ModelsProperties(intProfile, dsn);
     oType             = new Types(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 (Request.QueryString["add_deploy"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add_deploy", "<script type=\"text/javascript\">alert('The device was successfully deployed');<" + "/" + "script>");
     }
     if (Request.QueryString["add_return"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add_return", "<script type=\"text/javascript\">alert('The device was successfully returned');<" + "/" + "script>");
     }
     if (!IsPostBack)
     {
         int intPlatform = 0;
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             intPlatform = Int32.Parse(Request.QueryString["id"]);
         }
         if (intPlatform > 0)
         {
             rptDevices.DataSource = oAsset.Gets(intPlatform, (int)AssetStatus.Arrived);
             rptDevices.DataBind();
             foreach (RepeaterItem ri in rptDevices.Items)
             {
                 Button btnReturn = (Button)ri.FindControl("btnReturn");
                 btnReturn.Attributes.Add("onclick", "return confirm('Are you sure you want to return this device?');");
                 Button btnDeploy = (Button)ri.FindControl("btnDeploy");
                 int    intType   = oModelsProperties.GetType(Int32.Parse(btnDeploy.CommandName));
                 btnDeploy.Attributes.Add("onclick", "return OpenWindow('ASSET_DEPLOY','" + oType.Get(intType, "asset_deploy_path") + "?id=" + btnDeploy.CommandArgument + "');");
             }
             lblNone.Visible = (rptDevices.Items.Count == 0);
         }
     }
 }
示例#12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     AuthenticateUser();
     intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
     oAsset            = new Asset(0, dsnAsset);
     oIPAddresses      = new IPAddresses(0, dsnIP, dsn);
     oModel            = new Models(0, dsn);
     oModelsProperties = new ModelsProperties(0, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intID = Int32.Parse(Request.QueryString["id"]);
     }
     if (Request.QueryString["add"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add", "<script type=\"text/javascript\">alert('The HBA was successfully added');<" + "/" + "script>");
     }
     if (Request.QueryString["delete"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "delete", "<script type=\"text/javascript\">alert('The HBA was successfully deleted');<" + "/" + "script>");
     }
     if (!IsPostBack)
     {
         DataSet ds = oAsset.Get(intID);
         if (ds.Tables[0].Rows.Count > 0)
         {
             lblTracking.Text = ds.Tables[0].Rows[0]["tracking"].ToString();
             lblSerial.Text   = ds.Tables[0].Rows[0]["serial"].ToString();
             int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
             intModel          = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
             lblModel.Text     = ds.Tables[0].Rows[0]["modelname"].ToString();
             lblAsset.Text     = ds.Tables[0].Rows[0]["asset"].ToString();
             rptHBA.DataSource = oAsset.GetHBA(intID);
             rptHBA.DataBind();
             lblHBA.Visible = (rptHBA.Items.Count == 0);
             foreach (RepeaterItem ri in rptHBA.Items)
             {
                 LinkButton btnDelete = (LinkButton)ri.FindControl("btnDelete");
                 btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
             }
             btnAdd.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a name')" +
                                   ";");
             txtName.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnAdd.ClientID + "').click();return false;}} else {return true}; ");
         }
         else
         {
             btnAdd.Enabled = false;
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string      strResult    = "";
            Servers     oServer      = new Servers(0, dsn);
            OnDemand    oOnDemand    = new OnDemand(0, dsn);
            IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);

            oVMWare = new VMWare(0, dsn);
            string strConnect = oVMWare.ConnectDEBUG("https://ohcleutl4001/sdk", 3, "Dalton");

            if (strConnect == "")
            {
                VimService             _service       = oVMWare.GetService();
                ServiceContent         _sic           = oVMWare.GetSic();
                string                 strName        = "txpv00001a";
                ManagedObjectReference _vm_boot_order = oVMWare.GetVM(strName);

                OptionValue oValue = new OptionValue();
                oValue.key = "bios.bootDeviceClasses";
                // Set the PXE boot
                oValue.value = "allow:net";
                // Remove the PXE boot
                oValue.value = "";
                VirtualMachineConfigSpec _cs_boot_order = new VirtualMachineConfigSpec();
                _cs_boot_order.extraConfig = new OptionValue[] { oValue };

                ManagedObjectReference _task_boot_order = _service.ReconfigVM_Task(_vm_boot_order, _cs_boot_order);
                TaskInfo _inf_boot_order = (TaskInfo)oVMWare.getObjectProperty(_task_boot_order, "info");
                while (_inf_boot_order.state == TaskInfoState.running)
                {
                    _inf_boot_order = (TaskInfo)oVMWare.getObjectProperty(_task_boot_order, "info");
                }
                if (_inf_boot_order.state == TaskInfoState.success)
                {
                    strResult = "PXE Boot Forced";
                }
                else
                {
                    strResult = "PXE Boot NOT Forced";
                }
                Response.Write(strResult);
            }
            else
            {
                Response.Write("LOGIN error");
            }
        }
示例#14
0
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            int intAsset = Int32.Parse(Request.QueryString["id"]);

            oAsset.Update(intAsset, txtAsset.Text);
            IPAddresses oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
            int         intIP        = oIPAddresses.Add(0, Int32.Parse(txtIP1.Text), Int32.Parse(txtIP2.Text), Int32.Parse(txtIP3.Text), Int32.Parse(txtIP4.Text), intProfile);
            int         intDepotRoom = GetID(txtDepotRoom.Text, "cv_depot_rooms");

            if (intDepotRoom == 0)
            {
                oDepotRoom.Add(txtDepotRoom.Text, 1);
                intDepotRoom = GetID(txtDepotRoom.Text, "cv_depot_rooms");
            }
            int intShelf = GetID(txtShelf.Text, "cv_shelfs");

            if (intShelf == 0)
            {
                oShelf.Add(txtShelf.Text, 1);
                intShelf = GetID(txtShelf.Text, "cv_shelfs");
            }
            int intRoom = GetID(txtRoom.Text, "cv_rooms");

            if (intRoom == 0)
            {
                oRooms.Add(txtRoom.Text, 1);
                intRoom = GetID(txtRoom.Text, "cv_rooms");
            }
            int intRack = GetID(txtRack.Text, "cv_racks");

            if (intRack == 0)
            {
                oRacks.Add(txtRack.Text, 1);
                intRack = GetID(txtRack.Text, "cv_racks");
            }
            oAsset.UpdateNetwork(intAsset, txtName.Text, (int)AssetStatus.InUse, intProfile, DateTime.Parse(txtDate.Text), Int32.Parse(ddlDepot.SelectedItem.Value), intDepotRoom, intShelf, Int32.Parse(txtPorts.Text), Int32.Parse(ddlClass.SelectedItem.Value), Int32.Parse(Request.Form[hdnEnvironment.UniqueID]), Int32.Parse(Request.Form[hdnLocation.UniqueID]), intRoom, intRack, txtRackPosition.Text);
            oAsset.DeleteIP(intAsset);
            oAsset.AddIP(intAsset, intIP);
            if (Request.QueryString["sid"] != null)
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?sid=" + Request.QueryString["sid"] + "&id=" + intAsset.ToString() + "&commed=true");
            }
            else
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?pid=" + Request.QueryString["pid"] + "&save=true");
            }
        }
示例#15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/ip_vlans_ha.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");
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     if (!IsPostBack)
     {
         LoopRepeater();
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
     }
 }
        private void RunArtemis_Click(object sender, RoutedEventArgs e)
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            if (this.SelectedIPAddress != Locations.GetCurrentIPAddress())
            {
                if (!Locations.SetIPAddress(this.SelectedIPAddress))
                {
                    Locations.MessageBoxShow("Unable to set the Server IP address.\r\n\r\nReview log file for details as to why.",
                                             MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            Window thiswin = Window.GetWindow(this);


            thiswin.ShowInTaskbar = false;
            SessionMonitor win = new SessionMonitor();

            win.StartSession();
            DoAnimation();
            win.ShowDialog();
            thiswin.ShowInTaskbar = true;
            thiswin.WindowState   = System.Windows.WindowState.Normal;

            string newIP = Locations.GetCurrentIPAddress();

            if (!IPAddresses.Contains(newIP))
            {
                Locations.AddToIPList(newIP);
                IPAddresses.Add(newIP);
                SelectedIPAddress = newIP;
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);

            if (Request.QueryString["u"] != null && Request.QueryString["u"] == "GET")
            {
                XmlDocument oDoc = new XmlDocument();
                oDoc.Load(Request.InputStream);
                Response.ContentType = "application/xml";
                StringBuilder sb         = new StringBuilder("<values>");
                string        strValue   = Server.UrlDecode(oDoc.FirstChild.InnerXml);
                int           intNetwork = Int32.Parse(strValue);
                int           intVLAN    = 0;
                Int32.TryParse(oIPAddresses.GetNetwork(intNetwork, "vlanid"), out intVLAN);
                sb.Append("<value>");
                sb.Append(intVLAN.ToString());
                sb.Append("</value><text>");
                sb.Append(oIPAddresses.GetVlan(intVLAN, "vlan"));
                sb.Append("</text>");
                sb.Append("</values>");
                Response.Write(sb.ToString());
                Response.End();
            }
        }
        public virtual bool IsIPAddressAllowed(string ipAddressString)
        {
            IPAddress ipAddress = IPAddress.Parse(ipAddressString);

            if (FilteringType == IPAddressFilteringAction.Allow)
            {
                //reject the IP if it is in either list
                if ((IPAddresses != null && IPAddresses.Any() && !IsIPAddressInList(ipAddress)) &&
                    (IPAddressRanges != null && IPAddressRanges.Any() && !IPAddressRanges.Any(r => ipAddress.IsInRange(r.StartIPAddress, r.EndIPAddress))))
                {
                    return(false);
                }
            }
            else
            {
                //reject the IP if it is in either list
                if ((IPAddresses != null && IPAddresses.Any() && IsIPAddressInList(ipAddress)) ||
                    (IPAddressRanges != null && IPAddressRanges.Any() && IPAddressRanges.Any(r => ipAddress.IsInRange(r.StartIPAddress, r.EndIPAddress))))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#19
0
        public void Begin()
        {
            oServer          = new Servers(0, dsn);
            oAudit           = new Audit(0, dsn);
            oLog             = new Log(0, dsn);
            oOnDemand        = new OnDemand(0, dsn);
            oOperatingSystem = new OperatingSystems(0, dsn);
            oIPAddresses     = new IPAddresses(0, dsnIP, dsn);
            oVariable        = new Variables(intEnvironment);
            oFunction        = new Functions(0, dsn, intEnvironment);

            if (boolMultiThreaded == true)
            {
                // Run Audit Scripts in Multi-Threaded Fashion
                ThreadStart oThreadStart = new ThreadStart(RunAudits);
                Thread      oThread      = new Thread(oThreadStart);
                oThread.Start();
            }
            else
            {
                // Run Audit Scripts in Single-Threaded Fashion
                RunAudits();
            }
        }
示例#20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/sve_clusters.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");
            }
            oSolaris     = new Solaris(intProfile, dsn);
            oClass       = new Classes(intProfile, dsn);
            oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
            oServer      = new Servers(intProfile, dsn);
            oLocation    = new Locations(intProfile, dsn);
            oResiliency  = new Resiliency(intProfile, dsn);
            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                if (Request.QueryString["add"] == null)
                {
                    LoopRepeater();
                }
                else
                {
                    panAdd.Visible = true;
                }
            }
            else
            {
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                panAdd.Visible = true;
                intID          = Int32.Parse(Request.QueryString["id"]);
                if (intID > 0)
                {
                    if (!IsPostBack)
                    {
                        DataSet ds = oSolaris.GetSVECluster(intID);
                        txtName.Text        = ds.Tables[0].Rows[0]["name"].ToString();
                        chkDatabase.Checked = (ds.Tables[0].Rows[0]["db"].ToString() == "1");
                        int intClass = 0;
                        if (Int32.TryParse(ds.Tables[0].Rows[0]["classid"].ToString(), out intClass) == true)
                        {
                            ddlClass.SelectedValue = intClass.ToString();
                        }
                        ddlResiliency.SelectedValue = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                        chkAvailable.Checked        = (ds.Tables[0].Rows[0]["available"].ToString() == "1");
                        chkNetworks.Checked         = (ds.Tables[0].Rows[0]["networks"].ToString() == "1");
                        txtComments.Text            = ds.Tables[0].Rows[0]["comments"].ToString();
                        chkStorage.Checked          = (ds.Tables[0].Rows[0]["storage_allocated"].ToString() == "1");
                        chkTrunking.Checked         = (ds.Tables[0].Rows[0]["trunking"].ToString() == "1");
                        chkEnabled.Checked          = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnAdd.Text = "Update";

                        // Load Networks
                        if (chkNetworks.Checked == false)
                        {
                            strNetworks = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>SPECIFY NETWORK RANGES(S)</i> flag is checked</b></p>";
                        }
                        else
                        {
                            LoadClasses(oTreeNetworks, intClass);
                            oTreeNetworks.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                        }
                        LoadLocations();
                        // Load Hosts
                        rptHosts.DataSource = oServer.GetSVEClusters(intID);
                        rptHosts.DataBind();
                    }
                }
                else
                {
                    btnDelete.Enabled = false;
                }
            }

            if (panAdd.Visible == true)
            {
                int intMenuTab = 0;
                if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                {
                    intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                }
                Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);
                oTab.AddTab("Details", "");
                oTab.AddTab("Network Ranges", "");
                oTab.AddTab("Locations", "");
                oTab.AddTab("Current Hosts", "");
                strMenuTab1 = oTab.GetTabs();
            }

            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            strLocation = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, 0, true, "ddlCommon");
        }
示例#21
0
        private bool LoadInformation(int _request_workflow)
        {
            if (intProject > 0)
            {
                lblName.Text   = oProject.Get(intProject, "name");
                lblNumber.Text = oProject.Get(intProject, "number");
                lblType.Text   = "Project";
            }
            else
            {
                lblName.Text   = oResourceRequest.GetWorkflow(_request_workflow, "name");
                lblNumber.Text = "CVT" + intRequest.ToString();
                lblType.Text   = "Task";
            }
            bool    boolDone = false;
            DataSet ds       = oOnDemandTasks.GetVMWareII(intRequest, intItem, intNumber);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Forecast oForecast = new Forecast(intProfile, dsn);
                int      intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                if (oForecast.IsHARoom(intAnswer) == true)
                {
                    DataSet dsServer = oServer.GetAnswer(intAnswer);
                    foreach (DataRow drServer in dsServer.Tables[0].Rows)
                    {
                        int     intHA = Int32.Parse(drServer["id"].ToString());
                        DataSet dsHA  = oServer.GetHA(intHA);
                        if (dsHA.Tables[0].Rows.Count > 0)
                        {
                            if (lblHA.Text != "")
                            {
                                lblHA.Text += "<br/>";
                            }
                            lblHA.Text   += oServer.GetName(intHA, true) + " = " + oServer.GetName(Int32.Parse(dsHA.Tables[0].Rows[0]["serverid_ha"].ToString()), true);
                            panHA.Visible = true;
                        }
                    }
                }
                lblAnswer.Text = intAnswer.ToString();
                btnView.Attributes.Add("onclick", "return OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');");
                btnBirth.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                btnSC.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                lblView.Text = oOnDemandTasks.GetBody(intAnswer, intImplementorDistributed, intImplementorMidrange);
                int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                Models oModel     = new Models(intProfile, dsn);
                int    intType    = Int32.Parse(oModel.Get(intModel, "typeid"));
                Types  oType      = new Types(intProfile, dsn);
                string strExecute = oType.Get(intType, "forecast_execution_path");
                if (strExecute != "")
                {
                    btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                }
                chk1.Checked  = (ds.Tables[0].Rows[0]["chk1"].ToString() == "1");
                chk3.Checked  = (ds.Tables[0].Rows[0]["chk3"].ToString() == "1");
                chk4.Checked  = (ds.Tables[0].Rows[0]["chk4"].ToString() == "1");
                chk5.Checked  = (ds.Tables[0].Rows[0]["chk5"].ToString() == "1");
                chk6.Checked  = (ds.Tables[0].Rows[0]["chk6"].ToString() == "1");
                chk7.Checked  = (ds.Tables[0].Rows[0]["chk7"].ToString() == "1");
                chk8.Checked  = (ds.Tables[0].Rows[0]["chk8"].ToString() == "1");
                chk9.Checked  = (ds.Tables[0].Rows[0]["chk9"].ToString() == "1");
                chk10.Checked = (ds.Tables[0].Rows[0]["chk10"].ToString() == "1");
                chk11.Checked = (ds.Tables[0].Rows[0]["chk11"].ToString() == "1");
                int intNotifications = Int32.Parse(ds.Tables[0].Rows[0]["notifications"].ToString());
                int intClass         = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));

                if (oClass.Get(intClass, "prod") != "1")
                {
                    chk9.Checked   = true;
                    img9.ImageUrl  = "/images/cancel.gif";
                    chk10.Checked  = true;
                    img10.ImageUrl = "/images/cancel.gif";
                    chk11.Checked  = true;
                    img11.ImageUrl = "/images/cancel.gif";
                }
                boolDone = (chk1.Checked && chk3.Checked && chk4.Checked && chk5.Checked && chk6.Checked && chk7.Checked && chk8.Checked && chk9.Checked && chk10.Checked && chk11.Checked);

                img1.ImageUrl = "/images/green_arrow.gif";
                if (chk1.Checked == true)
                {
                    btnExecute.Enabled = false;
                    img1.ImageUrl      = "/images/check.gif";
                    img3.ImageUrl      = "/images/green_arrow.gif";
                    chk3.Enabled       = true;
                    Servers oServer  = new Servers(intProfile, dsn);
                    DataSet dsAnswer = oServer.GetAnswer(intAnswer);
                    foreach (DataRow drAnswer in dsAnswer.Tables[0].Rows)
                    {
                        if (lbl1.Text != "")
                        {
                            lbl1.Text += "<br/>";
                        }
                        int        intServer     = Int32.Parse(drAnswer["id"].ToString());
                        int        intServerName = Int32.Parse(drAnswer["nameid"].ToString());
                        ServerName oServerName   = new ServerName(0, dsn);
                        string     strName       = oServer.GetName(intServer, boolUsePNCNaming);
                        lbl1.Text += "Server Name: " + strName + "<br/>";
                        Zeus    oZeus  = new Zeus(intProfile, dsnZeus);
                        DataSet dsZeus = oZeus.GetBuildServer(intServer);
                        if (dsZeus.Tables[0].Rows.Count > 0)
                        {
                            lbl1.Text += "Serial Number: " + dsZeus.Tables[0].Rows[0]["serial"].ToString() + "<br/>";
                            lbl1.Text += "Asset Tag: " + dsZeus.Tables[0].Rows[0]["asset"].ToString() + "<br/>";
                        }
                        int     intDomain = Int32.Parse(drAnswer["domainid"].ToString());
                        Domains oDomain   = new Domains(intProfile, dsn);
                        boolMove = (oDomain.Get(intDomain, "move") == "1");
                        if (boolMove == true)
                        {
                            lbl1.Text += "DHCP Address: " + drAnswer["dhcp"].ToString() + "<br/>";
                        }
                        int         intIPAddress = 0;
                        IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);
                        lbl1.Text += "Assigned IP Address: " + oServer.GetIPs(intServer, 1, 0, 0, dsnIP, "", "") + "<br/>";
                        lbl1.Text += "Final IP Address: " + oServer.GetIPs(intServer, 0, 1, 0, dsnIP, "", "") + "<br/>";
                        Asset  oAsset   = new Asset(intProfile, dsnAsset);
                        VMWare oVMWare  = new VMWare(intProfile, dsn);
                        int    intAsset = 0;
                        if (drAnswer["assetid"].ToString() != "")
                        {
                            intAsset = Int32.Parse(drAnswer["assetid"].ToString());
                        }
                        if (intAsset > 0)
                        {
                            DataSet dsGuest = oVMWare.GetGuest(strName);
                            if (dsGuest.Tables[0].Rows.Count > 0)
                            {
                                int intHost       = Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString());
                                int intCluster    = Int32.Parse(oVMWare.GetHost(intHost, "clusterid"));
                                int intFolder     = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid"));
                                int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid"));
                                lbl1.Text += "DataCenter: " + oVMWare.GetDatacenter(intDataCenter, "name") + "<br/>";
                                lbl1.Text += "Host: " + oVMWare.GetHost(intHost, "name") + "<br/>";
                                int intDatastore = Int32.Parse(dsGuest.Tables[0].Rows[0]["datastoreid"].ToString());
                                lbl1.Text += "DataStore: " + oVMWare.GetDatastore(intDatastore, "name") + "<br/>";
                                int intPool = Int32.Parse(dsGuest.Tables[0].Rows[0]["poolid"].ToString());
                                //lbl1.Text += "Pool: " + oVMWare.GetPool(intPool, "name") + "<br/>";
                                int intVlan = Int32.Parse(dsGuest.Tables[0].Rows[0]["vlanid"].ToString());
                                lbl1.Text += "VLAN: " + oVMWare.GetVlan(intVlan, "name") + "<br/>";
                            }
                        }
                        Storage       oStorage      = new Storage(intProfile, dsn);
                        int           intCluster2   = Int32.Parse(drAnswer["clusterid"].ToString());
                        int           intCSMConfig2 = Int32.Parse(drAnswer["csmconfigid"].ToString());
                        int           intNumber2    = Int32.Parse(drAnswer["number"].ToString());
                        DataSet       dsLuns        = oStorage.GetLuns(intAnswer, 0, intCluster2, intCSMConfig2, intNumber2);
                        StringBuilder sbStorage     = new StringBuilder();
                        int           intRow        = 0;
                        bool          boolOverride  = (oForecast.GetAnswer(intAnswer, "storage_override") == "1");
                        foreach (DataRow drLun in dsLuns.Tables[0].Rows)
                        {
                            intRow++;
                            sbStorage.Append("<tr>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(intRow.ToString());
                            sbStorage.Append("</td>");
                            string strLetter = drLun["letter"].ToString();
                            if (strLetter == "")
                            {
                                if (drLun["driveid"].ToString() == "-1000")
                                {
                                    strLetter = "E";
                                }
                                else if (drLun["driveid"].ToString() == "-100")
                                {
                                    strLetter = "F";
                                }
                                else if (drLun["driveid"].ToString() == "-10")
                                {
                                    strLetter = "P";
                                }
                                else if (drLun["driveid"].ToString() == "-1")
                                {
                                    strLetter = "Q";
                                }
                            }
                            if ((boolOverride == true && drLun["driveid"].ToString() == "0") || oForecast.IsOSMidrange(intAnswer) == true)
                            {
                                sbStorage.Append("<td>");
                                sbStorage.Append(drLun["path"].ToString());
                                sbStorage.Append("</td>");
                            }
                            else
                            {
                                sbStorage.Append("<td>");
                                sbStorage.Append(strLetter);
                                sbStorage.Append(":");
                                sbStorage.Append(drLun["path"].ToString());
                                sbStorage.Append("</td>");
                            }
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["performance"].ToString());
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["size"].ToString());
                            sbStorage.Append(" GB</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_size"].ToString() == "-1" ? "Pending" : drLun["actual_size"].ToString() + " GB");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["size_qa"].ToString());
                            sbStorage.Append(" GB</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_size_qa"].ToString() == "-1" ? "Pending" : drLun["actual_size_qa"].ToString() + " GB");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["size_test"].ToString());
                            sbStorage.Append(" GB</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_size_test"].ToString() == "-1" ? "Pending" : drLun["actual_size_test"].ToString() + " GB");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["replicated"].ToString() == "0" ? "No" : "Yes");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_replicated"].ToString() == "-1" ? "Pending" : (drLun["actual_replicated"].ToString() == "0" ? "No" : "Yes"));
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["size"].ToString() + " GB)");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_high_availability"].ToString() == "-1" ? "Pending" : (drLun["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["actual_size"].ToString() + " GB)"));
                            sbStorage.Append("</td>");
                            sbStorage.Append("</tr>");
                            DataSet dsPoints = oStorage.GetMountPoints(Int32.Parse(drLun["id"].ToString()));
                            int     intPoint = 0;
                            foreach (DataRow drPoint in dsPoints.Tables[0].Rows)
                            {
                                intRow++;
                                intPoint++;
                                sbStorage.Append("<tr>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(intRow.ToString());
                                sbStorage.Append("</td>");
                                if (oForecast.IsOSMidrange(intAnswer) == true)
                                {
                                    sbStorage.Append("<td>");
                                    sbStorage.Append(drPoint["path"].ToString());
                                    sbStorage.Append("</td>");
                                }
                                else
                                {
                                    sbStorage.Append("<td>");
                                    sbStorage.Append(strLetter);
                                    sbStorage.Append(":\\SH");
                                    sbStorage.Append(drLun["driveid"].ToString());
                                    sbStorage.Append("VOL");
                                    sbStorage.Append(intPoint < 10 ? "0" : "");
                                    sbStorage.Append(intPoint.ToString());
                                    sbStorage.Append("</td>");
                                }
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["performance"].ToString());
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["size"].ToString());
                                sbStorage.Append(" GB</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_size"].ToString() == "-1" ? "Pending" : drPoint["actual_size"].ToString() + " GB");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["size_qa"].ToString());
                                sbStorage.Append(" GB</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_size_qa"].ToString() == "-1" ? "Pending" : drPoint["actual_size_qa"].ToString() + " GB");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["size_test"].ToString());
                                sbStorage.Append(" GB</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_size_test"].ToString() == "-1" ? "Pending" : drPoint["actual_size_test"].ToString() + " GB");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["replicated"].ToString() == "0" ? "No" : "Yes");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_replicated"].ToString() == "-1" ? "Pending" : (drPoint["actual_replicated"].ToString() == "0" ? "No" : "Yes"));
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["size"].ToString() + " GB)");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_high_availability"].ToString() == "-1" ? "Pending" : (drPoint["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["actual_size"].ToString() + " GB)"));
                                sbStorage.Append("</td>");
                                sbStorage.Append("</tr>");
                            }
                        }
                        if (sbStorage.ToString() != "")
                        {
                            sbStorage.Insert(0, "<tr class=\"bold\"><td></td><td>Path</td><td>Performance</td><td>Requested<br/>Size in Prod</td><td>Actual<br/>Size in Prod</td><td>Requested<br/>Size in QA</td><td>Actual<br/>Size in QA</td><td>Requested<br/>Size in Test</td><td>Actual<br/>Size in Test</td><td>Requested<br/>Replication</td><td>Actual<br/>Replication</td><td>Requested<br/>High Availability</td><td>Actual<br/>High Availability</td></tr>");
                            sbStorage.Insert(0, "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">");
                            sbStorage.Append("</table>");
                        }
                        lbl1.Text += sbStorage.ToString();
                    }
                }
                if (chk3.Checked == true)
                {
                    img3.ImageUrl = "/images/check.gif";
                    img4.ImageUrl = "/images/green_arrow.gif";
                    chk4.Enabled  = true;
                }
                if (chk4.Checked == true)
                {
                    img4.ImageUrl = "/images/check.gif";
                    if (boolMove == true)
                    {
                        img5.ImageUrl = "/images/green_arrow.gif";
                        chk5.Enabled  = true;
                    }
                    else
                    {
                        chk5.Checked  = true;
                        img7.ImageUrl = "/images/green_arrow.gif";
                        chk7.Enabled  = true;
                    }
                }
                if (chk5.Checked == true)
                {
                    if (boolMove == true)
                    {
                        img5.ImageUrl = "/images/check.gif";
                    }
                    else
                    {
                        img5.ImageUrl = "/images/cancel.gif";
                    }
                    if (boolMove == true)
                    {
                        img6.ImageUrl = "/images/green_arrow.gif";
                        chk6.Enabled  = true;
                    }
                }
                if (chk6.Checked == true)
                {
                    if (boolMove == true)
                    {
                        img6.ImageUrl = "/images/check.gif";
                    }
                    else
                    {
                        img6.ImageUrl = "/images/cancel.gif";
                    }
                    if (boolMove == true)
                    {
                        img7.ImageUrl = "/images/green_arrow.gif";
                        chk7.Enabled  = true;
                    }
                }
                if (chk7.Checked == true)
                {
                    img7.ImageUrl = "/images/check.gif";
                    img8.ImageUrl = "/images/green_arrow.gif";
                    chk8.Enabled  = true;
                }
                if (chk8.Checked == true)
                {
                    img8.ImageUrl = "/images/check.gif";
                    img9.ImageUrl = "/images/green_arrow.gif";
                    chk9.Enabled  = true;
                }
                if (chk9.Checked == true)
                {
                    img9.ImageUrl  = "/images/check.gif";
                    img10.ImageUrl = "/images/green_arrow.gif";
                    chk10.Enabled  = true;
                }
                if (chk10.Checked == true)
                {
                    img10.ImageUrl = "/images/check.gif";
                    img11.ImageUrl = "/images/green_arrow.gif";
                    chk11.Enabled  = true;
                }
                if (chk11.Checked == true)
                {
                    img11.ImageUrl = "/images/check.gif";
                }
            }
            if (Request.QueryString["div"] != null)
            {
                switch (Request.QueryString["div"])
                {
                case "E":
                    boolExecution = true;
                    break;
                }
            }
            if (boolDetails == false && boolExecution == false)
            {
                boolDetails = true;
            }
            return(boolDone);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/servername_components_details.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");
            }

            oServerName       = new ServerName(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oZeus             = new Zeus(intProfile, dsn);
            oAudit            = new Audit(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);

            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                if (Request.QueryString["parent"] == null)
                {
                    LoadComponents(oTreeDetails, false, false);
                }
                else
                {
                    panAdd.Visible          = true;
                    ddlParent.SelectedValue = Request.QueryString["parent"];
                    btnDelete.Enabled       = false;
                    strDisabled             = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available when updating an existing item</b></p>";
                    btnUser.Enabled         = false;
                }
            }
            else
            {
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                panAdd.Visible = true;
                intID          = Int32.Parse(Request.QueryString["id"]);
                if (!IsPostBack)
                {
                    DataSet ds = oServerName.GetComponentDetail(intID);
                    ddlParent.SelectedValue          = ds.Tables[0].Rows[0]["componentid"].ToString();
                    txtName.Text                     = ds.Tables[0].Rows[0]["name"].ToString();
                    ddlZEUSArrayConfig.SelectedValue = ds.Tables[0].Rows[0]["zeus_array_config_id"].ToString();
                    ddlZEUSBuildType.SelectedValue   = ds.Tables[0].Rows[0]["zeus_build_type_id"].ToString();
                    chkApproval.Checked              = (ds.Tables[0].Rows[0]["approval"].ToString() == "1");
                    chkModels.Checked                = (ds.Tables[0].Rows[0]["models"].ToString() == "1");
                    chkNetworks.Checked              = (ds.Tables[0].Rows[0]["networks"].ToString() == "1");
                    chkInstall.Checked               = (ds.Tables[0].Rows[0]["install"].ToString() == "1");
                    chkMount.Checked                 = (ds.Tables[0].Rows[0]["mount"].ToString() == "1");
                    txtNetworkPath.Text              = ds.Tables[0].Rows[0]["network_path"].ToString();
                    txtInstallPath.Text              = ds.Tables[0].Rows[0]["install_path"].ToString();
                    txtAD.Text = ds.Tables[0].Rows[0]["ad_move_location"].ToString();
                    ddlScript.SelectedValue      = ds.Tables[0].Rows[0]["scriptid"].ToString();
                    ddlEnvironment.SelectedValue = ds.Tables[0].Rows[0]["environment"].ToString();
                    chkEnabled.Checked           = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                    btnAdd.Text = "Update";

                    LoadClasses(oTreeClassEnvironment, false);
                    oTreeClassEnvironment.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    if (chkModels.Checked == false)
                    {
                        strModels = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>SPECIFY INDIVIDUAL MODEL(S)</i> flag is checked</b></p>";
                    }
                    else
                    {
                        LoadTypes(oTreeModels);
                        oTreeModels.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    }
                    LoadOperatingSystems(oTreeOperatingSystemServicePack);
                    if (chkApproval.Checked == false)
                    {
                        btnUser.Enabled = false;
                        strApprovals    = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>REQUIRES APPROVAL</i> flag is checked</b></p>";
                    }
                    else
                    {
                        LoadUsers();
                    }
                    LoadComponents(oTreeInclude, true, false);
                    oTreeInclude.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    LoadComponents(oTreeExclude, false, true);
                    oTreeExclude.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    LoadApplications(oTreeIncludeApp, true);
                    LoadApplications(oTreeExcludeApp, false);
                    if (chkNetworks.Checked == false)
                    {
                        strNetworks = "<p><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> <b>This section is only available if the <i>SPECIFY NETWORK RANGES(S)</i> flag is checked</b></p>";
                    }
                    else
                    {
                        LoadClasses(oTreeNetworks, true);
                        oTreeNetworks.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");
                    }
                    panScripts.Visible = true;
                    frmScripts.Attributes.Add("src", "/admin/servername_components_scripts.aspx?detailid=" + intID.ToString());
                }
            }

            if (panAdd.Visible == true)
            {
                int intMenuTab = 0;
                if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                {
                    intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                }
                Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);
                oTab.AddTab("Details", "");
                oTab.AddTab("Class / Environments", "");
                oTab.AddTab("Models", "");
                oTab.AddTab("Approvers", "");
                oTab.AddTab("Operating Systems / Service Packs", "");
                oTab.AddTab("Associated Components", "");
                int intMenuTabComp = 0;
                if (Request.QueryString["menu_tab_comp"] != null && Request.QueryString["menu_tab_comp"] != "")
                {
                    intMenuTabComp = Int32.Parse(Request.QueryString["menu_tab_comp"]);
                }
                Tab oTabComp = new Tab("", intMenuTabComp, "divMenuComp1", true, false);
                oTabComp.AddTab("Inclusions", "");
                oTabComp.AddTab("Exclusions", "");
                strMenuTabComp = oTabComp.GetTabs();
                oTab.AddTab("Associated Applications", "");
                int intMenuTabApp = 0;
                if (Request.QueryString["menu_tab_app"] != null && Request.QueryString["menu_tab_app"] != "")
                {
                    intMenuTabApp = Int32.Parse(Request.QueryString["menu_tab_app"]);
                }
                Tab oTabApp = new Tab("", intMenuTabApp, "divMenuApp1", true, false);
                oTabApp.AddTab("Inclusions", "");
                oTabApp.AddTab("Exclusions", "");
                strMenuTabApp = oTabApp.GetTabs();
                oTab.AddTab("Network Ranges", "");
                oTab.AddTab("Scripts", "");
                strMenuTab1 = oTab.GetTabs();
            }

            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            Variables oVariable = new Variables(intEnvironment);

            txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divUser.ClientID + "','" + lstUser.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstUser.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnUser.Attributes.Add("onclick", "return EnsureHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter the LAN ID of the user')" +
                                   ";");
            btnArrayConfig.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnArrayConfigId.ClientID + "','" + hdnArrayConfigOrder.ClientID + "&type=ZEUS_ARRAY_CONFIGS" + "',false,400,400);");
            btnBuildType.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnBuildTypeId.ClientID + "','" + hdnBuildTypeOrder.ClientID + "&type=ZEUS_BUILD_TYPES" + "',false,400,400);");
        }
示例#23
0
        private bool LoadInformation(int _request_workflow)
        {
            if (intProject > 0)
            {
                lblName.Text   = oProject.Get(intProject, "name");
                lblNumber.Text = oProject.Get(intProject, "number");
                lblType.Text   = "Project";
            }
            else
            {
                lblName.Text   = oResourceRequest.GetWorkflow(_request_workflow, "name");
                lblNumber.Text = "CVT" + intRequest.ToString();
                lblType.Text   = "Task";
            }
            bool    boolDone = false;
            DataSet ds       = oOnDemandTasks.GetVirtualII(intRequest, intItem, intNumber);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Forecast oForecast = new Forecast(intProfile, dsn);
                int      intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                lblAnswer.Text = intAnswer.ToString();
                btnView.Attributes.Add("onclick", "return OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');");
                //btnBirth.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                //btnSC.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                lblView.Text = oOnDemandTasks.GetBody(intAnswer, intImplementorDistributed, intImplementorMidrange);
                int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                Models oModel     = new Models(intProfile, dsn);
                int    intType    = Int32.Parse(oModel.Get(intModel, "typeid"));
                Types  oType      = new Types(intProfile, dsn);
                string strExecute = oType.Get(intType, "forecast_execution_path");
                if (strExecute != "")
                {
                    btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                }
                chk1.Checked  = (ds.Tables[0].Rows[0]["chk1"].ToString() == "1");
                chk2.Checked  = (ds.Tables[0].Rows[0]["chk2"].ToString() == "1");
                txtSCID.Text  = ds.Tables[0].Rows[0]["scid"].ToString();
                chk3.Checked  = (ds.Tables[0].Rows[0]["chk3"].ToString() == "1");
                chk4.Checked  = (ds.Tables[0].Rows[0]["chk4"].ToString() == "1");
                boolDone      = (chk1.Checked && chk2.Checked && chk3.Checked && chk4.Checked);
                img1.ImageUrl = "/images/green_arrow.gif";
                if (chk1.Checked == true)
                {
                    btnExecute.Enabled = false;
                    img1.ImageUrl      = "/images/check.gif";
                    img2.ImageUrl      = "/images/green_arrow.gif";
                    chk2.Enabled       = true;
                    Servers oServer  = new Servers(intProfile, dsn);
                    DataSet dsAnswer = oServer.GetAnswer(intAnswer);
                    foreach (DataRow drAnswer in dsAnswer.Tables[0].Rows)
                    {
                        if (lbl1.Text != "")
                        {
                            lbl1.Text += "<br/>";
                        }
                        int        intServerName = Int32.Parse(drAnswer["nameid"].ToString());
                        ServerName oServerName   = new ServerName(0, dsn);
                        lbl1.Text += "Server Name: " + oservername.getname2(intServerName, 0) + "<br/>";
                        int     intServer = Int32.Parse(drAnswer["id"].ToString());
                        Zeus    oZeus     = new Zeus(intProfile, dsnZeus);
                        DataSet dsZeus    = oZeus.GetBuildServer(intServer);
                        if (dsZeus.Tables[0].Rows.Count > 0)
                        {
                            lbl1.Text += "Serial Number: " + dsZeus.Tables[0].Rows[0]["serial"].ToString() + "<br/>";
                        }
                        int     intDomain = Int32.Parse(drAnswer["domainid"].ToString());
                        Domains oDomain   = new Domains(intProfile, dsn);
                        boolMove = (oDomain.Get(intDomain, "move") == "1");
                        if (boolMove == true)
                        {
                            lbl1.Text += "DHCP Address: " + drAnswer["dhcp"].ToString() + "<br/>";
                        }
                        int         intIPAddress = 0;
                        IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);
                        if (drAnswer["ipaddressid"].ToString() != "")
                        {
                            intIPAddress = Int32.Parse(drAnswer["ipaddressid"].ToString());
                            lbl1.Text   += "Assigned IP Address: " + oIPAddresses.GetName(intIPAddress, 0) + "<br/>";
                        }
                        if (drAnswer["ipaddressid_final"].ToString() != "")
                        {
                            intIPAddress = Int32.Parse(drAnswer["ipaddressid_final"].ToString());
                            lbl1.Text   += "Final IP Address: " + oIPAddresses.GetName(intIPAddress, 0) + "<br/>";
                        }
                    }
                }
            }
            if (boolMove == false)
            {
            }
            if (chk2.Checked == true)
            {
                chk1.Enabled  = false;
                img2.ImageUrl = "/images/check.gif";
                img3.ImageUrl = "/images/green_arrow.gif";
                chk3.Enabled  = true;
            }
            if (chk3.Checked == true)
            {
                chk2.Enabled  = false;
                img3.ImageUrl = "/images/check.gif";
                img4.ImageUrl = "/images/green_arrow.gif";
                chk4.Enabled  = true;
            }
            if (chk4.Checked == true)
            {
                chk3.Enabled  = false;
                img4.ImageUrl = "/images/check.gif";
            }
            if (Request.QueryString["div"] != null)
            {
                switch (Request.QueryString["div"])
                {
                case "E":
                    boolExecution = true;
                    break;
                }
            }
            if (boolDetails == false && boolExecution == false)
            {
                boolDetails = true;
            }
            return(boolDone);
        }
示例#24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            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);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            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);
            oResiliency       = new Resiliency(intProfile, dsn);
            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                    lblError.Text    = "Name Already Exists";
                }
                Int32.TryParse(oFunction.decryptQueryString(Request.QueryString["id"]), out intID);
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (intID > 0)
                {
                    DataSet ds = oDataPoint.GetAsset(intID);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information
                        intAsset        = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        lblAssetID.Text = "#" + intAsset.ToString();
                        string strSerial = ds.Tables[0].Rows[0]["serial"].ToString();
                        string strAsset  = ds.Tables[0].Rows[0]["asset"].ToString();

                        string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial);
                        lblHeader.Text    = "&quot;" + strHeader.ToUpper() + "&quot;";
                        Master.Page.Title = "DataPoint | Enclosure (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about an enclosure...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Asset Information", "");
                        oTab.AddTab("Location Information", "");
                        oTab.AddTab("Virtual Connect IPs", "");
                        oTab.AddTab("Resource Dependencies", "");
                        oTab.AddTab("Provisioning History", "");
                        oTab.AddTab("Blades", "");
                        //oTab.AddTab("Network Adapter Configuration", "");
                        strMenuTab1 = oTab.GetTabs();
                        if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true)
                        {
                            panOldLocationInfo.Visible = true;
                        }

                        if (!IsPostBack)
                        {
                            //DataSet dsAssets = oServer.GetAsset(intAsset);
                            //foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                            //{
                            //    if (drAsset["latest"].ToString() == "1")
                            //    {
                            //        intAsset = Int32.Parse(drAsset["assetid"].ToString());
                            //        intAssetClass = Int32.Parse(drAsset["classid"].ToString());
                            //        intAssetEnv = Int32.Parse(drAsset["environmentid"].ToString());
                            //        break;
                            //    }
                            //}

                            // Asset Information
                            oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "ENCLOSURE_SERIAL", strSerial, "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "ENCLOSURE_ASSET", strAsset, "", false, true);

                            int intAssetAttribute = Int32.Parse(oAsset.Get(intAsset, "asset_attribute"));
                            oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false);
                            oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true);
                            ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()");

                            ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');");
                            ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');");
                            int intModel = Int32.Parse(oAsset.Get(intAsset, "modelid"));

                            hdnModel.Value = intModel.ToString();
                            int intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                            int intType        = oModel.GetType(intModelParent);
                            int intPlatform    = oType.GetPlatform(intType);
                            oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "ENCLOSURE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "ENCLOSURE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "ENCLOSURE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "ENCLOSURE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true);

                            // Get Asset
                            DataSet dsAsset = oAsset.GetEnclosure(intAsset);
                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                oDataPoint.LoadTextBox(txtName, intProfile, null, "", lblName, fldName, "ENCLOSURE_NAME", dsAsset.Tables[0].Rows[0]["name"].ToString(), "", false, false);
                                if (txtName.Text != "")
                                {
                                    lblHeader.Text += "&nbsp;&nbsp;&nbsp;[" + txtName.Text + "]";
                                }
                                lblStatus.Text = dsAsset.Tables[0].Rows[0]["statusname"].ToString();
                                int intClass = Int32.Parse(dsAsset.Tables[0].Rows[0]["classid"].ToString());
                                int intEnv   = Int32.Parse(dsAsset.Tables[0].Rows[0]["environmentid"].ToString());
                                hdnEnvironment.Value = intEnv.ToString();

                                oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "ENCLOSURE_CLASS", "name", "id", oClass.Gets(1), intClass, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "ENCLOSURE_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true);
                                oDataPoint.LoadTextBox(txtPlatformVLAN, intProfile, null, "", lblPlatformVLAN, fldPlatformVLAN, "ENCLOSURE_VLAN", dsAsset.Tables[0].Rows[0]["vlan"].ToString(), "", false, true);
                                if (dsAsset.Tables[0].Rows[0]["oa_ip"].ToString() != "")
                                {
                                    oDataPoint.LoadTextBox(txtPlatformOA, intProfile, btnOA, "https://" + dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), lblPlatformOA, fldPlatformOA, "ENCLOSURE_OA", dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), "", false, true);
                                }
                                else
                                {
                                    oDataPoint.LoadTextBox(txtPlatformOA, intProfile, null, "", lblPlatformOA, fldPlatformOA, "ENCLOSURE_OA", dsAsset.Tables[0].Rows[0]["oa_ip"].ToString(), "", false, true);
                                }
                                int intResiliency = 0;
                                Int32.TryParse(dsAsset.Tables[0].Rows[0]["resiliencyid"].ToString(), out intResiliency);
                                oDataPoint.LoadDropDown(ddlPlatformResiliency, intProfile, null, "", lblPlatformResiliency, fldPlatformResiliency, "ENCLOSURE_RESILIENCY", "name", "id", oResiliency.Gets(1), intResiliency, false, false, true);

                                lblOldlocation.Text = dsAsset.Tables[0].Rows[0]["OldLocation"].ToString();
                                lblOldRoom.Text     = dsAsset.Tables[0].Rows[0]["OldRoom"].ToString();
                                lblOldRack.Text     = dsAsset.Tables[0].Rows[0]["OldRack"].ToString();

                                txtLocation.Text     = dsAsset.Tables[0].Rows[0]["Location"].ToString();
                                txtRoom.Text         = dsAsset.Tables[0].Rows[0]["Room"].ToString();
                                txtZone.Text         = dsAsset.Tables[0].Rows[0]["Zone"].ToString();
                                txtRack.Text         = dsAsset.Tables[0].Rows[0]["Rack"].ToString();
                                txtRackPosition.Text = dsAsset.Tables[0].Rows[0]["Rackposition"].ToString();
                                oDataPoint.LoadTextBox(txtRackPosition, intProfile, null, "", lblRackPositionValue, fldLocation, "CHANGE_LOCATION", dsAsset.Tables[0].Rows[0]["rackposition"].ToString(), "", false, true);
                                hdnRackId.Value = dsAsset.Tables[0].Rows[0]["NewRackId"].ToString();

                                oDataPoint.LoadButton(btnSelectLocation, intProfile, fldLocation, "CHANGE_LOCATION",
                                                      "return LoadLocationRoomRack('" + "rack" + "','" + hdnRackId.ClientID + "', '" + txtLocation.ClientID + "','" + txtRoom.ClientID + "','" + txtZone.ClientID + "','" + txtRack.ClientID + "');");


                                //DR Counterpart
                                int    intDR = oAsset.GetDR(intAsset);
                                string strDR = oAsset.Get(intDR, "serial");
                                if (intDR > 0)
                                {
                                    oDataPoint.LoadTextBox(txtPlatformDRCounterPart, intProfile, btnPlatformDRCounterPart, "/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(strDR) + "&id=" + oFunction.encryptQueryString(intDR.ToString()), lblPlatformDRCounterPart, fldPlatformDRCounterPart, "BLADE_DR", strDR, "", true, false);
                                }
                                else
                                {
                                    oDataPoint.LoadTextBox(txtPlatformDRCounterPart, intProfile, null, "", lblPlatformDRCounterPart, fldPlatformDRCounterPart, "BLADE_DR", "", "", true, false);
                                }

                                ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString();
                                ddlStatus.Enabled       = (intAssetAttribute == (int)AssetAttribute.Ok);
                                panStatus.Visible       = (ddlStatus.Enabled == false);
                            }
                            else
                            {
                                Response.Redirect("/datapoint/asset/enclosure_deploy.aspx?t=serial&q=" + oFunction.encryptQueryString(strSerial) + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&r=0");
                            }

                            // Resource Dependencies
                            AssetOrder      oAssetOrder     = new AssetOrder(0, dsn, dsnAsset, intEnvironment);
                            Services        oService        = new Services(0, dsn);
                            ServiceRequests oServiceRequest = new ServiceRequests(0, dsn);
                            rptServiceRequests.DataSource = oAssetOrder.GetByAsset(intAsset, false);
                            rptServiceRequests.DataBind();
                            trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0);
                            foreach (RepeaterItem ri in rptServiceRequests.Items)
                            {
                                Label lblServiceID = (Label)ri.FindControl("lblServiceID");
                                int   intService   = Int32.Parse(lblServiceID.Text);
                                Label lblDetails   = (Label)ri.FindControl("lblDetails");
                                Label lblProgress  = (Label)ri.FindControl("lblProgress");

                                if (lblProgress.Text == "")
                                {
                                    lblProgress.Text = "<i>Unavailable</i>";
                                }
                                else
                                {
                                    int     intResource  = Int32.Parse(lblProgress.Text);
                                    double  dblAllocated = 0.00;
                                    double  dblUsed      = 0.00;
                                    int     intStatus    = 0;
                                    bool    boolAssigned = false;
                                    DataSet dsResource   = oDataPoint.GetServiceRequestResource(intResource);
                                    if (dsResource.Tables[0].Rows.Count > 0)
                                    {
                                        Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus);
                                    }
                                    foreach (DataRow drResource in dsResource.Tables[1].Rows)
                                    {
                                        boolAssigned  = true;
                                        dblAllocated += double.Parse(drResource["allocated"].ToString());
                                        dblUsed      += double.Parse(drResource["used"].ToString());
                                        intStatus     = Int32.Parse(drResource["status"].ToString());
                                    }
                                    if (intStatus == (int)ResourceRequestStatus.Closed)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true);
                                    }
                                    else if (intStatus == (int)ResourceRequestStatus.Cancelled)
                                    {
                                        lblProgress.Text = "Cancelled";
                                    }
                                    else if (boolAssigned == false)
                                    {
                                        string  strManager = "";
                                        DataSet dsManager  = oService.GetUser(intService, 1); // Managers
                                        foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                        {
                                            if (strManager != "")
                                            {
                                                strManager += "\\n";
                                            }
                                            int intManager = Int32.Parse(drManager["userid"].ToString());
                                            strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]";
                                        }
                                        lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>";
                                    }
                                    else if (dblAllocated > 0.00)
                                    {
                                        lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                                    }
                                    else
                                    {
                                        lblProgress.Text = "<i>N / A</i>";
                                    }
                                    lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>";
                                }
                            }

                            // Provioning History
                            rptHistory.DataSource = oAsset.GetProvisioningHistory(oDataPoint.AssetHistorySelect(intAsset));
                            rptHistory.DataBind();
                            lblHistory.Visible = (rptHistory.Items.Count == 0);
                            oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "ENCLOSURE_STATUS");

                            // Virtual Connects
                            rptVirtualConnect.DataSource = oAsset.GetEnclosureVCs(intAsset, 1);
                            rptVirtualConnect.DataBind();
                            lblVirtualConnect.Visible = (rptVirtualConnect.Items.Count == 0);
                            oDataPoint.LoadButton(btnVC, intProfile, fldVC, "ENCLOSURE_VC", "return OpenWindow('ASSET_DEPLOY_VCs','" + intAsset.ToString() + "');");

                            if (Request.QueryString["highlight"] != null && Request.QueryString["highlight"] != "")
                            {
                                intHighlight = Int32.Parse(Request.QueryString["highlight"]);
                            }
                            // Blades
                            rptBlades.DataSource = oAsset.GetEnclosureBlades(intAsset);
                            rptBlades.DataBind();
                            lblBlades.Visible = (rptBlades.Items.Count == 0);

                            // Redeploy
                            oDataPoint.LoadButton(btnRedeploy, intProfile, fldRedeploy, "ENCLOSURE_REDEPLOY");
                            if (rptBlades.Items.Count == 0)
                            {
                                btnRedeploy.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy this enclosure?') && confirm('WARNING! Redeploying an asset means that ALL the information regarding this asset will be erased.\\n\\nAre you sure you want to redeploy this enclosure?');");
                            }
                            else
                            {
                                btnRedeploy.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy this enclosure?\\n\\WARNING: The blades associated with this enclosure have not been redployed!\\nIt is STRONGLY recommended that you redeploy the blades first to avoid corrupting the asset database.\\n\\nAre you sure you want to continue?');");
                            }
                            oDataPoint.LoadButton(btnRedeployBlades, intProfile, fldRedeployBlades, "ENCLOSURE_REDEPLOY_BLADES");
                            if (rptBlades.Items.Count == 0)
                            {
                                btnRedeployBlades.Attributes.Add("onclick", "alert('All blades have already been redeployed');return false;;");
                            }
                            else
                            {
                                btnRedeployBlades.Attributes.Add("onclick", "return confirm('Are you sure you want to redeploy ALL the blades in this enclosure?') && confirm('WARNING! Redeploying an asset means that ALL the information regarding this asset will be erased.\\n\\nAre you sure you want to redeploy ALL the blades in this enclosure?');");
                            }
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else if (Request.QueryString["q"] != null && Request.QueryString["q"] != "")
                {
                    string  strQuery = oFunction.decryptQueryString(Request.QueryString["q"]);
                    DataSet ds       = oDataPoint.GetAssetName(strQuery, intID, 0, "", "", 0);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());
                        Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()));
                    }
                    else
                    {
                        Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?multiple=true&t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"]);
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation());
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation());
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                //ddlLocationState.Attributes.Add("onchange", "LoadLocationCity('" + ddlLocationCity.ClientID + "');LoadLocationAddress('" + ddlLocationAddress.ClientID + "');PopulateCitys('" + ddlLocationState.ClientID + "','" + ddlLocationCity.ClientID + "');ResetDropDownHidden('" + hdnAddress.ClientID + "');");
                //ddlLocationCity.Attributes.Add("onchange", "LoadLocationAddress('" + ddlLocationAddress.ClientID + "');PopulateAddresss('" + ddlLocationCity.ClientID + "','" + ddlLocationAddress.ClientID + "');ResetDropDownHidden('" + hdnAddress.ClientID + "');");
                //ddlLocationAddress.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlLocationAddress.ClientID + "','" + hdnAddress.ClientID + "');");
            }
            else
            {
                panDenied.Visible = true;
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oAsset            = new Asset(0, dsnAsset);
            oIPAddresses      = new IPAddresses(0, dsnIP, dsn);
            oModel            = new Models(0, dsn);
            oModelsProperties = new ModelsProperties(0, dsn);
            oSolaris          = new Solaris(intProfile, dsn);
            oResiliency       = new Resiliency(intProfile, dsn);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID = Int32.Parse(Request.QueryString["id"]);
            }
            if (Request.QueryString["save"] != null)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Asset Deployed Successfully!');window.close();<" + "/" + "script>");
            }
            if (!IsPostBack)
            {
                DataSet ds = oAsset.Get(intID);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblTracking.Text = ds.Tables[0].Rows[0]["tracking"].ToString();
                    lblSerial.Text   = ds.Tables[0].Rows[0]["serial"].ToString();
                    int intModel  = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                    int intParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                    ddlModels.DataTextField  = "name";
                    ddlModels.DataValueField = "id";
                    ddlModels.DataSource     = oModelsProperties.GetModels(1, intParent, 1);
                    ddlModels.DataBind();
                    ddlModels.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                    ddlModels.SelectedValue = intModel.ToString();
                    //lblModel.Text = ds.Tables[0].Rows[0]["modelname"].ToString();
                    lblAsset.Text = ds.Tables[0].Rows[0]["asset"].ToString();
                    lblHBA.Text   = "&nbsp;(Currently = " + oAsset.GetHBA(intID).Tables[0].Rows.Count.ToString() + ")";

                    if (oModelsProperties.IsTypeBlade(intModel) == true)
                    {
                        panBlade.Visible            = true;
                        ddlEnclosure.DataValueField = "id";
                        ddlEnclosure.DataTextField  = "name";
                        ddlEnclosure.DataSource     = oAsset.GetEnclosures((int)AssetStatus.InUse);
                        ddlEnclosure.DataBind();
                        ddlEnclosure.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        btnSubmit.Attributes.Add("onclick", "return ValidateDropDown('" + ddlStatus.ClientID + "','Please select a status')" +
                                                 " && ValidateDropDown('" + ddlModels.ClientID + "','Please select a model')" +
                                                 " && ValidateDropDown('" + ddlEnclosure.ClientID + "','Please select an enclosure')" +
                                                 " && ValidateNumber0('" + txtSlot.ClientID + "','Please enter a valid slot number')" +
                                                 " && ValidateRadioButtons('" + radSpareYes.ClientID + "','" + radSpareNo.ClientID + "','Please select whether or not this blade is a spare')" +
                                                 " && ValidateText('" + txtILO.ClientID + "','Please enter an ILO address')" +
                                                 " && ValidateText('" + txtDummy.ClientID + "','Please enter a dummy name')" +
                                                 " && ValidateText('" + txtMAC.ClientID + "','Please enter a mac address')" +
                                                 " && ValidateNumber0('" + txtVLAN.ClientID + "','Please enter a valid original VLAN')" +
                                                 ";");
                    }
                    else
                    {
                        panServer.Visible = true;
                        LoadLists();
                        ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
                        ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                        btnSubmit.Attributes.Add("onclick", "return ValidateDropDown('" + ddlStatus.ClientID + "','Please select a status')" +
                                                 " && ValidateDropDown('" + ddlModels.ClientID + "','Please select a model')" +
                                                 " && ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                                                 " && ValidateDropDown('" + ddlEnvironment.ClientID + "','Please select an environment')" +
                                                 " && ValidateHidden0('" + hdnRackId.ClientID + "','" + btnChangeLocation.ClientID + "','Please select a location details')" +
                                                 " && ValidateHidden0('" + hdnRackPosition.ClientID + "','" + btnChangeLocation.ClientID + "','Please enter a rack position')" +
                                                 " && ValidateText('" + txtILO.ClientID + "','Please enter an ILO address')" +
                                                 " && ValidateText('" + txtDummy.ClientID + "','Please enter a dummy name')" +
                                                 " && ValidateText('" + txtMAC.ClientID + "','Please enter a mac address')" +
                                                 " && ValidateNumber0('" + txtVLAN.ClientID + "','Please enter a valid original VLAN')" +
                                                 ";");
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return parent.HidePanel();");
            btnHBAs.Attributes.Add("onclick", "return OpenWindow('ASSET_DEPLOY_HBAs','" + Request.QueryString["id"] + "');");
        }
示例#26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     AuthenticateUser();
     intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
     oAsset            = new Asset(0, dsnAsset);
     oIPAddresses      = new IPAddresses(0, dsnIP, dsn);
     oModel            = new Models(0, dsn);
     oModelsProperties = new ModelsProperties(0, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intID = Int32.Parse(Request.QueryString["id"]);
     }
     if (Request.QueryString["edit"] != null && Request.QueryString["edit"] != "")
     {
         intEdit = Int32.Parse(Request.QueryString["edit"]);
     }
     if (Request.QueryString["did"] != null && Request.QueryString["did"] != "")
     {
         int intDelete = Int32.Parse(Request.QueryString["did"]);
         int intParent = Int32.Parse(oAsset.GetEnclosureVC(intDelete, "enclosureid"));
         oAsset.DeleteEnclosureVC(intDelete);
         Response.Redirect(Request.Path + "?id=" + intParent.ToString() + "&delete=true");
     }
     if (Request.QueryString["add"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add", "<script type=\"text/javascript\">alert('The Virtual Connect IP was successfully added');<" + "/" + "script>");
     }
     if (Request.QueryString["update"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "update", "<script type=\"text/javascript\">alert('The Virtual Connect IP was updated added');<" + "/" + "script>");
     }
     if (Request.QueryString["delete"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "delete", "<script type=\"text/javascript\">alert('The Virtual Connect IP was successfully deleted');<" + "/" + "script>");
     }
     if (!IsPostBack)
     {
         DataSet ds = oAsset.Get(intID);
         if (ds.Tables[0].Rows.Count > 0)
         {
             lblTracking.Text = ds.Tables[0].Rows[0]["tracking"].ToString();
             lblSerial.Text   = ds.Tables[0].Rows[0]["serial"].ToString();
             int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
             intModel      = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
             lblModel.Text = ds.Tables[0].Rows[0]["modelname"].ToString();
             lblAsset.Text = ds.Tables[0].Rows[0]["asset"].ToString();
             if (intEdit > 0)
             {
                 btnAdd.Text       = "Update";
                 btnCancel.Visible = true;
                 DataSet dsVC = oAsset.GetEnclosureVC(intEdit);
                 if (dsVC.Tables[0].Rows.Count > 0)
                 {
                     txtVirtualConnect.Text = dsVC.Tables[0].Rows[0]["virtual_connect"].ToString();
                     btnSave.Enabled        = false;
                     imgOrderUp.Enabled     = false;
                     imgOrderDown.Enabled   = false;
                     imgRemove.Enabled      = false;
                     lstCurrent.Enabled     = false;
                 }
                 else
                 {
                     btnAdd.Enabled = false;
                 }
             }
             else
             {
                 imgOrderUp.Attributes.Add("onclick", "return MoveOrderUp(" + lstCurrent.ClientID + ",'" + hdnOrder.ClientID + "');");
                 imgOrderDown.Attributes.Add("onclick", "return MoveOrderDown(" + lstCurrent.ClientID + ",'" + hdnOrder.ClientID + "');");
                 imgRemove.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?') && MoveOut(" + lstCurrent.ClientID + ");");
                 lstCurrent.Attributes.Add("ondblclick", "return EditVC(this);");
                 btnAdd.Attributes.Add("onclick", "return ValidateText('" + txtVirtualConnect.ClientID + "','Please enter a Virtual Connect IP address')" +
                                       ";");
                 txtVirtualConnect.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnAdd.ClientID + "').click();return false;}} else {return true}; ");
                 lstCurrent.DataTextField  = "virtual_connect";
                 lstCurrent.DataValueField = "id";
                 lstCurrent.DataSource     = oAsset.GetEnclosureVCs(intID, 1);
                 lstCurrent.DataBind();
             }
         }
         else
         {
             btnAdd.Enabled = false;
         }
     }
 }
示例#27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
     oPage             = new Pages(intProfile, dsn);
     oUser             = new Users(intProfile, dsn);
     oPlatform         = new Platforms(intProfile, dsn);
     oAsset            = new Asset(intProfile, dsnAsset);
     oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
     oLocation         = new Locations(intProfile, dsn);
     oHost             = new Host(intProfile, dsn);
     oForecast         = new Forecast(intProfile, dsn);
     oModelsProperties = new ModelsProperties(intProfile, dsn);
     oModel            = new Models(intProfile, dsn);
     oType             = new Types(intProfile, dsn);
     oConfidence       = new Confidence(intProfile, dsn);
     oClass            = new Classes(intProfile, dsn);
     oOrder            = new Orders(intProfile, dsnAsset);
     oSetting          = new Settings(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 (Request.QueryString["order_add"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "order_add", "<script type=\"text/javascript\">alert('Device(s) successfully ordered');<" + "/" + "script>");
     }
     if (Request.QueryString["order_edit"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "order_edit", "<script type=\"text/javascript\">alert('Order successfully updated');<" + "/" + "script>");
     }
     if (Request.QueryString["order_delete"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "order_delete", "<script type=\"text/javascript\">alert('Order successfully deleted');<" + "/" + "script>");
     }
     if (!IsPostBack)
     {
         int intPlatform = 0;
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             intPlatform = Int32.Parse(Request.QueryString["id"]);
         }
         if (intPlatform > 0)
         {
             int intOrderAddress = 0;
             LoadLists(intPlatform);
             if (Request.QueryString["orderid"] != null && Request.QueryString["orderid"] != "")
             {
                 panOrders.Visible      = false;
                 panOrderUpdate.Visible = true;
                 int     intOrder = Int32.Parse(Request.QueryString["orderid"]);
                 DataSet dsOrder  = oOrder.Get(intOrder);
                 txtOrderName.Text           = dsOrder.Tables[0].Rows[0]["name"].ToString();
                 txtOrderTracking.Text       = dsOrder.Tables[0].Rows[0]["tracking"].ToString();
                 ddlOrderModel.SelectedValue = dsOrder.Tables[0].Rows[0]["modelid"].ToString();
                 intOrderAddress             = Int32.Parse(dsOrder.Tables[0].Rows[0]["addressid"].ToString());
                 txtOrderAddress.Text        = oLocation.GetFull(intOrderAddress);
                 hdnOrderAddress.Value       = intOrderAddress.ToString();
                 int intOrderClass = Int32.Parse(dsOrder.Tables[0].Rows[0]["classid"].ToString());
                 ddlOrderClass.SelectedValue = intOrderClass.ToString();
                 int intOrderEnv = Int32.Parse(dsOrder.Tables[0].Rows[0]["environmentid"].ToString());
                 ddlOrderEnvironment.Enabled        = true;
                 ddlOrderEnvironment.DataTextField  = "name";
                 ddlOrderEnvironment.DataValueField = "id";
                 ddlOrderEnvironment.DataSource     = oClass.GetEnvironment(intOrderClass, 0);
                 ddlOrderEnvironment.DataBind();
                 ddlOrderEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                 ddlOrderEnvironment.SelectedValue = intOrderEnv.ToString();
                 hdnOrderEnvironment.Value         = intOrderEnv.ToString();
                 txtOrderQuantity.Text             = dsOrder.Tables[0].Rows[0]["quantity"].ToString();
                 txtOrderDate.Text            = DateTime.Parse(dsOrder.Tables[0].Rows[0]["ordered"].ToString()).ToShortDateString();
                 ddlOrderStatus.SelectedValue = dsOrder.Tables[0].Rows[0]["status"].ToString();
                 txtOrderComments.Text        = dsOrder.Tables[0].Rows[0]["comments"].ToString();
                 btnAddOrder.Visible          = false;
                 btnUpdateOrder.Attributes.Add("onclick", "return ValidateText('" + txtOrderTracking.ClientID + "','Please enter a tracking number')" +
                                               " && ValidateDropDown('" + ddlOrderModel.ClientID + "','Please select a model')" +
                                               " && ValidateHidden0('" + hdnOrderAddress.ClientID + "','" + txtOrderAddress.ClientID + "','Please select a location')" +
                                               " && ValidateDropDown('" + ddlOrderClass.ClientID + "','Please select a class')" +
                                               " && ValidateDropDown('" + ddlOrderEnvironment.ClientID + "','Please select an environment')" +
                                               " && ValidateNumber0('" + txtOrderQuantity.ClientID + "','Please enter a valid quantity')" +
                                               " && ValidateDate('" + txtOrderDate.ClientID + "','Please enter a valid order date')" +
                                               ";");
             }
             else
             {
                 intOrderAddress      = intLocation;
                 rptOrders.DataSource = oOrder.Gets(intPlatform);
                 rptOrders.DataBind();
                 lblNoOrders.Visible = (rptOrders.Items.Count == 0);
                 foreach (RepeaterItem ri in rptOrders.Items)
                 {
                     Label      lblQuantity = (Label)ri.FindControl("lblQuantity");
                     Label      lblReceived = (Label)ri.FindControl("lblReceived");
                     LinkButton oRemove     = (LinkButton)ri.FindControl("btnRemoveOrder");
                     oRemove.Enabled = (lblQuantity.Text == lblReceived.Text);
                     LinkButton oDelete = (LinkButton)ri.FindControl("btnDeleteOrder");
                     oDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this order?');");
                 }
                 btnUpdateOrder.Visible = false;
                 btnAddOrder.Attributes.Add("onclick", "return ValidateText('" + txtOrderTracking.ClientID + "','Please enter a tracking number')" +
                                            " && ValidateDropDown('" + ddlOrderModel.ClientID + "','Please select a model')" +
                                            " && ValidateHidden0('" + hdnOrderAddress.ClientID + "','" + txtOrderAddress.ClientID + "','Please select a location')" +
                                            " && ValidateDropDown('" + ddlOrderClass.ClientID + "','Please select a class')" +
                                            " && ValidateDropDown('" + ddlOrderEnvironment.ClientID + "','Please select an environment')" +
                                            " && ValidateNumber0('" + txtOrderQuantity.ClientID + "','Please enter a valid quantity')" +
                                            " && ValidateDate('" + txtOrderDate.ClientID + "','Please enter a valid order date')" +
                                            ";");
             }
             if (intOrderAddress > 0)
             {
                 txtOrderAddress.Text = oLocation.GetFull(intOrderAddress);
             }
             hdnOrderAddress.Value = intOrderAddress.ToString();
             imgOrderDate.Attributes.Add("onclick", "return ShowCalendar('" + txtOrderDate.ClientID + "');");
             ddlOrderClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlOrderClass.ClientID + "','" + ddlOrderEnvironment.ClientID + "',0);");
             ddlOrderEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlOrderEnvironment.ClientID + "','" + hdnOrderEnvironment.ClientID + "');");
             btnOrderAddress.Attributes.Add("onclick", "return OpenLocations('" + hdnOrderAddress.ClientID + "','" + txtOrderAddress.ClientID + "');");
         }
     }
 }
示例#28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage             = new Pages(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oHost             = new Host(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oConfidence       = new Confidence(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oOrder            = new Orders(intProfile, dsnAsset);
            oSetting          = new Settings(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 (Request.QueryString["order_add"] != null)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "order_add", "<script type=\"text/javascript\">alert('Device(s) successfully ordered');<" + "/" + "script>");
            }
            if (Request.QueryString["order_edit"] != null)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "order_edit", "<script type=\"text/javascript\">alert('Order successfully updated');<" + "/" + "script>");
            }
            if (Request.QueryString["order_delete"] != null)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "order_delete", "<script type=\"text/javascript\">alert('Order successfully deleted');<" + "/" + "script>");
            }
            if (!IsPostBack)
            {
                int intPlatform = 0;

                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    intPlatform = Int32.Parse(Request.QueryString["id"]);
                }
                if (intPlatform > 0)
                {
                    int intOrderAddress = 0;
                    LoadLists(intPlatform);
                    if (Request.QueryString["orderid"] != null && Request.QueryString["orderid"] != "")
                    {
                        panHost.Visible        = false;
                        panOrders.Visible      = false;
                        panOrderUpdate.Visible = true;
                        int     intOrder = Int32.Parse(Request.QueryString["orderid"]);
                        DataSet dsOrder  = oOrder.Get(intOrder);
                        txtOrderName.Text           = dsOrder.Tables[0].Rows[0]["name"].ToString();
                        txtOrderTracking.Text       = dsOrder.Tables[0].Rows[0]["tracking"].ToString();
                        ddlOrderModel.SelectedValue = dsOrder.Tables[0].Rows[0]["modelid"].ToString();
                        intOrderAddress             = Int32.Parse(dsOrder.Tables[0].Rows[0]["addressid"].ToString());
                        txtOrderAddress.Text        = oLocation.GetFull(intOrderAddress);
                        hdnOrderAddress.Value       = intOrderAddress.ToString();
                        int intOrderClass = Int32.Parse(dsOrder.Tables[0].Rows[0]["classid"].ToString());
                        ddlOrderClass.SelectedValue = intOrderClass.ToString();
                        int intOrderEnv = Int32.Parse(dsOrder.Tables[0].Rows[0]["environmentid"].ToString());
                        ddlOrderEnvironment.Enabled        = true;
                        ddlOrderEnvironment.DataTextField  = "name";
                        ddlOrderEnvironment.DataValueField = "id";
                        ddlOrderEnvironment.DataSource     = oClass.GetEnvironment(intOrderClass, 0);
                        ddlOrderEnvironment.DataBind();
                        ddlOrderEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        ddlOrderEnvironment.SelectedValue = intOrderEnv.ToString();
                        hdnOrderEnvironment.Value         = intOrderEnv.ToString();
                        txtOrderQuantity.Text             = dsOrder.Tables[0].Rows[0]["quantity"].ToString();
                        txtOrderDate.Text            = DateTime.Parse(dsOrder.Tables[0].Rows[0]["ordered"].ToString()).ToShortDateString();
                        ddlOrderStatus.SelectedValue = dsOrder.Tables[0].Rows[0]["status"].ToString();
                        txtOrderComments.Text        = dsOrder.Tables[0].Rows[0]["comments"].ToString();
                        btnAddOrder.Visible          = false;
                        btnUpdateOrder.Attributes.Add("onclick", "return ValidateText('" + txtOrderTracking.ClientID + "','Please enter a tracking number')" +
                                                      " && ValidateDropDown('" + ddlOrderModel.ClientID + "','Please select a model')" +
                                                      " && ValidateHidden0('" + hdnOrderAddress.ClientID + "','" + txtOrderAddress.ClientID + "','Please select a location')" +
                                                      " && ValidateDropDown('" + ddlOrderClass.ClientID + "','Please select a class')" +
                                                      " && ValidateDropDown('" + ddlOrderEnvironment.ClientID + "','Please select an environment')" +
                                                      " && ValidateNumber0('" + txtOrderQuantity.ClientID + "','Please enter a valid quantity')" +
                                                      " && ValidateDate('" + txtOrderDate.ClientID + "','Please enter a valid order date')" +
                                                      " && ProcessButton(this)" +
                                                      ";");
                    }
                    else
                    {
                        intOrderAddress      = intLocation;
                        rptOrders.DataSource = oOrder.Gets(intPlatform);
                        rptOrders.DataBind();
                        lblNoOrders.Visible = (rptOrders.Items.Count == 0);
                        foreach (RepeaterItem ri in rptOrders.Items)
                        {
                            Label lblQuantity = (Label)ri.FindControl("lblQuantity");
                            Label lblReceived = (Label)ri.FindControl("lblReceived");
                            int   intQuantity = Int32.Parse(lblQuantity.Text);
                            int   intReceived = Int32.Parse(lblReceived.Text);
                            if (intReceived > 0)
                            {
                                if (intQuantity == intReceived)
                                {
                                    Button btnRemoveOrder = (Button)ri.FindControl("btnRemoveOrder");
                                    btnRemoveOrder.Attributes.Add("onclick", "return confirm('Are you sure you want to remove this order?\\n\\nNOTE: This does not cancel the order. It simply removes it from this view.');");
                                    btnRemoveOrder.Enabled = true;
                                }
                                Panel panRemove = (Panel)ri.FindControl("panRemove");
                                panRemove.Visible = true;
                            }
                            else
                            {
                                Panel panEdit = (Panel)ri.FindControl("panEdit");
                                panEdit.Visible = true;
                                Button btnDeleteOrder = (Button)ri.FindControl("btnDeleteOrder");
                                btnDeleteOrder.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel this order?');");
                            }
                        }
                        btnUpdateOrder.Visible = false;
                        btnAddOrder.Attributes.Add("onclick", "return ValidateText('" + txtOrderTracking.ClientID + "','Please enter a tracking number')" +
                                                   " && ValidateDropDown('" + ddlOrderModel.ClientID + "','Please select a model')" +
                                                   " && ValidateHidden0('" + hdnOrderAddress.ClientID + "','" + txtOrderAddress.ClientID + "','Please select a location')" +
                                                   " && ValidateDropDown('" + ddlOrderClass.ClientID + "','Please select a class')" +
                                                   " && ValidateDropDown('" + ddlOrderEnvironment.ClientID + "','Please select an environment')" +
                                                   " && ValidateNumber0('" + txtOrderQuantity.ClientID + "','Please enter a valid quantity')" +
                                                   " && ValidateDate('" + txtOrderDate.ClientID + "','Please enter a valid order date')" +
                                                   " && ProcessButton(this)" +
                                                   ";");
                    }
                    if (intOrderAddress > 0)
                    {
                        txtOrderAddress.Text = oLocation.GetFull(intOrderAddress);
                    }
                    imgOrderDate.Attributes.Add("onclick", "return ShowCalendar('" + txtOrderDate.ClientID + "');");
                    ddlOrderClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlOrderClass.ClientID + "','" + ddlOrderEnvironment.ClientID + "',0);");
                    ddlOrderEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlOrderEnvironment.ClientID + "','" + hdnOrderEnvironment.ClientID + "');");
                    btnOrderAddress.Attributes.Add("onclick", "return OpenLocations('" + hdnOrderAddress.ClientID + "','" + txtOrderAddress.ClientID + "');");
                    hdnOrderAddress.Value = intOrderAddress.ToString();
                    rptHosts.DataSource   = oForecast.GetAnswersPlatform(intPlatform);
                    rptHosts.DataBind();
                    foreach (RepeaterItem ri in rptHosts.Items)
                    {
                        Label  lblComplete  = (Label)ri.FindControl("lblComplete");
                        Button btnEdit      = (Button)ri.FindControl("btnEdit");
                        Button btnDelete    = (Button)ri.FindControl("btnDelete");
                        Button btnExecute   = (Button)ri.FindControl("btnExecute");
                        Button btnConfigure = (Button)ri.FindControl("btnConfigure");
                        Label  lblHost      = (Label)ri.FindControl("lblHost");
                        int    intHost      = Int32.Parse(lblHost.Text);
                        if (lblComplete.Text != "")
                        {
                            btnEdit.Enabled    = false;
                            btnDelete.Enabled  = false;
                            btnExecute.Enabled = false;
                            btnConfigure.Attributes.Add("onclick", "return OpenWindow('DEPLOY_HOST','" + oHost.Get(intHost, "path") + "?hostid=" + lblHost.Text + "&id=" + btnConfigure.CommandArgument + "');");
                        }
                        else
                        {
                            btnConfigure.Enabled = false;
                            Label lblRequestId  = (Label)ri.FindControl("lblRequestId");
                            Label lblAnswer     = (Label)ri.FindControl("lblAnswer");
                            int   intID         = Int32.Parse(lblAnswer.Text);
                            int   intModel      = Int32.Parse(oHost.Get(intHost, "modelid"));
                            int   intType       = oModel.GetType(Int32.Parse(oModelsProperties.Get(intModel, "modelid")));
                            Label lblCommitment = (Label)ri.FindControl("lblCommitment");
                            btnEdit.Attributes.Add("onclick", "return OpenWindow('INVENTORY_HOST','?id=" + intPlatform.ToString() + "&hostid=" + intID.ToString() + "');");
                            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this line item?');");
                            if (oConfidence.Get(Int32.Parse(oForecast.GetAnswer(intID, "confidenceid")), "name").ToUpper().Contains("100") == true)
                            {
                                int intRequestID = 0;
                                if (lblRequestId.Text != "")
                                {
                                    intRequestID = Int32.Parse(lblRequestId.Text);
                                }
                                if (lblCommitment.Text == DateTime.Today.ToShortDateString() || (lblCommitment.Text != "" && DateTime.Parse(lblCommitment.Text) < DateTime.Today) || intRequestID > 0)
                                {
                                    btnDelete.Enabled = false;
                                    btnEdit.Text      = "View";
                                    string strExecute = oType.Get(intType, "forecast_execution_path");
                                    if (strExecute != "")
                                    {
                                        btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intID.ToString() + "');");
                                    }
                                    else
                                    {
                                        btnExecute.Attributes.Add("onclick", "alert('Forecast execution has not been configured for asset type " + oType.Get(intType, "name") + "');return false;");
                                    }
                                }
                                else
                                {
                                    btnExecute.Enabled = false;
                                }
                            }
                            else
                            {
                                btnExecute.Enabled = false;
                            }
                        }
                    }
                    lblNone.Visible = (rptHosts.Items.Count == 0);
                    btnAddHost.Attributes.Add("onclick", "return OpenWindow('INVENTORY_HOST','?id=" + intPlatform.ToString() + "&hostid=0');");
                }
            }
        }
示例#29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strNetwork = "Desktop";

            if (string.IsNullOrEmpty(Request.QueryString["n"]) == false)
            {
                strNetwork = Request.QueryString["n"];
            }
            string strPortGroup = "dvPortGroupVLAN1000";

            if (string.IsNullOrEmpty(Request.QueryString["g"]) == false)
            {
                strPortGroup = Request.QueryString["g"];
            }

            Servers     oServer      = new Servers(0, dsn);
            OnDemand    oOnDemand    = new OnDemand(0, dsn);
            IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);

            oVMWare = new VMWare(0, dsn);
            string strConnect = oVMWare.ConnectDEBUG("https://wssvt350a.pncbank.com/sdk", 999, "PNC-Pittsburgh");

            if (strConnect == "")
            {
                VimService               _service      = oVMWare.GetService();
                ServiceContent           _sic          = oVMWare.GetSic();
                ManagedObjectReference   datacenterRef = oVMWare.GetDataCenter();
                ManagedObjectReference   netFolderRef  = (ManagedObjectReference)oVMWare.getObjectProperty(datacenterRef, "networkFolder");
                ManagedObjectReference[] netList       = (ManagedObjectReference[])oVMWare.getObjectProperty(netFolderRef, "childEntity");
                ManagedObjectReference   net           = null;
                foreach (ManagedObjectReference network in netList)
                {
                    if (((string)oVMWare.getObjectProperty(network, "name")) == strNetwork)
                    {
                        net = network;
                        break;
                    }
                }

                if (net != null)
                {
                    ManagedObjectReference[] switchList = (ManagedObjectReference[])oVMWare.getObjectProperty(net, "childEntity");
                    foreach (ManagedObjectReference swit in switchList)
                    {
                        try
                        {
                            if (((string)oVMWare.getObjectProperty(swit, "name")) == strPortGroup)
                            {
                                DVPortgroupConfigInfo pgConfig = (DVPortgroupConfigInfo)oVMWare.getObjectProperty(swit, "config");
                                Response.Write("Num Ports = " + pgConfig.numPorts.ToString() + "<br/>");
                                ManagedObjectReference[] pgVM = (ManagedObjectReference[])oVMWare.getObjectProperty(swit, "vm");
                                Response.Write("Num Machines = " + pgVM.Length.ToString() + "<br/>");
                                int intAvailable = pgConfig.numPorts - pgVM.Length;
                                Response.Write("Ports Available = " + intAvailable.ToString() + "<br/>");
                                break;
                            }
                        }
                        catch { }
                    }
                }

                //    ManagedObjectReference[] oDatastores = oVMWare.GetDatastores("ohclexcv4004");
                //    foreach (ManagedObjectReference oDataStore in oDatastores)
                //    {
                //        DatastoreSummary oSummary = (DatastoreSummary)oVMWare.getObjectProperty(oDataStore, "summary");
                //        double oAvailable = double.Parse(oSummary.capacity.ToString());
                //        oAvailable = oAvailable / 1024.00;
                //        oAvailable = oAvailable / 1024.00;
                //        oAvailable = oAvailable / 1024.00;
                //        double oFree = double.Parse(oSummary.freeSpace.ToString());
                //        oFree = oFree / 1024.00;
                //        oFree = oFree / 1024.00;
                //        oFree = oFree / 1024.00;
                //        Response.Write(oSummary.name + " = " + oFree.ToString("F") + " GB / " + oAvailable.ToString("F") + " GB<br/>");
                //    }
            }
            else
            {
                Response.Write("LOGIN error");
            }
        }
示例#30
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/bypass.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");
     }
     oAsset           = new Asset(intProfile, dsnAsset, dsn);
     oLog             = new Log(intProfile, dsn);
     oUser            = new Users(intProfile, dsn);
     oServer          = new Servers(intProfile, dsn);
     oTSM             = new TSM(intProfile, dsn);
     oResourceRequest = new ResourceRequest(intProfile, dsn);
     oIPAddresses     = new IPAddresses(intProfile, dsnIP, dsn);
     oServerName      = new ServerName(intProfile, dsn);
     oAssetOrder      = new AssetOrder(intProfile, dsn, dsnAsset, intEnvironment);
     if (!IsPostBack)
     {
         Variables oVariable = new Variables(intEnvironment);
         txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','hdnAJAXValue','" + oVariable.URL() + "/frame/users.aspx',2);");
         lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
         txtFind.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnFind.ClientID + "').click();return false;}} else {return true}; ");
         btnFind.Attributes.Add("onclick", "SearchText('" + txtFind.ClientID + "','" + panResult.ClientID + "');return false;");
         txtName.Focus();
         btnSearch.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a device name');");
         btnSubmit.Attributes.Add("onclick", "return ValidateHidden0('hdnAJAXValue','" + txtUser.ClientID + "','Please select the requestor / client')"
                                  + " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid date')"
                                  + " && ValidateText('" + txtPTM.ClientID + "','Please enter a change control')"
                                  + " && ValidateText('" + txtReason.ClientID + "','Please enter a reason')"
                                  + "&& confirm('WARNING: You are about to alter production data! This action CANNOT be undone!\\n\\nAre you sure you want to continue?') && confirm('LAST CHANCE! If you do not know what you are doing, I suggest you do not do this!\\n\\nAre you REALLY sure you want to do this?');");
     }
     if (Request.QueryString["assets"] != null)
     {
         string[]      strAssets = Request.QueryString["assets"].Split(strSplit);
         StringBuilder strDeploy = new StringBuilder();
         strDeploy.Append("<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\">");
         strDeploy.Append("<tr bgcolor=\"#EEEEEE\"><td><b>Server Name</b></td><td><b>Serial Number</b></td><td><b>Power On Using</b></td><td><b>Backup?</b></td></tr>");
         int intBypass = 0;
         for (int ii = 0; ii < strAssets.Length; ii++)
         {
             if (strAssets[ii].Trim() != "")
             {
                 int    intAsset = Int32.Parse(strAssets[ii].Trim());
                 string strILO   = oAsset.GetServerOrBlade(intAsset, "ilo");
                 strDeploy.Append("<tr>");
                 strDeploy.Append("<td>");
                 string strName = oAsset.GetStatus(intAsset, "name");
                 strDeploy.Append(strName);
                 strDeploy.Append("</td>");
                 strDeploy.Append("<td>");
                 strDeploy.Append(oAsset.Get(intAsset, "serial"));
                 strDeploy.Append("</td>");
                 strDeploy.Append("<td>");
                 strDeploy.Append(strILO == "" ? "VMware Virtual Center" : "ILO: <a href=\"https://" + strILO + "\" target=\"_blank\">" + strILO + "</a>");
                 strDeploy.Append("</td>");
                 strDeploy.Append("<td>");
                 DataSet dsTSM = oTSM.GetDecom(strName);
                 if (dsTSM.Tables[0].Rows.Count > 0)
                 {
                     DataRow drTSM = dsTSM.Tables[0].Rows[0];
                     strDeploy.Append("YES<br/>");
                     strDeploy.Append("Server: " + drTSM["server"].ToString() + "<br/>");
                     strDeploy.Append("Port: " + drTSM["port"].ToString() + "<br/>");
                     strDeploy.Append("Domain: " + drTSM["domain"].ToString() + "<br/>");
                     strDeploy.Append("Schedule: " + drTSM["schedule"].ToString() + "<br/>");
                     strDeploy.Append("Contact(s): " + drTSM["contacts"].ToString());
                 }
                 else
                 {
                     strDeploy.Append("NO");
                 }
                 strDeploy.Append("</td>");
                 strDeploy.Append("</tr>");
                 intBypass++;
             }
         }
         strDeploy.Append("</table>");
         lblResult.Text  = "<p>ClearView bypassed the cooldown for " + intBypass.ToString() + " device(s)...</p>";
         lblResult.Text += "<p>Please use the following information to configure the devices...</p>";
         lblResult.Text += strDeploy.ToString();
     }
 }