Exemplo n.º 1
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdWlLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_WL data = response.DataTable.ToEntity <MES_BD_WL>();

        this.Bind(data);
        hidPIC1Path.Value  = data.PIC1_PATH;
        hidPIC1.Value      = data.PIC1;
        hidPIC2Path.Value  = data.PIC2_PATH;
        hidPIC2.Value      = data.PIC2;
        hidPIC3Path.Value  = data.PIC3_PATH;
        hidPIC3.Value      = data.PIC3;
        hidPIC4Path.Value  = data.PIC4_PATH;
        hidPIC4.Value      = data.PIC4;
        hidPIC5Path.Value  = data.PIC5_PATH;
        hidPIC5.Value      = data.PIC5;
        hidPIC6Path.Value  = data.PIC6_PATH;
        hidPIC6.Value      = data.PIC6;
        hidPIC7Path.Value  = data.PIC7_PATH;
        hidPIC7.Value      = data.PIC7;
        hidPIC8Path.Value  = data.PIC8_PATH;
        hidPIC8.Value      = data.PIC8;
        hidPIC9Path.Value  = data.PIC9_PATH;
        hidPIC9.Value      = data.PIC9;
        hidPIC10Path.Value = data.PIC10_PATH;
        hidPIC10.Value     = data.PIC10;
        hidFILE1Path.Value = data.FILE1_PATH;
        hidFILE1.Value     = data.FILE1;
    }
Exemplo n.º 2
0
    public string GetRootJson()
    {
        EciRequest request = new EciRequest(MESService.MesBdZyLoad);

        request.Type = "GetRoot";

        EciResponse response     = SOA.Execute(request);
        DataTable   dataResponse = response.DataTable;

        DataTable data = DataTableHelper.Create("ID,PARENTID,TEXT,STATE,TAG", 1).DataTable;

        data.Rows[0]["ID"]    = dataResponse.Rows[0]["GUID"];
        data.Rows[0]["TEXT"]  = dataResponse.Rows[0]["NAME"];
        data.Rows[0]["STATE"] = "closed";

        EntityBase entity = data.ToEntity();

        entity.JsonKeyIsLower     = true;
        entity.Attributes         = new EntityBase();
        entity.Attributes["root"] = "true";

        List <EntityBase> list = new List <EntityBase>();

        list.Add(entity);

        string content = list.ToJson(true);

        return(content);
    }
Exemplo n.º 3
0
    public void Save(EciResponse ajax)
    {
        MES_BD_ZY item = new MES_BD_ZY();

        item.GUID   = PageHelper.Request(MES_BD_ZY.Fields.GUID);
        item.GH     = PageHelper.Request(MES_BD_ZY.Fields.GH);
        item.NAME   = PageHelper.Request(MES_BD_ZY.Fields.NAME);
        item.CODE   = PageHelper.Request(MES_BD_ZY.Fields.CODE);
        item.STATUS = PageHelper.Request(MES_BD_ZY.Fields.STATUS);

        EciRequest request = new EciRequest(MESService.MesBdZySave);

        request.Entity = item;
        request.IsAdd  = PageHelper.Request("FLAG") == "Add";

        if (request.IsAdd)
        {
            item.PARENTID = PageHelper.Request(MES_BD_ZY.Fields.PARENTID);
            request.Type  = "tree";
        }

        EciResponse response = SOA.Execute(request);

        ajax.Data = response.Data;
    }
Exemplo n.º 4
0
        /// <summary>
        /// Returns the SOA (site of activity) instance for this exchange visitor's site of activity.
        /// </summary>
        /// <returns>The SOA i.e. site of activity for this exchange visitor.</returns>
        public SOA GetSOA()
        {
            Contract.Requires(this.SiteOfActivity != null, "The site of activity must not be null.");
            Contract.Requires(this.SiteOfActivity.Street1 != null, "The site of activity street 1 must not be null.");
            Contract.Requires(this.SiteOfActivity.Street2 != null, "The site of activity street 2 must not be null.");
            Contract.Requires(this.SiteOfActivity.City != null, "The site of activity city must not be null.");
            Contract.Requires(this.SiteOfActivity.Division != null, "The site of activity division must not be null.");
            Contract.Requires(this.SiteOfActivity.Country == LocationServiceAddressValidator.UNITED_STATES_COUNTRY_NAME, "The site of activity country must be the united states.");
            Contract.Requires(this.SiteOfActivity.LocationName != null, "The site of activity location name must be defined.");
            Contract.Requires(this.SiteOfActivity.PostalCode != null, "The site of activity postal code must be defined.");

            var soa = new SOA
            {
                Address1                 = this.SiteOfActivity.Street1,
                Address2                 = this.SiteOfActivity.Street2,
                City                     = this.SiteOfActivity.City,
                Explanation              = null,
                ExplanationCode          = null,
                ExplanationCodeSpecified = false,
                PostalCode               = this.SiteOfActivity.PostalCode,
                PrimarySite              = true,
                Remarks                  = null,
                State                    = this.SiteOfActivity.DivisionIso.GetStateCodeType(),
                StateSpecified           = true,
                SiteName                 = this.SiteOfActivity.LocationName
            };

            return(soa);
        }
Exemplo n.º 5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        EciRequest request = new EciRequest(MESService.MesBdMjlxcsSave);

        request.IsAdd = this.key.NullOrEmpty();

        MES_BD_MJLXCS saveEntity = new MES_BD_MJLXCS();

        request.Entity = saveEntity;

        saveEntity.Data = this.GetEntityFromUI().Data;

        saveEntity.GUID = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_MJLXCS data = response.Entity.Upgrade <MES_BD_MJLXCS>();

        if (request.IsAdd)
        {
            this.key = data.GUID;

            this.btnAdd.Enabled = true;

            //this.txtCreateDate.Text = DateTime.Now.ToFullString();
            //this.txtCreateUser.Text = this.UserInfo.UserName;
        }

        //this.txtUpdateDate.Text = DateTime.Now.ToFullString();
        //this.txtUpdateUser.Text = this.UserInfo.UserName;

        response.Message.Tip();
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string type = PageHelper.Request("type");

        if (type == "load" && PageHelper.Request("id").NullOrEmpty())
        {
            string content = GetRootJson();
            Response.Write(content);
            Response.End();
        }
        else if (type == "load")
        {
            string id = PageHelper.Request("id");

            EciRequest request = new EciRequest(MESService.MesBdZyGetLower);
            request["ID"] = id;

            EciResponse response = SOA.Execute(request);
            DataTable   data     = response.DataTable;

            string content = data.ToJson(true);

            Response.Write(content);

            Response.End();
        }
    }
