private void LoadResourceInvolvement() { DataSet ds = oDataPoint.GetServiceRequestResourceInvolvement( (intProjectId > 0?intProjectId: null), (intRequestId > 0 ? intRequestId : null), (intResourceRequestId > 0 ? intResourceRequestId : null), (intResourceId > 0 ? intResourceId : null), 1); if (ds.Tables.Count != 0) { if (ds.Tables.Count > 1 && ds.Tables[1].Rows.Count > 0) { ds.Relations.Add("relationship", ds.Tables[0].Columns["RRWFId"], ds.Tables[1].Columns["parent"], false); } //rptResourceInvolvement.DataSource = ds.Tables[0]; rptResourceInvolvement.DataSource = ds; rptResourceInvolvement.DataBind(); lblResourceInvolvement.Visible = (rptResourceInvolvement.Items.Count == 0); foreach (RepeaterItem ri in rptResourceInvolvement.Items) { Label lblResource = (Label)ri.FindControl("lblResource"); lblResource.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblResource.ToolTip + "');\">" + lblResource.Text + "</a>"; Label lblRequest = (Label)ri.FindControl("lblRequest"); Label lblRRID = (Label)ri.FindControl("lblRRID"); if (lblRRID.Text == "" || lblRRID.Text == "0") { lblRequest.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindowMenu('/datapoint/service/request.aspx?t=" + oFunction.encryptQueryString(lblRequest.ToolTip) + " &q=" + oFunction.encryptQueryString(lblRequest.ToolTip) + " ', '800', '600');\">" + lblRequest.Text + "</a>"; } else { lblRequest.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(lblRRID.Text) + "', '800', '600');\">" + lblRequest.Text + "</a>"; } Label lblService = (Label)ri.FindControl("lblService"); lblService.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('SERVICES_DETAIL','?sid=" + lblService.ToolTip + "');\">" + lblService.Text + "</a>"; Label lblUsed = (Label)ri.FindControl("lblUsed"); Label lblAllocated = (Label)ri.FindControl("lblAllocated"); Label lblProgress = (Label)ri.FindControl("lblProgress"); double dblProgress = 0; if (double.Parse(lblUsed.Text) > 0 && double.Parse(lblAllocated.Text) > 0) { dblProgress = double.Parse(lblUsed.Text) / double.Parse(lblAllocated.Text) * 100; } if (Int32.Parse(lblProgress.Text) == 3) { dblProgress = 100.00; } lblProgress.Text = oServiceRequest.GetStatusBarIn(dblProgress, "100", "12", true);; Label lblTime = (Label)ri.FindControl("lblTime"); double dblSLA = 0.00; double.TryParse(lblTime.ToolTip, out dblSLA); double dblElapsed = 0.00; double.TryParse(lblTime.Text, out dblElapsed); if (dblSLA > 0.00 && dblElapsed > 0.00) { lblTime.CssClass = (dblElapsed > dblSLA ? "redbold" : "bluebold"); } Label lblCompleted = (Label)ri.FindControl("lblCompleted"); if (lblCompleted != null && lblCompleted.Text != "") { lblCompleted.Text = " @ "; } Label lblUpdatedBy = (Label)ri.FindControl("lblUpdatedBy"); lblUpdatedBy.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblUpdatedBy.ToolTip + "');\">" + lblUpdatedBy.Text + "</a>"; LinkButton btnEdit = (LinkButton)ri.FindControl("btnEdit"); Panel pnlDelete = (Panel)ri.FindControl("pnlDelete"); LinkButton btnVirtualView = (LinkButton)ri.FindControl("btnVirtualView"); int intService = Int32.Parse(btnEdit.ToolTip); if (pnlDelete.ToolTip == "1") { pnlDelete.Visible = true; } else { pnlDelete.Visible = false; if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile)) { btnEdit.Enabled = true; btnEdit.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/manager.aspx?id=" + btnVirtualView.ToolTip + "', '800', '600');"); } else { btnEdit.Enabled = false; } btnVirtualView.Attributes.Add("onclick", "return OpenNewWindowMenu('/frame/resource_request.aspx?rrid=" + btnVirtualView.ToolTip + "', '800', '600');"); } Label lblComments = (Label)ri.FindControl("lblComments"); if (lblComments.Text == "") { HtmlTable tblCurrentStatusUpdates = (HtmlTable)ri.FindControl("tblCurrentStatusUpdates"); tblCurrentStatusUpdates.Visible = false; } else { Label lblResourceStatus = (Label)ri.FindControl("lblResourceStatus"); lblResourceStatus.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblResourceStatus.ToolTip + "');\">" + lblResourceStatus.Text + "</a>"; } LinkButton lnkbtnAdditionalComments = (LinkButton)ri.FindControl("lnkbtnAdditionalComments"); HtmlTableRow trAdditionalComments = (HtmlTableRow)ri.FindControl("trAdditionalComments"); Repeater rptServices = (Repeater)ri.FindControl("rptServices"); lnkbtnAdditionalComments.Visible = (rptServices.Items.Count > 0); lnkbtnAdditionalComments.Attributes.Add("onclick", "ShowHideDiv2('" + trAdditionalComments.ClientID + "');return false;"); foreach (RepeaterItem ri2 in rptServices.Items) { Label lblResourceStatus = (Label)ri2.FindControl("lblResourceStatus"); lblResourceStatus.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblResourceStatus.ToolTip + "');\">" + lblResourceStatus.Text + "</a>"; } } } }
private void LoadServiceProgression() { DataSet dsServices = oDataPoint.GetServiceRequestSearchResults( "", "", null, null, null, null, (intResourceAssigned > 0 ? intResourceAssigned : null), (intProjectId > 0 ? intProjectId : null), null, null, null, null, null, null, hdnOrderBy.Value.ToString(), Int32.Parse(hdnOrder.Value.ToString()), Int32.Parse(hdnPageNo.Value), Int32.Parse(hdnRecsPerPage.Value)); rptServices.DataSource = dsServices.Tables[0]; rptServices.DataBind(); foreach (RepeaterItem ri in rptServices.Items) { Label lblAutomate = (Label)ri.FindControl("lblAutomate"); Label lblRRID = (Label)ri.FindControl("lblRRID"); Label lblRequest = (Label)ri.FindControl("lblRequest"); if (lblAutomate.Text != "1") { lblRequest.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(lblRRID.Text) + "', '800', '600');\">" + lblRequest.Text + "</a>"; } else { lblRequest.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindowMenu('/datapoint/service/request.aspx?t=" + oFunction.encryptQueryString(lblRequest.ToolTip) + " &q=" + oFunction.encryptQueryString(lblRequest.ToolTip) + " ', '800', '600');\">" + lblRequest.Text + "</a>"; } Label lblService = (Label)ri.FindControl("lblService"); lblService.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('SERVICES_DETAIL','?sid=" + lblService.ToolTip + "');\">" + lblService.Text + "</a>"; Label lblRequestedBy = (Label)ri.FindControl("lblRequestedBy"); lblRequestedBy.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblRequestedBy.ToolTip + "');\">" + lblRequestedBy.Text + "</a>"; Label lblAssignedBy = (Label)ri.FindControl("lblAssignedBy"); lblAssignedBy.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblAssignedBy.ToolTip + "');\">" + lblAssignedBy.Text + "</a>"; Label lblAssignedTo = (Label)ri.FindControl("lblAssignedTo"); lblAssignedTo.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblAssignedTo.ToolTip + "');\">" + lblAssignedTo.Text + "</a>"; Label lblProgress = (Label)ri.FindControl("lblProgress"); //Get the Progress if (lblAutomate.Text == "1") { lblProgress.Text = oServiceRequest.GetStatusBarIn(100.00, "100", "12", true); } else { if (lblRRID.Text == "") { lblProgress.Text = "<i>Unavailable</i>"; } else { int intRRId = Int32.Parse(lblRRID.Text); 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) { Label lblOnDemand = (Label)ri.FindControl("lblOnDemand"); if (lblOnDemand.Text == "" || lblOnDemand.Text == "0") { Label lblServiceID = (Label)ri.FindControl("lblServiceID"); 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(lblServiceID.Text), 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>"; } lblProgress.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); Label lblRequestID = (Label)ri.FindControl("lblRequestID"); DataSet dsService = oForecast.GetAnswerService(Int32.Parse(lblRequestID.Text)); 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 != "") { lblProgress.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 { lblProgress.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) { lblProgress.Text = oServiceRequest.GetStatusBarIn((dblUsed / dblAllocated) * 100.00, "100", "12", true); } else { lblProgress.Text = "<i>N / A</i>"; } } } } //dlServices.Visible = (dlServices.Items.Count > 0); lblServices.Visible = (rptServices.Items.Count == 0); }
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 lblProgress = (Label)e.Item.FindControl("lblServiceProgress"); lblProgress.Text = drv["ResourceRequestID"].ToString(); Label lblRequestStatus = (Label)e.Item.FindControl("lblServiceStatus"); lblRequestStatus.Text = drv["ServiceStatusName"].ToString(); ((Label)e.Item.FindControl("lblServiceSubmitted")).Text = drv["RequestSubmitted"].ToString(); ((Label)e.Item.FindControl("lblServiceLastUpdated")).Text = drv["RequestModified"].ToString(); //Get the progress bar if (lblRequestStatus.Text == "Submitted") { if (lblProgress.Text == "") { lblProgress.Text = "<i>Unavailable</i>"; } else { int intResource = Int32.Parse(lblProgress.Text); double dblAllocated = 0.00; double dblUsed = 0.00; bool boolAssigned = false; DataSet dsResource = oDataPoint.GetServiceRequestResource(intResource); 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") { if (drv["Automate"] == DBNull.Value || drv["Automate"].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>"; } lblProgress.Text = "Pending Assignment [<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"ShowHideDiv2('divAssign" + intResource.ToString() + "');\">View Service Managers</a>]<div id=\"divAssign" + intResource.ToString() + "\" style=\"display:none\"><table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">" + strManager + "</table></div>"; } else { lblProgress.Text = oServiceRequest.GetStatusBarIn(100.00, "100", "12", true); } } 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 != "") { lblProgress.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 { lblProgress.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) { lblProgress.Text = oServiceRequest.GetStatusBarIn((dblUsed / dblAllocated) * 100.00, "100", "12", true); } else { lblProgress.Text = "<i>N / A</i>"; } } } else { lblProgress.Text = "---"; } } }