Exemplo n.º 1
0
        private void LoadServer(DataRow dr)
        {
            int intRequest = Int32.Parse(dr["requestid"].ToString());
            int intItem    = Int32.Parse(dr["itemid"].ToString());
            int intNumber  = Int32.Parse(dr["number"].ToString());

            string strNameCurrent  = dr["name_current"].ToString();
            string strIPCurrent    = dr["ip_current"].ToString();
            string strAliasCurrent = dr["alias_current"].ToString();
            string strNameNew      = dr["name_new"].ToString();
            string strIPNew        = dr["ip_new"].ToString();
            string strAliasNew     = dr["alias_new"].ToString();
            string strReason       = dr["reason"].ToString();

            txtSearchName.Text  = strNameCurrent;
            txtSearchIP.Text    = strIPCurrent;
            txtSearchAlias.Text = strAliasCurrent;

            if (strReason != "")
            {
                // Show Confirmation Page
                lblName.Text       = strNameCurrent;
                lblIP.Text         = strIPCurrent;
                lblAlias.Text      = strAliasCurrent;
                panConfirm.Visible = true;
                strConfirm         = oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment);
                btnNext.Attributes.Add("onclick", "return ValidateCheck('" + chkAgree.ClientID + "','Please check the box stating that you agree to the disclaimer notice')" +
                                       " && ProcessButton(this)" +
                                       ";");
                btnDiscard.Attributes.Add("onclick", "return confirm('WARNING: Starting over will discard all the changes you have made.\\n\\nAre you sure you want to continue?') && ProcessButton(this);");
                btnContinue.Visible = false;
                btnConfirm.Visible  = false;
            }
            else
            {
                panSearch.Visible = true;
                btnNext.Visible   = false;

                // Get Record from DNS
                System.Net.NetworkCredential oCredentials = new System.Net.NetworkCredential(oVariable.ADUser(), oVariable.ADPassword(), oVariable.Domain());
                ClearViewWebServices         oWebService  = new ClearViewWebServices();
                oWebService.Timeout     = Int32.Parse(ConfigurationManager.AppSettings["WS_TIMEOUT"]);
                oWebService.Credentials = oCredentials;
                oWebService.Url         = oVariable.WebServiceURL();
                Settings oSetting        = new Settings(0, dsn);
                bool     boolDNS_QIP     = oSetting.IsDNS_QIP();
                bool     boolDNS_Bluecat = oSetting.IsDNS_Bluecat();

                // Get Values
                if (strNameCurrent != "")
                {
                    if (boolDNS_QIP == true)
                    {
                        strIPCurrent = oWebService.SearchDNSforPNC("", strNameCurrent, false, true);
                        if (strIPCurrent.StartsWith("***") == false)
                        {
                            strNameCurrent  = oWebService.SearchDNSforPNC(strIPCurrent, "", false, true);
                            strAliasCurrent = oWebService.SearchDNSforPNC(strIPCurrent, "", true, true);
                            if (strAliasCurrent.StartsWith("***") == true)
                            {
                                strAliasCurrent = "";
                            }
                        }
                        else
                        {
                            strNameCurrent = "";
                            strIPCurrent   = "";
                        }
                    }
                    if (boolDNS_Bluecat == true)
                    {
                        strIPCurrent = oWebService.SearchBluecatDNS("", strNameCurrent);
                        if (strIPCurrent.StartsWith("***") == false)
                        {
                            strNameCurrent  = oWebService.SearchBluecatDNS(strIPCurrent, "");
                            strAliasCurrent = "";
                        }
                        else
                        {
                            strNameCurrent = "";
                            strIPCurrent   = "";
                        }
                    }
                }
                else if (strIPCurrent != "")
                {
                    if (boolDNS_QIP == true)
                    {
                        strNameCurrent = oWebService.SearchDNSforPNC(strIPCurrent, "", false, true);
                        if (strNameCurrent.StartsWith("***") == false)
                        {
                            strAliasCurrent = oWebService.SearchDNSforPNC(strIPCurrent, "", true, true);
                            if (strAliasCurrent.StartsWith("***") == true)
                            {
                                strAliasCurrent = "";
                            }
                        }
                        else
                        {
                            strNameCurrent = "";
                            strIPCurrent   = "";
                        }
                    }
                    if (boolDNS_Bluecat == true)
                    {
                        strNameCurrent = oWebService.SearchBluecatDNS(strIPCurrent, "");
                        if (strNameCurrent.StartsWith("***") == false)
                        {
                            strAliasCurrent = "";
                        }
                        else
                        {
                            strNameCurrent = "";
                            strIPCurrent   = "";
                        }
                    }
                }
                else if (strAliasCurrent != "")
                {
                    if (boolDNS_QIP == true)
                    {
                        strIPCurrent = oWebService.SearchDNSforPNC("", strAliasCurrent, true, true);
                        if (strIPCurrent.StartsWith("***") == false)
                        {
                            strNameCurrent  = oWebService.SearchDNSforPNC(strIPCurrent, "", false, true);
                            strAliasCurrent = oWebService.SearchDNSforPNC(strIPCurrent, "", true, true);
                            if (strAliasCurrent.StartsWith("***") == true)
                            {
                                strAliasCurrent = "";
                            }
                        }
                        else
                        {
                            strAliasCurrent = "";
                            strIPCurrent    = "";
                        }
                    }
                    if (boolDNS_Bluecat == true)
                    {
                        strAliasCurrent = "";
                        strIPCurrent    = "";
                    }
                }

                if (strNameCurrent.Contains(".") == true)
                {
                    strDomain      = strNameCurrent.Substring(strNameCurrent.IndexOf("."));
                    strNameCurrent = strNameCurrent.Substring(0, strNameCurrent.IndexOf("."));
                }

                if (strNameCurrent != "" && strIPCurrent != "")
                {
                    DataSet ds = oServer.GetDNS(strNameCurrent);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        bool boolPermit   = false;
                        int  intServer    = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        int  intUser      = (ds.Tables[0].Rows[0]["userid"].ToString() == "" ? 0 : Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString()));
                        int  intOwner     = (ds.Tables[0].Rows[0]["appcontact"].ToString() == "" ? 0 : Int32.Parse(ds.Tables[0].Rows[0]["appcontact"].ToString()));
                        int  intPrimary   = (ds.Tables[0].Rows[0]["admin1"].ToString() == "" ? 0 : Int32.Parse(ds.Tables[0].Rows[0]["admin1"].ToString()));
                        int  intSecondary = (ds.Tables[0].Rows[0]["admin2"].ToString() == "" ? 0 : Int32.Parse(ds.Tables[0].Rows[0]["admin2"].ToString()));
                        int  intRequestor = (ds.Tables[0].Rows[0]["requestor"].ToString() == "" ? 0 : Int32.Parse(ds.Tables[0].Rows[0]["requestor"].ToString()));
                        int  intClass     = (ds.Tables[0].Rows[0]["classid"].ToString() == "" ? 0 : Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()));
                        int  intProd      = (intClass > 0 ? (oClass.IsProd(intClass) ? 1 : 0) : -1);

                        panShow.Visible  = true;
                        panAlias.Visible = boolDNS_QIP;
                        lblName.Text     = strNameCurrent;
                        lblIP.Text       = strIPCurrent;
                        lblAlias.Text    = strAliasCurrent;
                        lblDomain.Text   = strDomain;

                        // Load Values
                        txtName.Text = strNameCurrent;
                        char[]   strIPSplit = { '.' };
                        string[] strIP      = strIPCurrent.Split(strIPSplit);
                        txtIP1.Text = strIP[0];
                        txtIP2.Text = strIP[1];
                        txtIP3.Text = strIP[2];
                        txtIP4.Text = strIP[3];
                        char[]   strAliasSplit = { ';' };
                        string[] strAlias      = strAliasCurrent.Split(strAliasSplit);
                        for (int ii = 0; ii < strAlias.Length; ii++)
                        {
                            if (strAlias[ii].Trim() != "")
                            {
                                string strAliasName = strAlias[ii].Trim();
                                while (strAliasName.Contains(strDomain) == true)
                                {
                                    strAliasName = strAliasName.Replace(strDomain, "");
                                }
                                lstAlias.Items.Add(new ListItem(strAliasName, strAliasName));
                            }
                        }

                        // Check Permission and either show read only, or permit edit
                        if (intProfile == intOwner || intProfile == intPrimary || intProfile == intSecondary || intProfile == intRequestor)
                        {
                            boolPermit = true;
                        }
                        if (oApplication.Get(intApplication, "dns") == "1" || oUser.IsAdmin(intProfile) || intProfile == intUser)
                        {
                            boolPermit = true;
                        }

                        if (boolPermit == true)
                        {
                            btnContinue.Visible    = false;
                            txtSearchName.Enabled  = false;
                            txtSearchIP.Enabled    = false;
                            txtSearchAlias.Enabled = false;
                            chkName.Attributes.Add("onclick", "CheckChange3('" + chkName.ClientID + "','" + chkIP.ClientID + "','" + chkAlias.ClientID + "','" + txtName.ClientID + "');");
                            chkIP.Attributes.Add("onclick", "CheckChange3('" + chkIP.ClientID + "','" + chkName.ClientID + "','" + chkAlias.ClientID + "','" + txtIP1.ClientID + "','" + txtIP2.ClientID + "','" + txtIP3.ClientID + "','" + txtIP4.ClientID + "');");
                            chkAlias.Attributes.Add("onclick", "CheckChange3('" + chkAlias.ClientID + "','" + chkName.ClientID + "','" + chkIP.ClientID + "','" + lstAlias.ClientID + "','" + btnAdd.ClientID + "','" + btnEdit.ClientID + "','" + btnRemove.ClientID + "','" + txtAlias.ClientID + "');");
                            btnAdd.Attributes.Add("onclick", "return AddDNS('" + lstAlias.ClientID + "','" + txtAlias.ClientID + "','" + hdnAlias.ClientID + "');");
                            btnEdit.Attributes.Add("onclick", "return EditDNS('" + lstAlias.ClientID + "','" + txtAlias.ClientID + "','" + hdnAlias.ClientID + "');");
                            btnRemove.Attributes.Add("onclick", "return RemoveDNS('" + lstAlias.ClientID + "','" + hdnAlias.ClientID + "');");
                            string strChange = "";
                            if (intProd != 0 || oServer.Get(intServer, "infrastructure") == "1")
                            {
                                panChange.Visible = true;
                                strChange         = " && ValidateTextLength('" + txtChange.ClientID + "', 'Please enter a valid change control number\\n\\n - Must start with either \"CHG\" or \"PTM\"\\n - Must be exactly 10 characters in length', 10, ['CHG','PTM'], ['CHG0000000','PTM0000000','CHG1111111','PTM1111111','CHG9999999','PTM9999999','CHGXXXXXXX','PTMXXXXXXX'])";
                            }
                            btnConfirm.Attributes.Add("onclick", "return EnsureDNSCheck('" + chkName.ClientID + "','" + chkIP.ClientID + "','" + chkAlias.ClientID + "')" +
                                                      " && (document.getElementById('" + chkName.ClientID + "').checked == false || (document.getElementById('" + chkName.ClientID + "').checked == true" +
                                                      " && ValidateText('" + txtName.ClientID + "','Please enter a valid name')" +
                                                      "))" +
                                                      " && (document.getElementById('" + chkIP.ClientID + "').checked == false || (document.getElementById('" + chkIP.ClientID + "').checked == true" +
                                                      " && ValidateNumberBetween('" + txtIP1.ClientID + "',1,255,'Please enter a valid IP Address')" +
                                                      " && ValidateNumberBetween('" + txtIP2.ClientID + "',1,255,'Please enter a valid IP Address')" +
                                                      " && ValidateNumberBetween('" + txtIP3.ClientID + "',1,255,'Please enter a valid IP Address')" +
                                                      " && ValidateNumberBetween('" + txtIP4.ClientID + "',1,255,'Please enter a valid IP Address')" +
                                                      "))" +
                                                      strChange +
                                                      " && ValidateText('" + txtReason.ClientID + "','Please enter a reason')" +
                                                      " && ProcessButton(this)" +
                                                      ";");
                        }
                        else
                        {
                            btnConfirm.Visible = false;
                            panAccess.Visible  = true;
                            chkName.Enabled    = false;
                            chkIP.Enabled      = false;
                            chkAlias.Enabled   = false;
                            btnAdd.Enabled     = false;
                            btnEdit.Enabled    = false;
                            btnRemove.Enabled  = false;
                            if (intUser > 0)
                            {
                                strContacts += "<tr><td>Device Owner:</td><td>" + oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")" + "</td></tr>";
                            }
                            if (intOwner > 0)
                            {
                                strContacts += "<tr><td>Departmental Manager:</td><td>" + oUser.GetFullName(intOwner) + " (" + oUser.GetName(intOwner) + ")" + "</td></tr>";
                            }
                            if (intPrimary > 0)
                            {
                                strContacts += "<tr><td>Application Technical Lead:</td><td>" + oUser.GetFullName(intPrimary) + " (" + oUser.GetName(intPrimary) + ")" + "</td></tr>";
                            }
                            if (intSecondary > 0)
                            {
                                strContacts += "<tr><td>Administrative Contact:</td><td>" + oUser.GetFullName(intSecondary) + " (" + oUser.GetName(intSecondary) + ")" + "</td></tr>";
                            }
                            if (intRequestor > 0)
                            {
                                strContacts += "<tr><td>Design Initiated By:</td><td>" + oUser.GetFullName(intRequestor) + " (" + oUser.GetName(intRequestor) + ")" + "</td></tr>";
                            }
                            DataSet dsDecoms = oApplication.GetDecoms();
                            if (dsDecoms.Tables[0].Rows.Count > 0)
                            {
                                strContacts += "<tr><td colspan=\"2\">Alternatively, you can contact a resource from one of the following departments:</td></tr>";
                                foreach (DataRow drDecom in dsDecoms.Tables[0].Rows)
                                {
                                    strContacts += "<tr><td></td><td>" + drDecom["name"].ToString() + "</td></tr>";
                                }
                            }
                        }
                    }
                    else
                    {
                        btnReset.Enabled   = false;
                        btnConfirm.Visible = false;
                        panExist.Visible   = true;
                        lblExist.Text      = "This device does not exist in the database. Please try again...";
                    }
                }
                else
                {
                    btnReset.Enabled   = false;
                    btnConfirm.Visible = false;
                    panExist.Visible   = true;
                    lblExist.Text      = "This device does not exist in DNS. Please try again...";
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);
            int             intRequest      = Int32.Parse(Request.QueryString["rid"]);
            string          strStatus       = oServiceRequest.Get(intRequest, "checkout");
            DataSet         dsItems         = oRequestItem.GetForms(intRequest);
            int             intItem         = 0;
            int             intService      = 0;
            int             intNumber       = 0;

            if (dsItems.Tables[0].Rows.Count > 0)
            {
                bool boolBreak = false;
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (boolBreak == true)
                    {
                        break;
                    }
                    if (drItem["done"].ToString() == "0")
                    {
                        intItem    = Int32.Parse(drItem["itemid"].ToString());
                        intService = Int32.Parse(drItem["serviceid"].ToString());
                        intNumber  = Int32.Parse(drItem["number"].ToString());
                        boolBreak  = true;
                    }
                    if (intItem > 0 && (strStatus == "1" || strStatus == "2"))
                    {
                        bool   boolSuccess = true;
                        string strResult   = oService.GetName(intService) + " Completed";
                        string strError    = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************
                        DNS oDNS = new DNS(intProfile, dsn);
                        strResult = "";
                        strError  = "";
                        if (intEnvironment < 3)
                        {
                            intEnvironment = 3;
                        }
                        Variables oVariable = new Variables(intEnvironment);
                        Requests  oRequest  = new Requests(intProfile, dsn);
                        Users     oUser     = new Users(intProfile, dsn);
                        DataSet   ds        = oDNS.GetDNS(intRequest, intItem, intNumber);
                        Domains   oDomain   = new Domains(intProfile, dsn);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string strAction       = ds.Tables[0].Rows[0]["action"].ToString();
                            string strNameCurrent  = ds.Tables[0].Rows[0]["name_current"].ToString();
                            string strIPCurrent    = ds.Tables[0].Rows[0]["ip_current"].ToString();
                            string strAliasCurrent = ds.Tables[0].Rows[0]["alias_current"].ToString();
                            string strNameNew      = ds.Tables[0].Rows[0]["name_new"].ToString();
                            string strIPNew        = ds.Tables[0].Rows[0]["ip_new"].ToString();
                            string strAliasNew     = ds.Tables[0].Rows[0]["alias_new"].ToString();
                            string strDomain       = ds.Tables[0].Rows[0]["domain"].ToString();
                            string strObject       = ds.Tables[0].Rows[0]["value"].ToString();
                            int    intUser         = oRequest.GetUser(intRequest);

                            // Connect to DNS to process the request
                            System.Net.NetworkCredential oCredentials = new System.Net.NetworkCredential(oVariable.ADUser(), oVariable.ADPassword(), oVariable.Domain());
                            ClearViewWebServices         oWebService  = new ClearViewWebServices();
                            oWebService.Timeout     = Int32.Parse(ConfigurationManager.AppSettings["WS_TIMEOUT"]);
                            oWebService.Credentials = oCredentials;
                            oWebService.Url         = oVariable.WebServiceURL();
                            Settings oSetting        = new Settings(0, dsn);
                            bool     boolDNS_QIP     = oSetting.IsDNS_QIP();
                            bool     boolDNS_Bluecat = oSetting.IsDNS_Bluecat();

                            string strWebServiceResult = "";

                            switch (strAction)
                            {
                            case "CREATE":
                                if (strIPNew != "" && strNameNew != "")
                                {
                                    if (boolDNS_QIP == true)
                                    {
                                        strWebServiceResult = oWebService.CreateDNSforPNC(strIPNew, strNameNew, strObject, strAliasNew, oVariable.DNS_Domain(), oVariable.DNS_NameService(), oVariable.DNS_DynamicDNSUpdate(), intProfile, 0, true);
                                        if (strWebServiceResult == "SUCCESS")
                                        {
                                            strResult += "<p>The following record was successfully created in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                        }
                                        else if (strWebServiceResult.StartsWith("***DUPLICATE") == true)
                                        {
                                            strResult += "<p>The following record was already created in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                        }
                                        else if (strWebServiceResult.StartsWith("***CONFLICT") == true)
                                        {
                                            strError += "<p>A CONFLICT occurred when attempting to create the following record in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Conflict Message:</p><p>" + strWebServiceResult + "</p>";
                                        }
                                        else
                                        {
                                            strError += "<p>An ERROR occurred when attempting to create the following record in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Error Message:</p><p>" + strWebServiceResult + "</p>";
                                        }
                                    }
                                    if (boolDNS_Bluecat == true)
                                    {
                                        strWebServiceResult = oWebService.CreateBluecatDNS(strIPNew, strNameNew, strNameNew, "");
                                        if (strWebServiceResult == "SUCCESS")
                                        {
                                            strResult += "<p>The following record was successfully created in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                        }
                                        else if (strWebServiceResult.StartsWith("***DUPLICATE") == true)
                                        {
                                            strResult += "<p>The following record was already created in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                        }
                                        else if (strWebServiceResult.StartsWith("***CONFLICT") == true)
                                        {
                                            strError += "<p>A CONFLICT occurred when attempting to create the following record in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Conflict Message:</p><p>" + strWebServiceResult + "</p>";
                                        }
                                        else
                                        {
                                            strError += "<p>An ERROR occurred when attempting to create the following record in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Error Message:</p><p>" + strWebServiceResult + "</p>";
                                        }
                                    }
                                }
                                else
                                {
                                    strError = "<p>Invalid Parameters...</p>";
                                }

                                break;

                            case "UPDATE":
                                string strIP    = (strIPNew != "" ? strIPNew : strIPCurrent);
                                string strName  = (strNameNew != "" ? strNameNew : strNameCurrent);
                                string strAlias = (((strAliasCurrent != "" && strAliasNew == "") || strAliasNew != "") ? strAliasNew : strAliasCurrent);
                                if (strObject == "")
                                {
                                    strObject = "Server";
                                }
                                if (boolDNS_QIP == true)
                                {
                                    strWebServiceResult = oWebService.UpdateDNSforPNC(strIP, strName, strObject, strAlias, oVariable.DNS_Domain(), oVariable.DNS_NameService(), oVariable.DNS_DynamicDNSUpdate(), intProfile, 0, true);
                                    if (strWebServiceResult == "SUCCESS")
                                    {
                                        strResult += "<p>The following record was successfully updated in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                    }
                                    else if (strWebServiceResult.StartsWith("***DUPLICATE") == true)
                                    {
                                        strResult += "<p>The following record was already updated in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                    }
                                    else if (strWebServiceResult.StartsWith("***CONFLICT") == true)
                                    {
                                        strError += "<p>A CONFLICT occurred when attempting to update the following record in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Conflict Message:</p><p>" + strWebServiceResult + "</p>";
                                    }
                                    else
                                    {
                                        strError += "<p>An ERROR occurred when attempting to update the following record in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Error Message:</p><p>" + strWebServiceResult + "</p>";
                                    }
                                }
                                if (boolDNS_Bluecat == true)
                                {
                                    strWebServiceResult = oWebService.UpdateBluecatDNS(strIP, strName, strNameNew, "");
                                    if (strWebServiceResult == "SUCCESS")
                                    {
                                        strResult += "<p>The following record was successfully updated in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                    }
                                    else if (strWebServiceResult.StartsWith("***DUPLICATE") == true)
                                    {
                                        strResult += "<p>The following record was already updated in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                    }
                                    else if (strWebServiceResult.StartsWith("***CONFLICT") == true)
                                    {
                                        strError += "<p>A CONFLICT occurred when attempting to update the following record in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Conflict Message:</p><p>" + strWebServiceResult + "</p>";
                                    }
                                    else
                                    {
                                        strError += "<p>An ERROR occurred when attempting to update the following record in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Error Message:</p><p>" + strWebServiceResult + "</p>";
                                    }
                                }
                                break;

                            case "DELETE":
                                if (boolDNS_QIP == true)
                                {
                                    if (strIPCurrent != "")
                                    {
                                        strWebServiceResult = oWebService.DeleteDNSforPNC(strIPCurrent, "", intProfile, true);
                                    }
                                    else if (strNameCurrent != "")
                                    {
                                        strWebServiceResult = oWebService.DeleteDNSforPNC("", strNameCurrent, intProfile, true);
                                    }

                                    if (strWebServiceResult == "SUCCESS")
                                    {
                                        strResult += "<p>The following record was successfully deleted in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                    }
                                    else
                                    {
                                        strError += "<p>An ERROR occurred when attempting to delete the following record in QIP DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Error Message:</p><p>" + strWebServiceResult + "</p>";
                                    }
                                }
                                if (boolDNS_Bluecat == true)
                                {
                                    if (strIPCurrent != "")
                                    {
                                        strWebServiceResult = oWebService.DeleteBluecatDNS(strIPCurrent, "", false, false);
                                    }
                                    else if (strNameCurrent != "")
                                    {
                                        strWebServiceResult = oWebService.DeleteBluecatDNS("", strNameCurrent, false, false);
                                    }

                                    if (strWebServiceResult == "SUCCESS")
                                    {
                                        strResult += "<p>The following record was successfully deleted in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p>";
                                    }
                                    else
                                    {
                                        strError += "<p>An ERROR occurred when attempting to delete the following record in BlueCat DNS...</p><p>" + oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment) + "</p><p>Error Message:</p><p>" + strWebServiceResult + "</p>";
                                    }
                                }
                                break;
                            }
                            if (strResult != "")
                            {
                                oRequest.AddResult(intRequest, intItem, intNumber, oService.GetName(intService), "", strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                            }
                            else if (strError != "")
                            {
                                oRequest.AddResult(intRequest, intItem, intNumber, oService.GetName(intService), strError, "", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                            }
                            oDNS.UpdateDNSCompleted(intRequest, intItem, intNumber);
                        }
                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public string GetBody(int _requestid, int _itemid, int _number, int _serviceid, int _rrid, int _rr_workflowid, string _se_dsn, int _environment, string _dsn_asset, string _dsn_ip)
        {
            string              strView              = "";
            Applications        oApplication         = new Applications(user, dsn);
            RequestItems        oRequestItem         = new RequestItems(user, dsn);
            ResourceRequest     oResourceRequest     = new ResourceRequest(user, dsn);
            Users               oUser                = new Users(user, dsn);
            Services            oService             = new Services(user, dsn);
            Variables           oVariable            = new Variables(_environment);
            Functions           oFunction            = new Functions(0, dsn, _environment);
            Requests            oRequest             = new Requests(user, dsn);
            Projects            oProject             = new Projects(user, dsn);
            ServiceRequests     oServiceRequest      = new ServiceRequests(user, dsn);
            ServiceEditor       oServiceEditor       = new ServiceEditor(user, _se_dsn);
            Servers             oServer              = new Servers(user, dsn);
            Workstations        oWorkstation         = new Workstations(user, dsn);
            AssetOrder          oAssetOrder          = new AssetOrder(user, dsn, _dsn_asset, _environment);
            AssetSharedEnvOrder oAssetSharedEnvOrder = new AssetSharedEnvOrder(user, dsn, _dsn_asset, _environment);
            PNCTasks            oPNCTask             = new PNCTasks(user, dsn);
            TSM          oTSM         = new TSM(user, dsn);
            StatusLevels oStatusLevel = new StatusLevels();

            DataSet dsRR = oResourceRequest.GetRequestService(_requestid, _serviceid, _number);

            if (dsRR.Tables[0].Rows.Count > 0)
            {
                if (_rrid == 0)
                {
                    Int32.TryParse(dsRR.Tables[0].Rows[0]["parent"].ToString(), out _rrid);
                }
                if (_rr_workflowid == 0)
                {
                    Int32.TryParse(dsRR.Tables[0].Rows[0]["id"].ToString(), out _rr_workflowid);
                }
            }

            // Workflow
            string strWorkflowName = "";
            int    intProject      = oRequest.GetProjectNumber(_requestid);

            if (intProject > 0)
            {
                strView += "<tr><td valign=\"top\"><b>Project Name:</b></td>";
                strView += "<td colspan=\"40\">" + oProject.Get(intProject, "name") + "</td></tr>";
                strView += "<tr><td valign=\"top\"><b>Project Number:</b></td>";
                strView += "<td>" + "<a href=\"" + oRequest.GetDataPointLink(_requestid, _environment) + "\" target=\"_blank\">" + oProject.Get(intProject, "number") + "</a></td></tr>";
            }
            else
            {
                string strTaskName = "N/A";
                if (_rr_workflowid > 0)
                {
                    strTaskName = oResourceRequest.GetWorkflow(_rr_workflowid, "name").Trim();
                }
                if ((strTaskName == "" || strTaskName == "N/A") && _rrid > 0)
                {
                    strTaskName = oResourceRequest.Get(_rrid, "name").Trim();
                }
                if ((strTaskName == "" || strTaskName == "N/A") && _requestid > 0)
                {
                    strTaskName = oServiceRequest.Get(_requestid, "name").Trim();
                }
                strView += "<tr><td valign=\"top\"><b>Task Name:</b></td>";
                strView += "<td colspan=\"40\">" + strTaskName + "</td></tr>";
            }
            strView += "<tr><td valign=\"top\"><b>Task Number:</b></td>";
            strView += "<td>" + "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(_rrid.ToString()) + "', '800', '600');\">CVT" + _requestid.ToString() + "-" + _serviceid.ToString() + "-" + _number.ToString() + "</a></td></tr>";
            //strWorkflowName += "<td>" + "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('" + oRequest.GetDataPointLink(_requestid, _environment) + "', '800', '600');\">CVT" + _requestid.ToString() + "</a></td>";

            string strWorkflowRequested  = "";
            string strWorkflowCreated    = "";
            string strWorkflowService    = "";
            string strWorkflowDepartment = "";
            string strWorkflowResources  = "";
            string strWorkflowStatus     = "";
            string strWorkflowComments   = "";
            int    intStatus             = 0;

            // Requested
            strWorkflowRequested += "<td valign=\"top\"><b>Requested By:</b></td>";
            int intRequestor        = oRequest.GetUser(_requestid);
            int intRequestorManager = 0;

            Int32.TryParse(oUser.Get(intRequestor, "manager"), out intRequestorManager);
            Int32.TryParse(oResourceRequest.Get(_rrid, "status"), out intStatus);
            strWorkflowRequested += "<td>" + oUser.GetFullName(intRequestor) + " (" + oUser.GetName(intRequestor) + ")" + "</td>";
            strWorkflowCreated   += "<td valign=\"top\"><b>Created On:</b></td>";
            if (_rrid > 0)
            {
                strWorkflowCreated += "<td>" + DateTime.Parse(oResourceRequest.Get(_rrid, "created")).ToLongDateString() + "</td>";
            }
            else
            {
                strWorkflowCreated += "<td>" + DateTime.Parse(oRequest.Get(_requestid, "created")).ToLongDateString() + "</td>";
            }
            // Service
            strWorkflowService += "<td valign=\"top\"><b>Service:</b></td>";
            if (_serviceid == 0)
            {
                strWorkflowService += "<td>" + oRequestItem.GetItem(_itemid, "service_title") + "</td>";
            }
            else
            {
                strWorkflowService += "<td>" + oService.GetName(_serviceid) + "</td>";
            }
            // Department
            strWorkflowDepartment += "<td valign=\"top\"><b>Department:</b></td>";
            strWorkflowDepartment += "<td>" + oApplication.Get(oRequestItem.GetItemApplication(_itemid), "service_title") + "</td>";
            // Resources
            string  strApprovers = "";
            DataSet dsApprovals  = oResourceRequest.GetApprovals(_requestid, _serviceid, _number);

            foreach (DataRow drApprover in dsApprovals.Tables[0].Rows)
            {
                int intApprover = Int32.Parse(drApprover["userid"].ToString());
                if (drApprover["approved"].ToString() == "" && drApprover["denied"].ToString() == "")
                {
                    if (strApprovers != "")
                    {
                        strApprovers += "\\n";
                    }
                    strApprovers += oUser.GetFullName(intApprover) + " (" + oUser.GetName(intApprover) + ")";
                }
            }
            bool boolAutomated = (oService.Get(_serviceid, "automate") == "1");

            if (boolAutomated == false)
            {
                DataSet dsReqForm = oRequestItem.GetForm(_requestid, _serviceid, _itemid, _number);
                if (dsReqForm.Tables[0].Rows.Count > 0)
                {
                    boolAutomated = (dsReqForm.Tables[0].Rows[0]["automated"].ToString() == "1" ? true : false);
                }
            }
            strWorkflowResources += "<td valign=\"top\"><b>Assigned:</b></td>";
            strWorkflowStatus    += "<td><b>Status:</b></td>";
            if (boolAutomated == true)
            {
                strWorkflowResources += "<td valign=\"top\">---</td>";
                intStatus             = (int)ResourceRequestStatus.NotAvailable; // Set to N/A since it is automated...
                strWorkflowStatus    += "<td>" + oStatusLevel.HTML(intStatus) + "</td>";
            }
            else
            {
                List <WorkflowStatus> RR = oResourceRequest.GetStatus(null, _rrid, null, null, null, null, false, _se_dsn);
                if (RR.Count > 0)
                {
                    StringBuilder strUsers = new StringBuilder();
                    foreach (string strUser in RR[0].users)
                    {
                        if (String.IsNullOrEmpty(strUser) == false)
                        {
                            strUsers.Append(strUser);
                            strUsers.AppendLine("<br/>");
                        }
                    }
                    strWorkflowResources += "<td valign=\"top\">" + strUsers.ToString() + "</td>";
                    strWorkflowStatus    += "<td>" + RR[0].status + "</td>";
                    if (String.IsNullOrEmpty(RR[0].comments) == false)
                    {
                        strWorkflowComments += "<td valign=\"top\"><b>Comments:</b></td>";
                        strWorkflowComments += "<td valign=\"top\">" + oFunction.FormatText(RR[0].comments) + "</td>";
                    }
                }
                else
                {
                    strWorkflowResources += "<td valign=\"top\"> N / A </td>";
                    strWorkflowStatus    += "<td> N / A </td>";
                }
            }
            strView += "<tr>" + strWorkflowRequested + "</tr><tr>" + strWorkflowCreated + "</tr><tr>" + strWorkflowService + "</tr><tr>" + strWorkflowDepartment + "</tr>" + "<tr>" + strWorkflowStatus + "</tr>" + (strWorkflowResources == "" ? "" : "<tr>" + strWorkflowResources + "</tr>") + (strWorkflowComments == "" ? "" : "<tr>" + strWorkflowComments + "</tr>");

            if (strView == "")
            {
                strView = "Information Unavailable";
            }
            else
            {
                strView = "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strView + "</table>";
                StringBuilder      sbViewRequest       = new StringBuilder();
                Customized         oCustomized         = new Customized(user, dsn);
                DNS                oDNS                = new DNS(user, dsn);
                OnDemandTasks      oOnDemandTask       = new OnDemandTasks(user, dsn);
                Reports            oReport             = new Reports(user, dsn);
                Audit              oAudit              = new Audit(user, dsn);
                Enhancements       oEnhancement        = new Enhancements(user, dsn);
                ServerDecommission oServerDecommission = new ServerDecommission(0, dsn);
                Storage            oStorage            = new Storage(0, dsn);

                string strCatch = "1";
                try
                {
                    sbViewRequest.Append(oServiceEditor.GetRequestBody(_requestid, _serviceid, _number, dsn));
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "2";
                        sbViewRequest.Append(oCustomized.GetPNCDNSConflictBody(_requestid, _itemid, _number));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "3";
                        sbViewRequest.Append(oCustomized.GetStorage3rdBody(_requestid, _itemid, _number, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "4";
                        sbViewRequest.Append(oOnDemandTask.GetServerOther(_requestid, _serviceid, _number, _environment, _dsn_asset, _dsn_ip));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "5";
                        sbViewRequest.Append(GetBody(oReport.GetOrderReport(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "6";
                        sbViewRequest.Append(oServerDecommission.GetBody(_requestid, _number, _dsn_asset, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "7";
                        sbViewRequest.Append(oCustomized.GetDecommissionServerBody(_requestid, _itemid, _number, _dsn_asset));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "7.1";
                        sbViewRequest.Append(oWorkstation.GetApprovalSummary(_requestid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "8";
                        int intEnhancementID = oCustomized.GetEnhancementID(_requestid);
                        if (intEnhancementID > 0)
                        {
                            sbViewRequest.Append("<tr><td>");
                            sbViewRequest.Append(oCustomized.GetEnhancementBody(intEnhancementID, _environment, false));
                            sbViewRequest.Append("</td></tr>");
                        }
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "9";
                        int intIssueID = oCustomized.GetIssueID(_requestid);
                        if (intIssueID > 0)
                        {
                            sbViewRequest.Append("<tr><td>");
                            sbViewRequest.Append(oCustomized.GetIssueBody(intIssueID, _environment, false));
                            sbViewRequest.Append("</td></tr>");
                        }
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "10";
                        sbViewRequest.Append(GetBody(oCustomized.GetIIS(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "11";
                        sbViewRequest.Append(GetBody(oCustomized.GetRemediation(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "12";
                        sbViewRequest.Append(GetBody(oCustomized.GetServerArchive(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "13";
                        sbViewRequest.Append(GetBody(oCustomized.GetServerRetrieve(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "14";
                        sbViewRequest.Append(GetBody(oCustomized.GetTPM(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "15";
                        sbViewRequest.Append(GetBody(oCustomized.GetWorkstation(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "16";
                        sbViewRequest.Append(GetBody(oCustomized.GetThirdTierDistributed(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "17";
                        sbViewRequest.Append(GetBody(oCustomized.GetGeneric(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "18";
                        sbViewRequest.Append(oDNS.GetDNSBody(_requestid, _itemid, _number, false, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "19";
                        sbViewRequest.Append(oAudit.GetErrorBody(_requestid, _serviceid, _number));
                    }

                    if (sbViewRequest.ToString() == "")//Server Error Provisioning Support
                    {
                        strCatch = "20";
                        sbViewRequest.Append(oServer.GetErrorDetailsBody(_requestid, _itemid, _number, _environment));
                    }

                    if (sbViewRequest.ToString() == "") //Workstation Error Provisioning Support
                    {
                        strCatch = "21";
                        sbViewRequest.Append(oWorkstation.GetVirtualErrorDetailsBody(_requestid, _number, _environment));
                    }

                    if (sbViewRequest.ToString() == "") //Asset Procurement
                    {
                        strCatch = "22";
                        sbViewRequest.Append(oAssetOrder.GetOrderBody(_requestid, _itemid, _number));
                    }

                    if (sbViewRequest.ToString() == "") //Shared Environement - IM
                    {
                        strCatch = "23";
                        sbViewRequest.Append(oAssetSharedEnvOrder.GetOrderBody(_requestid, _itemid, _number));
                    }

                    if (sbViewRequest.ToString() == "") //Backup
                    {
                        strCatch = "24";
                        sbViewRequest.Append(oTSM.GetBody(_requestid, _itemid, _number, _dsn_asset, _dsn_ip));
                    }

                    if (sbViewRequest.ToString() == "") // New Enhancement
                    {
                        strCatch = "25";
                        sbViewRequest.Append(oEnhancement.GetBodyRequest(_requestid, _environment));
                    }

                    if (sbViewRequest.ToString() == "") // New Enhancement
                    {
                        strCatch = "26";
                        sbViewRequest.Append(oStorage.GetBody(_requestid, _itemid, _number, _dsn_asset, _dsn_ip, _environment, false));
                    }


                    if (sbViewRequest.ToString() == "")
                    {
                        //strViewRequest = "Information Unavailable";
                        sbViewRequest.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                    }
                    else
                    {
                        if (sbViewRequest.ToString().Trim().StartsWith("<table") == false)
                        {
                            sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">");
                            sbViewRequest.Append("</table>");
                        }
                    }
                }
                catch
                {
                    sbViewRequest = new StringBuilder("&nbsp;&nbsp;** WARNING: Information Unavailable (# " + strCatch + ") **&nbsp;&nbsp;");
                }
                sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\"><tr><td>");
                sbViewRequest.Append("</td></tr></table>");
                strView += "<br/>" + sbViewRequest.ToString();
            }
            return(strView);
        }
Exemplo n.º 4
0
        private void LoadServer(DataRow dr)
        {
            int intRequest = Int32.Parse(dr["requestid"].ToString());
            int intItem    = Int32.Parse(dr["itemid"].ToString());
            int intNumber  = Int32.Parse(dr["number"].ToString());

            string strNameNew  = dr["name_new"].ToString();
            string strIPNew    = dr["ip_new"].ToString();
            string strAliasNew = dr["alias_new"].ToString();

            ddlType.SelectedValue = dr["typeid"].ToString();
            txtName.Text          = strNameNew;
            char[]   strIPSplit = { '.' };
            string[] strIP      = strIPNew.Split(strIPSplit);
            txtIP1.Text = strIP[0];
            txtIP2.Text = strIP[1];
            txtIP3.Text = strIP[2];
            txtIP4.Text = strIP[3];

            if (strAliasNew != "NONE")
            {
                // Show Confirmation Page
                lblName.Text       = strNameNew;
                lblIP.Text         = strIPNew;
                lblAlias.Text      = strAliasNew;
                panConfirm.Visible = true;
                strConfirm         = oDNS.GetDNSBody(intRequest, intItem, intNumber, true, intEnvironment);
                btnNext.Attributes.Add("onclick", "return ValidateCheck('" + chkAgree.ClientID + "','Please check the box stating that you agree to the disclaimer notice')" +
                                       " && ProcessButton(this)" +
                                       ";");
                btnDiscard.Attributes.Add("onclick", "return confirm('WARNING: Starting over will discard all the changes you have made.\\n\\nAre you sure you want to continue?') && ProcessButton(this);");
                btnContinue.Visible = false;
                btnConfirm.Visible  = false;
            }
            else
            {
                panSearch.Visible = true;
                btnNext.Visible   = false;

                // Get Record from DNS
                System.Net.NetworkCredential oCredentials = new System.Net.NetworkCredential(oVariable.ADUser(), oVariable.ADPassword(), oVariable.Domain());
                ClearViewWebServices         oWebService  = new ClearViewWebServices();
                oWebService.Timeout     = Int32.Parse(ConfigurationManager.AppSettings["WS_TIMEOUT"]);
                oWebService.Credentials = oCredentials;
                oWebService.Url         = oVariable.WebServiceURL();
                bool boolFoundName = false;
                bool boolFoundIP   = false;
                // Get Values
                if (strNameNew != "")
                {
                    string strTemp = "";
                    if (boolDNS_QIP == true)
                    {
                        strTemp = oWebService.SearchDNSforPNC("", strNameNew, false, true);
                        if (strTemp.StartsWith("***") == false)
                        {
                            boolFoundName = true;
                        }
                    }
                    if (boolDNS_Bluecat == true)
                    {
                        strTemp = oWebService.SearchBluecatDNS("", strNameNew);
                        if (strTemp.StartsWith("***") == false)
                        {
                            boolFoundName = true;
                        }
                    }
                }
                if (strIPNew != "")
                {
                    string strTemp = "";
                    if (boolDNS_QIP == true)
                    {
                        strTemp = oWebService.SearchDNSforPNC(strIPNew, "", false, true);
                        if (strTemp.StartsWith("***") == false)
                        {
                            boolFoundIP = true;
                        }
                    }
                    if (boolDNS_Bluecat == true)
                    {
                        strTemp = oWebService.SearchBluecatDNS(strIPNew, "");
                        if (strTemp.StartsWith("***") == false)
                        {
                            boolFoundIP = true;
                        }
                    }
                }

                //DataSet ds = oServer.GetDNS(strNameNew);
                //if (ds.Tables[0].Rows.Count == 0)
                if (boolFoundName == false && boolFoundIP == false)
                {
                    //if (boolFound == true)
                    //{
                    //    btnReset.Enabled = false;
                    //    btnConfirm.Visible = false;
                    //    panExist.Visible = true;
                    //    lblExist.Text = "This device already exists in DNS. Please try again...";
                    //}
                    //else
                    //{
                    bool boolPermit = true;
                    panAlias.Visible = boolDNS_QIP;
                    panShow.Visible  = true;
                    lblName.Text     = strNameNew;
                    lblIP.Text       = strIPNew;
                    lblAlias.Text    = strAliasNew;

                    // Check Permission and either show read only, or permit edit
                    if (oApplication.Get(intApplication, "dns") == "1" || oUser.IsAdmin(intProfile))
                    {
                        boolPermit = true;
                    }

                    if (boolPermit == true)
                    {
                        btnContinue.Visible = false;
                        ddlType.Enabled     = false;
                        txtName.Enabled     = false;
                        txtIP1.Enabled      = false;
                        txtIP2.Enabled      = false;
                        txtIP3.Enabled      = false;
                        txtIP4.Enabled      = false;
                        txtAlias.Enabled    = true;
                        lstAlias.Enabled    = true;
                        txtContact1.Enabled = true;
                        txtContact2.Enabled = true;
                        btnAdd.Attributes.Add("onclick", "return AddDNS('" + lstAlias.ClientID + "','" + txtAlias.ClientID + "','" + hdnAlias.ClientID + "');");
                        btnEdit.Attributes.Add("onclick", "return EditDNS('" + lstAlias.ClientID + "','" + txtAlias.ClientID + "','" + hdnAlias.ClientID + "');");
                        btnRemove.Attributes.Add("onclick", "return RemoveDNS('" + lstAlias.ClientID + "','" + hdnAlias.ClientID + "');");
                        string strChange = "";
                        if (boolChange == true)
                        {
                            panChange.Visible = true;
                            strChange         = " && ValidateTextLength('" + txtChange.ClientID + "', 'Please enter a valid change control number\\n\\n - Must start with either \"CHG\" or \"PTM\"\\n - Must be exactly 10 characters in length', 10, ['CHG','PTM'], ['CHG0000000','PTM0000000','CHG1111111','PTM1111111','CHG9999999','PTM9999999','CHGXXXXXXX','PTMXXXXXXX'])";
                        }
                        btnConfirm.Attributes.Add("onclick", "return ValidateHidden0('" + hdnContact1.ClientID + "','" + txtContact1.ClientID + "','Please enter the LAN ID of your contact # 1')" +
                                                  " && ValidateHidden0('" + hdnContact2.ClientID + "','" + txtContact2.ClientID + "','Please enter the LAN ID of your contact # 2')" +
                                                  strChange +
                                                  " && ValidateText('" + txtReason.ClientID + "','Please enter a reason')" +
                                                  " && ProcessButton(this)" +
                                                  ";");
                    }
                    else
                    {
                        btnConfirm.Visible = false;
                        panAccess.Visible  = true;
                        btnAdd.Enabled     = false;
                        btnEdit.Enabled    = false;
                        btnRemove.Enabled  = false;
                        DataSet dsDecoms = oApplication.GetDecoms();
                        if (dsDecoms.Tables[0].Rows.Count > 0)
                        {
                            strContacts += "<tr><td colspan=\"2\">Alternatively, you can contact a resource from one of the following departments:</td></tr>";
                            foreach (DataRow drDecom in dsDecoms.Tables[0].Rows)
                            {
                                strContacts += "<tr><td></td><td>" + drDecom["name"].ToString() + "</td></tr>";
                            }
                        }
                    }
                    //}
                }
                else
                {
                    btnReset.Enabled   = false;
                    btnConfirm.Visible = false;
                    panExist.Visible   = true;
                    lblExist.Text      = "The " + (boolFoundName ? "device name" : "IP address") + " is already registered in DNS. Please try again...";
                    //lblExist.Text = "This device already exists in the database. Please try again...";
                }
            }
        }