Exemplo n.º 7
0
    public void Save(EciResponse ajax)
    {
        MES_BD_ZY item = new MES_BD_ZY();

        item.GUID         = PageHelper.Request(MES_BD_ZY.Fields.GUID);
        item.GH           = PageHelper.Request(MES_BD_ZY.Fields.GH);
        item.NAME         = PageHelper.Request(MES_BD_ZY.Fields.NAME);
        item.CODE         = PageHelper.Request(MES_BD_ZY.Fields.CODE);
        item.STATUS       = PageHelper.Request(MES_BD_ZY.Fields.STATUS);
        item.TEL          = PageHelper.Request(MES_BD_ZY.Fields.TEL);
        item.ID_CARD      = PageHelper.Request(MES_BD_ZY.Fields.ID_CARD);
        item.KHYH         = PageHelper.Request(MES_BD_ZY.Fields.KHYH);
        item.KHM          = PageHelper.Request(MES_BD_ZY.Fields.KHM);
        item.BANK         = PageHelper.Request(MES_BD_ZY.Fields.BANK);
        item.WHCD         = PageHelper.Request(MES_BD_ZY.Fields.WHCD);
        item.BYXX         = PageHelper.Request(MES_BD_ZY.Fields.BYXX);
        item.BYZY         = PageHelper.Request(MES_BD_ZY.Fields.BYZY);
        item.BYNF         = PageHelper.Request(MES_BD_ZY.Fields.BYNF);
        item.PROVINCE     = PageHelper.Request(MES_BD_ZY.Fields.PROVINCE);
        item.CITY         = PageHelper.Request(MES_BD_ZY.Fields.CITY);
        item.ADDRESS      = PageHelper.Request(MES_BD_ZY.Fields.ADDRESS);
        item.MAIL         = PageHelper.Request(MES_BD_ZY.Fields.MAIL);
        item.REMARK       = PageHelper.Request(MES_BD_ZY.Fields.REMARK);
        item.JS1          = PageHelper.Request(MES_BD_ZY.Fields.JS1);
        item.JS1_RELATION = PageHelper.Request(MES_BD_ZY.Fields.JS1_RELATION);
        item.JS1_TEL      = PageHelper.Request(MES_BD_ZY.Fields.JS1_TEL);
        item.JS1_ADDRESS  = PageHelper.Request(MES_BD_ZY.Fields.JS1_ADDRESS);
        item.JS2          = PageHelper.Request(MES_BD_ZY.Fields.JS2);
        item.JS2_RELATION = PageHelper.Request(MES_BD_ZY.Fields.JS2_RELATION);
        item.JS2_TEL      = PageHelper.Request(MES_BD_ZY.Fields.JS2_TEL);
        item.JS2_ADDRESS  = PageHelper.Request(MES_BD_ZY.Fields.JS2_ADDRESS);
        item.JS3          = PageHelper.Request(MES_BD_ZY.Fields.JS3);
        item.JS3_RELATION = PageHelper.Request(MES_BD_ZY.Fields.JS3_RELATION);
        item.JS3_TEL      = PageHelper.Request(MES_BD_ZY.Fields.JS3_TEL);
        item.JS3_ADDRESS  = PageHelper.Request(MES_BD_ZY.Fields.JS3_ADDRESS);
        item.JS4          = PageHelper.Request(MES_BD_ZY.Fields.JS4);
        item.JS4_RELATION = PageHelper.Request(MES_BD_ZY.Fields.JS4_RELATION);
        item.JS4_TEL      = PageHelper.Request(MES_BD_ZY.Fields.JS4_TEL);
        item.JS4_ADDRESS  = PageHelper.Request(MES_BD_ZY.Fields.JS4_ADDRESS);
        item.CAR_NO       = PageHelper.Request(MES_BD_ZY.Fields.CAR_NO);
        item.CAR_TYPE     = PageHelper.Request(MES_BD_ZY.Fields.CAR_TYPE);
        item.PIC1         = PageHelper.Request(MES_BD_ZY.Fields.PIC1);
        item.PIC1_PATH    = PageHelper.Request(MES_BD_ZY.Fields.PIC1_PATH);

        EciRequest request = new EciRequest(MESService.MesBdZySave);

        request.Entity = item;
        request.IsAdd  = PageHelper.Request("FLAG") == "Add";

        if (request.IsAdd)
        {
            item.PARENTID = PageHelper.Request(MES_BD_ZY.Fields.PARENTID);
            request.Type  = "tree";
        }

        EciResponse response = SOA.Execute(request);

        ajax.Data = response.Data;
    }
Exemplo n.º 8
0
        // NsSearch
        //
        // Executes a query for the SOA from the local or specified DNS server.
        // Executes a query for the NS records from the SOA.
        // Performs the query on each listed Name Server.

        internal void NsSearch(String Name, String Server)
        {
            String Domain = Name;

            Boolean HasSOA  = false;
            Boolean NoError = true;

            do
            {
                Lookup(Domain, RecordType.SOA, Server, false);

                DnsPacket Message = (DnsPacket)ResponseMessages[0];
                if (Message.Header.RCode == RCode.NoError)
                {
                    foreach (ResourceRecord Answer in Message.Answer)
                    {
                        if (Answer.RecordType == RecordType.SOA)
                        {
                            SOA SOARecord = (SOA)Answer;
                            HasSOA = true;
                            Server = SOARecord.TargetName;
                        }
                    }
                    if (!HasSOA)
                    {
                        // Remove a label and retry.
                        if (Domain.Contains("."))
                        {
                            Domain = Domain.Substring(Domain.IndexOf('.') + 1, Domain.Length - Domain.IndexOf('.') - 1);
                        }
                        else
                        {
                            NoError = false;
                        }
                    }
                }
                else
                {
                    NoError = false;
                }
            } while (!HasSOA & NoError);

            // Get the list of name servers from the SOA
            if (HasSOA)
            {
                Lookup(Domain, RecordType.NS, Server, false);

                Object[] NameServers = ((DnsPacket)ResponseMessages[0]).Answer;

                // Get the answer for Name from each Authoritative Server
                foreach (ResourceRecord NameServer in NameServers)
                {
                    Server = NameServer.RecordData;
                    Lookup(Name, RecordType, Server, true);
                }
            }
        }
Exemplo n.º 9
0
    public void LoadRecord(EciResponse ajax)
    {
        string id = PageHelper.Request("id");

        EciRequest request = new EciRequest(MESService.MesBdZyLoad);

        request.Key = id;
        DataTable data = SOA.Execute(request).DataTable;

        ajax.Data = data.ToEntity().Data;
    }
Exemplo n.º 10
0
        internal Byte[] AddAuthority(Byte[] Payload, SOA SOARecord)
        {
            Byte[] SOABytes = SOARecord.ToIxfrByte();

            Byte[] PayloadWithAuth = new Byte[Payload.Length + SOABytes.Length];

            Array.Copy(Payload, PayloadWithAuth, Payload.Length);
            Array.Copy(SOABytes, 0, PayloadWithAuth, Payload.Length, SOABytes.Length);

            return(PayloadWithAuth);
        }
Exemplo n.º 11
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdCpxsDocLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_CPXS_DOC data = response.DataTable.ToEntity <MES_BD_CPXS_DOC>();

        this.Bind(data);
    }
Exemplo n.º 12
0
    protected DataTable GetFileInfoData()
    {
        EciRequest request = new EciRequest(MESService.ImportSearch);

        request["BIZ_TYPE"] = "ZY";
        request["BIZ_NO"]   = Guid;

        EciResponse response = SOA.Execute(request);
        DataTable   dt       = response.DataTable;

        return(dt);
    }
Exemplo n.º 13
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdGdzcFssbLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_GDZC_FSSB data = response.DataTable.ToEntity <MES_BD_GDZC_FSSB>();

        this.Bind(data);
    }
Exemplo n.º 14
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdWlFzUnitLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_WL_FZ_UNIT data = response.DataTable.ToEntity <MES_BD_WL_FZ_UNIT>();

        this.Bind(data);
    }
Exemplo n.º 15
0
    public void Delete(EciResponse ajax)
    {
        string key = PageHelper.Request("id");

        EciRequest request = new EciRequest(MESService.MesBdZyDelete);

        request.ListKey = key.ToList();

        SOA.Execute(request);

        ajax.Message = "删除成功!";
    }
Exemplo n.º 16
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdProvinceLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_PROVINCE data = response.DataTable.ToEntity <MES_BD_PROVINCE>();

        this.Bind(data);
    }
Exemplo n.º 17
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdGysGywlLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_GYS_GYWL data = response.DataTable.ToEntity <MES_BD_GYS_GYWL>();

        this.Bind(data);
    }
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdScxBcGzGzLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_SCX_BC_GZ_GZ data = response.DataTable.ToEntity <MES_BD_SCX_BC_GZ_GZ>();

        this.Bind(data);
    }
Exemplo n.º 19
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdMjlxcsLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_MJLXCS data = response.DataTable.ToEntity <MES_BD_MJLXCS>();

        this.Bind(data);
    }
Exemplo n.º 20
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdSbLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_SB data = response.DataTable.ToEntity <MES_BD_SB>();

        this.Bind(data);
        hidPICPath.Value = data.PIC_PATH;
        hidPIC.Value     = data.PIC;
    }
