コード例 #1
0
        public void AD_Mismatched_Accounts()
        {
            Requests        oRequest        = new Requests(0, dsn);
            Projects        oProject        = new Projects(0, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(0, dsn);
            int             intRequest      = 28815;

            if (oServiceRequest.Get(intRequest).Tables[0].Rows.Count == 0)
            {
                oServiceRequest.Add(intRequest, 1, 1);
            }
            double dblHours = 0.00;

            if (intEnvironment == 4)
            {
                dblHours += CompareDomainAccounts(2, 4, "X", 0, intRequest);
                dblHours += CompareDomainAccounts(3, 4, "X", 0, intRequest);
            }
            else
            {
                dblHours += CompareDomainAccounts(2, 3, "T", 0, intRequest);
            }
            double dblTime    = 5.00 / 60.00;
            double dblDevices = dblHours / dblTime;

            dblDevices = Math.Round(dblDevices);
            int intDevices  = Int32.Parse(dblDevices.ToString());
            int intResource = oServiceRequest.AddRequest(intRequest, intRemediationItem, 0, intDevices, dblHours, 2, 1, dsnServiceEditor);

            oServiceRequest.NotifyTeamLead(intRemediationItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile      = Int32.Parse(Request.Cookies["profileid"].Value);
            oAsset          = new Asset(intProfile, dsnAsset);
            oForecast       = new Forecast(intProfile, dsn);
            oWorkstation    = new Workstations(intProfile, dsn);
            oServiceRequest = new ServiceRequests(intProfile, dsn);
            oOnDemandTasks  = new OnDemandTasks(intProfile, dsn);

            //Menu
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);

            //End Menu



            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            int intForecast = 0;

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID       = Int32.Parse(Request.QueryString["id"]);
                intForecast = Int32.Parse(oForecast.GetAnswer(intID, "forecastid"));
                intRequest  = oForecast.GetRequestID(intID, true);
                DataSet dsRequest = oServiceRequest.Get(intRequest);
                if (dsRequest.Tables[0].Rows.Count > 0)
                {
                    Response.Redirect(Request.Path + "?rid=" + intRequest);
                }
            }
            if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
            }
            if (Request.QueryString["notify"] != null)
            {
                string strRedirect = Request.Url.PathAndQuery;
                strRedirect = strRedirect.Substring(0, strRedirect.IndexOf("&notify"));
                if (Request.QueryString["notify"] == "true")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has been successfully notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "false")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has ALREADY been notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('There was a problem notifying your design implementor\\n\\nPlease contact your ClearView administrator\\n\\nRequestID: " + intRequest.ToString() + "');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
            }
            if (intID > 0)
            {
                panBegin.Visible = true;
                bool boolAssigned = false;
                if (oForecast.CanAutoProvision(intID) == true)
                {
                    boolAssigned = true;
                }
                else if (oOnDemandTasks.GetPending(intID).Tables[0].Rows.Count > 0)
                {
                    boolAssigned = true;
                }

                if (intForecast == 0)
                {
                    btnStart.Attributes.Add("onclick", "return ProcessButton(this);");
                }
                else if (boolAssigned == false)
                {
                    btnStart.Attributes.Add("onclick", "alert('You cannot execute a design until a design implementor has been assigned.');return false;");
                }
                else
                {
                    lblNotify.Visible = true;
                    //btnStart.Attributes.Add("onclick", "return confirm('NOTE: Billing will begin: " + DateTime.Today.ToShortDateString() + "\\n\\nAre you sure you want to continue?') && OpenWindow('AUTO_PROVISIONING','?answerid=" + intID.ToString() + "&modelid=" + oForecast.GetModel(intID).ToString() + "');");
                    btnStart.Attributes.Add("onclick", "return confirm('NOTE: Billing will begin: " + DateTime.Today.ToShortDateString() + "\\n\\nAre you sure you want to continue?');");
                }
            }
            else if (intRequest > 0)
            {
                intRequest       = Int32.Parse(Request.QueryString["rid"]);
                panStart.Visible = true;
                DataSet   ds        = oWorkstation.GetVirtualRequests(intRequest);
                int       intCount  = 0;
                Functions oFunction = new Functions(intProfile, dsn, intEnvironment);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    intCount++;
                    int    intDevice = Int32.Parse(dr["id"].ToString());
                    int    intAsset  = Int32.Parse(dr["assetid"].ToString());
                    string strName   = "Device " + intCount.ToString();
                    if (intAsset > 0)
                    {
                        string strTempName = oAsset.Get(intAsset, "name");
                        if (strTempName != "")
                        {
                            strName = strTempName;
                        }
                    }
                    if (intCount == 1)
                    {
                        //strTab += "<td><img src=\"/images/TabOnLeftCap.gif\"></td><td nowrap background=\"/images/TabOnBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOnRightCap.gif\"></td>";
                        oTab.AddTab(strName, "");
                        strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:inline\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"/ondemand/ondemand_workstation_virtual.aspx?id=" + oFunction.encryptQueryString(intDevice.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                    }
                    else
                    {
                        // strTab += "<td><img src=\"/images/TabOffLeftCap.gif\"></td><td nowrap background=\"/images/TabOffBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOffRightCap.gif\"></td>";
                        oTab.AddTab(strName, "");
                        strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:none\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"/ondemand/ondemand_workstation_virtual.aspx?id=" + oFunction.encryptQueryString(intDevice.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                    }
                }
                //if (strTab != "")
                //    strMenuTab1 += "<tr>" + strTab + "<td width=\"100%\" background=\"/images/TabEmptyBackground.gif\">&nbsp;</td></tr>";
                //strMenuTab1 = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" + strMenuTab1 + "</table>";
                strMenuTab1 = oTab.GetTabs();
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oVariable        = new Variables(intEnvironment);
            oProject         = new Projects(intProfile, dsn);
            oPlatform        = new Platforms(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }

            if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
            {
                panFinish.Visible = true;
            }
            else
            {
                if (!IsPostBack)
                {
                    if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
                    {
                        // PLATFORM
                        int intResource = Int32.Parse(Request.QueryString["rrid"]);
                        lblRequest.Text = Request.QueryString["rrid"];
                        if (intResource > 0)
                        {
                            DataSet dsResource = oResourceRequest.Get(intResource);
                            if (dsResource.Tables[0].Rows.Count > 0)
                            {
                                int intRequest = Int32.Parse(dsResource.Tables[0].Rows[0]["requestid"].ToString());
                                int intService = Int32.Parse(dsResource.Tables[0].Rows[0]["serviceid"].ToString());
                                int intNumber  = Int32.Parse(dsResource.Tables[0].Rows[0]["number"].ToString());
                                if (oRequest.Allowed(intRequest, intService, intNumber, intProfile, true))
                                {
                                    panRequest.Visible = true;
                                    int intProject = oRequest.GetProjectNumber(intRequest);
                                    int intItem    = Int32.Parse(dsResource.Tables[0].Rows[0]["itemid"].ToString());
                                    int intApp     = oRequestItem.GetItemApplication(intItem);
                                    lblView.Text = oRequestField.GetBodyOverall(intResource, 0, dsnServiceEditor, intEnvironment, dsnAsset, dsnIP);
                                    //LoadProject(intProject, intRequest);
                                }
                                else
                                {
                                    panDenied.Visible = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else if (Request.QueryString["srid"] != null && Request.QueryString["srid"] != "")
                    {
                        // SERVICE
                        int intServiceSelectedID = Int32.Parse(Request.QueryString["srid"]);
                        if (intServiceSelectedID > 0)
                        {
                            DataSet dsServiceSelected = oService.GetSelectedById(intServiceSelectedID);
                            if (dsServiceSelected.Tables[0].Rows.Count > 0)
                            {
                                DataRow drServiceSelected = dsServiceSelected.Tables[0].Rows[0];
                                int     intRequest        = Int32.Parse(drServiceSelected["requestid"].ToString());
                                int     intService        = Int32.Parse(drServiceSelected["serviceid"].ToString());
                                int     intItem           = oService.GetItemId(intService);
                                int     intNumber         = Int32.Parse(drServiceSelected["number"].ToString());
                                if (drServiceSelected["approvedon"].ToString() == "" || drServiceSelected["approved"].ToString() == "0")
                                {
                                    int intApp = oRequestItem.GetItemApplication(intItem);
                                    lblRequest.Text = intRequest.ToString();
                                    if (oRequest.Allowed(intRequest, intService, intNumber, intProfile, true))
                                    {
                                        panRequest.Visible = true;
                                        int intProject = oRequest.GetProjectNumber(intRequest);
                                        lblView.Text = oRequestField.GetBodyNoEnv(intRequest, intItem, intNumber, intService, 0, 0, dsnServiceEditor, intEnvironment, dsnAsset, dsnIP);
                                        //LoadProject(intProject, intRequest);
                                    }
                                    else
                                    {
                                        panDenied.Visible = true;
                                    }
                                }
                                else
                                {
                                    // Already approved
                                    litAlreadyStatus.Text = (drServiceSelected["approved"].ToString() == "1" ? "Approved" : "Denied");
                                    litAlreadyBy.Text     = oUser.GetFullNameWithLanID(Int32.Parse(drServiceSelected["approvedby"].ToString()));
                                    litAlreadyOn.Text     = " on " + drServiceSelected["approvedon"].ToString();
                                    panAlready.Visible    = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
                    {
                        // MANAGER
                        int intRequest = Int32.Parse(Request.QueryString["rid"]);
                        lblRequest.Text = Request.QueryString["rid"];
                        int intProject = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                        //ds = oResourceRequest.GetRequestAll(intRequest);
                        int intRequester = Int32.Parse(oRequest.Get(intRequest, "userid"));
                        if (intRequest > 0)
                        {
                            bool boolAllowed = oUser.IsManager(intRequester, intProfile, true);
                            if (boolAllowed == false)
                            {
                                int intManager = oUser.GetManager(intRequester, true);
                                boolAllowed = (oDelegate.Get(intManager, intProfile) > 0);
                            }
                            if (oUser.IsAdmin(intProfile) || boolAllowed)
                            {
                                trHR.Visible       = false;
                                panRequest.Visible = true;
                                lblView.Text       = "As the manager of <b>" + oUser.GetFullName(intRequester) + "</b>, you will need to approve this request before it is submitted. You can view the details of the request by clicking [<a href=\"javascript:void(0);\">View</a>] next to each item.";
                                Control oControl = (Control)LoadControl("/controls/resource_request_new.ascx");
                                PHForm.Controls.Add(oControl);
                                if (String.IsNullOrEmpty(Request.QueryString["approve"]))
                                {
                                    btnApprove.Visible = btnDeny.Visible = false;
                                    lblView.Text       = "Here are the details of the service request...";
                                }

                                if (oServiceRequest.Get(intRequest, "manager_approval") != "0")
                                {
                                    // Already approved
                                    btnApprove.Enabled    = btnDeny.Enabled = false;
                                    litAlreadyStatus.Text = (oServiceRequest.Get(intRequest, "manager_approval") == "1" ? "Approved" : "Denied");
                                    litAlreadyBy.Text     = oUser.GetFullNameWithLanID(oUser.GetManager(intRequester, true));
                                    panAlready.Visible    = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            btnFinish.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnAlready.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnApprove.Attributes.Add("onclick", "return confirm('Are you sure you want to APPROVE this request?') && ProcessButton(this) && LoadWait();");
            btnDeny.Attributes.Add("onclick", "return Deny('" + divDeny.ClientID + "','" + divApprove.ClientID + "','" + txtReason.ClientID + "');");
            btnDone.Attributes.Add("onclick", "return ValidateText('" + txtReason.ClientID + "', 'Please enter a reason') && confirm('Are you sure you want to DENY this request?') && ProcessButton(this) && LoadWait();");
            btnCancel.Attributes.Add("onclick", "return Cancel('" + divDeny.ClientID + "','" + divApprove.ClientID + "');");
        }
コード例 #4
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);
            ServiceDetails  oServiceDetail  = new ServiceDetails(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 **************
                        Requests  oRequest  = new Requests(intProfile, dsn);
                        Functions oFunction = new Functions(intProfile, dsn, intEnvironment);
                        Variables oVariable = new Variables(intEnvironment);
                        Users     oUser     = new Users(intProfile, dsn);
                        Pages     oPage     = new Pages(intProfile, dsn);
                        if (oRequest.Get(intRequest, "description") == "")
                        {
                            Customized oCustomized = new Customized(intProfile, dsn);
                            DataSet    dsStatement = oCustomized.GetWorkstation(intRequest, intItem, intNumber);
                            if (dsStatement.Tables[0].Rows.Count > 0)
                            {
                                oRequest.UpdateDescription(intRequest, dsStatement.Tables[0].Rows[0]["statement"].ToString());
                            }
                        }
                        int     intDevices  = 0;
                        double  dblQuantity = 0.00;
                        DataSet ds          = oService.GetSelected(intRequest, intService);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            dblQuantity = double.Parse(ds.Tables[0].Rows[0]["quantity"].ToString());
                            intDevices  = Int32.Parse(ds.Tables[0].Rows[0]["quantity"].ToString());
                        }
                        double dblHours    = oServiceDetail.GetHours(intService, dblQuantity);
                        int    intResource = oServiceRequest.AddRequest(intRequest, intItem, intService, intDevices, dblHours, 2, intNumber, dsnServiceEditor);
                        if (oService.Get(intService, "typeid") == "3")
                        {
                        }
                        else if (oService.Get(intService, "typeid") == "2")
                        {
                        }
                        else
                        {
                            if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                            {
                                oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                            }
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + strResult + "</span></p>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> " + strError + "</span></p>";
                            }
                            else
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + oService.GetName(intService) + " Submitted</span></p>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);
            Functions       oFunction       = new Functions(intProfile, dsn, intEnvironment);
            Workstations    oWorkstation    = new Workstations(intProfile, dsn);
            Customized      oCustomized     = new Customized(intProfile, dsn);
            Forecast        oForecast       = new Forecast(intProfile, dsn);
            Variables       oVariable       = new Variables(intEnvironment);
            Users           oUser           = new Users(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 **************
                        DataSet ds = oCustomized.GetVirtualWorkstationAccount(intRequest, intItem, intNumber);
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            int    intWorkstation = Int32.Parse(dr["workstationid"].ToString());
                            int    intAnswer      = Int32.Parse(oWorkstation.GetVirtual(intWorkstation, "answerid"));
                            int    intUser        = Int32.Parse(oForecast.GetAnswer(intAnswer, "appcontact"));
                            string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                            oFunction.SendEmail("Virtual Workstation Account Approval", oUser.GetName(intUser), strEMailIdsBCC, strEMailIdsBCC, "Virtual Workstation Account Approval", "<p><b>A virtual workstation account request requires your approval.</b></p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/approval/workstation/account.aspx?id=" + intWorkstation.ToString() + "\" target=\"_blank\">Click here to view this request.</a></p>", true, false);
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + strResult + "</span></p>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> " + strError + "</span></p>";
                            }
                            else
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + oService.GetName(intService) + " Submitted</span></p>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);

            oFunction = new Functions(intProfile, dsn, intEnvironment);
            oUser     = new Users(intProfile, dsn);
            oRequest  = new Requests(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 strResult = "";
                        string strError  = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************

                        Servers          oServer           = new Servers(intProfile, dsn);
                        OnDemand         oOnDemand         = new OnDemand(intProfile, dsn);
                        Audit            oAudit            = new Audit(intProfile, dsn);
                        ServerName       oServerName       = new ServerName(intProfile, dsn);
                        ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                        Asset            oAsset            = new Asset(intProfile, dsnAsset, dsn);
                        DataSet          dsRebuild         = oServer.GetRebuild(intRequest, intService, intNumber);
                        bool             found             = false;
                        foreach (DataRow drRebuild in dsRebuild.Tables[0].Rows)
                        {
                            found = true;

                            int    intServer      = Int32.Parse(drRebuild["serverid"].ToString());
                            string strName        = oServer.GetName(intServer, true);
                            int    intModel       = 0;
                            int    intRebuildStep = 0;
                            // Load General Information
                            int     intAsset = 0;
                            DataSet dsAssets = oServer.GetAssets(intServer);
                            foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                            {
                                if (drAsset["latest"].ToString() == "1")
                                {
                                    intAsset = Int32.Parse(drAsset["assetid"].ToString());
                                    break;
                                }
                            }
                            if (intAsset > 0)
                            {
                                // Asset Information
                                intModel = Int32.Parse(oAsset.Get(intAsset, "modelid"));
                            }
                            if (oModelsProperties.IsTypeVMware(intModel) == false)
                            {
                                intRebuildStep = 6;
                            }
                            else
                            {
                                intRebuildStep = 7;
                            }

                            oServer.UpdateStep(intServer, intRebuildStep);
                            // Redo step...delete current step and update the other step
                            oOnDemand.UpdateStepDoneServerRedo(intServer, intRebuildStep);
                            oServer.DeleteSwitchports(intServer);   // Reconfigure switchports
                            oServer.UpdateRebuilding(intServer, 1);
                            // Delete Audits
                            oAudit.DeleteServer(intServer, 0);
                            oAudit.DeleteServer(intServer, 1);
                            // Set installs back
                            DataSet dsInstalls = oServerName.GetComponentDetailSelected(intServer, 0);
                            foreach (DataRow drInstall in dsInstalls.Tables[0].Rows)
                            {
                                oServerName.UpdateComponentDetailSelected(intServer, Int32.Parse(drInstall["detailid"].ToString()), -2);
                            }
                            int intStepSkipStart = 0;
                            int intStepSkipGoto  = 0;
                            oServer.UpdateStepSkip(intServer, intStepSkipStart, intStepSkipGoto);
                            strResult += "<p>The server " + strName + " was successfully queued for rebuild</p>";
                            strError   = "";
                            break;
                        }
                        if (found == false)
                        {
                            strError = "<p>There was a problem configuring the server for rebuild ~ Request not found.</p>";
                        }

                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1, 1);
                    }
                }
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            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 **************
                        Requests         oRequest          = new Requests(intProfile, dsn);
                        Users            oUser             = new Users(intProfile, dsn);
                        Workstations     oWorkstation      = new Workstations(intProfile, dsn);
                        Workstations     oRemote           = new Workstations(intProfile, dsnRemote);
                        Asset            oAsset            = new Asset(intProfile, dsnAsset);
                        Domains          oDomain           = new Domains(intProfile, dsn);
                        ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                        DataSet          ds = oWorkstation.GetVirtualDecommissions(intRequest, intItem, intNumber);
                        strResult = "";
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            int    intID    = Int32.Parse(dr["id"].ToString());
                            int    intName  = Int32.Parse(dr["nameid"].ToString());
                            string strName  = oWorkstation.GetName(intName);
                            int    intAsset = Int32.Parse(dr["assetid"].ToString());
                            int    intModel = Int32.Parse(dr["modelid"].ToString());
                            if (oModelsProperties.IsTypeVMware(intModel) == true)
                            {
                                // VMware Workstation
                                bool boolUnique = oAsset.AddDecommission(intRequest, intItem, intNumber, intAsset, intProfile, "", DateTime.Now, strName, 0, "");
                                if (boolUnique == true)
                                {
                                    oAsset.UpdateDecommission(intRequest, intItem, intNumber, 1);
                                    VMWare  oVMWare    = new VMWare(intProfile, dsn);
                                    DataSet dsGuest    = oVMWare.GetGuest(strName);
                                    string  strCluster = "???";
                                    if (dsGuest.Tables[0].Rows.Count > 0 && dsGuest.Tables[0].Rows[0]["hostid"].ToString() != "")
                                    {
                                        int intHost    = Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString());
                                        int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid"));
                                        strCluster = oVMWare.GetCluster(intCluster, "name");
                                    }
                                    strResult += "<p>The VMware workstation " + strName + " is queued to be decommissioned from the cluster " + strCluster + ".</p>";
                                }
                                else
                                {
                                    strResult += "<p>The VMware workstation " + strName + " is ALREADY queued to be decommissioned</p>";
                                }
                            }
                            else
                            {
                                // Microsoft Virtual Workstation
                                int     intHost       = Int32.Parse(dr["virtualhostid"].ToString());
                                int     intOS         = Int32.Parse(dr["osid"].ToString());
                                string  strHost       = oAsset.GetServerOrBlade(intHost, "name");
                                string  strVirtualDir = "";
                                DataSet dsOS          = oAsset.GetVirtualHostOs(intHost);
                                foreach (DataRow drOS in dsOS.Tables[0].Rows)
                                {
                                    if (Int32.Parse(drOS["osid"].ToString()) == intOS)
                                    {
                                        strVirtualDir = drOS["virtualdir"].ToString();
                                        break;
                                    }
                                }
                                int intDomain = Int32.Parse(dr["domainid"].ToString());
                                int intEnv    = Int32.Parse(oDomain.Get(intDomain, "environment"));
                                oRemote.AddRemoteVirtualDecom(intEnv, strHost, strVirtualDir, strName);
                                // Clean up database
                                oWorkstation.DeleteVirtual(intID);
                                oWorkstation.UpdateName(intName, 1);
                                oAsset.DeleteGuest(intAsset);
                                oAsset.AddStatus(intAsset, "", (int)AssetStatus.Decommissioned, intProfile, DateTime.Now);
                                strResult += "<p>The virtual workstation " + strName + " was successfully decommissioned from the host " + strHost + ".</p>";
                            }
                            strError = "";
                        }
                        oRequest.AddResult(intRequest, intItem, intNumber, "Virtual Workstation Decommission", strError, strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intProfile));
                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1, 1);
                    }
                }
            }
        }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/projects_pending.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oProject        = new Projects(intProfile, dsn);
     oProjectNumber  = new ProjectNumber(intProfile, dsn);
     oRequest        = new Requests(intProfile, dsn);
     oRequestItem    = new RequestItems(intProfile, dsn);
     oService        = new Services(intProfile, dsn);
     oProjectPending = new ProjectsPending(intProfile, dsn, intEnvironment);
     oOrganization   = new Organizations(intProfile, dsn);
     oDocument       = new Documents(intProfile, dsn);
     oUser           = new Users(intProfile, dsn);
     oForecast       = new Forecast(intProfile, dsn);
     oServiceRequest = new ServiceRequests(intProfile, dsn);
     if (!IsPostBack)
     {
         if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
         {
             // Process Service Requests
             int     intRequest = Int32.Parse(Request.QueryString["rid"]);
             DataSet dsForm     = oRequestItem.GetForms(intRequest);
             foreach (DataRow drForm in dsForm.Tables[0].Rows)
             {
                 if (drForm["done"].ToString() == "0")
                 {
                     int    intItem    = Int32.Parse(drForm["itemid"].ToString());
                     int    intNumber  = Int32.Parse(drForm["number"].ToString());
                     int    intService = Int32.Parse(drForm["serviceid"].ToString());
                     string strPath    = oService.Get(intService, "cp_path");
                     if (strPath.Trim() == "")
                     {
                         // For now, bypass
                         oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                     }
                     else
                     {
                         Control oControl = (Control)LoadControl(strPath);
                         PHcp.Controls.Add(oControl);
                     }
                 }
             }
             panPH.Visible = true;
         }
         else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             DataSet ds         = oProjectPending.Get(Int32.Parse(Request.QueryString["id"]));
             int     intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
             if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
             {
                 int intProject = Int32.Parse(Request.QueryString["pid"]);
                 if (intProject > 0)
                 {
                     // Process Design Builder
                     DataSet dsForecast = oForecast.GetRequest(intRequest);
                     if (dsForecast.Tables[0].Rows.Count > 0)
                     {
                         int             intForecast      = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString());
                         DataSet         dsDesigns        = oForecast.GetAnswers(intForecast);
                         OnDemandTasks   oOnDemandTasks   = new OnDemandTasks(0, dsn);
                         ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                         foreach (DataRow drDesign in dsDesigns.Tables[0].Rows)
                         {
                             int intDesign        = Int32.Parse(drDesign["id"].ToString());
                             int intDesignRequest = 0;
                             if (Int32.TryParse(oForecast.GetAnswer(intDesign, "requestid"), out intDesignRequest) == true)
                             {
                                 if (intDesignRequest > 0)
                                 {
                                     // Update the REQUESTID in CV_FORECAST_ANSWERS with the new project correlation
                                     oRequest.Update(intDesignRequest, intProject);
                                 }
                             }
                             if (oForecast.CanAutoProvision(intDesign) == false)
                             {
                                 // Need to add a builder
                                 int     intImplementorD = 0;
                                 DataSet dsResourceD     = oResourceRequest.GetProjectItem(intProject, intImplementorDistributed);
                                 if (dsResourceD.Tables[0].Rows.Count > 0)
                                 {
                                     intImplementorD = Int32.Parse(dsResourceD.Tables[0].Rows[0]["userid"].ToString());
                                 }
                                 int     intImplementorM = 0;
                                 DataSet dsResourceM     = oResourceRequest.GetProjectItem(intProject, intImplementorMidrange);
                                 if (dsResourceM.Tables[0].Rows.Count > 0)
                                 {
                                     intImplementorM = Int32.Parse(dsResourceM.Tables[0].Rows[0]["userid"].ToString());
                                 }
                                 if (oForecast.GetPlatformDistributedForecast(intDesign, intWorkstationPlatform) == true)
                                 {
                                     if (intImplementorD > 0)
                                     {
                                         int intNextNumber       = oResourceRequest.GetNumber(intRequest);
                                         int intResourceParent   = oResourceRequest.Add(intRequest, -1, -1, intNextNumber, "Provisioning Task (Distributed)", 0, 6.00, 2, 1, 1, 1);
                                         int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (Distributed)", intImplementorD, 0, 6.00, 2, 0);
                                         oOnDemandTasks.AddPending(intDesign, intResourceWorkflow);
                                         oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                                     }
                                     else
                                     {
                                         // Submit for assignment
                                         if (oServiceRequest.Get(intRequest, "requestid") == "")
                                         {
                                             oServiceRequest.Add(intRequest, 1, 1);
                                         }
                                         int intResource = oServiceRequest.AddRequest(intRequest, intImplementorDistributed, intImplementorDistributedService, 0, 0.00, 2, 1, dsnServiceEditor);
                                         if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                         {
                                             oServiceRequest.NotifyTeamLead(intImplementorDistributed, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                         }
                                     }
                                 }
                                 if (oForecast.GetPlatformMidrangeForecast(intDesign) == true)
                                 {
                                     if (intImplementorM > 0)
                                     {
                                         int intNextNumber       = oResourceRequest.GetNumber(intRequest);
                                         int intResourceParent   = oResourceRequest.Add(intRequest, -1, -1, intNextNumber, "Provisioning Task (Midrange)", 0, 6.00, 2, 1, 1, 1);
                                         int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (Midrange)", intImplementorM, 0, 6.00, 2, 0);
                                         oOnDemandTasks.AddPending(intDesign, intResourceWorkflow);
                                         oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                                     }
                                     else
                                     {
                                         // Submit for assignment
                                         if (oServiceRequest.Get(intRequest, "requestid") == "")
                                         {
                                             oServiceRequest.Add(intRequest, 1, 1);
                                         }
                                         int intResource = oServiceRequest.AddRequest(intRequest, intImplementorMidrange, intImplementorMidrangeService, 0, 0.00, 2, 1, dsnServiceEditor);
                                         if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                         {
                                             oServiceRequest.NotifyTeamLead(intImplementorMidrange, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 oRequest.Update(intRequest, intProject);
                 oDocument.Update(intRequest, intProject);
                 oProjectPending.Approve(Int32.Parse(Request.QueryString["id"]));
                 if (intProject == 0)
                 {
                     oServiceRequest.Update(intRequest, ds.Tables[0].Rows[0]["name"].ToString());
                 }
                 Response.Redirect(Request.Path + "?rid=" + intRequest.ToString());
             }
             else
             {
                 if (Request.QueryString["reject"] != null)
                 {
                     panReject.Visible = true;
                 }
                 else
                 {
                     strProject = LoadProject(0, ds.Tables[0].Rows[0], intRequest, true);
                     btnView.Attributes.Add("onclick", "return ShowServiceRequests('" + intRequest.ToString() + "');");
                     btnViewDesigns.Attributes.Add("onclick", "return ShowDesigns('" + intRequest.ToString() + "');");
                     if (Request.QueryString["c"] != null && Request.QueryString["c"] != "")
                     {
                         panCompare.Visible = true;
                         string[] strProjects;
                         char[]   strSplit = { ' ' };
                         strProjects = Request.QueryString["c"].Split(strSplit);
                         bool boolOther = false;
                         for (int jj = 0; jj < strProjects.Length; jj++)
                         {
                             if (strProjects[jj].Trim() != "")
                             {
                                 TableRow  oRow  = new TableRow();
                                 TableCell oCell = new TableCell();
                                 oCell.Text = strProject;
                                 oRow.Cells.Add(oCell);
                                 oCell = new TableCell();
                                 HyperLink oCheck = new HyperLink();
                                 oCheck.ImageUrl    = "/images/bigCheck.gif";
                                 oCheck.ToolTip     = "Click to Assign";
                                 oCheck.NavigateUrl = Request.Path + "?id=" + Request.QueryString["id"] + "&pid=" + strProjects[jj];
                                 oCheck.Attributes.Add("onclick", "return confirm('Are you sure you want to assign this project?');");
                                 oCell.Controls.Add(oCheck);
                                 oRow.Cells.Add(oCell);
                                 oCell      = new TableCell();
                                 oCell.Text = LoadProject(Int32.Parse(strProjects[jj]), null, 0, false);
                                 if (boolOther == true)
                                 {
                                     oRow.Attributes.Add("bgcolor", "#EFEFEF");
                                 }
                                 boolOther = !boolOther;
                                 oRow.Cells.Add(oCell);
                                 tblCompare.Rows.Add(oRow);
                             }
                         }
                     }
                     else
                     {
                         panView.Visible = true;
                         LoadList();
                     }
                 }
             }
         }
         else
         {
             panAll.Visible = true;
             DataSet ds = oProjectPending.Gets();
             rptView.DataSource = ds;
             rptView.DataBind();
         }
     }
     btnCreateProject.Attributes.Add("onclick", "return confirm('Are you sure you want to create this PROJECT?');");
     btnCreateTask.Attributes.Add("onclick", "return confirm('Are you sure you want to create this TASK?');");
     btnCreateTask.Enabled = false;
     btnRejectConfirm.Attributes.Add("onclick", "return confirm('Are you sure you want to reject this project / task?');");
 }
コード例 #9
0
ファイル: cp_dns.ascx.cs プロジェクト: radtek/ClearView
        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);
                    }
                }
            }
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);

            oFunction = new Functions(intProfile, dsn, intEnvironment);
            oUser     = new Users(intProfile, dsn);
            oRequest  = new Requests(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 **************
                        bool boolIsServerVMWare = false;
                        bool boolIsNotManual    = false;
                        int  intServer          = 0;
                        int  intModel           = 0;

                        Customized oCustomized   = new Customized(intProfile, dsn);
                        DataSet    dsDecomServer = oCustomized.GetDecommissionServer(intRequest, intItem, intNumber);
                        if (dsDecomServer.Tables[0].Rows.Count > 0)
                        {
                            intServer = Int32.Parse(dsDecomServer.Tables[0].Rows[0]["serverid"].ToString());
                            DateTime datPower    = DateTime.Parse(dsDecomServer.Tables[0].Rows[0]["poweroff"].ToString());
                            string   strPowerNew = dsDecomServer.Tables[0].Rows[0]["poweroff_new"].ToString();
                            string   strName     = dsDecomServer.Tables[0].Rows[0]["servername"].ToString();
                            Asset    oAsset      = new Asset(intProfile, dsnAsset);
                            Servers  oServers    = new Servers(intProfile, dsn);
                            DataSet  dsAssets    = oServers.GetAssets(intServer);

                            if (intServer > 0)
                            {
                                DataSet          dsServer          = oServers.Get(intServer);
                                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                                if (dsServer.Tables[0].Rows[0]["modelid"] != DBNull.Value)
                                {
                                    intModel = Int32.Parse(dsServer.Tables[0].Rows[0]["modelid"].ToString());
                                }
                                if (intModel > 0 && oModelsProperties.IsTypeVMware(intModel) == true)
                                {
                                    boolIsServerVMWare = true;
                                }
                                boolIsNotManual = true;
                            }
                            // VMWARE
                            if (boolIsNotManual == true)
                            {
                                bool boolUnique = true;
                                foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                                {
                                    if (drAsset["latest"].ToString() == "1" || drAsset["dr"].ToString() == "1")
                                    {
                                        int intAsset = Int32.Parse(drAsset["assetid"].ToString());
                                        boolUnique = oAsset.AddDecommission(intRequest, intItem, intNumber, intAsset, intProfile, dsDecomServer.Tables[0].Rows[0]["reason"].ToString(), datPower, strName + (drAsset["dr"].ToString() == "1" ? "-DR" : ""), (drAsset["dr"].ToString() == "1" ? 1 : 0), strPowerNew);
                                        if (boolUnique == false)
                                        {
                                            break;
                                        }
                                    }
                                }
                                if (boolUnique == true || strPowerNew != "")
                                {
                                    oAsset.UpdateDecommission(intRequest, intItem, intNumber, 1);
                                    strResult += "<p>The server " + strName + " was successfully queued for decommission on " + (strPowerNew != "" ? strPowerNew : datPower.ToShortDateString()) + "</p>";
                                    strError   = "";
                                }
                                else
                                {
                                    strError = "<p>The server " + strName + " has already been queued for decommission</p>";
                                }
                                //Send service center notification
                                //"Assignment: Complete and Close"
                                # region "Send Service Center Notification"
                                ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn);
                                DataSet         dsRR             = oResourceRequest.GetResourceRequest(intRequest, intItem, intNumber);
                                int             intRRId          = 0;
                                if (dsRR.Tables[0].Rows.Count > 0)
                                {
                                    intRRId = Int32.Parse(dsRR.Tables[0].Rows[0]["id"].ToString());
                                }

                                //int intServerDecommServiceID = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_SERVER_DECOMMISSION"]);
                                //if (intService == intServerDecommServiceID)
                                //{
                                //    SendServiceCenterNotification(intRequest, intItem, intService, intNumber, 0);
                                //}
                                #endregion
                            }
                            else
                            {
                                // MANUAL (non-automated)
                                double dblHours   = 0.00;
                                int    intDevices = 1;
                                Field  oField     = new Field(intProfile, dsn);

                                strResult += "<p>The server decommission request was submitted for " + strName + ".</p>";
                                strError   = "";

                                string strTable = oField.GetTableName2(intService);
                                if (strTable != "")
                                {
                                    DataSet ds = oField.GetTableServiceRequest(strTable, intRequest.ToString(), intItem.ToString(), intNumber.ToString());
                                    if (ds.Tables[0].Columns.Contains("hours") == true)
                                    {
                                        foreach (DataRow dr in ds.Tables[0].Rows)
                                        {
                                            dblHours += double.Parse(dr["hours"].ToString());
                                        }
                                    }
                                    if (ds.Tables[0].Columns.Contains("devices") == true)
                                    {
                                        foreach (DataRow dr in ds.Tables[0].Rows)
                                        {
                                            intDevices += Int32.Parse(dr["devices"].ToString());
                                        }
                                    }
                                }
                                if (oService.Get(intService, "quantity_is_device") == "1")
                                {
                                    DataSet dsTemp = oService.GetSelected(intRequest, intService);
                                    if (dsTemp.Tables[0].Rows.Count > 0)
                                    {
                                        intDevices = Int32.Parse(dsTemp.Tables[0].Rows[0]["quantity"].ToString());
                                    }
                                }
                                int intResource = oServiceRequest.AddRequest(intRequest, intItem, intService, intDevices, dblHours, 2, intNumber, dsnServiceEditor);
                                if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                {
                                    oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                }

                                oRequest.AddResult(intRequest, intItem, intNumber, "Server Decommission", strError, strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intProfile));
                            }
                        }
                        else
                        {
                            strResult     = "";
                            dsDecomServer = oCustomized.GetDecommissionServerDeleted(intRequest, intItem, intNumber);
                            string strName = "";
                            if (dsDecomServer.Tables[0].Rows.Count > 0)
                            {
                                strName = dsDecomServer.Tables[0].Rows[0]["servername"].ToString();
                            }
                            if (strName == "")
                            {
                                strError = "<p>One or more of the servers you attempted to decommission have already been queued for decommission</p>";
                            }
                            else
                            {
                                strError = "<p>The server " + strName + " has already been queued for decommission</p>";
                            }
                            oRequestItem.DeleteForms(intRequest, intService, intNumber);
                        }

                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1, (boolIsNotManual?1:0));
                    }
                }
            }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title        = "ClearView Auto-Provisioning";
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oAsset            = new Asset(intProfile, dsnAsset);
            oForecast         = new Forecast(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oServiceRequest   = new ServiceRequests(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOnDemandTasks    = new OnDemandTasks(intProfile, dsn);
            oResourceRequest  = new ResourceRequest(intProfile, dsn);
            oProject          = new Projects(intProfile, dsn);
            oSetting          = new Settings(intProfile, dsn);

            //Menu
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            Tab oTab = new Tab("", intMenuTab, "divMenu1", true, true);

            //End Menu

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID      = Int32.Parse(Request.QueryString["id"]);
                intRequest = oForecast.GetRequestID(intID, true);
                DataSet dsRequest = oServiceRequest.Get(intRequest);
                if (dsRequest.Tables[0].Rows.Count > 0)
                {
                    Response.Redirect(Request.Path + "?rid=" + intRequest);
                }
            }
            if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
            }
            if (Request.QueryString["notify"] != null)
            {
                string strRedirect = Request.Url.PathAndQuery;
                strRedirect = strRedirect.Substring(0, strRedirect.IndexOf("&notify"));
                if (Request.QueryString["notify"] == "none")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "true")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has been successfully notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "false")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has ALREADY been notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('There was a problem notifying your design implementor\\n\\nPlease contact your ClearView administrator\\n\\nRequestID: " + intRequest.ToString() + "');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
            }
            if (intID > 0)
            {
                Page.Title = "ClearView Auto-Provisioning | Design # " + intID.ToString();
                btnPrint.Attributes.Add("onclick", "return OpenWindow('DESIGN_PRINT', '?id=" + intID.ToString() + "');");
                bool    boolApproveNeeded = false;
                bool    boolApproved      = false;
                bool    boolPending       = false;
                bool    boolDenied        = false;
                Tab     oTabServer        = new Tab("", 0, "divMenuApprove", true, false);
                DataSet dsServers         = oServer.GetAnswer(intID);
                int     intServerCount    = 0;
                foreach (DataRow drServer in dsServers.Tables[0].Rows)
                {
                    int intServer = Int32.Parse(drServer["id"].ToString());
                    intServerCount++;
                    DataSet dsApprove = oServerName.GetComponentDetailUserApprovalsByServer(intServer);
                    if (dsApprove.Tables[0].Rows.Count > 0)
                    {
                        boolApproveNeeded = true;
                        oTabServer.AddTab("Device # " + intServerCount.ToString(), "");
                        string strApproveItem = "";
                        bool   boolOther      = true;
                        foreach (DataRow drApprove in dsApprove.Tables[0].Rows)
                        {
                            boolOther = (boolOther == false);
                            int      intDetail           = Int32.Parse(drApprove["detailid"].ToString());
                            int      intApprover         = 0;
                            string   strApproverComments = "";
                            int      intApproverApproved = -1;
                            DateTime datApproved         = DateTime.Now;
                            DataSet  dsApprovals         = oServerName.GetComponentDetailUserApprovals(intServer, intDetail);
                            if (dsApprovals.Tables[0].Rows.Count == 0)
                            {
                                boolPending = true;
                            }
                            else
                            {
                                intApprover         = Int32.Parse(dsApprovals.Tables[0].Rows[0]["userid"].ToString());
                                strApproverComments = dsApprovals.Tables[0].Rows[0]["comments"].ToString();
                                intApproverApproved = Int32.Parse(dsApprovals.Tables[0].Rows[0]["approved"].ToString());
                                datApproved         = DateTime.Parse(dsApprovals.Tables[0].Rows[0]["modified"].ToString());
                                if (intApproverApproved == 0)
                                {
                                    boolDenied = true;
                                }
                            }
                            string  strApprovers = "";
                            DataSet dsApprovers  = oServerName.GetComponentDetailUsers(intDetail, 1);
                            foreach (DataRow drApprover in dsApprovers.Tables[0].Rows)
                            {
                                int intUser = Int32.Parse(drApprover["userid"].ToString());
                                strApprovers += "<tr><td><a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + intUser.ToString() + "');\"><img src=\"/images/" + (intApprover == 0 ? "pending" : (intUser == intApprover ? (intApproverApproved == 1 ? "check" : "cancel") : "user")) + ".gif\" border=\"0\" align=\"absmiddle\"/> " + oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")</a></td></tr>";
                            }
                            strApprovers    = "<table>" + strApprovers + "</table>";
                            strApproveItem += "<tr" + (boolOther ? " bgcolor=\"#F6F6F6\"" : "") + ">";
                            string strLabel = drApprove["name"].ToString();
                            if (intApproverApproved > -1)
                            {
                                strLabel = "<a href=\"javascript:void(0);\" onclick=\"ShowHideDiv2('trApproval" + intServerCount.ToString() + "_" + intDetail.ToString() + "');\">" + strLabel + "</a>";
                            }
                            strApproveItem += "<td valign=\"top\" width=\"45%\" class=\"biggerbold\">" + strLabel + "</td>";
                            strApproveItem += "<td valign=\"top\" width=\"10%\">" + (intApproverApproved == -1 ? "Pending" : (intApproverApproved == 0 ? "Denied" : "Approved")) + "</td>";
                            strApproveItem += "<td valign=\"top\" width=\"45%\" align=\"right\">" + strApprovers + "</td>";
                            strApproveItem += "</tr>";
                            if (intApproverApproved > -1)
                            {
                                string strApproveTable = "<tr><td colspan=\"2\"><span style=\"width:100%;border-bottom:1 dotted #CCCCCC;\"/></td></tr>";
                                strApproveTable += "<tr>";
                                strApproveTable += "<td nowrap valign=\"top\"><img src=\"/images/" + (intApproverApproved == 0 ? "cancel" : "check") + ".gif\" border=\"0\" align=\"absmiddle\"/></td>";
                                strApproveTable += "<td width=\"100%\" valign=\"top\">" + oUser.GetFullName(intApprover) + " " + (intApproverApproved == 0 ? "DENIED" : "APPROVED") + " this request on " + datApproved.ToString() + "</td>";
                                strApproveTable += "</tr>";
                                if (strApproverComments != "")
                                {
                                    strApproveTable += "<tr>";
                                    strApproveTable += "<td colspan=\"2\">The following comments were added...</td>";
                                    strApproveTable += "</tr>";
                                    strApproveTable += "<tr>";
                                    strApproveTable += "<td nowrap valign=\"top\"><img src=\"/images/comment.gif\" border=\"0\" align=\"absmiddle\"/></td>";
                                    strApproveTable += "<td width=\"100%\" valign=\"top\" class=\"comment\">" + strApproverComments + "</td>";
                                    strApproveTable += "</tr>";
                                }
                                strApproveTable = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"3\" border=\"0\">" + strApproveTable + "</table>";
                                strApproveItem += "<tr id=\"trApproval" + intServerCount.ToString() + "_" + intDetail.ToString() + "\" style=\"display:none\"" + (boolOther ? " bgcolor=\"#F6F6F6\"" : "") + "><td colspan=\"3\">" + strApproveTable + "</td></tr>";
                            }
                        }
                        strApproveItem = "<tr bgcolor=\"#EEEEEE\"><td class=\"header\">Component</td><td class=\"header\">Status</td><td class=\"header\" align=\"right\">Approver(s)</td></tr>" + strApproveItem;
                        strApproveItem = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\">" + strApproveItem + "</table>";
                        strApprove    += "<div id=\"divTab" + intServerCount.ToString() + "\" style=\"display:none\">" + strApproveItem + "</div>";
                    }
                }
                if (boolApproveNeeded == true)
                {
                    trApprove.Visible = true;
                    if (boolDenied == true)
                    {
                        btnSoftwareBack.Visible = true;
                        imgApproved.ImageUrl    = "/images/ico_error.gif";
                        lblApprovedHeader.Text  = "Software Component(s) Denied";
                        lblApproved.Text        = "One or more of the software components you requested have been denied. You cannot continue until all components have been approved.<br/>You will need to make changes to this design - please click <b>Make Changes</b> to change your software component requirements.<br/>All questions and status inquiries should be sent to the approver(s) listed below.";
                    }
                    else if (boolPending == true)
                    {
                        imgApproved.ImageUrl   = "/images/ico_hourglass.gif";
                        lblApprovedHeader.Text = "Software Component(s) Pending";
                        lblApproved.Text       = "One or more of the software components you requested are awaiting approval. You cannot continue until all components have been approved.<br/>All questions and status inquiries should be sent to the approver(s) listed below.";
                    }
                    else
                    {
                        boolApproved           = true;
                        lblApprovedHeader.Text = "Software Component(s) Approved";
                        lblApproved.Text       = "All of the software components you requested have been approved!";
                    }
                    btnApproved.Attributes.Add("onclick", "ShowHideDiv2('" + trApprove.ClientID + "');return false;");
                    strMenuTabApprove = oTabServer.GetTabs();
                }
                else
                {
                    boolApproved           = true;
                    lblApprovedHeader.Text = "No Approval Required";
                    lblApproved.Text       = "There are no approvals required for your software components";
                    btnApproved.Enabled    = false;
                }

                string strSchedule = oForecast.GetAnswer(intID, "execution");
                if (strSchedule != "")
                {
                    DateTime datSchedule = DateTime.Parse(strSchedule);
                    txtScheduleDate.Text = datSchedule.ToShortDateString();
                    txtScheduleTime.Text = datSchedule.ToShortTimeString();
                    btnSchedule.Text     = "Update the Build";
                }
                panBegin.Visible = true;
                bool boolAssigned = false;

                int intModel = oForecast.GetModelAsset(intID);
                if (intModel == 0)
                {
                    intModel = oForecast.GetModel(intID);
                }

                string strChange = "true";
                string strFreeze = "";
                // Check Freeze Dates
                bool boolFreeze = false;
                strFreezeStart = oSetting.Get("freeze_start");
                strFreezeEnd   = oSetting.Get("freeze_end");
                if (strFreezeStart != "" && strFreezeEnd != "" && DateTime.Parse(strFreezeStart) <= DateTime.Now && DateTime.Parse(strFreezeEnd) > DateTime.Now)
                {
                    boolFreeze = true;
                    divChange.Style["display"] = "inline";
                    if (!IsPostBack)
                    {
                        txtChange.Text = oForecast.GetAnswer(intID, "change");
                    }
                    strChange = "ValidateTextLength('" + txtChange.ClientID + "', 'Please enter a valid change control number\\n\\n - Must start with \"CHG\" or \"PTM\"\\n - Must be exactly 10 characters in length', 10, 'CHG', 'PTM')";
                }
                int intClass = Int32.Parse(oForecast.GetAnswer(intID, "classid"));

                int intForecast = 0;
                Int32.TryParse(oForecast.GetAnswer(intID, "forecastid"), out intForecast);
                int intRequestID = 0;
                Int32.TryParse(oForecast.Get(intForecast, "requestid"), out intRequestID);
                int intProject = 0;
                if (intRequestID > 0)
                {
                    intProject = oRequest.GetProjectNumber(intRequestID);
                }
                int intProjectStatus = 0;
                if (intProject > 0)
                {
                    Int32.TryParse(oProject.Get(intProject, "status"), out intProjectStatus);
                }

                if (oForecast.CanAutoProvision(intID) == true)
                {
                    boolAssigned = true;
                }
                else
                {
                    if (oOnDemandTasks.GetPending(intID).Tables[0].Rows.Count > 0)
                    {
                        boolAssigned = true;
                    }
                    else
                    {
                        // Add Resource Request
                        int     intImplementor = 0;
                        string  strType        = "Distributed";
                        DataSet dsResource     = oResourceRequest.GetProjectItem(intProject, intImplementorDistributed);
                        if (oForecast.GetPlatformDistributed(intID, intWorkstationPlatform) == false)
                        {
                            dsResource = oResourceRequest.GetProjectItem(intProject, intImplementorMidrange);
                            strType    = "Midrange";
                        }
                        if (dsResource.Tables[0].Rows.Count > 0)
                        {
                            intImplementor = (dsResource.Tables[0].Rows[0]["userid"].ToString() == "" ? 0 : Int32.Parse(dsResource.Tables[0].Rows[0]["userid"].ToString()));
                        }
                        if (intImplementor > 0)
                        {
                            int intNextNumber       = oResourceRequest.GetNumber(intRequestID);
                            int intResourceParent   = oResourceRequest.Add(intRequestID, -1, -1, intNextNumber, "Provisioning Task (" + strType + ")", 0, 6.00, 2, 1, 1, 1);
                            int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (" + strType + ")", intImplementor, 0, 6.00, 2, 0);
                            oOnDemandTasks.AddPending(intID, intResourceWorkflow);
                            oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                        }
                    }
                }

                lblNotify.Visible = boolBurnIn;

                bool boolOKtoExecute = false;
                if (intProject == -100)
                {
                    // Pending project approval
                    btnStart.Attributes.Add("onclick", "alert('This design cannot be executed because the associated project is currently pending approval.\\n\\nMost likely, this is because you just entered a new project into the system\\n\\nPlease contact your ClearView administrator or check back later.');return false;");
                    btnSchedule.Attributes.Add("onclick", "alert('This design cannot be scheduled because the associated project is currently pending approval.\\n\\nMost likely, this is because you just entered a new project into the system\\n\\nPlease contact your ClearView administrator or check back later.');return false;");
                }
                else
                {
                    if (oForecast.CanAutoProvision(intID) == true)
                    {
                        btnSchedule.Enabled = true;
                        boolOKtoExecute     = true;
                    }
                    else
                    {
                        if (boolAssigned == false)
                        {
                            btnStart.Attributes.Add("onclick", "alert('You cannot execute a design until a design implementor has been assigned.');return false;");
                            btnSchedule.Attributes.Add("onclick", "alert('You cannot schedule the execution of a design until a design implementor has been assigned.');return false;");
                        }
                        else
                        {
                            boolOKtoExecute = true;
                        }
                    }
                }

                imgScheduleDate.Attributes.Add("onclick", "return ShowCalendar('" + txtScheduleDate.ClientID + "');");
                if (boolOKtoExecute == true)
                {
                    btnStart.Attributes.Add("onclick", "return " + strChange + " && confirm('NOTE: Billing will begin: " + DateTime.Today.ToShortDateString() + "\\n\\nAre you sure you want to continue?');");
                    btnSchedule.Attributes.Add("onclick", "return ValidateDate('" + txtScheduleDate.ClientID + "','Please enter a valid schedule date')" +
                                               " && ValidateDateToday('" + txtScheduleDate.ClientID + "','The scheduled date must occur after today')" +
                                               " && ValidateFreeze('" + txtScheduleDate.ClientID + "','" + divChange.ClientID + "','" + txtChange.ClientID + "'," + (boolFreeze ? "true" : "false") + ")" +
                                               " && ValidateTime('" + txtScheduleTime.ClientID + "','Please enter a valid start time')" +
                                               " && confirm('NOTE: Billing will begin: ' + document.getElementById('" + txtScheduleDate.ClientID + "').value + '\\n\\nAre you sure you want to continue?')" +
                                               " && ProcessButton(this)" +
                                               ";");
                }

                if (oModelsProperties.IsInventory(intModel) == true)
                {
                    panInventoryYes.Visible = true;
                    if (boolApproved == false)
                    {
                        divSoftware.Style["display"] = "inline";
                        divDefault.Style["display"]  = "none";
                        radStart.Enabled             = false;
                        btnStart.Enabled             = false;
                        radSchedule.Enabled          = false;
                        btnSchedule.Enabled          = false;
                        radApproval.Enabled          = false;
                        btnApprovals.Enabled         = false;
                    }
                }
                else
                {
                    lblInventory.Text            = oModelsProperties.Get(intModel, "name");
                    panInventoryNo.Visible       = true;
                    divSoftware.Style["display"] = "none";
                    divDefault.Style["display"]  = "none";
                    radStart.Enabled             = false;
                    btnStart.Enabled             = false;
                    radSchedule.Enabled          = false;
                    btnSchedule.Enabled          = false;
                    radApproval.Enabled          = false;
                    btnApprovals.Enabled         = false;
                }
            }
            else if (intRequest > 0)
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
                DateTime datSchedule = DateTime.Now;
                DataSet  ds          = oServer.GetRequests(intRequest, 1);
                bool     boolPending = false;
                int      intAnswer   = 0;
                int      intModel    = 0;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    intModel  = oForecast.GetModelAsset(intAnswer);
                    if (intModel == 0)
                    {
                        intModel = oForecast.GetModel(intAnswer);
                    }
                    string strSchedule = oForecast.GetAnswer(intAnswer, "execution");
                    if (strSchedule != "")
                    {
                        datSchedule          = DateTime.Parse(strSchedule);
                        lblScheduleDate.Text = datSchedule.ToShortDateString();
                        lblScheduleTime.Text = datSchedule.ToShortTimeString();
                        if (DateTime.Now < datSchedule)
                        {
                            boolPending = true;
                        }
                    }
                }
                Page.Title = "ClearView Auto-Provisioning | Design # " + intAnswer.ToString();
                if (oForecast.CanAutoProvision(intAnswer) == false)
                {
                    panNotExecutable.Visible = true;
                    lblInitiated.Text        = oForecast.GetAnswer(intAnswer, "executed");
                    lblCompleted.Text        = oForecast.GetAnswer(intAnswer, "completed");
                    int     intImplementorUser = 0;
                    DataSet dsImplementor      = oOnDemandTasks.GetPending(intAnswer);
                    if (dsImplementor.Tables[0].Rows.Count > 0)
                    {
                        intImplementorUser = Int32.Parse(dsImplementor.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementorUser = Int32.Parse(oResourceRequest.GetWorkflow(intImplementorUser, "userid"));
                    }
                    strManualImage        = "<img src=\"/frame/picture.aspx?xid=" + oUser.GetName(intImplementorUser) + "\" border=\"0\" align=\"absmiddle\" style=\"height:90px;width:90px;border-width:0px;border:solid 1px #999999;\" />";
                    lblImplementor.Text   = oUser.GetFullName(intImplementorUser) + " (" + oUser.GetName(intImplementorUser) + ")";
                    strManualReason       = oForecast.CanAutoProvisionReason(intAnswer);
                    btnManual.NavigateUrl = "/datapoint/service/design.aspx?t=design&q=" + oFunction.encryptQueryString(intAnswer.ToString());
                    rptServers.DataSource = oServer.GetManual(intAnswer, false);
                    rptServers.DataBind();
                    foreach (RepeaterItem ri in rptServers.Items)
                    {
                        Label lblName = (Label)ri.FindControl("lblName");
                        if (lblName.Text != "--- Pending ---")
                        {
                            lblName.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=name&q=" + oFunction.encryptQueryString(lblName.Text) + "&id=" + oFunction.encryptQueryString(lblName.ToolTip) + "',800,600);\">" + lblName.Text + "</a>";
                        }
                        else
                        {
                            lblName.Text = "<i>" + lblName.Text + "</i>";
                        }
                        Label lblAsset = (Label)ri.FindControl("lblAsset");
                        if (lblAsset.Text != "--- Pending ---")
                        {
                            lblAsset.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(lblAsset.Text) + "',800,600);\">" + lblAsset.Text + "</a>";
                        }
                        else
                        {
                            lblAsset.Text = "<i>" + lblAsset.Text + "</i>";
                        }
                        Label lblAssetDR = (Label)ri.FindControl("lblAssetDR");
                        if (lblAssetDR.Text != "--- None ---")
                        {
                            if (lblAssetDR.Text != "--- Pending ---")
                            {
                                if (lblAssetDR.Text != "Missing!!!")
                                {
                                    lblAssetDR.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(lblAssetDR.Text) + "',800,600);\">" + lblAssetDR.Text + "</a>";
                                }
                                else
                                {
                                    lblAssetDR.Text = "<span class=\"highlight\">" + lblAssetDR.Text + "</span>";
                                }
                            }
                            else
                            {
                                lblAssetDR.Text = "<i>" + lblAssetDR.Text + "</i>";
                            }
                        }
                        else
                        {
                            lblAssetDR.Text = "<i>Not Required</i>";
                        }
                        Label lblIP1 = (Label)ri.FindControl("lblIP1");
                        if (lblIP1.Text == "--- Pending ---")
                        {
                            lblIP1.Text = "<i>" + lblIP1.Text + "</i>";
                        }
                        Label lblIP2 = (Label)ri.FindControl("lblIP2");
                        if (lblIP2.Text == "--- Pending ---")
                        {
                            lblIP2.Text = "<i>" + lblIP2.Text + "</i>";
                        }
                        Label lblIP3 = (Label)ri.FindControl("lblIP3");
                        if (lblIP3.Text == "--- Pending ---")
                        {
                            lblIP3.Text = "<i>" + lblIP3.Text + "</i>";
                        }
                    }
                }
                else
                {
                    if (boolPending == true)
                    {
                        panPending.Visible = true;
                        TimeSpan oSpan = datSchedule.Subtract(DateTime.Now);
                        if (oSpan.Seconds > 0)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "cdown", "<script type=\"text/javascript\">StartClockCountdown('" + lblCountdown.ClientID + "'," + oSpan.TotalMilliseconds.ToString() + ");<" + "/" + "script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "cdown", "<script type=\"text/javascript\">StartClockCountdown('" + lblCountdown.ClientID + "',0);<" + "/" + "script>");
                        }
                    }
                    else
                    {
                        panStart.Visible = true;
                        int   intCount = 0;
                        Types oType    = new Types(intProfile, dsn);

                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            intCount++;
                            int intServer = Int32.Parse(dr["id"].ToString());
                            int intAsset  = 0;
                            if (dr["assetid"].ToString() != "")
                            {
                                intAsset = Int32.Parse(dr["assetid"].ToString());
                            }
                            int intType = 0;
                            intModel = 0;
                            if (dr["modelid"].ToString() != "")
                            {
                                intModel = Int32.Parse(dr["modelid"].ToString());
                            }
                            if (intModel > 0)
                            {
                                intType = oModelsProperties.GetType(intModel);
                            }
                            string strName = "Device " + intCount.ToString();
                            if (intAsset > 0)
                            {
                                string strTempName = oAsset.Get(intAsset, "name");
                                if (strTempName != "")
                                {
                                    strName = strTempName;
                                }
                            }
                            if (intCount == 1)
                            {
                                //strTab += "<td><img src=\"/images/TabOnLeftCap.gif\"></td><td nowrap background=\"/images/TabOnBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOnRightCap.gif\"></td>";
                                oTab.AddTab(strName, "");
                                strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:inline\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"" + oType.Get(intType, "ondemand_steps_path") + "?id=" + oFunction.encryptQueryString(intServer.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                            }
                            else
                            {
                                // strTab += "<td><img src=\"/images/TabOffLeftCap.gif\"></td><td nowrap background=\"/images/TabOffBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOffRightCap.gif\"></td>";
                                oTab.AddTab(strName, "");
                                strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:none\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"" + oType.Get(intType, "ondemand_steps_path") + "?id=" + oFunction.encryptQueryString(intServer.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                            }
                        }

                        strMenuTab1 = oTab.GetTabs();
                        //if (strTab != "")
                        //    strMenuTab1 += "<tr>" + strTab + "<td width=\"100%\" background=\"/images/TabEmptyBackground.gif\">&nbsp;</td></tr>";
                        //strMenuTab1 = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" + strMenuTab1 + "</table>";
                    }
                }
            }
            radStart.Attributes.Add("onclick", "ShowBuildDivs('" + divStart.ClientID + "','" + divDefault.ClientID + "','" + divSchedule.ClientID + "','" + divApproval.ClientID + "');");
            radSchedule.Attributes.Add("onclick", "ShowBuildDivs('" + divSchedule.ClientID + "','" + divDefault.ClientID + "','" + divStart.ClientID + "','" + divApproval.ClientID + "');");
            radApproval.Attributes.Add("onclick", "ShowBuildDivs('" + divApproval.ClientID + "','" + divDefault.ClientID + "','" + divStart.ClientID + "','" + divSchedule.ClientID + "');");
            btnApprovals.Attributes.Add("onclick", "return OpenWindow('DESIGN_APPROVERS','?id=" + intID.ToString() + "');");
        }
