Esempio n. 1
0
        private bool LoadStatus(int _resourceid)
        {
            bool    boolRed  = false;
            DataSet dsStatus = oResourceRequest.GetStatuss(_resourceid);

            rptStatus.DataSource = dsStatus;
            rptStatus.DataBind();
            lblNoStatus.Visible = (rptStatus.Items.Count == 0);
            double dblTotalStatus = 0.00;

            foreach (RepeaterItem ri in rptStatus.Items)
            {
                Label _status = (Label)ri.FindControl("lblStatus");
                if (boolRed == false && _status.Text == "1")
                {
                    boolRed = true;
                }
                double dblStatus = double.Parse(_status.Text);
                if (dblTotalStatus == 0.00)
                {
                    dblTotalStatus = dblStatus;
                }
                _status.Text = oResourceRequest.GetStatus(dblStatus, 50, 15);
            }
            lblStatus.Text = oResourceRequest.GetStatus(dblTotalStatus, 50, 15);
            return(boolRed);
        }
Esempio n. 2
0
        public string GetBody(int _requestid, int _itemid, int _number, int _serviceid, int _rrid, int _rr_workflowid, string _se_dsn, int _environment, string _dsn_asset, string _dsn_ip)
        {
            string              strView              = "";
            Applications        oApplication         = new Applications(user, dsn);
            RequestItems        oRequestItem         = new RequestItems(user, dsn);
            ResourceRequest     oResourceRequest     = new ResourceRequest(user, dsn);
            Users               oUser                = new Users(user, dsn);
            Services            oService             = new Services(user, dsn);
            Variables           oVariable            = new Variables(_environment);
            Functions           oFunction            = new Functions(0, dsn, _environment);
            Requests            oRequest             = new Requests(user, dsn);
            Projects            oProject             = new Projects(user, dsn);
            ServiceRequests     oServiceRequest      = new ServiceRequests(user, dsn);
            ServiceEditor       oServiceEditor       = new ServiceEditor(user, _se_dsn);
            Servers             oServer              = new Servers(user, dsn);
            Workstations        oWorkstation         = new Workstations(user, dsn);
            AssetOrder          oAssetOrder          = new AssetOrder(user, dsn, _dsn_asset, _environment);
            AssetSharedEnvOrder oAssetSharedEnvOrder = new AssetSharedEnvOrder(user, dsn, _dsn_asset, _environment);
            PNCTasks            oPNCTask             = new PNCTasks(user, dsn);
            TSM          oTSM         = new TSM(user, dsn);
            StatusLevels oStatusLevel = new StatusLevels();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


                    if (sbViewRequest.ToString() == "")
                    {
                        //strViewRequest = "Information Unavailable";
                        sbViewRequest.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                    }
                    else
                    {
                        if (sbViewRequest.ToString().Trim().StartsWith("<table") == false)
                        {
                            sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">");
                            sbViewRequest.Append("</table>");
                        }
                    }
                }
                catch
                {
                    sbViewRequest = new StringBuilder("&nbsp;&nbsp;** WARNING: Information Unavailable (# " + strCatch + ") **&nbsp;&nbsp;");
                }
                sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\"><tr><td>");
                sbViewRequest.Append("</td></tr></table>");
                strView += "<br/>" + sbViewRequest.ToString();
            }
            return(strView);
        }