Exemplo n.º 21
0
    /// <summary>
    /// 导入
    /// </summary>
    /// <param name="datatable"></param>
    protected void DyUpload(DataSet ds)
    {
        MES_BD_ZY saveEntity = new MES_BD_ZY();
        //DataSet hzqdDateSet = new DataSet();
        //hzqdDateSet.Tables.Add(datatable);
        //新增表头数据
        EciRequest request = new EciRequest(MESService.MesBdZyImport);

        request.Entity  = saveEntity;
        request.DataSet = ds;

        EciResponse response = SOA.Execute(request);

        response.Message.Tip();
    }
Exemplo n.º 22
0
    private void LoadHeadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdZyLoad);

        request.Key = this.fguid;

        EciResponse response = SOA.Execute(request);

        MES_BD_ZY data = response.DataTable.ToEntity <MES_BD_ZY>();

        if (!data.IsNull())
        {
            txtName.Text = data.NAME;
        }
    }
Exemplo n.º 23
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdZyStatusLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_ZY_STATUS data = response.DataTable.ToEntity <MES_BD_ZY_STATUS>();

        if (!data.IsNull())
        {
            this.Bind(data);
        }
    }
Exemplo n.º 24
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        Button btn = sender as Button;
        string key = btn.CommandArgument;

        EciRequest request = new EciRequest(MESService.MesBdWlplDelete);

        request.ListKey = new List <string>()
        {
            key
        };

        SOA.Execute(request);

        EAlert.Tip("删除执行成功");

        this.Search();
    }
Exemplo n.º 25
0
    private void LoadRecord()
    {
        EciRequest request = new EciRequest(MESService.MesBdZyLoad);

        request.Key = this.key;

        EciResponse response = SOA.Execute(request);

        MES_BD_ZY data = response.DataTable.ToEntity <MES_BD_ZY>();

        this.Bind(data);
        LoadTab(data);

        hidPic1Path.Value = data.PIC1_PATH;
        hidPic1.Value     = data.PIC1;
        hidPIC2Path.Value = data.PIC2_PATH;
        hidPIC2.Value     = data.PIC2;
    }
Exemplo n.º 26
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        EciRequest request = new EciRequest(MESService.MesBdZySave);

        request.IsAdd = this.key.NullOrEmpty();

        MES_BD_ZY saveEntity = new MES_BD_ZY();

        request.Entity = saveEntity;

        saveEntity.Data = this.GetEntityFromUI().Data;

        saveEntity.GUID = this.key;

        if (txtFileUpload.HasFile)
        {
            btnUpload_Click(sender, e);

            saveEntity.PIC1_PATH = this.hidPic1Path.Value;
            saveEntity.PIC1      = this.hidPic1.Value;
        }
        if (txtFileUpload2.HasFile)
        {
            btnUpload2_Click(sender, e);

            saveEntity.PIC2_PATH = this.hidPIC2Path.Value;
            saveEntity.PIC2      = this.hidPIC2.Value;
        }
        EciResponse response = SOA.Execute(request);

        MES_BD_ZY data = response.Entity.Upgrade <MES_BD_ZY>();

        if (request.IsAdd)
        {
            this.key = data.GUID;

            this.btnAdd.Enabled = true;
            HtmlWindow.Onload("eci.open('frmMesBdZyEditTab.aspx?key=" + this.key + "')");
        }
        response.Message.Tip();
    }
Exemplo n.º 27
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        EciRequest request = new EciRequest(MESService.MesBdSbSave);

        request.IsAdd = this.key.NullOrEmpty();

        MES_BD_SB saveEntity = new MES_BD_SB();

        request.Entity = saveEntity;

        saveEntity.Data = this.GetEntityFromUI().Data;

        saveEntity.GUID = this.key;
        if (txtFileUpload.HasFile)
        {
            btnUpload_Click(sender, e);

            saveEntity.PIC_PATH = this.hidPICPath.Value;
            saveEntity.PIC      = this.hidPIC.Value;
        }
        EciResponse response = SOA.Execute(request);

        MES_BD_SB data = response.Entity.Upgrade <MES_BD_SB>();

        if (request.IsAdd)
        {
            this.key = data.GUID;

            this.btnAdd.Enabled = true;

            //this.txtCreateDate.Text = DateTime.Now.ToFullString();
            //this.txtCreateUser.Text = this.UserInfo.UserName;
        }

        //this.txtUpdateDate.Text = DateTime.Now.ToFullString();
        //this.txtUpdateUser.Text = this.UserInfo.UserName;

        response.Message.Tip();
    }
Exemplo n.º 28
0
        // Incremental Zone Transfer
        //
        // Get the current SOA, modify the serial and send the request.

        internal void IXFRLookup(String Name, UInt32 Serial, String Server)
        {
            this.Tcp = false;
            Lookup(Name, RecordType.SOA, Server, false);

            // Use the server returned by the SOA as a target for the query
            DnsPacket Message = (DnsPacket)ResponseMessages[0];

            SOA SOARecord = new SOA(Name, Serial);

            Header DnsHeader = new Header(false, 1);

            DnsHeader.AuthorityCount = 1;
            Question DnsQuestion = new Question(Name, RecordType.IXFR);

            Byte[] Payload = CreatePayload(DnsHeader, DnsQuestion);

            Payload = AddAuthority(Payload, SOARecord);

            // Clear old responses
            ResponseMessages.Clear();
            this.Tcp = true;
            ExecuteLookup(Payload, RecordType.IXFR, Server, true);
        }