コード例 #12
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 **************
                        AccountRequest oAccountRequest = new AccountRequest(intProfile, dsn);
                        Requests       oRequest        = new Requests(intProfile, dsn);
                        Users          oUser           = new Users(intProfile, dsn);
                        DataSet        ds      = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                        Domains        oDomain = new Domains(intProfile, dsn);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string         strUser      = ds.Tables[0].Rows[0]["username"].ToString();
                            int            intDomain    = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                            int            intEnv       = Int32.Parse(oDomain.Get(intDomain, "environment"));
                            int            intUser      = oRequest.GetUser(intRequest);
                            DataSet        dsParameters = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
                            AD             oAD          = new AD(intProfile, dsn, intEnv);
                            Variables      oVariable    = new Variables(intEnv);
                            DirectoryEntry oEntry       = oAD.UserSearch(strUser);
                            if (oEntry != null)
                            {
                                strResult = "<p>The account " + strUser + " already exists in " + oDomain.Get(intDomain, "name") + "</p>";
                            }
                            else
                            {
                                strError = "";
                                Encryption oEncrypt     = new Encryption();
                                string     strFirst     = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                string     strLast      = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                string     strEmail     = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                string     strTechnical = dsParameters.Tables[0].Rows[3]["value"].ToString();
                                string     strPassword  = oEncrypt.Decrypt(dsParameters.Tables[0].Rows[4]["value"].ToString(), "adpass");
                                if (strTechnical == "1")
                                {
                                    strResult = oAD.CreateUser(strUser, strFirst, strLast, strPassword, "", "Created By ClearView on " + DateTime.Today.ToShortDateString() + Environment.NewLine + "Requested by " + oUser.GetFullName(intProfile) + " (" + oUser.GetName(intProfile) + ")", oVariable.UserOUTechnical());
                                    if (strResult == "")
                                    {
                                        strResult = "<p>The account " + strUser + " was successfully created in " + oDomain.Get(intDomain, "name") + " with registry access (Password: "******")</p>";
                                    }
                                }
                                else
                                {
                                    strResult = oAD.CreateUser(strUser, strFirst, strLast, strPassword, "", "Created By ClearView on " + DateTime.Today.ToShortDateString() + Environment.NewLine + "Requested by " + oUser.GetFullName(intProfile) + " (" + oUser.GetName(intProfile) + ")", oVariable.UserOU());
                                    if (strResult == "")
                                    {
                                        strResult = "<p>The account " + strUser + " was successfully created in " + oDomain.Get(intDomain, "name") + " (Password: "******")</p>";
                                    }
                                }
                                string   strGroupsRequested = dsParameters.Tables[0].Rows[5]["value"].ToString();
                                string[] strGroupRequested;
                                char[]   strSplit = { ';' };
                                strGroupRequested = strGroupsRequested.Split(strSplit);
                                // Add Groups
                                for (int ii = 0; ii < strGroupRequested.Length; ii++)
                                {
                                    if (strGroupRequested[ii].Trim() != "")
                                    {
                                        // Add the group
                                        string strJoin = oAD.JoinGroup(strUser, strGroupRequested[ii].Trim(), 0);
                                        if (strJoin == "")
                                        {
                                            strResult += "<p>The user " + strUser + " was successfully joined to the group " + strGroupRequested[ii].Trim() + "</p>";
                                        }
                                        else
                                        {
                                            strError += "<p>The user " + strUser + " was NOT successfully joined to the group " + strGroupRequested[ii].Trim() + " : " + strJoin + "</p>";
                                        }
                                    }
                                }
                                oRequest.AddResult(intRequest, intItem, intNumber, "Account Modification", strError, strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                            }
                        }
                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