Esempio n. 3
0
        protected void LoopRepeater(string _sort, int _start)
        {
            if (_start > ds.Tables[0].Rows.Count)
            {
                _start = 0;
            }
            intRecordStart = _start + 1;

            //Check if new request
            DataColumn oColumn;

            oColumn            = new DataColumn();
            oColumn.DataType   = System.Type.GetType("System.String");
            oColumn.ColumnName = "new";
            ds.Tables[0].Columns.Add(oColumn);
            DataView dv = ds.Tables[0].DefaultView;

            if (Request.QueryString["sort"] != null)
            {
                try
                {
                    dv.Sort = Request.QueryString["sort"];
                }
                catch { }
            }
            int intCount = _start + intRecords;

            if (dv.Count < intCount)
            {
                intCount = dv.Count;
            }
            int ii = 0;

            lblRecords.Text = "Requests " + intRecordStart.ToString() + " - " + intCount.ToString() + " of " + dv.Count.ToString();
            for (ii = 0; ii < _start; ii++)
            {
                dv[0].Delete();
            }
            int intTotalCount = (dv.Count - intRecords);

            for (ii = 0; ii < intTotalCount; ii++)
            {
                dv[intRecords].Delete();
            }

            foreach (DataRowView dr in dv)
            {
                dr["new"] = IsNewWorkflowRequest(dr).ToString();
            }

            rptView.DataSource = dv;
            rptView.DataBind();
            Functions oFunction = new Functions(0, dsn, intEnvironment);

            foreach (RepeaterItem ri in rptView.Items)
            {
                Label _number = (Label)ri.FindControl("lblNumber");
                if (_number.Text == "")
                {
                    _number.Text = "<i>To Be Determined...</i>";
                }
                Label  _status   = (Label)ri.FindControl("lblColor");
                string strStatus = _status.Text;
                int    intGreen  = 0;
                Int32.TryParse(strStatus.Substring(0, strStatus.IndexOf("_")), out intGreen);
                strStatus = strStatus.Substring(strStatus.IndexOf("_") + 1);
                int intYellow = 0;
                Int32.TryParse(strStatus.Substring(0, strStatus.IndexOf("_")), out intYellow);
                strStatus = strStatus.Substring(strStatus.IndexOf("_") + 1);
                int intRed = 0;
                Int32.TryParse(strStatus, out intRed);
                strStatus = "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">";
                if (intRed > 0)
                {
                    strStatus += "<tr><td>" + oFunction.GetBox("FF0000", 15, 8) + "</td>" + (intRed > 1 ? "<td> (" + intRed.ToString() + ")</td>" : "") + "</tr>";
                }
                if (intYellow > 0)
                {
                    strStatus += "<tr><td>" + oFunction.GetBox("FFFF00", 15, 8) + "</td>" + (intYellow > 1 ? "<td> (" + intYellow.ToString() + ")</td>" : "") + "</tr>";
                }
                if (intGreen > 0)
                {
                    strStatus += "<tr><td>" + oFunction.GetBox("00FF00", 15, 8) + "</td>" + (intGreen > 1 ? "<td> (" + intGreen.ToString() + ")</td>" : "") + "</tr>";
                }
                strStatus   += "</table>";
                _status.Text = strStatus;
                // Actual Status
                Label lblStatus          = (Label)ri.FindControl("lblStatus");
                int   intRRID            = Int32.Parse(lblStatus.Text);
                List <WorkflowStatus> RR = oResourceRequest.GetStatus(null, intRRID, null, null, null, null, false, dsnServiceEditor);
                if (RR.Count > 0)
                {
                    lblStatus.Text = RR[0].status;
                }
                else
                {
                    lblStatus.Text = "---";
                }
            }
            lblNone.Visible = (rptView.Items.Count == 0);
            _start++;
        }
        private string GetSummary(int _requestid, int _serviceid, int _number)
        {
            Users           oUser           = new Users(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            Applications    oApplication    = new Applications(intProfile, dsn);
            StringBuilder   sbSummary       = new StringBuilder();
            DataSet         ds       = oResourceRequest.GetRequestService(_requestid, _serviceid, _number);
            int             intCount = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                intCount++;
                int           intResource  = Int32.Parse(dr["id"].ToString());
                double        dblAllocated = double.Parse(dr["allocated"].ToString());
                double        dblUsed      = oResourceRequest.GetWorkflowUsed(intResource);
                DataSet       dsStatus     = oResourceRequest.GetStatuss(intResource);
                string        strStatus    = "";
                StringBuilder sbStatuses   = new StringBuilder();
                bool          boolChange   = false;
                foreach (DataRow drStatus in dsStatus.Tables[0].Rows)
                {
                    double dblStatus = double.Parse(drStatus["status"].ToString());
                    strStatus = oResourceRequest.GetStatus(dblStatus, 30, 15);
                    if (boolChange == true)
                    {
                        sbStatuses.Append("<tr>");
                    }
                    else
                    {
                        sbStatuses.Append("<tr bgcolor=\"#F6F6F6\">");
                    }
                    sbStatuses.Append("<td nowrap valign=\"top\" align=\"center\">");
                    sbStatuses.Append(oResourceRequest.GetStatus(dblStatus, 30, 10));
                    sbStatuses.Append("</td>");
                    sbStatuses.Append("<td nowrap valign=\"top\" align=\"center\">");
                    sbStatuses.Append(DateTime.Parse(drStatus["modified"].ToString()).ToShortDateString());
                    sbStatuses.Append("</td>");
                    sbStatuses.Append("<td width=\"100%\" valign=\"top\">");
                    sbStatuses.Append(drStatus["comments"].ToString());
                    sbStatuses.Append("</td>");
                    sbStatuses.Append("</tr>");
                    boolChange = !boolChange;
                }
                if (sbStatuses.ToString() != "")
                {
                    sbStatuses.Insert(0, "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\"><tr bgcolor=\"#EEEEEE\"><td>&nbsp;</td><td><b><u>Date:</u></b></td><td><b><u>Comments:</u></b></td></tr>");
                    sbStatuses.Append("</table>");
                }
                double dblProgress = 0.00;
                if (dblAllocated > 0.00)
                {
                    dblProgress = (dblUsed / dblAllocated) * 100.00;
                }
                sbSummary.Append("<tr>");
                sbSummary.Append("<td><img src=\"/images/resource_people.gif\" border=\"0\" align=\"absmiddle\"></td>");
                int intUser = Int32.Parse(dr["userid"].ToString());
                sbSummary.Append("<td>");
                sbSummary.Append(intUser > 0 ? oUser.GetFullName(intUser) : "Pending Assignment");
                sbSummary.Append("</td>");
                sbSummary.Append("<td>");
                sbSummary.Append(oApplication.GetName(oRequestItem.GetItemApplication(Int32.Parse(dr["itemid"].ToString()))));
                sbSummary.Append("</td>");
                sbSummary.Append("<td nowrap align=\"center\">");
                sbSummary.Append(intUser > 0 ? strStatus : "---");
                sbSummary.Append("</td>");
                sbSummary.Append("<td nowrap width=\"100\">");
                sbSummary.Append(intUser > 0 ? oServiceRequest.GetStatusBar(dblProgress, "100", "14", true) : "---");
                sbSummary.Append("</td>");
                sbSummary.Append("<td width=\"1\" nowrap><a href=\"javascript:void(0);\" onclick=\"ShowHide('div");
                sbSummary.Append(intCount.ToString());
                sbSummary.Append("');\">[Details]</a></td>");
                sbSummary.Append("</tr>");
                sbSummary.Append("<tr>");
                sbSummary.Append("<td colspan=\"6\">");
                sbSummary.Append("<div id=\"div");
                sbSummary.Append(intCount.ToString());
                sbSummary.Append("\" style=\"display:none\">");
                sbSummary.Append(sbStatuses.ToString());
                sbSummary.Append("</div>");
                sbSummary.Append("</td>");
                sbSummary.Append("</tr>");
            }

            sbSummary.Insert(0, "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\"><tr><td></td><td><b><u>Technician:</u></b></td><td><b><u>Department:</u></b></td><td align=\"center\"><b><u>Status:</u></b></td><td><b><u>Progress:</u></b></td><td></td></tr>");
            sbSummary.Append("</table>");

            return(sbSummary.ToString());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint        = new DataPoint(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oWorkstation      = new Workstations(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oZeus             = new Zeus(intProfile, dsnZeus);
            oLog             = new Log(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);

            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                    //      -100: More than one device name
                    //       -10: No device names
                    //        -5: Improper Name Format
                    //        -1: ServerID = 0
                    if (Request.QueryString["error"] == "-100")
                    {
                        lblError.Text = "More than one name";
                    }
                    else if (Request.QueryString["error"] == "-10")
                    {
                        lblError.Text = "User Cancelled Prompt";
                    }
                    else if (Request.QueryString["error"] == "-5")
                    {
                        lblError.Text = "Name is in Incorrect Format";
                    }
                    else if (Request.QueryString["error"] == "-1")
                    {
                        lblError.Text = "DeviceID = 0";
                    }
                    else
                    {
                        lblError.Text = "Generic Error";
                    }
                }
                Int32.TryParse(oFunction.decryptQueryString(Request.QueryString["id"]), out intID);
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (intID > 0)
                {
                    DataSet ds = oDataPoint.GetAsset(intID);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information
                        intAsset        = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        lblAssetID.Text = "#" + intAsset.ToString();
                        string strSerial = ds.Tables[0].Rows[0]["serial"].ToString();
                        string strAsset  = ds.Tables[0].Rows[0]["asset"].ToString();

                        string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial);
                        lblHeader.Text    = "&quot;" + strHeader.ToUpper() + "&quot;";
                        Master.Page.Title = "DataPoint | VMware Workstation (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about a VMware Workstation...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);
                        oTab.AddTab("Asset Information", "");
                        oTab.AddTab("Guest Information", "");
                        oTab.AddTab("Account Information", "");
                        oTab.AddTab("Resource Dependencies", "");
                        oTab.AddTab("Provisioning Information", "");
                        if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true)
                        {
                            oTab.AddTab("Administration", "");
                            panAdministration.Visible = true;
                        }
                        strMenuTab1 = oTab.GetTabs();

                        if (!IsPostBack)
                        {
                            // Asset Information
                            oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "WORKSTATION_VMWARE_SERIAL", strSerial, "", false, true);
                            oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "WORKSTATION_VMWARE_ASSET", strAsset, "", false, true);

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

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

                            hdnModel.Value = intModel.ToString();
                            int    intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                            int    intType        = oModel.GetType(intModelParent);
                            string strExecute     = oType.Get(intType, "forecast_execution_path");
                            if (strExecute != "")
                            {
                                DataSet dsVirtual = oWorkstation.GetVirtualAsset(intAsset);
                                if (dsVirtual.Tables[0].Rows.Count > 0)
                                {
                                    btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + dsVirtual.Tables[0].Rows[0]["answerid"].ToString() + "');");
                                }
                                else
                                {
                                    btnExecute.Enabled = false;
                                }
                            }
                            else
                            {
                                btnExecute.Enabled = false;
                            }
                            int intPlatform = oType.GetPlatform(intType);
                            oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "WORKSTATION_VMWARE_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "WORKSTATION_VMWARE_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "WORKSTATION_VMWARE_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true);
                            oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "WORKSTATION_VMWARE_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true);

                            // Get Asset
                            int     intWorkstation = 0;
                            DataSet dsAsset        = oWorkstation.GetVirtualAsset(intAsset);
                            if (dsAsset.Tables[0].Rows.Count > 0)
                            {
                                intWorkstation      = Int32.Parse(dsAsset.Tables[0].Rows[0]["id"].ToString());
                                lblWorkstation.Text = intWorkstation.ToString();
                                txtStep.Text        = dsAsset.Tables[0].Rows[0]["step"].ToString();
                                oDataPoint.LoadTextBoxDeviceName(txtName, btnName, null, true, hdnPNC, intProfile, null, "", lblName, fldName, "WORKSTATION_VMWARE_NAME", dsAsset.Tables[0].Rows[0]["name"].ToString(), "", false, false);
                                if (txtName.Text != "")
                                {
                                    lblHeader.Text += "&nbsp;&nbsp;&nbsp;[" + txtName.Text + "]";
                                }
                                lblStatus.Text = dsAsset.Tables[0].Rows[0]["statusname"].ToString();
                                // Administrative Functions
                                if (Request.QueryString["admin"] != null)
                                {
                                    if (Request.QueryString["result"] != null)
                                    {
                                        strAdministration = "<tr><td>" + oFunction.decryptQueryString(Request.QueryString["result"]) + "</td></tr>";
                                    }
                                    if (Request.QueryString["output"] != null)
                                    {
                                        DataSet dsOutput = oWorkstation.GetVirtualOutput(intWorkstation);
                                        foreach (DataRow drOutput in dsOutput.Tables[0].Rows)
                                        {
                                            strAdministration += "<tr><td><a href=\"javascript:void(0);\" onclick=\"ShowHideDiv2('div" + drOutput["id"].ToString() + "');\">" + drOutput["type"].ToString() + "</a></td></tr>";
                                            strAdministration += "<tr id=\"div" + drOutput["id"].ToString() + "\" style=\"display:none\"><td>" + oFunction.FormatText(drOutput["output"].ToString()) + "</td></tr>";
                                        }
                                        if (lblStatus.Text != "")
                                        {
                                            strAdministration += "<tr><td>" + oLog.GetEvents(oLog.GetEventsByName(txtName.Text.ToUpper(), (int)LoggingType.Error), intEnvironment) + "</td></tr>";
                                        }
                                    }
                                }
                                int intClass = Int32.Parse(dsAsset.Tables[0].Rows[0]["classid"].ToString());
                                int intEnv   = Int32.Parse(dsAsset.Tables[0].Rows[0]["environmentid"].ToString());
                                hdnEnvironment.Value = intEnv.ToString();
                                oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "WORKSTATION_VMWARE_CLASS", "name", "id", oClass.GetWorkstationVMwares(1), intClass, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "WORKSTATION_VMWARE_ENVIRONMENT", "name", "id", oClass.GetEnvironment(intClass, 0), intEnv, false, false, true);
                                ddlStatus.SelectedValue = dsAsset.Tables[0].Rows[0]["status"].ToString();
                                ddlStatus.Enabled       = (intAssetAttribute == (int)AssetAttribute.Ok);
                                panStatus.Visible       = (ddlStatus.Enabled == false);

                                int  intOS    = Int32.Parse(dsAsset.Tables[0].Rows[0]["osid"].ToString());
                                bool boolXP   = (oOperatingSystem.Get(intOS, "code") == "XP");
                                bool boolWin7 = (oOperatingSystem.Get(intOS, "code") == "7");
                                oDataPoint.LoadDropDown(ddlPlatformOS, intProfile, null, "", lblPlatformOS, fldPlatformOS, "WORKSTATION_VMWARE_OS", "name", "id", oOperatingSystem.Gets(1, 1), intOS, false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformServicePack, intProfile, null, "", lblPlatformServicePack, fldPlatformServicePack, "WORKSTATION_VMWARE_SP", "name", "id", oOperatingSystem.GetServicePack(intOS), Int32.Parse(dsAsset.Tables[0].Rows[0]["spid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformDomain, intProfile, null, "", lblPlatformDomain, fldPlatformDomain, "WORKSTATION_VMWARE_DOMAIN", "name", "id", oDomain.Gets(1), Int32.Parse(dsAsset.Tables[0].Rows[0]["domainid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformHDD, intProfile, null, "", lblPlatformHDD, fldPlatformHDD, "WORKSTATION_VMWARE_HDD", "name", "id", oVirtualHDD.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1), Int32.Parse(dsAsset.Tables[0].Rows[0]["hddid"].ToString()), false, false, true);
                                oDataPoint.LoadDropDown(ddlPlatformRam, intProfile, null, "", lblPlatformRam, fldPlatformRam, "WORKSTATION_VMWARE_RAM", "name", "id", oVirtualRam.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1), Int32.Parse(dsAsset.Tables[0].Rows[0]["ramid"].ToString()), false, false, true);
                            }
                            else
                            {
                                Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                            }

                            // Get Host
                            oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(dsAsset.Tables[0].Rows[0]["hostname"].ToString()), lblHostName, fldHostName, "WORKSTATION_VMWARE_HOST", dsAsset.Tables[0].Rows[0]["hostname"].ToString(), "", false, false);
                            if (Request.Cookies["virtual_guest"] != null && Request.Cookies["virtual_guest"].Value != "")
                            {
                                string strHost = "";
                                string strFind = txtName.Text;
                                //strFind = "ohcleapp103d";
                                DateTime datStart = DateTime.Parse(Request.Cookies["virtual_guest"].Value);
                                Response.Cookies["virtual_guest"].Value = "";
                                VMWare         oVMWare    = new VMWare(intProfile, dsn);
                                string         strConnect = oVMWare.Connect(strFind);
                                VimService     _service   = oVMWare.GetService();
                                ServiceContent _sic       = oVMWare.GetSic();
                                try
                                {
                                    ManagedObjectReference oVM         = oVMWare.GetVM(strFind);
                                    ManagedObjectReference oParent     = (ManagedObjectReference)oVMWare.getObjectProperty(oVM, "parent");
                                    ManagedObjectReference oDataCenter = (ManagedObjectReference)oVMWare.getObjectProperty(oParent, "parent");
                                    string    strDataCenter            = (string)oVMWare.getObjectProperty(oDataCenter, "name");
                                    GuestInfo ginfo = (GuestInfo)oVMWare.getObjectProperty(oVM, "guest");
                                    lblGuestState.Text = ginfo.guestState;
                                    GuestNicInfo[] nInfo = ginfo.net;
                                    foreach (GuestNicInfo nic in nInfo)
                                    {
                                        string[] strIPAddresses = nic.ipAddress;
                                        foreach (string strIPAddress in strIPAddresses)
                                        {
                                            if (lblIPAddress.Text != "")
                                            {
                                                lblIPAddress.Text += ", ";
                                            }
                                            lblIPAddress.Text += strIPAddress;
                                        }
                                        if (lblMACAddress.Text != "")
                                        {
                                            lblMACAddress.Text += ", ";
                                        }
                                        lblMACAddress.Text += nic.macAddress;
                                        if (lblNetwork.Text != "")
                                        {
                                            lblNetwork.Text += ", ";
                                        }
                                        lblNetwork.Text += nic.network;
                                    }
                                    // HDD
                                    GuestDiskInfo[] oVMDisks = ginfo.disk;
                                    foreach (GuestDiskInfo oDisk in oVMDisks)
                                    {
                                        if (lblHDD.Text != "")
                                        {
                                            lblHDD.Text += "<br/>";
                                        }
                                        double dblCapacity = double.Parse(oDisk.capacity.ToString());
                                        dblCapacity = dblCapacity / 1024.00;
                                        dblCapacity = dblCapacity / 1024.00;
                                        dblCapacity = dblCapacity / 1024.00;
                                        double dblAvailable = double.Parse(oDisk.freeSpace.ToString());
                                        dblAvailable = dblAvailable / 1024.00;
                                        dblAvailable = dblAvailable / 1024.00;
                                        dblAvailable = dblAvailable / 1024.00;
                                        lblHDD.Text += oDisk.diskPath + "&nbsp;&nbsp;" + dblCapacity.ToString("F") + " GB (" + dblAvailable.ToString("F") + " GB available)";
                                    }
                                    // Status
                                    VirtualMachineSummary oVMSummary = (VirtualMachineSummary)oVMWare.getObjectProperty(oVM, "summary");
                                    ManagedEntityStatus   oVMStatus  = oVMSummary.overallStatus;

                                    //lblOverallStatus.Text = (string)oVMStatus;
                                    lblOverallStatus.Text = Enum.GetName(typeof(ManagedEntityStatus), (ManagedEntityStatus)oVMStatus);
                                    // RAM & CPUs & Host
                                    VirtualMachineConfigSummary oVMConfig = oVMSummary.config;
                                    lblRAM.Text  = oVMConfig.memorySizeMB.ToString();
                                    lblCPUs.Text = oVMConfig.numCpu.ToString();
                                    VirtualMachineRuntimeInfo oVMRuntime = oVMSummary.runtime;
                                    ManagedObjectReference    oVMHost    = oVMRuntime.host;
                                    strHost = (string)oVMWare.getObjectProperty(oVMHost, "name");
                                    if (strHost.IndexOf(".") > -1)
                                    {
                                        strHost = strHost.Substring(0, strHost.IndexOf("."));
                                    }
                                    lblVirtualCenter.Text = oVMWare.VirtualCenter();
                                    lblDataCenter.Text    = oVMWare.DataCenter();
                                }
                                catch { }
                                finally
                                {
                                    if (_service != null)
                                    {
                                        _service.Abort();
                                        if (_service.Container != null)
                                        {
                                            _service.Container.Dispose();
                                        }
                                        try
                                        {
                                            _service.Logout(_sic.sessionManager);
                                        }
                                        catch { }
                                        _service.Dispose();
                                        _service = null;
                                        _sic     = null;
                                    }
                                }

                                if (strHost != "")
                                {
                                    panGuestYes.Visible = true;
                                    oDataPoint.LoadTextBox(txtHostName, intProfile, btnHostName, "/datapoint/asset/server.aspx?t=name&q=" + oFunction.encryptQueryString(strHost), lblHostName, fldHostName, "WORKSTATION_VMWARE_HOST", strHost, "", false, false);
                                }
                                else
                                {
                                    panGuestNo.Visible = true;
                                }
                                TimeSpan oSpan = DateTime.Now.Subtract(datStart);
                                btnGuestQuery.Enabled = false;
                                btnGuestQuery.Text    = "Query Time: " + oSpan.TotalSeconds.ToString("0") + " seconds...";
                            }
                            oDataPoint.LoadPanel(panGuestQuery, intProfile, fldHostQuery, "WORKSTATION_VMWARE_HOST_QUERY");

                            // Account Information
                            DataSet dsAccounts = oWorkstation.GetAccountsVMware(intWorkstation);
                            rptAccounts.DataSource = dsAccounts;
                            rptAccounts.DataBind();
                            lblNone.Visible = (rptAccounts.Items.Count == 0);

                            // Resource Dependencies
                            rptServiceRequests.DataSource = ds.Tables[1];
                            rptServiceRequests.DataBind();
                            trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0);
                            foreach (RepeaterItem ri in rptServiceRequests.Items)
                            {
                                Label lblRequestID = (Label)ri.FindControl("lblRequestID");
                                Label lblServiceID = (Label)ri.FindControl("lblServiceID");
                                Label lblNumber    = (Label)ri.FindControl("lblNumber");
                                int   intService   = Int32.Parse(lblServiceID.Text);
                                Label lblDetails   = (Label)ri.FindControl("lblDetails");
                                Label lblProgress  = (Label)ri.FindControl("lblProgress");

                                if (lblProgress.Text == "")
                                {
                                    lblProgress.Text = "<i>Unavailable</i>";
                                }
                                else
                                {
                                    int intResource = Int32.Parse(lblProgress.Text);
                                    //lblProgress.Text = oResourceRequest.GetStatus(Int32.Parse(lblRequestID.Text), Int32.Parse(lblServiceID.Text), Int32.Parse(lblNumber.Text), true, true, dsnServiceEditor, dsnAsset, intServiceDecommission);
                                    lblProgress.Text = oResourceRequest.GetStatus(null, null, Int32.Parse(lblRequestID.Text), Int32.Parse(lblServiceID.Text), null, Int32.Parse(lblNumber.Text), true, dsnServiceEditor)[0].status;

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

                            // Provioning History
                            rptHistory.DataSource = SqlHelper.ExecuteDataset(dsnAsset, CommandType.Text, oDataPoint.AssetHistorySelect(intAsset));
                            rptHistory.DataBind();
                            lblHistory.Visible = (rptHistory.Items.Count == 0);
                            oDataPoint.LoadPanel(panProvisioning, intProfile, fldProvisioning, "WORKSTATION_VMWARE_STATUS");
                        }
                    }
                    else
                    {
                        if (Request.QueryString["t"] != null && Request.QueryString["q"] != null)
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0");
                        }
                        else
                        {
                            Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                        }
                    }
                }
                else if (Request.QueryString["q"] != null && Request.QueryString["q"] != "")
                {
                    string  strQuery = oFunction.decryptQueryString(Request.QueryString["q"]);
                    DataSet ds       = oDataPoint.GetAssetName(strQuery, intID, 0, "", "", 0);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        intAsset = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());
                        Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()));
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx");
                }
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnName.Attributes.Add("onclick", "return OpenWindow('DEVICE_NAME','?assetid=" + intAsset.ToString() + "');");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation("ProcessControlButton()"));
                ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);");
                ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
                btnGuestQuery.Attributes.Add("onclick", "ProcessButton(this,'Querying... please be patient...','225') && ProcessControlButton();");
                btnOutput.Attributes.Add("onclick", "return ProcessButton(this) && ProcessControlButton();");
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     AuthenticateUser();
     intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
     oResourceRequest = new ResourceRequest(intProfile, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         if (!IsPostBack)
         {
             int intId = Int32.Parse(Request.QueryString["id"]);
             if (Request.QueryString["type"] == "t")
             {
                 panTPMPC.Visible = true;
                 dsStatus         = oResourceRequest.GetStatusTPM(intId);
                 if (dsStatus.Tables[0].Rows.Count > 0)
                 {
                     double dblScope    = double.Parse(dsStatus.Tables[0].Rows[0]["scope"].ToString());
                     double dblTimeline = double.Parse(dsStatus.Tables[0].Rows[0]["timeline"].ToString());
                     double dblBudget   = double.Parse(dsStatus.Tables[0].Rows[0]["budget"].ToString());
                     if (dblTimeline > 0.00)
                     {
                         panTPM.Visible   = true;
                         lblScope.Text    = oResourceRequest.GetStatus(dblScope, 75, 15);
                         lblTimeline.Text = oResourceRequest.GetStatus(dblTimeline, 75, 15);
                         lblBudget.Text   = oResourceRequest.GetStatus(dblBudget, 75, 15);
                         lblScopeD.Text   = DateTime.Parse(dsStatus.Tables[0].Rows[0]["datestamp"].ToString()).ToShortDateString();
                     }
                     else
                     {
                         panPC.Visible     = true;
                         lblVariance.Text  = oResourceRequest.GetStatus(dblScope, 75, 15);
                         lblVarianceD.Text = DateTime.Parse(dsStatus.Tables[0].Rows[0]["datestamp"].ToString()).ToShortDateString();
                     }
                     txtComments.Text = dsStatus.Tables[0].Rows[0]["comments"].ToString();
                     txtThis.Text     = dsStatus.Tables[0].Rows[0]["thisweek"].ToString();
                     txtNext.Text     = dsStatus.Tables[0].Rows[0]["nextweek"].ToString();
                     btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
                     if (dblScope == 3.00 && dblTimeline == 3.00 && dblBudget == 3.00)
                     {
                         btnSubmit.Attributes.Add("onclick", "return ValidateText('" + txtThis.ClientID + "','Please enter some information for this weeks accomplishments')" +
                                                  " && ValidateText('" + txtNext.ClientID + "','Please enter some information for next weeks accomplishments')" +
                                                  ";");
                     }
                     else
                     {
                         btnSubmit.Attributes.Add("onclick", "return ValidateText('" + txtThis.ClientID + "','Please enter some information for this weeks accomplishments')" +
                                                  " && ValidateText('" + txtNext.ClientID + "','Please enter some information for next weeks accomplishments')" +
                                                  " && ValidateText('" + txtComments.ClientID + "','Please enter some comments')" +
                                                  ";");
                     }
                 }
             }
             if (Request.QueryString["type"] == "r")
             {
                 panResource.Visible = true;
                 dsStatus            = oResourceRequest.GetStatus(intId);
                 if (dsStatus.Tables[0].Rows.Count > 0)
                 {
                     lblStatus.Text    = oResourceRequest.GetStatus(double.Parse(dsStatus.Tables[0].Rows[0]["status"].ToString()), 75, 15);
                     lblComments2.Text = dsStatus.Tables[0].Rows[0]["comments"].ToString();
                 }
             }
         }
     }
 }
        protected void dlServices_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView drv = (DataRowView)e.Item.DataItem;

                LinkButton lnkRequestId = (LinkButton)e.Item.FindControl("lnkRequestId");
                lnkRequestId.Text = drv["ReqServiceNumber"].ToString();

                if (drv["automate"].ToString() != "1")
                {
                    lnkRequestId.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(drv["ResourceRequestID"].ToString()) + "', '800', '600');");
                }
                else
                {
                    lnkRequestId.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/request.aspx?t=" + oFunction.encryptQueryString(drv["RequestNumber"].ToString()) + " &q=" + oFunction.encryptQueryString(drv["RequestNumber"].ToString()) + " ', '800', '600');");
                }


                LinkButton lnkServiceName = (LinkButton)e.Item.FindControl("lnkServiceName");
                lnkServiceName.Text    = drv["ServiceName"].ToString();
                lnkServiceName.ToolTip = drv["ServiceId"].ToString();
                lnkServiceName.Attributes.Add("onclick", "return OpenWindow('SERVICES_DETAIL','?sid=" + drv["ServiceId"].ToString() + "');");


                Label lblServiceSubmitted = (Label)e.Item.FindControl("lblServiceSubmitted");
                lblServiceSubmitted.Text    = (drv["RequestSubmitted"] != DBNull.Value ? DateTime.Parse(drv["RequestSubmitted"].ToString()).ToShortDateString() : "");
                lblServiceSubmitted.ToolTip = drv["RequestSubmitted"].ToString();

                //Get the Progress
                Label lblServiceProgress = (Label)e.Item.FindControl("lblServiceProgress");
                Label lblServiceStatus   = (Label)e.Item.FindControl("lblServiceStatus");
                if (drv["Automate"] != DBNull.Value && drv["Automate"].ToString() == "1")
                {
                    lblServiceProgress.Text = oServiceRequest.GetStatusBarIn(100.00, "100", "12", true);
                    lblServiceStatus.Text   = "Complete";
                }
                else
                {
                    if (drv["ResourceRequestID"].ToString() == "")
                    {
                        lblServiceProgress.Text = lblServiceStatus.Text = "<i>Unavailable</i>";
                    }
                    else
                    {
                        int     intRRId      = Int32.Parse(drv["ResourceRequestID"].ToString());
                        double  dblAllocated = 0.00;
                        double  dblUsed      = 0.00;
                        bool    boolAssigned = false;
                        DataSet dsResource   = oDataPoint.GetServiceRequestResource(intRRId);
                        foreach (DataRow drResource in dsResource.Tables[1].Rows)
                        {
                            if (drResource["deleted"].ToString() == "0")
                            {
                                boolAssigned  = true;
                                dblAllocated += double.Parse(drResource["allocated"].ToString());
                                dblUsed      += double.Parse(drResource["used"].ToString());
                            }
                        }
                        if (boolAssigned == false)
                        {
                            if (drv["OnDemand"] == DBNull.Value || drv["OnDemand"].ToString() == "0")
                            {
                                string  strManager = "<tr><td colspan=\"3\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td></tr>";
                                DataSet dsManager  = oService.GetUser(Int32.Parse(drv["serviceid"].ToString()), 1); // Managers
                                foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                {
                                    int intManager = Int32.Parse(drManager["userid"].ToString());
                                    strManager += "<tr><td><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td><td>-</td><td><a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intManager.ToString() + "');\">" + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]</a></td></tr>";
                                }
                                lblServiceProgress.Text = "Pending Assignment [<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"ShowHideDiv2('divAssign" + intRRId.ToString() + "');\">View Service Managers</a>]<div id=\"divAssign" + intRRId.ToString() + "\" style=\"display:none\"><table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">" + strManager + "</table></div>";
                            }
                            else
                            {
                                Forecast         oForecast         = new Forecast(intProfile, dsn);
                                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                                Types            oType             = new Types(intProfile, dsn);
                                DataSet          dsService         = oForecast.GetAnswerService(Int32.Parse(drv["requestid"].ToString()));
                                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");
                                    if (strExecute != "")
                                    {
                                        lblServiceProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');\">Execute</a>";
                                    }
                                    else
                                    {
                                        lblServiceProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');\">Execute</a>";
                                    }
                                }
                            }
                        }
                        else if (dblAllocated > 0.00)
                        {
                            lblServiceProgress.Text = oServiceRequest.GetStatusBarIn((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                        }
                        else
                        {
                            lblServiceProgress.Text = "<i>N / A</i>";
                        }

                        List <WorkflowStatus> RR = oResourceRequest.GetStatus(null, intRRId, null, null, null, null, false, dsnServiceEditor);
                        if (RR.Count > 0)
                        {
                            lblServiceStatus.Text = RR[0].status;
                        }
                        else
                        {
                            lblServiceStatus.Text = "Not Available";
                        }
                    }
                }

                //Label lblServiceStatus = (Label)e.Item.FindControl("lblServiceStatus");
                //lblServiceStatus.Text = drv["ServiceStatusName"].ToString();
            }
        }