Exemplo n.º 29
0
        private TreeNode[] recurseSOATree(SOA soa)
        {
            string strCPU = null;
            string strWCF = null;
            string strASPNET = null;
            if (soa.ConnectedSOAs == null || soa.ConnectedSOAs.Count == 0)
                return null;
            TreeNode[] returnNodes = new TreeNode[soa.ConnectedSOAs.Count];
            for (int i = 0; i < soa.ConnectedSOAs.Count; i++)
            {
                int imageIndex = 0;
                if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_CIRCULAR_REF_TERMINAL))
                    imageIndex = 3;
                else
                    if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_OFFLINE))
                        imageIndex = 1;
                string rootName = "<span><Font color='#84BDEC'>" + soa.ConnectedSOAs[i].SOAName + "</font></span>";
                TreeNode root = new TreeNode(rootName, imageIndex.ToString(), imageList[imageIndex]);
                root.ToolTip = "Connected Service Domain";
                root.Expand();
                imageIndex = 0;
                int offset = 0;
                string prefix = "";
                string deployment = "";
                string display="";
                if (soa.ConnectedSOAs[i].MyVirtualHost != null)
                {
                    if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count > 0 && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0] != null)
                    {
                        if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
                            offset = 0;
                        else
                        {
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform!=null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("azure"))
                            {
                                offset = 1;
                                prefix = "Azure Platform Cloud Deployed ";
                            }
                            else
                                if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("hyper"))
                                {
                                    offset = 2;
                                    prefix = "On-premise Deployed (Hyper-V) ";
                                }
                                else
                                {
                                    offset = 0;
                                    prefix = "On-premise Deployed ";
                                }
                        }
                    }
                    if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_ONLINE)
                        imageIndex = 4 + offset;
                    else
                        if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
                            imageIndex = 7 + offset;
                        else
                            if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_SOME_NODES_DOWN)
                                imageIndex = 10 + offset;
                    TreeNode myVHost = new TreeNode(prefix + soa.ConnectedSOAs[i].MyVirtualHost.VHostName, imageIndex.ToString(), imageList[imageIndex]);
                    myVHost.Expand();
                    TreeNode[] clusterNodes = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count];
                    
                    for (int h = 0; h < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count; h++)
                    {
                        TreeNode primaryEPs = new TreeNode("", "23", imageList[23]);
                        primaryEPs.ToolTip = "Primary Endpoints are those defined by the business application developer to service business requests via their custom business logic.";
                        primaryEPs.Collapse();
                        TreeNode configEPs = new TreeNode("", "22", imageList[22]);
                        configEPs.ToolTip = "Configuration Service Endpoints are infrastructure endpoints available for the Configuration Service itself, for example an endpoint to which ConfigWeb connects.";
                        configEPs.Collapse();
                     //   TreeNode dcEPs = new TreeNode("", "24", imageList[24]);
                     //   dcEPs.Collapse();
                        TreeNode[] endPointNodesPrimary = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count];
                        TreeNode[] endPointNodesConfig = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints.Count];
                     //   TreeNode[] endPointNodesDC = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints.Count];
                        for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count; j++)
                        {
                            string NAT = "";
                            string NAT2 = "";
                            int endPointImageIndex = 0;
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
                            }
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceType.Equals(1))
                            {
                                NAT = "<span style=\"color:#FFFFFF\"> --> {" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceAddress + "}</span>";
                                NAT2 = "<span style=\"color:#FFFFFF\"> --> {NAT Load-Balanced}</span>";
                            }
                            TreeNode endpointnode = null;
                            if (CheckBoxEndpointDetail.Checked)
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].RemoteAddress + "</span>" + NAT, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            else
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" +soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].ServiceFriendlyName + "</span>" + NAT2, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            endpointnode.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].Exception;
                            endPointNodesPrimary[j] = endpointnode;
                        }
                        for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints.Count; j++)
                        {
                            string NAT = "";
                            string NAT2 = "";
                            int endPointImageIndex = 0;
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
                            }
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].LoadBalanceType.Equals(1))
                            {
                                NAT = "<span style=\"color:#FFFFFF\"> --> {" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].LoadBalanceAddress + "}</span>";
                                NAT2 = "<span style=\"color:#FFFFFF\"> --> {NAT Load-Balanced}</span>";
                            }
                            TreeNode endpointnode = null;
                            if (CheckBoxEndpointDetail.Checked)
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].RemoteAddress + "</span>" +  NAT, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            else
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].ServiceFriendlyName + "</span>" + NAT2, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            endpointnode.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].Exception;
                            endPointNodesConfig[j] = endpointnode;
                        }
                        /*
                        for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints.Count; j++)
                        {
                            int endPointImageIndex = 0;
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
                            }
                            TreeNode endpointnode = null;
                            if (CheckBoxEndpointDetail.Checked)
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">"+ soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].RemoteAddress+ "</span>", endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            else
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" +soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].ServiceFriendlyName + "</span>", endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            endpointnode.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].Exception;
                            endPointNodesDC[j] = endpointnode;
                        }
                        for (int k = 0; k < endPointNodesDC.Length; k++)
                        {
                            dcEPs.ChildNodes.Add(endPointNodesDC[k]);
                        }
                         * */
                        for (int k = 0; k < endPointNodesConfig.Length; k++)
                        {
                            configEPs.ChildNodes.Add(endPointNodesConfig[k]);
                        }
                        for (int k = 0; k < endPointNodesPrimary.Length; k++)
                        {
                            primaryEPs.ChildNodes.Add(endPointNodesPrimary[k]);
                        }
                        int nodeimageIndex = 0;
                        offset = 0;
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform != null)
                        {
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform.ToLower().Contains("azure"))
                            {
                                offset = 1;
                                deployment = "Windows Azure";
                            }
                            else
                                if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform.ToLower().Contains("hyper"))
                                {
                                    offset = 2;
                                    deployment = "On-Premise/Private Cloud (Hyper-V)";
                                }
                                else
                                {
                                    offset = 0;
                                    deployment = "On-Premise/Private Cloud";
                                }
                        }
                        else
                        {
                            offset = 0;
                        }
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { nodeimageIndex = 13 + offset; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { nodeimageIndex = 16 + offset; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { nodeimageIndex = 19 + offset; break; }
                                case ConfigSettings.MESSAGE_SOME_NODES_DOWN: { nodeimageIndex = 50 + offset; break; }
                            }
                        TreeNode node = null;
                        string vhostname = null;
                        string azureRoleInstanceID = "";
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].AzureRoleInstanceID!=null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].AzureRoleInstanceID!="")
                            azureRoleInstanceID = "<span style=\"font-size:.85em;\">&nbsp;&nbsp;&nbsp;{" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].AzureRoleInstanceID + "}</span>";
                        if (CheckBoxEndpointDetail.Checked)
                        {
                            vhostname = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Address + azureRoleInstanceID;
                        }
                        else
                        {
                            vhostname = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].NodeServiceName + azureRoleInstanceID;

                        }
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].CPU != -1f)
                            strCPU = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].CPU).ToString();
                        else
                            strCPU = "*";
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ASPNETReqPerSec != -1f)
                            strASPNET = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ASPNETReqPerSec).ToString();
                        else
                            strASPNET = "*";
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].WCFReqPerSec != -1f)
                            strWCF = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].WCFReqPerSec).ToString();
                        else
                            strWCF = "*";
                        string runtime;
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].OSVersionString == null)
                            runtime = "";
                        else
                            runtime = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform + ": OS v " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].OSVersionString;
                        if (CheckBoxNoDetail.Checked)
                        {
                            display = "<span style=\"padding-left:10px;color:#848483;\">" + vhostname + "</span>";
                        }
                        else
                        {
                            display = "<table align=\"right\" width='1675px' style='color:#848483;border:0px;table-layout:fixed;border-collpase:collapse'>" +
                                                    "<col width=\"775\"/><col width=\"200\"/><col width=\"200\"/><col width=\"200\"/><col width=\"300\"/> <tr>" +
                                                    "<td style=\"width:770;padding-left:10px;\">" + vhostname + "</td>" +
                                                    "<td style=\"width:200;font-size:.9em\">ASP.NET Request/Sec: <span style=\"Color:#6B8EAA;\">" + strASPNET + "</td></span>" +
                                                    "<td style=\"width:200;font-size:.9em\">WCF Requests/Sec: <span style=\"Color:#6B8EAA;\">" + strWCF + "</td></span>" +
                                                    "<td style=\"width:200;font-size:.9em\">Current CPU  : <span style=\"Color:#6B8EAA;\">" + strCPU + "%</span></td>" +
                                                    "<td style=\"width:300;font-size:.9em\">Runtime Platform: " + runtime + "</td></tr></table>";
                        }
                        node = new TreeNode(display, nodeimageIndex.ToString(), imageList[nodeimageIndex]);

                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Exception == "Online" && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData.Count > 0)
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count > 0 || soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].RequestsPerDay > 0)
                            {
                                if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count > 0)
                                    node.ToolTip = "Active Since: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].ActiveSince.ToString() + "\nTotal Primary Business Service Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].TotalRequests.ToString() + "\nPrimary Business Service Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].RequestsPerDay.ToString();
                                else
                                    node.ToolTip = "Active Since: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].ActiveSince.ToString() + "\nTotal Measured Page Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].TotalRequests.ToString() + "\nMeasured Page Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].RequestsPerDay.ToString();
                            }
                            else
                                node.ToolTip = "Active Since: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].ActiveSince.ToString();
                        else
                            node.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Exception;
                        node.Collapse();
                       // node.ChildNodes.Add(dcEPs);
                        node.ChildNodes.Add(configEPs);
                        node.ChildNodes.Add(primaryEPs);
                        clusterNodes[h] = node;
                    }
                    if (soa.ConnectedSOAs[i].MyVirtualHost.AvgCPU != -1f)
                        strCPU = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.AvgCPU).ToString();
                    else
                        strCPU = "*";
                    if (soa.ConnectedSOAs[i].MyVirtualHost.TotalASPNETRecPerSec != -1f)
                        strASPNET = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.TotalASPNETRecPerSec).ToString();
                    else
                        strASPNET = "*";
                    if (soa.ConnectedSOAs[i].MyVirtualHost.TotalWCFRecPerSec != -1f)
                        strWCF = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.TotalWCFRecPerSec).ToString();
                    else
                        strWCF = "*";
                    string display2 = "";
                    if (CheckBoxNoDetail.Checked)
                    {

                        display2 = "<span style=\"color:#FFFFFF;padding-left:10px\">" + soa.ConnectedSOAs[i].MyVirtualHost.VHostName + "  (Node Count=" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count.ToString() + ")</span>";
                    }
                    else
                    {
                          display2 = "<table align=\"right\" width=\"1700px\" style=\"color:#FFFFFF;border:0px;table-layout:fixed;border-collapse:collapse\">" +
                          "<col width=\"800\"/><col width=\"200\"/><col width=\"200\"/><col width=\"200\"/><col width=\"300\"/><tr>" +
                                                  "<td style=\"width:800;padding-left:10px;border:0px\">" + soa.ConnectedSOAs[i].MyVirtualHost.VHostName + "  (Node Count=" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count.ToString() + ")</td>" +
                                                  "<td style=\"width:200;font-size:.9em\">ASP.NET Request/Sec: <span style=\"Color:#6B8EAA;font-weight:bold;\">" + strASPNET + "</span></td>" +
                                                  "<td style=\"width:200;font-size:.9em\">WCF Requests/Sec: <span style=\"Color:#6B8EAA;font-weight:bold;\">" + strWCF + "</td></span>" +
                                                  "<td style=\"width:200;font-size:.9em\">Avg. Node CPU: <span style=\"Color:#6B8EAA;font-weight:bold;\">" + strCPU + "%</td></span>" +
                                                  "<td style=\"width:300;font-size:.9em\">Deployment: " + deployment + "</td></tr></table>";
                    }
                    myVHost.Text = display2;
                    for (int c = 0; c < clusterNodes.Length; c++)
                    {
                        myVHost.ChildNodes.Add(clusterNodes[c]);
                    }
                    TreeNode myDatabases = getMyDatabases(soa.ConnectedSOAs[i]);
                    TreeNode myDistributedCaches = getMyDistributedCaches(soa.ConnectedSOAs[i]);
                    root.ChildNodes.Add(myDatabases);
                    root.ChildNodes.Add(myDistributedCaches);
                    string prefix2 = "Service Domain ";
                    if (deployment.ToLower().Contains("azure"))
                        prefix2 = "Windows Azure Service Domain ";
                    else
                        if (deployment.ToLower().Contains("hyper-v"))
                            prefix2 = "Windows Server Hyper-V Service Domain ";
                    if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count > 0)
                    {
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].PrimaryListenEndpoints.Count > 0 || soa.ConnectedSOAs[i].MyVirtualHost.RequestsPerDay > 0)
                        {
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].PrimaryListenEndpoints.Count>0)
                                myVHost.ToolTip = prefix2 + "\nTotal Primary Business Service Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.TotalRequests.ToString() + "\nPrimary Business Service Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.RequestsPerDay.ToString();
                            else
                                myVHost.ToolTip = prefix2 + "\nTotal Measured Page Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.TotalRequests.ToString() + "\nPrimary Measured Page Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.RequestsPerDay.ToString();
                        }
                        else
                            myVHost.ToolTip = prefix2;
                    }
                    root.ChildNodes.Add(myVHost);
                    if (soa.ConnectedSOAs[i].ConnectedSOAs != null && soa.ConnectedSOAs[i].ConnectedSOAs.Count > 0)
                    {
                        TreeNode[] csnodes = recurseSOATree(soa.ConnectedSOAs[i]);
                        for (int k = 0; k < csnodes.Length; k++)
                        {
                            root.ChildNodes[2].ChildNodes.Add(csnodes[k]);
                        }
                    }

                }
                returnNodes[i] = root;
            }
            return returnNodes;
        }
Exemplo n.º 30
0
        private TreeNode getMyDatabases(SOA mySOA)
        {
            int imageIndex = 0;
            bool rootYellow=false;
            if (mySOA.MyDatabaseServers!=null)
            {
                for (int i = 0; i < mySOA.MyDatabaseServers.Count; i++)
                {
                    if (mySOA.MyDatabaseServers[i].Status != ConfigUtility.DATABASE_ONLINE)
                        rootYellow = true;
                }
            }
            if (rootYellow)
                imageIndex = 54;
            else
                imageIndex = 38;
            TreeNode root = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">Database Servers</span>", imageIndex.ToString(), imageList[imageIndex]);
            if (rootYellow)
                root.ToolTip = "Connected Databases - Some Offline!";
            else
                root.ToolTip = "Connected Databases";
            if (mySOA.MyDatabaseServers == null || mySOA.MyDatabaseServers.Count == 0)
                return root;
            root.Collapse();
            imageIndex = 0;
            int offset = 0;
            TreeNode[] clusterNodes = new TreeNode[mySOA.MyDatabaseServers.Count];
            string prefix = "";
            for (int i = 0; i < mySOA.MyDatabaseServers.Count; i++)
            {
                if (mySOA.MyDatabaseServers[i].Edition == null)
                {
                    mySOA.MyDatabaseServers[i].Edition = "Unknown";
                    mySOA.MyDatabaseServers[i].Version = "Unknown";
                }
                else
                    if (mySOA.MyDatabaseServers[i].Edition.ToLower().Contains("azure"))
                    {
                        offset = 1;
                        prefix = "SQL Azure Cloud RDBMS ";
                    }
                    else
                    {
                        offset = 0;
                        prefix = "On-Premise SQL Server ";
                    }
                if (mySOA.MyDatabaseServers[i].Status.Equals(ConfigUtility.DATABASE_ONLINE))
                    imageIndex = 28 + offset;
                else
                    if (mySOA.MyDatabaseServers[i].Status.Equals(ConfigUtility.DATABASE_OFFLINE))
                        imageIndex = 30 + offset;
                    else
                        imageIndex = 32 + offset;
                TreeNode dbServer;
                if (CheckBoxNoDetail.Checked)
                {
                    dbServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDatabaseServers[i].ServerName + "</span>", imageIndex.ToString(), imageList[imageIndex]);
                }
                else
                {
                    dbServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDatabaseServers[i].ServerName + " : " + mySOA.MyDatabaseServers[i].Edition + " : " + mySOA.MyDatabaseServers[i].Version + "</span>", imageIndex.ToString(), imageList[imageIndex]);
                }
                dbServer.ToolTip = mySOA.MyDatabaseServers[i].Exception;
                dbServer.Collapse();
                TreeNode[] databases = new TreeNode[mySOA.MyDatabaseServers[i].MyDatabases.Count];
                for (int j = 0; j < mySOA.MyDatabaseServers[i].MyDatabases.Count; j++)
                {
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].Edition == null)
                    {
                        mySOA.MyDatabaseServers[i].MyDatabases[j].Edition = "Unknown";
                    }
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].Edition.ToLower().Contains("azure"))
                        offset = 1;
                    else
                        offset = 0;
                    switch (mySOA.MyDatabaseServers[i].MyDatabases[j].Status)
                    {
                        case ConfigUtility.DATABASE_ONLINE: { imageIndex = 34 + offset; break; }
                        case ConfigUtility.DATABASE_OFFLINE: { imageIndex = 36 + offset; break; }
                        default: { imageIndex = 36 + offset; break; }
                    }
                    //the most likely cause of not having data here is that the user does not permissions for stats on SQL Server.  For the detailed query stats, you need the login user to be in an admin role or some sort.
                    //For ConfigWeb, the config administrator needs to be granted these permissions on a per database case; if desired.  If not desired,
                    //you  just will get no additional info.
               
                    databases[j] = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">" + mySOA.MyDatabaseServers[i].MyDatabases[j].DatabaseName +  " : Size=  </span><span style=\"Color:#6B8EAA;\">" + (mySOA.MyDatabaseServers[i].MyDatabases[j].DatabaseSize*1000f).ToString() + " (MB)</span>", imageIndex.ToString(), imageList[imageIndex]);
                    databases[j].ToolTip = mySOA.MyDatabaseServers[i].MyDatabases[j].Exception;
                    TreeNode[] queries = new TreeNode[5];
                    TreeNode latency = new TreeNode("<span style=\"color:#63553D;\">Latency to SQL Database ms: " + mySOA.MyDatabaseServers[i].MyDatabases[j].Latency.ToString() + "</span>", "42", imageList[42]);
                    latency.ToolTip = "The amount of time in ms to execute a simple query and retrieve the single row-result set from the remote SQL database. Note that service-domains co-located with their SQL Azure databases in the same Azure region will typically have lower latency on database calls.";
                    queries[0] = latency;
                    databases[j].ChildNodes.Add(queries[0]);
                    //top slowest first.
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime != null)
                    {
                        TreeNode topSlowSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime.Count.ToString() + " Slowest SQL Statements</span>", "39", imageList[39]);
                        topSlowSQL.ToolTip = "The slowest n queries as returned by SQL Server Dynamic Management View statistics.  Pay attention to the number of times executed, and the last vs. Avg completion time. A database beginning to approach capacity (CPU and/or IO) will show an increasing last-exec time deviation from avg-exec time. You can easily adjust the number of queries shown using ConfigWeb.";
                        TreeNode[] sqlData0;
                        for (int queryslowestcount = 0; queryslowestcount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime.Count; queryslowestcount++)
                        {
                            Queries query0 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime[queryslowestcount];
                            sqlData0 = new TreeNode[5];
                            sqlData0[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode0 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query0.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData0.Length; childcount++)
                            {
                                queryNode0.ChildNodes.Add(sqlData0[childcount]);
                            }
                            queries[1] = queryNode0;
                            topSlowSQL.ChildNodes.Add(queryNode0);
                        }
                        databases[j].ChildNodes.Add(topSlowSQL);
                    }

                    //top worst CPU use next
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime != null)
                    {
                        TreeNode topExpensiveSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime.Count.ToString() + " Most CPU Intense SQL Statements</span>", "39", imageList[39]);
                        topExpensiveSQL.ToolTip = "The SQL queries that consume the most CPU time as returned by SQL Server Dynamic Management View statistics.  Pay attention to the number of times executed--focus on queries executed frequently within the application, as you will also see here one-off admin queries as executed over time. You can easily adjust the number of queries shown using ConfigWeb.";
                        TreeNode[] sqlData1;
                        for (int queryworstexpensivecount = 0; queryworstexpensivecount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime.Count; queryworstexpensivecount++)
                        {
                            Queries query1 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime[queryworstexpensivecount];
                            sqlData1 = new TreeNode[5];
                            sqlData1[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode1 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query1.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData1.Length; childcount++)
                            {
                                queryNode1.ChildNodes.Add(sqlData1[childcount]);
                            }
                            queries[2] = queryNode1;
                            topExpensiveSQL.ChildNodes.Add(queryNode1);
                        }
                        databases[j].ChildNodes.Add(topExpensiveSQL);
                    }

                    //Now the best.  Save for last!
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime != null)
                    {
                        TreeNode topFastestSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime.Count.ToString() + " Fastest SQL Statements</span>", "39", imageList[39]);
                        TreeNode[] sqlData2;
                        topFastestSQL.ToolTip = "The fastest n queries as returned by SQL Server Dynamic Management View statistics. You can easily adjust the number of queries shown using ConfigWeb.";
                        for (int queryfastestcount = 0; queryfastestcount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime.Count; queryfastestcount++)
                        {
                            Queries query2 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime[queryfastestcount];
                            sqlData2 = new TreeNode[5];
                            sqlData2[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode2 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query2.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData2.Length; childcount++)
                            {
                                queryNode2.ChildNodes.Add(sqlData2[childcount]);
                            }
                            queries[3] = queryNode2;
                            topFastestSQL.ChildNodes.Add(queryNode2);
                        }
                        databases[j].ChildNodes.Add(topFastestSQL);
                    }

                    //Now best by CPU use
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime != null)
                    {
                        TreeNode topFreeSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime.Count.ToString() + " Least CPU Intense SQL Statements</span>", "39", imageList[39]);
                        topFreeSQL.ToolTip = "The SQL queries that consume the least CPU time as returned by SQL Server Dynamic Management View statistics. You can easily adjust the number of queries shown using ConfigWeb.";
                        TreeNode[] sqlData3;
                        for (int queryleastexpcount = 0; queryleastexpcount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime.Count; queryleastexpcount++)
                        {
                            Queries query3 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime[queryleastexpcount];
                            sqlData3 = new TreeNode[5];
                            sqlData3[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:ffffff;font-size:.9em\">" + (query3.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode3 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query3.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData3.Length; childcount++)
                            {
                                queryNode3.ChildNodes.Add(sqlData3[childcount]);
                            }
                            queries[4] = queryNode3;
                            topFreeSQL.ChildNodes.Add(queryNode3);
                        }
                        databases[j].ChildNodes.Add(topFreeSQL);
                    }
                }
                for (int nodecount = 0; nodecount < databases.Length; nodecount++)
                {
                    dbServer.ChildNodes.Add(databases[nodecount]);
                }
                clusterNodes[i] = dbServer;
            }
            if (clusterNodes != null && clusterNodes.Length > 0)
            {
                for (int i = 0; i < clusterNodes.Length; i++)
                {
                    root.ChildNodes.Add(clusterNodes[i]);
                }
            }
            return root;
        }
Exemplo n.º 31
0
        protected override void ProcessRecord()
        {
            this.SetOptions();
            this.SetScope(Server);
            this.SetManagementPath(Identity);
            ManagementObject wmiRecord = this.Get();

            WmiRecordClass WmiRecordClassName = (WmiRecordClass)Enum.Parse(typeof(WmiRecordClass), (String)wmiRecord.Properties["__CLASS"].Value);
            String         NewPath            = String.Empty;

            #region Parameter Set validation
            Boolean Terminate = false;
            switch (ParameterSetName)
            {
            case "PS0": break;

            case "PS1":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AAAAType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WKSType)
                {
                    Terminate = true;
                }
                break;

            case "PS2":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_CNAMEType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MBType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MDType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MFType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_NSType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_PTRType)
                {
                    Terminate = true;
                }
                break;

            case "PS3":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MGType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MRType)
                {
                    Terminate = true;
                }
                break;

            case "PS4":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_TXTType)
                {
                    Terminate = true;
                }
                break;

            case "PS5":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_HINFOType)
                {
                    Terminate = true;
                }
                break;

            case "PS6":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_ISDNType)
                {
                    Terminate = true;
                }
                break;

            case "PS7":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MINFOType)
                {
                    Terminate = true;
                }
                break;

            case "PS8":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_NXTType)
                {
                    Terminate = true;
                }
                break;

            case "PS9":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_RPType)
                {
                    Terminate = true;
                }
                break;

            case "PS10":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AFSDBType)
                {
                    Terminate = true;
                }
                break;

            case "PS11":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MXType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_RTType)
                {
                    Terminate = true;
                }
                break;

            case "PS12":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_X25Type)
                {
                    Terminate = true;
                }
                break;

            case "PS13":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_SOAType)
                {
                    Terminate = true;
                }
                break;

            case "PS14":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_SRVType)
                {
                    Terminate = true;
                }
                break;

            case "PS15":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WINSType)
                {
                    Terminate = true;
                }
                break;

            case "PS16":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WINSRType)
                {
                    Terminate = true;
                }
                break;
            }

            if (Terminate)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        new PSInvalidOperationException("InvalidParameterSetForRecordType"),
                        "InvalidOperation",
                        ErrorCategory.InvalidOperation,
                        typeof(ManagementCmdlet)));
            }
            #endregion

            if (ShouldProcess((String)wmiRecord.Properties["TextRepresentation"].Value))
            {
                switch (WmiRecordClassName)
                {
                case WmiRecordClass.MicrosoftDNS_AType:
                    A ARecord = new A(wmiRecord, Server);
                    NewPath = ARecord.Modify(TTL, Address.ToString());
                    break;

                case WmiRecordClass.MicrosoftDNS_AAAAType:
                    AAAA AAAARecord = new AAAA(wmiRecord, Server);
                    NewPath = AAAARecord.Modify(TTL, Address.ToString());
                    break;

                case WmiRecordClass.MicrosoftDNS_AFSDBType:
                    AFSDB AFSDBRecord = new AFSDB(wmiRecord, Server);
                    NewPath = AFSDBRecord.Modify(TTL, SubType, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_CNAMEType:
                    CNAME CNAMERecord = new CNAME(wmiRecord, Server);
                    NewPath = CNAMERecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_HINFOType:
                    HINFO HINFORecord = new HINFO(wmiRecord, Server);
                    NewPath = HINFORecord.Modify(TTL, CPU, OS);
                    break;

                case WmiRecordClass.MicrosoftDNS_ISDNType:
                    ISDN ISDNRecord = new ISDN(wmiRecord, Server);
                    NewPath = ISDNRecord.Modify(TTL, ISDNNumber, SubAddress);
                    break;

                case WmiRecordClass.MicrosoftDNS_MBType:
                    MB MBRecord = new MB(wmiRecord, Server);
                    NewPath = MBRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_MDType:
                    MD MDRecord = new MD(wmiRecord, Server);
                    NewPath = MDRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_MFType:
                    MF MFRecord = new MF(wmiRecord, Server);
                    NewPath = MFRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_MGType:
                    MG MGRecord = new MG(wmiRecord, Server);
                    NewPath = MGRecord.Modify(TTL, MailboxName);
                    break;

                case WmiRecordClass.MicrosoftDNS_MINFOType:
                    MINFO MINFORecord = new MINFO(wmiRecord, Server);
                    NewPath = MINFORecord.Modify(TTL, ResponsibleMailbox, ErrorMailbox);
                    break;

                case WmiRecordClass.MicrosoftDNS_MRType:
                    MR MRRecord = new MR(wmiRecord, Server);
                    NewPath = MRRecord.Modify(TTL, MailboxName);
                    break;

                case WmiRecordClass.MicrosoftDNS_MXType:
                    MX MXRecord = new MX(wmiRecord, Server);
                    NewPath = MXRecord.Modify(TTL, Preference, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_NSType:
                    NS NSRecord = new NS(wmiRecord, Server);
                    NewPath = NSRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_NXTType:
                    NXT NXTRecord = new NXT(wmiRecord, Server);
                    NewPath = NXTRecord.Modify(TTL, NextDomainName, Types);
                    break;

                case WmiRecordClass.MicrosoftDNS_PTRType:
                    PTR PTRRecord = new PTR(wmiRecord, Server);
                    NewPath = PTRRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_RPType:
                    RP RPRecord = new RP(wmiRecord, Server);
                    NewPath = RPRecord.Modify(TTL, ResponsibleMailbox, TXTDomainName);
                    break;

                case WmiRecordClass.MicrosoftDNS_RTType:
                    RT RTRecord = new RT(wmiRecord, Server);
                    NewPath = RTRecord.Modify(TTL, Preference, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_SOAType:
                    SOA SOARecord = new SOA(wmiRecord, Server);
                    NewPath = SOARecord.Modify(TTL, SerialNumber,
                                               SOAServer, ResponsibleMailbox, RefreshInterval,
                                               RetryDelay, ExpireLimit, MinimumTTL);
                    break;

                case WmiRecordClass.MicrosoftDNS_SRVType:
                    SRV SRVRecord = new SRV(wmiRecord, Server);
                    NewPath = SRVRecord.Modify(TTL, Priority, Weight, Port, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_TXTType:
                    TXT TXTRecord = new TXT(wmiRecord, Server);
                    NewPath = TXTRecord.Modify(TTL, Text);
                    break;

                case WmiRecordClass.MicrosoftDNS_WINSType:
                    WINS WINSRecord = new WINS(wmiRecord, Server);
                    NewPath = WINSRecord.Modify(TTL, MappingFlag, LookupTimeout,
                                                CacheTimeout, String.Join(" ", WinsServers));
                    break;

                case WmiRecordClass.MicrosoftDNS_WINSRType:
                    WINSR WINSRRecord = new WINSR(wmiRecord, Server);
                    NewPath = WINSRRecord.Modify(TTL, MappingFlag, LookupTimeout,
                                                 CacheTimeout, ResultDomain);
                    break;

                case WmiRecordClass.MicrosoftDNS_WKSType:
                    WKS WKSRecord = new WKS(wmiRecord, Server);
                    NewPath = WKSRecord.Modify(Address, TTL, IPProtocol, String.Join(" ", Services));
                    break;

                case WmiRecordClass.MicrosoftDNS_X25Type:
                    X25 X25Record = new X25(wmiRecord, Server);
                    NewPath = X25Record.Modify(TTL, PSDNAddress);
                    break;

                default:
                    ThrowTerminatingError(
                        new ErrorRecord(
                            new PSNotSupportedException("Unsupported Record Type"),
                            "RecordModificationNotSupported",
                            ErrorCategory.NotImplemented,
                            typeof(ManagementCmdlet)));
                    break;
                }

                if (PassThru)
                {
                    this.SetManagementPath(NewPath);
                    wmiRecord = this.Get();

                    WriteRecord(wmiRecord);
                }
            }
        }
Exemplo n.º 32
0
 private TreeNode getMyDistributedCaches(SOA mySOA)
 {
     bool rootYellow = false;
     if (mySOA.MyDistributedCaches != null)
     {
         for (int i = 0; i < mySOA.MyDistributedCaches.Count; i++)
         {
             if (mySOA.MyDistributedCaches[i].Status != ConfigUtility.DISTRIBUTED_CACHE_ONLINE)
                 rootYellow = true;
         }
     }
     int imageIndex = 0;
     if (rootYellow)
         imageIndex = 53;
     else
         imageIndex = 49;
     TreeNode root = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">Distributed Caches</span>", imageIndex.ToString(), imageList[imageIndex]);
     if (rootYellow)
         root.ToolTip = "Distributed Caches - Some Offline!";
     else
         root.ToolTip = "Distributed Caches";
     if (mySOA.MyDistributedCaches == null || mySOA.MyDistributedCaches.Count == 0)
         return root;
     root.Collapse();
     imageIndex=0;
     int offset = 0;
     TreeNode[] clusterNodes = new TreeNode[mySOA.MyDistributedCaches.Count];
     string prefix = "";
     for (int i = 0; i < mySOA.MyDistributedCaches.Count; i++)
     {
         if (mySOA.MyDistributedCaches[i].Status == null)
         {
             mySOA.MyDistributedCaches[i].Status = "Unknown";
         }
         else
             if (mySOA.MyDistributedCaches[i].CacheServers!=null && mySOA.MyDistributedCaches[i].CacheServers.Count != 0)
             {
                 if (mySOA.MyDistributedCaches[i].CacheServers[0].ServerName.ToLower().Contains("windows.net"))
                 {
                     offset = 1;
                     prefix = "Windows Azure AppFabric ";
                 }
                 else
                 {
                     offset = 0;
                     prefix = "Windows Server AppFabric ";
                 }
             }
         if (mySOA.MyDistributedCaches[i].Status.Equals(ConfigUtility.DISTRIBUTED_CACHE_ONLINE))
             imageIndex = 43 + offset;
         else
             if (mySOA.MyDistributedCaches[i].Status.Equals(ConfigUtility.DISTRIBUTED_CACHE_OFFLINE))
             {
                 imageIndex = 45 + offset;
             }
             else
             {
                 imageIndex = 47 + offset;
             }
         TreeNode cacheServer;
         if (CheckBoxNoDetail.Checked)
         {
             cacheServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDistributedCaches[i].Name + "</span>", imageIndex.ToString(), imageList[imageIndex]);
         }
         else
         {
             cacheServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDistributedCaches[i].Name + "</span>", imageIndex.ToString(), imageList[imageIndex]);
         }
         cacheServer.ToolTip = mySOA.MyDistributedCaches[i].Exception;
         cacheServer.Collapse();
         TreeNode[] cacheservers = new TreeNode[mySOA.MyDistributedCaches[i].CacheServers.Count];
         TreeNode latencyLocal = new TreeNode("<span style=\"color:#63553D;\">Latency for Client Local Cache Get ms: " + mySOA.MyDistributedCaches[i].LocalCacheLatency.ToString() + "</span>", "42", imageList[42]);
         TreeNode latencyDistributed = new TreeNode("<span style=\"color:#63553D;\">Latency for Client Distributed Cache Get ms: " + mySOA.MyDistributedCaches[i].DistributedCacheLatency.ToString() + "</span>", "42", imageList[42]);
         latencyLocal.ToolTip = "The amount of time in ms to pull from the in-memory local cache a 3K custom object that exists in the local cache, inclusive of deserialization time. Since the test object exists in the local cache, a network request to the distributed cache cluster is not necessary and is not performed by the AppFabric cache client.";
         latencyDistributed.ToolTip = "The amount of time in ms to pull from the distributed cache cluster a 3K custom object. This is inclusive of the remote network call, and deserialization time.  The cache client is gauranteed to make a distributed network call on this request, as the local cache will not contain the test object.";
         if (offset == 1)
             imageIndex = 5;
         else
             imageIndex = 13;
         for (int j = 0; j < mySOA.MyDistributedCaches[i].CacheServers.Count; j++)
         {
             if (mySOA.MyDistributedCaches[i].CacheServers[j].ServerName == null || mySOA.MyDistributedCaches[i].CacheServers[j].ServerName == "")
                 break;
             cacheservers[j] = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">" + mySOA.MyDistributedCaches[i].CacheServers[j].ServerName + ":" + mySOA.MyDistributedCaches[i].CacheServers[j].Port.ToString(), imageIndex.ToString(), imageList[imageIndex]);
             if (imageIndex == 5)
                 cacheservers[j].ToolTip = "Windows Azure AppFabric Cache Namespace: Multiple Servers Service This Cache Behind Azure AppFabric Load Balancer";
             else
                 cacheservers[j].ToolTip = "Windows Server AppFabric Cache Host";
         }
         if (mySOA.MyDistributedCaches[i].Status == ConfigUtility.DISTRIBUTED_CACHE_ONLINE)
         {
             cacheServer.ChildNodes.Add(latencyDistributed);
             cacheServer.ChildNodes.Add(latencyLocal);
         }
         if (cacheservers != null)
         {
             for (int nodecount = 0; nodecount < cacheservers.Length; nodecount++)
             {
                 cacheServer.ChildNodes.Add(cacheservers[nodecount]);
             }
         }
         clusterNodes[i] = cacheServer;
     }
     if (clusterNodes != null && clusterNodes.Length > 0)
     {
         for (int i = 0; i < clusterNodes.Length; i++)
         {
             root.ChildNodes.Add(clusterNodes[i]);
         }
     }
     return root;
 }