コード例 #13
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);
            Log             oLog            = new Log(intProfile, dsn);
            Users           oUser           = new Users(intProfile, dsn);
            Functions       oFunction       = new Functions(intProfile, dsn, intEnvironment);
            Pages           oPage           = new Pages(intProfile, dsn);
            Requests        oRequest        = new Requests(intProfile, dsn);
            Variables       oVariable       = new Variables(intEnvironment);
            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"))
                    {
                        string strResult = oService.GetName(intService) + " Completed";
                        string strError  = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************
                        string           strCVT            = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                        Forecast         oForecast         = new Forecast(intProfile, dsn);
                        ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                        Types            oType             = new Types(intProfile, dsn);
                        DataSet          dsService         = oForecast.GetAnswerService(intRequest);
                        if (dsService.Tables[0].Rows.Count > 0)
                        {
                            int     intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                            int     intModel   = Int32.Parse(dsService.Tables[0].Rows[0]["modelid"].ToString());
                            int     intType    = oModelsProperties.GetType(intModel);
                            string  strExecute = oType.Get(intType, "forecast_execution_path");
                            DataSet dsSelected = oService.GetSelected(intRequest, intService, intNumber);

                            if (oServiceRequest.NotifyApproval(intRequest, intService, intNumber, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                            {
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been fully approved", LoggingType.Debug);
                                Workstations oWorkstation = new Workstations(intProfile, dsn);
                                oWorkstation.ExecuteVMware(intRequest);
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request ExecuteVMware has completed.", LoggingType.Debug);
                            }
                            else
                            {
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been sent for approval", LoggingType.Debug);
                            }
                            //if (strExecute != "")
                            //    btnStart.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                            //else
                            //    btnStart.Attributes.Add("onclick", "alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');return false;");
                            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>";
                        }
                        // ******** END PROCESSING **************
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);

            oFunction = new Functions(intProfile, dsn, intEnvironment);
            oUser     = new Users(intProfile, dsn);
            oRequest  = new Requests(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 strResult = "";
                        string strError  = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************

                        Workstations oWorkstation = new Workstations(intProfile, dsn);
                        DataSet      dsRebuild    = oWorkstation.GetVirtualRebuild(intRequest, intService, intNumber);
                        bool         found        = false;
                        foreach (DataRow drRebuild in dsRebuild.Tables[0].Rows)
                        {
                            if (drRebuild["cancelled"].ToString() == "")
                            {
                                found = true;
                                int intWorkstation = Int32.Parse(drRebuild["workstationid"].ToString());
                                int intName        = Int32.Parse(drRebuild["nameid"].ToString());
                                oWorkstation.UpdateVirtualRebuild(intRequest, intService, intNumber);
                                string strName  = oWorkstation.GetName(intName);
                                string strPower = drRebuild["scheduled"].ToString();
                                strResult += "<p>The workstation " + strName + " was successfully queued for rebuild on " + strPower + "</p>";
                                strError   = "";
                                break;
                            }
                        }
                        if (found == false)
                        {
                            strError = "<p>There was a problem configuring the workstation for rebuild ~ Request not found.</p>";
                        }

                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1, 1);
                    }
                }
            }
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            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 **************
                        Asset    oAsset   = new Asset(intProfile, dsnAsset);
                        Requests oRequest = new Requests(intProfile, dsn);
                        Users    oUser    = new Users(intProfile, dsn);
                        oAsset.UpdateDecommission(intRequest, intItem, intNumber, 1);
                        strResult += "<p>The server(s) were successfully queued for decommission</p>";
                        strError   = "";
                        oRequest.AddResult(intRequest, intItem, intNumber, "Server Decommission", strError, strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intProfile));
                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            RequestItems    oRequestItem     = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField    = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest  = new ServiceRequests(intProfile, dsn);
            Services        oService         = new Services(intProfile, dsn);
            ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn);
            Log             oLog             = new Log(intProfile, dsn);
            Users           oUser            = new Users(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 strWorkflowTitle = oService.Get(intService, "workflow_title");
                        string strResult        = (strWorkflowTitle == "" ? oService.GetName(intService) : strWorkflowTitle) + " Completed";
                        string strError         = (strWorkflowTitle == "" ? oService.GetName(intService) : strWorkflowTitle) + " Error";
                        // ********* BEGIN PROCESSING **************
                        double dblHours   = 0.00;
                        int    intDevices = 1;
                        Field  oField     = new Field(intProfile, dsn);
                        string strTable   = oField.GetTableName2(intService);
                        if (strTable != "")
                        {
                            DataSet ds = oField.GetTableServiceRequest(strTable, intRequest.ToString(), intItem.ToString(), intNumber.ToString());
                            if (ds.Tables[0].Columns.Contains("hours") == true)
                            {
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    dblHours += double.Parse(dr["hours"].ToString());
                                }
                            }
                            if (ds.Tables[0].Columns.Contains("devices") == true)
                            {
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    intDevices += Int32.Parse(dr["devices"].ToString());
                                }
                            }
                        }
                        if (oService.Get(intService, "quantity_is_device") == "1")
                        {
                            DataSet dsTemp = oService.GetSelected(intRequest, intService);
                            if (dsTemp.Tables[0].Rows.Count > 0)
                            {
                                intDevices = Int32.Parse(dsTemp.Tables[0].Rows[0]["quantity"].ToString());
                            }
                        }
                        string strCVT      = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                        int    intResource = oServiceRequest.AddRequest(intRequest, intItem, intService, intDevices, dblHours, 2, intNumber, dsnServiceEditor);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been submitted by " + oUser.GetFullNameWithLanID(intProfile), LoggingType.Debug);
                        if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                        {
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been fully approved", LoggingType.Debug);
                            oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Service request NotifyTeamLead has completed.", LoggingType.Debug);
                        }
                        else
                        {
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been sent for approval", LoggingType.Debug);
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + strResult + "</span></p>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> " + strError + "</span></p>";
                            }
                            else
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + (strWorkflowTitle == "" ? oService.GetName(intService) : strWorkflowTitle) + " Submitted</span></p>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
コード例 #17
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;
                        StringBuilder sbResult    = new StringBuilder(oService.GetName(intService) + " Completed");
                        StringBuilder sbError     = new StringBuilder(oService.GetName(intService) + " Error");

                        // ********* BEGIN PROCESSING **************
                        AccountRequest oAccountRequest = new AccountRequest(intProfile, dsn);
                        Requests       oRequest        = new Requests(intProfile, dsn);
                        Users          oUser           = new Users(intProfile, dsn);
                        DataSet        ds      = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                        Domains        oDomain = new Domains(intProfile, dsn);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string         strUser      = ds.Tables[0].Rows[0]["username"].ToString();
                            int            intDomain    = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                            int            intEnv       = Int32.Parse(oDomain.Get(intDomain, "environment"));
                            int            intUser      = oRequest.GetUser(intRequest);
                            DataSet        dsParameters = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
                            AD             oAD          = new AD(intProfile, dsn, intEnv);
                            DirectoryEntry oEntry       = oAD.UserSearch(strUser);

                            if (oEntry == null)
                            {
                                sbResult = new StringBuilder();
                            }
                            else
                            {
                                sbError = new StringBuilder();

                                string strFirstOld = "";
                                if (oEntry.Properties.Contains("givenname") == true)
                                {
                                    strFirstOld = oEntry.Properties["givenname"].Value.ToString();
                                }
                                string strLastOld = "";
                                if (oEntry.Properties.Contains("sn") == true)
                                {
                                    strLastOld = oEntry.Properties["sn"].Value.ToString();
                                }
                                string strFirstNew        = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                string strLastNew         = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                string strEnable          = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                string strUnlock          = dsParameters.Tables[0].Rows[3]["value"].ToString();
                                string strGroupsRequested = dsParameters.Tables[0].Rows[4]["value"].ToString();
                                if (strFirstOld != strFirstNew || strLastOld != strLastNew)
                                {
                                    if (strFirstOld != strFirstNew && strLastOld != strLastNew)
                                    {
                                        oEntry.Properties["givenname"].Value   = strFirstNew;
                                        oEntry.Properties["sn"].Value          = strLastNew;
                                        oEntry.Properties["displayname"].Value = strLastNew + ", " + strFirstNew;
                                        oEntry.CommitChanges();
                                        sbResult.Append("<p>The first name and last name for account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully updated</p>");
                                    }
                                    else if (strFirstOld != strFirstNew)
                                    {
                                        oEntry.Properties["givenname"].Value   = strFirstNew;
                                        oEntry.Properties["displayname"].Value = strLastNew + ", " + strFirstNew;
                                        oEntry.CommitChanges();
                                        sbResult.Append("<p>The first name for account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully updated</p>");
                                    }
                                    else
                                    {
                                        oEntry.Properties["sn"].Value          = strLastNew;
                                        oEntry.Properties["displayname"].Value = strLastNew + ", " + strFirstNew;
                                        oEntry.CommitChanges();
                                        sbResult.Append("<p>The last name for account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully updated</p>");
                                    }
                                }
                                if (strEnable == "1")
                                {
                                    strEnable = oAD.Enable(oEntry, true);
                                    if (strEnable == "")
                                    {
                                        sbResult.Append("<p>The user account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully enabled</p>");
                                    }
                                    else
                                    {
                                        sbError.Append("<p>The user account ");
                                        sbError.Append(strUser);
                                        sbError.Append(" was NOT successfully enabled</p>");
                                    }
                                }
                                if (strUnlock == "1")
                                {
                                    strUnlock = oAD.Unlock(oEntry);
                                    if (strUnlock == "")
                                    {
                                        sbResult.Append("<p>The user account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully unlocked</p>");
                                    }
                                    else
                                    {
                                        sbError.Append("<p>The user account ");
                                        sbError.Append(strUser);
                                        sbError.Append(" was NOT successfully unlocked</p>");
                                    }
                                }

                                string   strGroupsExist = oAD.GetGroups(oEntry);
                                string[] strGroupRequested;
                                string[] strGroupExist;
                                char[]   strSplit = { ';' };
                                strGroupRequested = strGroupsRequested.Split(strSplit);
                                strGroupExist     = strGroupsExist.Split(strSplit);

                                // Add Groups
                                for (int ii = 0; ii < strGroupRequested.Length; ii++)
                                {
                                    if (strGroupRequested[ii].Trim() != "")
                                    {
                                        bool boolExist = false;
                                        for (int jj = 0; jj < strGroupExist.Length; jj++)
                                        {
                                            if (strGroupExist[jj].Trim() != "" && strGroupRequested[ii].Trim() == strGroupExist[jj].Trim())
                                            {
                                                boolExist = true;
                                                break;
                                            }
                                        }
                                        if (boolExist == false)
                                        {
                                            // Add the group
                                            string strJoin = oAD.JoinGroup(strUser, strGroupRequested[ii].Trim(), 0);
                                            if (strJoin == "")
                                            {
                                                sbResult.Append("<p>The user ");
                                                sbResult.Append(strUser);
                                                sbResult.Append(" was successfully joined to the group ");
                                                sbResult.Append(strGroupRequested[ii].Trim());
                                                sbResult.Append("</p>");
                                            }
                                            else
                                            {
                                                sbError.Append("<p>The user ");
                                                sbError.Append(strUser);
                                                sbError.Append(" was NOT successfully joined to the group ");
                                                sbError.Append(strGroupRequested[ii].Trim());
                                                sbError.Append(" : ");
                                                sbError.Append(strJoin);
                                                sbError.Append("</p>");
                                            }
                                        }
                                    }
                                }
                                // Remove Groups
                                for (int ii = 0; ii < strGroupExist.Length; ii++)
                                {
                                    if (strGroupExist[ii].Trim() != "")
                                    {
                                        bool boolExist = false;
                                        for (int jj = 0; jj < strGroupRequested.Length; jj++)
                                        {
                                            if (strGroupRequested[jj].Trim() != "" && strGroupExist[ii].Trim() == strGroupRequested[jj].Trim())
                                            {
                                                boolExist = true;
                                                break;
                                            }
                                        }
                                        if (boolExist == false)
                                        {
                                            // Remove the group
                                            string strJoin = oAD.RemoveGroup(strUser, strGroupExist[ii].Trim());
                                            if (strJoin == "")
                                            {
                                                sbResult.Append("<p>The user ");
                                                sbResult.Append(strUser);
                                                sbResult.Append(" was successfully removed from the group ");
                                                sbResult.Append(strGroupExist[ii].Trim());
                                                sbResult.Append("</p>");
                                            }
                                            else
                                            {
                                                sbError.Append("<p>The user ");
                                                sbError.Append(strUser);
                                                sbError.Append(" was NOT successfully removed from the group ");
                                                sbError.Append(strGroupExist[ii].Trim());
                                                sbError.Append(" : ");
                                                sbError.Append(strJoin);
                                                sbError.Append("</p>");
                                            }
                                        }
                                    }
                                }
                                oRequest.AddResult(intRequest, intItem, intNumber, "Account Modification", sbError.ToString(), sbResult.ToString(), intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                            }
                        }

                        if (sbResult.ToString() == "")
                        {
                            boolSuccess = false;
                        }

                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + sbResult.ToString() + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + sbError.ToString() + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
コード例 #18
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 **************
                        AccountRequest oAccountRequest = new AccountRequest(intProfile, dsn);
                        Requests       oRequest        = new Requests(intProfile, dsn);
                        Users          oUser           = new Users(intProfile, dsn);
                        DataSet        ds      = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                        Domains        oDomain = new Domains(intProfile, dsn);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string         strUser   = ds.Tables[0].Rows[0]["username"].ToString();
                            int            intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                            int            intEnv    = Int32.Parse(oDomain.Get(intDomain, "environment"));
                            int            intUser   = oRequest.GetUser(intRequest);
                            AD             oAD       = new AD(intProfile, dsn, intEnv);
                            DirectoryEntry oEntry    = oAD.UserSearch(strUser);
                            if (oEntry == null)
                            {
                                strResult = "";
                            }
                            else
                            {
                                if (oAD.IsLocked(oEntry) == true)
                                {
                                    strResult = oAD.Unlock(oEntry);
                                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Unlock", strResult, "Account " + strUser + " was successfully unlocked", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                                    if (strResult == "")
                                    {
                                        strResult = "<p>Account " + strUser + " was unlocked</p>";
                                    }
                                }
                                else
                                {
                                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Unlock", "", "Account " + strUser + " was not locked", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                                    strResult = "<p>Account " + strUser + " was not locked</p>";
                                }
                            }
                        }
                        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);
                    }
                }
            }
        }