Exemplo n.º 33
0
        internal void Inicializar(SOA.Datos.ARP_SOA mensa)
        {
            _fecha.Text = mensa.Fecha.ToString();
            _ArpBS.DataSource = mensa.Asociaciones;

        }
Exemplo n.º 34
0
 private void getData()
 {
     string version = null;
     string platform = null;
     string hoster = null;
     string binding = null;
     Input.getHostData(IsPostBack, ViewState, out userid, out address, out user, out binding, out hostNameIdentifier, out configName, out version, out platform, out hoster, false);
     UTC.Text = "<span style=\"color:silver;font-size:1.1em;padding-left:20px;\">" + DateTime.Now.ToUniversalTime().ToString("f") + " (UTC)";
     try
     {
         configProxy = new ServiceConfigurationClient(binding, address, user);
         mySOA = configProxy.getSOAMap(hostNameIdentifier, configName, null, user);  //this one call gets the entire network deployment across the world, complete with perf stats.
         soaTreeView.Nodes.Clear();
         if (mySOA != null && mySOA.MyVirtualHost != null)
         {
             fillMap(soaTreeView);  //now display it.
         }
     }
     catch (Exception eSoa)
         {
             InValid.Text = "Error Getting SOA Map (try again).  Exception is: <br/>" + eSoa.ToString();
         }
 }
Exemplo n.º 35
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        EciRequest request = new EciRequest(MESService.MesBdWlSave);

        request.IsAdd = this.key.NullOrEmpty();

        MES_BD_WL saveEntity = new MES_BD_WL();

        request.Entity = saveEntity;

        saveEntity.Data = this.GetEntityFromUI().Data;

        saveEntity.GUID = this.key;
        if (txtFileUpload.HasFile)
        {
            btnUpload_Click(sender, e);

            saveEntity.PIC1_PATH = this.hidPIC1Path.Value;
            saveEntity.PIC1      = this.hidPIC1.Value;
        }
        if (txtFileUpload2.HasFile)
        {
            btnUpload2_Click(sender, e);

            saveEntity.PIC2_PATH = this.hidPIC2Path.Value;
            saveEntity.PIC2      = this.hidPIC2.Value;
        }
        if (txtFileUpload3.HasFile)
        {
            btnUpload3_Click(sender, e);

            saveEntity.PIC3_PATH = this.hidPIC3Path.Value;
            saveEntity.PIC3      = this.hidPIC3.Value;
        }
        if (txtFileUpload4.HasFile)
        {
            btnUpload4_Click(sender, e);

            saveEntity.PIC4_PATH = this.hidPIC4Path.Value;
            saveEntity.PIC4      = this.hidPIC4.Value;
        }
        if (txtFileUpload5.HasFile)
        {
            btnUpload5_Click(sender, e);

            saveEntity.PIC5_PATH = this.hidPIC5Path.Value;
            saveEntity.PIC5      = this.hidPIC5.Value;
        }
        if (txtFileUpload6.HasFile)
        {
            btnUpload6_Click(sender, e);

            saveEntity.PIC6_PATH = this.hidPIC6Path.Value;
            saveEntity.PIC6      = this.hidPIC6.Value;
        }
        if (txtFileUpload7.HasFile)
        {
            btnUpload7_Click(sender, e);

            saveEntity.PIC7_PATH = this.hidPIC7Path.Value;
            saveEntity.PIC7      = this.hidPIC7.Value;
        }
        if (txtFileUpload8.HasFile)
        {
            btnUpload8_Click(sender, e);

            saveEntity.PIC8_PATH = this.hidPIC8Path.Value;
            saveEntity.PIC8      = this.hidPIC8.Value;
        }
        if (txtFileUpload9.HasFile)
        {
            btnUpload9_Click(sender, e);

            saveEntity.PIC9_PATH = this.hidPIC9Path.Value;
            saveEntity.PIC9      = this.hidPIC9.Value;
        }
        if (txtFileUpload10.HasFile)
        {
            btnUpload10_Click(sender, e);

            saveEntity.PIC10_PATH = this.hidPIC10Path.Value;
            saveEntity.PIC10      = this.hidPIC10.Value;
        }
        if (txtFileUpload11.HasFile)
        {
            btnUpload11_Click(sender, e);

            saveEntity.FILE1_PATH = this.hidFILE1Path.Value;
            saveEntity.FILE1      = this.hidFILE1.Value;
        }
        EciResponse response = SOA.Execute(request);

        MES_BD_WL data = response.Entity.Upgrade <MES_BD_WL>();

        if (request.IsAdd)
        {
            this.key = data.GUID;

            this.btnAdd.Enabled = true;

            //this.txtCreateDate.Text = DateTime.Now.ToFullString();
            //this.txtCreateUser.Text = this.UserInfo.UserName;
        }

        //this.txtUpdateDate.Text = DateTime.Now.ToFullString();
        //this.txtUpdateUser.Text = this.UserInfo.UserName;

        response.Message.Tip();
    }