コード例 #19
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    = int.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;
                        StringBuilder sbResult    = new StringBuilder(oService.GetName(intService) + " Completed");
                        string        strError    = oService.GetName(intService) + " Error";

                        // ********* BEGIN PROCESSING **************
                        Restart oRestart = new Restart(0, dsn);
                        Scripts oScript  = new Scripts(0, dsn);
                        DataSet ds       = oRestart.GetRequests(intRequest);
                        sbResult = new StringBuilder();

                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            string strName    = dr["name"].ToString();
                            string strSeconds = "30";
                            oRestart.DeleteRequest(Int32.Parse(dr["id"].ToString()));
                            StringBuilder sbScript = new StringBuilder();
                            sbScript.Append("Dim objShell\r\n");
                            sbScript.Append("Set objShell = CreateObject(\"WScript.Shell\")\r\n");
                            sbScript.Append("objShell.Run(\"cmd.exe /c shutdown -r -m \\\\");
                            sbScript.Append(strName);
                            sbScript.Append(" -t ");
                            sbScript.Append(strSeconds);
                            sbScript.Append(" -f\")\r\n");
                            sbScript.Append("Set objShell = Nothing\r\n");

                            oScript.Add(sbScript.ToString(), Int32.Parse(dr["environment"].ToString()));

                            sbResult.Append(strName);
                            sbResult.Append(" was successfully sent a restart request");
                        }

                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + sbResult.ToString() + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }

                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }