protected void btnSave_Click(Object Sender, EventArgs e) { int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); //if (ddlStatus.SelectedIndex > -1 && txtComments.Text.Trim() != "") //{ // oResourceRequest.AddStatus(intResourceWorkflow, Int32.Parse(ddlStatus.SelectedItem.Value), txtComments.Text); // //CVT62149 Workload Manager Red Light Status =Hold // if (ddlStatus.SelectedValue == "1") //Red // oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 5, true); // else // oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 2, true); //} if (oResourceRequest.Get(intResourceParent, "status") == ((int)ResourceRequestStatus.Closed).ToString() || oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == ((int)ResourceRequestStatus.Closed).ToString()) { // already completed - nothing to do except close the window. } else { if (panNoSlider.Visible == false) { double dblHours = 0.00; if (panSlider.Visible == true) { if (Request.Form["hdnHours"] != null && Request.Form["hdnHours"] != "") { dblHours = double.Parse(Request.Form["hdnHours"]); } double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); dblHours = (dblHours - dblUsed); if (dblHours > 0.00) { oResourceRequest.UpdateWorkflowHours(intResourceWorkflow, dblHours); } } else { oServiceDetail.UpdateCheckboxes(Request, intResourceWorkflow, intRequest, intItem, intNumber); double dblAllocated = oResourceRequest.GetDetailsHoursUsed(intRequest, intItem, intNumber, intResourceWorkflow, false); oResourceRequest.UpdateWorkflowAllocated(intResourceWorkflow, dblAllocated); } } if (panForm.Visible == true) { oServiceEditor.SaveForm(Request, intRequest, intService, intNumber, true, intEnvironment, dsn); } oResourceRequest.UpdateWorkflowName(intResourceWorkflow, txtCustom.Text, intProfile); } Response.Redirect(Request.Path + "?rrid=" + intResourceWorkflow.ToString() + "&div=E&save=true"); }
protected void btnSubmit_Click(Object Sender, EventArgs e) { bool boolSent = false; DataSet dsWF = oResourceRequest.GetWorkflow(intResource); int intTo = 0; if (dsWF.Tables[0].Rows.Count > 0 && Int32.TryParse(Request.Form[hdnEmployee.UniqueID], out intTo) == true) { int intParent = Int32.Parse(dsWF.Tables[0].Rows[0]["parent"].ToString()); DataSet ds = oResourceRequest.Get(intParent); if (ds.Tables[0].Rows.Count > 0) { int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); oFunction.SendEmail("Service Request [CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + "]", oUser.GetName(intTo), "", oUser.GetName(intProfile), "Service Request [CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString() + "]", "<p>The following service request information has been sent to you by <b>" + oUser.GetFullName(intProfile) + "</b>.</p>" + (txtComments.Text == "" ? "" : "<p>" + txtComments.Text + "</p>") + "<p>" + oResourceRequest.GetSummary(intParent, intResource, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); boolSent = true; } } if (boolSent) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">alert('An email was successfully sent.');window.parent.location.reload();window.close();<" + "/" + "script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">alert('There was a problem sending the email.');window.parent.location.reload();window.close();<" + "/" + "script>"); } }
private void LoadInformation(int intResourceWorkflow) { int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); int intRequest = Int32.Parse(oResourceRequest.Get(intResourceParent, "requestid")); DataSet ds = oRequest.Get(intRequest); lblName.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); lblStart.Text = DateTime.Parse(ds.Tables[0].Rows[0]["start_date"].ToString()).ToLongDateString(); lblEnd.Text = DateTime.Parse(ds.Tables[0].Rows[0]["end_date"].ToString()).ToLongDateString(); lblDescription.Text = ds.Tables[0].Rows[0]["description"].ToString(); if (Request.QueryString["div"] != null) { switch (Request.QueryString["div"]) { case "E": boolExecution = true; break; case "C": boolChange = true; break; case "M": boolMyDocuments = true; break; } } if (boolExecution == false && boolChange == false && boolMyDocuments == false) { boolExecution = true; } }
protected bool CheckConfigured(int _projectid, int _requestid, int _resourceid) { lblNumber.Text = oProject.Get(_projectid, "number"); txtNumber.Text = lblNumber.Text; if (lblNumber.Text == "") { txtNumber.Visible = true; panLink.Visible = true; hypNumber.NavigateUrl = "javascript:void(0);"; hypNumber.Attributes.Add("onclick", "return OpenWindow('CLARITY_NUMBER','');"); DataSet ds2 = oResourceRequest.Get(_resourceid); if (ds2.Tables[0].Rows[0]["solo"].ToString() == "0") { btnView.Text = "View Original Project Request"; btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + _requestid.ToString() + "');"); } else { btnView.Text = "View Original Request Details"; btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + _resourceid.ToString() + "');"); } strProjectSummary = oProject.GetBody(_projectid, intEnvironment, false); return(false); } else { lblNumber.Visible = true; return(true); } }
protected void btnSave_Click(Object Sender, EventArgs e) { int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); oResourceRequest.UpdateWorkflowName(intResourceWorkflow, txtCustom.Text, intProfile); ds = oResourceRequest.Get(intResourceParent); int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intStatus = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "status")); double dblHours = double.Parse(lblUsed.Text); double dblTime = 5.00 / 60.00; foreach (RepeaterItem ri in rptView.Items) { CheckBox chkDelete = (CheckBox)ri.FindControl("chkDelete"); if (chkDelete.Checked == true) { Label lblId = (Label)ri.FindControl("lblId"); Label lblPath = (Label)ri.FindControl("lblPath"); Label lblEnvironment = (Label)ri.FindControl("lblEnvironment"); Variables oVariable = new Variables(Int32.Parse(lblEnvironment.Text)); DirectoryEntry oEntry = new DirectoryEntry(lblPath.Text, oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword()); AD oAD = new AD(intProfile, dsn, Int32.Parse(lblEnvironment.Text)); if (oAD.Exists(oEntry)) { oAD.Enable(oEntry, false); } dblHours += dblTime; oADObject.UpdateDomainAccount(Int32.Parse(lblId.Text), intProfile); } } // Delete objects over a month old ds = oADObject.GetDomainAccountsDisabled(DateTime.Today.AddMonths(-1)); foreach (DataRow dr in ds.Tables[0].Rows) { int _environment = Int32.Parse(dr["environment"].ToString()); Variables oVariable = new Variables(_environment); DirectoryEntry oEntry = new DirectoryEntry(dr["path"].ToString(), oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword()); AD oAD = new AD(intProfile, dsn, _environment); if (oAD.Exists(oEntry) && oAD.IsDisabled(oEntry) == true) { oAD.Delete(oEntry); oADObject.UpdateDomainAccountDisabled(Int32.Parse(dr["adid"].ToString()), -1); } else { oADObject.UpdateDomainAccountDisabled(Int32.Parse(dr["adid"].ToString()), -10); } } double dblTotal = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); dblHours = (dblHours - dblUsed); if (dblHours > 0.00) { oResourceRequest.UpdateWorkflowHours(intResourceWorkflow, dblHours); } Response.Redirect(Request.Path + "?rrid=" + intResourceWorkflow.ToString() + "&save=true"); }
protected void btnCancel_Click(Object Sender, EventArgs e) { Button btnCancel = (Button)Sender; int intService = Int32.Parse(btnCancel.CommandArgument); // Remove Resource Request int intItem = oService.GetItemId(intService); DataSet dsForm = oRequestItem.GetForms(intRequest, intService); int intCancelNum = Int32.Parse(btnCancel.CommandName); strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT,EMAILGRP_REQUEST_STATUS"); foreach (DataRow drForm in dsForm.Tables[0].Rows) { int intCancelNum2 = Int32.Parse(drForm["number"].ToString()); if (intCancelNum > 0) { intCancelNum2 = intCancelNum; } DataSet dsResource = oResourceRequest.Get(intRequest, intItem, intCancelNum2); if (dsResource.Tables[0].Rows.Count > 0) { int intResourceWorkflow = Int32.Parse(dsResource.Tables[0].Rows[0]["id"].ToString()); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); oResourceRequest.UpdateStatusOverall(intResourceParent, -2); DataSet dsManager = oService.GetUser(intService, 1); DataSet dsResources = oResourceRequest.GetWorkflowsParent(intResourceParent); foreach (DataRow drResources in dsResources.Tables[0].Rows) { int intUser = Int32.Parse(drResources["userid"].ToString()); if (intUser == 0) { foreach (DataRow drManager in dsManager.Tables[0].Rows) { int intManager = Int32.Parse(drManager["userid"].ToString()); oFunction.SendEmail("ClearView Service Request CANCELLED", oUser.GetName(intManager), "", strEMailIdsBCC, "ClearView Service Request CANCELLED", "<p><b>The following service request has been cancelled by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(Int32.Parse(drResources["id"].ToString()), intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } } else { foreach (DataRow drManager in dsManager.Tables[0].Rows) { int intManager = Int32.Parse(drManager["userid"].ToString()); oFunction.SendEmail("ClearView Service Request CANCELLED", oUser.GetName(intUser), oUser.GetName(intManager), strEMailIdsBCC, "ClearView Service Request CANCELLED", "<p><b>The following service request has been cancelled by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(Int32.Parse(drResources["id"].ToString()), intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } } } } oService.CancelSelected(intRequest, intService, intCancelNum2); if (intCancelNum > 0) { break; } } Response.Redirect(Request.Path + "?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intRequest.ToString()) + "&cancel=true"); }
private void Save(int intRequest) { int intItem = Int32.Parse(lblItem.Text); int intNumber = Int32.Parse(lblNumber.Text); int intService = Int32.Parse(lblService.Text); int intProject = oRequest.GetProjectNumber(intRequest); //if (intProject == -1) // oServiceRequest.Update(intRequest, txtTitle.Text); oServiceEditor.AddRequest(intRequest, intService, intNumber, txtTitle.Text, Int32.Parse(radPriority.SelectedItem.Value), txtStatement.Text, DateTime.Now, DateTime.Now, (radExpediteYes.Checked ? 1 : 0)); oServiceEditor.SaveForm(Request, intRequest, intService, intNumber, false, intEnvironment, dsn); //Reset the Resource Request and Workflow status for returned requests if (boolReqReturned == true) { int intReturned = 0; Int32.TryParse(lblReturned.Text, out intReturned); ResourceRequest oResourceRequest = new ResourceRequest(0, dsn); DataSet dsRR = oResourceRequest.GetRequestService(intRequest, intReturned, Int32.Parse(lblNumber.Text)); if (dsRR.Tables[0].Rows.Count > 0) { int intRRId = Int32.Parse(dsRR.Tables[0].Rows[0]["parent"].ToString()); oResourceRequest.updateResourceRequestReturnCompleted(Int32.Parse(lblReqReturnedId.Text)); DataSet dsRRWF = oResourceRequest.GetWorkflowsParent(intRRId); oResourceRequest.UpdateStatusRequest(intRRId, 2); foreach (DataRow dr in dsRRWF.Tables[0].Rows) { int intRRWFId = Int32.Parse(dr["id"].ToString()); oResourceRequest.UpdateWorkflowStatus(intRRWFId, 2, true); } } } //Reset the Resource Request and approval process for denied requests if (boolReqDenied == true) { ResourceRequest oResourceRequest = new ResourceRequest(0, dsn); DataSet dsResource = oResourceRequest.GetAllService(intRequest, intService, Int32.Parse(lblNumber.Text)); if (dsResource.Tables[0].Rows.Count > 0) { int intResource = Int32.Parse(dsResource.Tables[0].Rows[0]["rrid"].ToString()); DataSet dsRR = oResourceRequest.Get(intResource); if (dsRR.Tables[0].Rows.Count > 0) { oResourceRequest.UpdateStatusOverall(intResource, 2); oService.UpdateSelectedApprove(intRequest, intService, Int32.Parse(lblNumber.Text), 0, 0, DateTime.Now, ""); if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false) { oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0); } } } } }
public void get_returns_expected_response_when_nothing_has_been_registered() { var sut = new EngineBuilder().Build(); var response = sut.GetResponseFor(ResourceRequest.Get("/foo")); Assert.Equal( expected: ResourceResponse.NotFound(), actual: response, comparer: new StatusCodeComparer() ); }
protected void Page_Load(object sender, EventArgs e) { oResourceRequest = new ResourceRequest(0, dsn); oService = new Services(0, dsn); oHoliday = new Holidays(0, dsn); oUser = new Users(0, dsn); if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "") { int intService = Int32.Parse(oResourceRequest.Get(Int32.Parse(Request.QueryString["rrid"]), "serviceid")); DateTime datTime = DateTime.Now; string strAssigned = oResourceRequest.Get(Int32.Parse(Request.QueryString["rrid"]), "assigned"); if (strAssigned != "") { datTime = DateTime.Parse(strAssigned); } double dblSLA = oService.GetSLA(intService); if (dblSLA > 0.00) { panShow.Visible = true; lblAssigned.Text = datTime.ToLongDateString(); dblSLA = dblSLA / 8.00; datTime = oHoliday.GetDays(dblSLA, datTime); lblDays.Text = dblSLA.ToString(); lblDeadline.Text = datTime.ToLongDateString(); } else { panHide.Visible = true; string strManager = ""; DataSet dsManagers = oService.GetUser(intService, -1); foreach (DataRow drManager in dsManagers.Tables[0].Rows) { strManager += "<img src=\"/images/user.gif\" border=\"0\" align=\"absmiddle\"/> " + oUser.GetFullName(Int32.Parse(drManager["userid"].ToString())) + "<br/>"; } lblManager.Text = strManager; } } btnClose.Attributes.Add("onclick", "parent.HidePanel();"); }
public string GetBodyOverall(int _resourcerequestid, int _resourcerequestworkflowid, string _se_dsn, int _environment, string _dsn_asset, string _dsn_ip) { ResourceRequest oResourceRequest = new ResourceRequest(user, dsn); DataSet dsResource = oResourceRequest.Get(_resourcerequestid); if (dsResource.Tables[0].Rows.Count > 0) { return(GetBodyNoEnv(Int32.Parse(dsResource.Tables[0].Rows[0]["requestid"].ToString()), Int32.Parse(dsResource.Tables[0].Rows[0]["itemid"].ToString()), Int32.Parse(dsResource.Tables[0].Rows[0]["number"].ToString()), Int32.Parse(dsResource.Tables[0].Rows[0]["serviceid"].ToString()), _resourcerequestid, _resourcerequestworkflowid, _se_dsn, _environment, _dsn_asset, _dsn_ip)); } else { return("** WARNING: No Resource Request for ID " + _resourcerequestid.ToString()); } }
public bool NotifyApproval(int _resourcerequestid, int _resourcerequestapprove, int _environment, string _cc, string _dsn_service_editor) { bool boolNotify = false; ResourceRequest oResourceRequest = new ResourceRequest(user, dsn); DataSet dsResource = oResourceRequest.Get(_resourcerequestid); if (dsResource.Tables[0].Rows.Count > 0) { DataRow drResource = dsResource.Tables[0].Rows[0]; int _requestid = Int32.Parse(drResource["requestid"].ToString()); int intService = Int32.Parse(drResource["serviceid"].ToString()); int intNumber = Int32.Parse(drResource["number"].ToString()); return(NotifyApproval(_requestid, intService, intNumber, _resourcerequestapprove, _environment, _cc, _dsn_service_editor)); } //if (intApproval) return(boolNotify); }
public void get_single_returns_expected_response_when_nothing_was_found() { var sut = new EngineBuilder().Build(); sut.RegisterHandler(new HandlerDefinition { HttpVerb = HttpVerbs.Get, ResourceName = "foo", Handler = request => HandlerResult.Nothing() }); var response = sut.GetResponseFor(ResourceRequest.Get("/foo/1")); Assert.Equal( expected: ResourceResponse.NotFound(), actual: response, comparer: new StatusCodeComparer() ); }
public void get_single_returns_expected_response() { var expectedBody = "foo-body"; var sut = new EngineBuilder().Build(); sut.RegisterHandler(new HandlerDefinition { HttpVerb = HttpVerbs.Get, ResourceName = "foo", Handler = request => HandlerResult.FromResult(expectedBody) }); var response = sut.GetResponseFor(ResourceRequest.Get("/foo/1")); Assert.Equal( expected: ResourceResponse.Ok(expectedBody), actual: response, comparer: new StatusCodeAndBodyComparer() ); }
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); oRequestItem = new RequestItems(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oVariable = new Variables(intEnvironment); oService = new Services(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oStatusLevel = new StatusLevels(); oEnhancement = new Enhancements(intProfile, dsn); oLog = new Log(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.QueryString["action"] != null && Request.QueryString["action"] != "") { panFinish.Visible = true; } else { 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); } if (!IsPostBack) { if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "") { lblResourceParent.Text = Request.QueryString["rrid"]; int intResourceParent = Int32.Parse(lblResourceParent.Text); ds = oResourceRequest.Get(intResourceParent); if (ds.Tables[0].Rows.Count > 0) { int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); Forecast oForecast = new Forecast(intProfile, dsn); if (intService == intStorageService) { try { OnDemandTasks oOnDemandTask = new OnDemandTasks(0, dsn); Locations oLocation = new Locations(0, dsn); DataSet dsDesign = oOnDemandTask.GetServerStorage(intRequest, intItem, intNumber); if (dsDesign.Tables[0].Rows.Count == 1) { int intAnswer = Int32.Parse(dsDesign.Tables[0].Rows[0]["answerid"].ToString()); int intAddress = Int32.Parse(oForecast.GetAnswer(intAnswer, "addressid")); lblLocation.Text = oLocation.GetFull(intAddress); panLocation.Visible = true; } } catch { } } int intProject = Int32.Parse(oRequest.Get(intRequest, "projectid")); int intApp = oRequestItem.GetItemApplication(intItem); int intForecast = 0; DataSet dsForecast = oForecast.GetProject(intProject); if (dsForecast.Tables[0].Rows.Count > 0) { intForecast = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString()); } if (intForecast > 0) { btnView.Attributes.Add("oncontextmenu", "return OpenWindow('NEW_WINDOW','" + oPage.GetFullLink(intDesignBuilder) + "?id=" + intForecast.ToString() + "');"); } else { btnView.Attributes.Add("oncontextmenu", "alert('There is no design for this project');return false;"); } if (ds.Tables[0].Rows[0]["solo"].ToString() == "0") { btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');"); btnView.Text = "Click here to view the project details"; lblType.Text = "Project Request"; } else { btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResourceParent.ToString() + "');"); if (oApplication.Get(intApp, "tpm") == "1") { btnView.Text = "Click here to view the project details"; } else { btnView.Text = "Click here to view this request"; } lblType.Text = "Service Request"; } btnAssignments.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intSearchPage.ToString() + "&pid=" + intProject + "&aid=" + intApp.ToString() + "&sort=userid');"); //btnAssignments.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/projects/datapoint_projects.aspx?id=" + oFunction.encryptQueryString(intProject.ToString()) + "', '800', '600');"); lblItem.Text = intItem.ToString(); lblService.Text = oService.GetName(intService); if (oApplication.Get(intApp, "request_items") == "1") { lblGroup.Text = oApplication.GetName(intApp) + " | " + oRequestItem.GetItemName(intItem); } else { lblGroup.Text = oApplication.GetName(intApp); } int intUser = Int32.Parse(oRequest.Get(intRequest, "userid")); int intAppManager = oApplication.GetManager(intApp); if (ds.Tables[0].Rows[0]["accepted"].ToString() == "-1" && oApplication.Get(intApp, "tpm") == "1") { if (intUser == intProfile || oDelegate.Get(intUser, intProfile) > 0) { panRequest.Visible = true; panAssignSingle.Visible = true; txtHours.Text = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F"); panHours.Visible = !(oApplication.Get(intApp, "tpm") == "1"); txtHours.Enabled = (oService.Get(intService, "disable_hours") == "1" ? false : true); lblQuantity.Text = ds.Tables[0].Rows[0]["devices"].ToString(); lblStatus.Text = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString())); panQuantity.Visible = (lblQuantity.Text != "0"); txtQuantity.Text = lblQuantity.Text; txtQuantity.Enabled = (txtQuantity.Text != "0"); txtQuantity.Enabled = false; lblAssign.Text = oUser.GetFullName(intProfile); strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false); } else { Response.Write("no rights"); panDenied.Visible = true; } btnSubmit.Attributes.Add("onclick", "return ValidateNumber0('" + txtHours.ClientID + "','Please enter a valid number for the hours allocated') && ValidateHidden('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter a valid LAN ID') && ProcessButton(this);"); } else { string strValidate = ""; if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile) || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1")) { panRequest.Visible = true; panAssignMultiple.Visible = true; btnSubmit.Enabled = (ds.Tables[0].Rows[0]["assigned"].ToString() == ""); if (ds.Tables[0].Rows[0]["status"].ToString() == "5") { radHold.Checked = true; divChoice.Style["display"] = "inline"; divHold.Style["display"] = "inline"; txtHold.Text = ds.Tables[0].Rows[0]["reason"].ToString(); } else { divChoice.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "0" ? "inline" : "none"); divAccept.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "1" ? "inline" : "none"); } int intEnhancementService = 0; Int32.TryParse(ConfigurationManager.AppSettings["HELP_ENHANCEMENT_SERVICEID"], out intEnhancementService); if (intService == intEnhancementService) { panEnhancement.Visible = true; ddlModule.DataTextField = "name"; ddlModule.DataValueField = "id"; ddlModule.DataSource = oEnhancement.GetModules(1); ddlModule.DataBind(); ddlModule.Items.Insert(0, new ListItem("-- SELECT --", "0")); strValidate += "ValidateDropDown('" + ddlModule.ClientID + "','Select a classification') && "; radEnhancementShort.Checked = true; radEnhancementReject.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','none');ShowHideDiv('" + divAccept.ClientID + "','none');"); radEnhancementDuplicate.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','none');ShowHideDiv('" + divAccept.ClientID + "','none');"); radEnhancementShort.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','none');ShowHideDiv('" + trEnhancementClassification.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','inline');"); radEnhancementLong.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','inline');"); } panDelete.Visible = (intItem == intImplementorDistributed || intItem == intImplementorMidrange); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this request');"); txtHours.Text = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F"); panHours.Visible = !(oApplication.Get(intApp, "tpm") == "1"); txtHours.Enabled = (oService.Get(intService, "disable_hours") == "1" ? false : true); lblQuantity.Text = ds.Tables[0].Rows[0]["devices"].ToString(); panQuantity.Visible = (lblQuantity.Text != "0"); txtQuantity.Text = lblQuantity.Text; txtQuantity.Enabled = (txtQuantity.Text != "0"); txtQuantity.Enabled = false; lblStatus.Text = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString())); trAssigned.Visible = !(btnSubmit.Enabled); string strAssign = ""; DataSet dsManager = oService.GetUser(intService, 1); foreach (DataRow drManager in dsManager.Tables[0].Rows) { if (strAssign != "") { strAssign += ", "; } strAssign += oUser.GetFullName(Int32.Parse(drManager["userid"].ToString())); } lblAssign.Text = strAssign; DataSet dsReports = oUser.GetManagerReports(intAppManager, intRequest, intService, intNumber); DataTable dtReports = dsReports.Tables[0].Copy(); dtReports.Clear(); DataSet dsAssignment = oService.GetUser(intService, -100); foreach (DataRow drAssignment in dsAssignment.Tables[0].Rows) { int intAssignment = Int32.Parse(drAssignment["userid"].ToString()); DataSet dsAssignees = oUser.GetManagerReports(intAssignment, intRequest, intService, intNumber); foreach (DataRow drAssignee in dsAssignees.Tables[0].Rows) { dtReports.ImportRow(drAssignee); } } if (dtReports.Rows.Count > 0) { // Use custom assignment list // First, remove duplicates Hashtable hTable = new Hashtable(); ArrayList duplicateList = new ArrayList(); foreach (DataRow drow in dtReports.Rows) { if (hTable.Contains(drow["userid"])) { duplicateList.Add(drow); } else { hTable.Add(drow["userid"], string.Empty); } } foreach (DataRow dRow in duplicateList) { dtReports.Rows.Remove(dRow); } // Next, sort by username dtReports.DefaultView.Sort = "username"; // Now add to dataset dsReports = new DataSet(); dsReports.Tables.Add(dtReports.DefaultView.ToTable()); } LoadList(dsReports, intApp); LoadAvailable(dsReports, intApp); strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false); } else { Response.Write("no delegate"); panDenied.Visible = true; } btnSubmit.Attributes.Add("onclick", "return " + strValidate + "ValidateChoice('" + divChoice.ClientID + "','" + radAccept.ClientID + "','" + radReject.ClientID + "','" + radHold.ClientID + "','" + ddlUser.ClientID + "','" + txtHours.ClientID + "') && ProcessButton(this);"); } } else { panDenied.Visible = true; } } else { panDenied.Visible = true; } } } btnClose.Attributes.Add("onclick", "return CloseWindow();"); lnkAvailable.Attributes.Add("onclick", "return ShowHideAvailable('" + divAvailable.ClientID + "');"); radAccept.Attributes.Add("onclick", "ShowHideDiv('" + divAccept.ClientID + "','inline');ShowHideDiv('" + divReject.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');"); radReject.Attributes.Add("onclick", "ShowHideDiv('" + divReject.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');"); radHold.Attributes.Add("onclick", "ShowHideDiv('" + divHold.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divReject.ClientID + "','none');"); txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);"); lstManager.Attributes.Add("ondblclick", "AJAXClickRow();"); }
protected void btnSubmit_Click(Object Sender, EventArgs e) { int intResourceParent = Int32.Parse(lblResourceParent.Text); ds = oResourceRequest.Get(intResourceParent); if (ds.Tables[0].Rows.Count > 0) { int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); string strCVT = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(); string strService = oService.GetName(intService); if (intService == 0) { strService = oRequestItem.GetItemName(intItem); } int intApp = oRequestItem.GetItemApplication(intItem); int intProject = Int32.Parse(oRequest.Get(intRequest, "projectid")); Projects oProject = new Projects(intProfile, dsn); ProjectsPending oProjectsPending = new ProjectsPending(intProfile, dsn, intEnvironment); Variables oVariable = new Variables(intEnvironment); RequestFields oRequestField = new RequestFields(intProfile, dsn); int intRequester = Int32.Parse(oRequest.Get(intRequest, "userid")); int intPC = 0; int intIE = 0; if (intProject > 0) { if (oProject.Get(intProject, "lead") != "") { intPC = Int32.Parse(oProject.Get(intProject, "lead")); } if (oProject.Get(intProject, "engineer") != "") { intIE = Int32.Parse(oProject.Get(intProject, "engineer")); } } else { try { intPC = Int32.Parse(oProjectsPending.GetRequest(intRequest, "lead")); intIE = Int32.Parse(oProjectsPending.GetRequest(intRequest, "engineer")); } catch { } } string strCC = ""; if (intPC > 0) { strCC += oUser.GetName(intPC) + ";"; } if (intIE > 0) { strCC += oUser.GetName(intIE) + ";"; } int intEnhancement = 0; if (panEnhancement.Visible) { DataSet dsEnhancement = oEnhancement.GetRequest(intRequest); if (dsEnhancement.Tables[0].Rows.Count == 1) { intEnhancement = Int32.Parse(dsEnhancement.Tables[0].Rows[0]["id"].ToString()); } } if (radReject.Checked == true || (panEnhancement.Visible && radEnhancementReject.Checked)) { string strComments = txtEnhancementReject.Text.Trim(); if (strComments == "" && txtReject.Text.Trim() != "") { strComments = "<p>The following comments were added:<br/>" + oFunction.FormatText(txtReject.Text) + "</p>"; } string strDefault = oUser.GetApplicationUrl(intRequester, intAssignPage); string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT,EMAILGRP_REQUEST_STATUS"); if (strDefault == "" || oApplication.Get(intApp, "tpm") != "1") { oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p>The following request has been rejected by <b>" + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments, true, false); } else { oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p>The following request has been rejected by <b>" + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments + "<p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intAssignPage) + "?rrid=" + intResourceParent.ToString() + "\" target=\"_blank\">Click here to assign a new project manager to your request.</a></p>", true, false); } oResourceRequest.UpdateAccepted(intResourceParent, -1); oResourceRequest.UpdateReason(intResourceParent, txtReject.Text); if (panEnhancement.Visible) { oResourceRequest.UpdateStatusOverall(intResourceParent, (int)EnhancementStatus.Denied); oResourceRequest.UpdateReason(intResourceParent, txtEnhancementReject.Text); oEnhancement.AddLog(intEnhancement, 0, "Rejected", intProfile, ""); } } else if (radHold.Checked == true) { oResourceRequest.UpdateStatusOverall(intResourceParent, 5); oResourceRequest.UpdateReason(intResourceParent, txtHold.Text); } else { if (panEnhancement.Visible && radEnhancementLong.Checked) { oResourceRequest.UpdateStatusOverall(intResourceParent, (int)EnhancementStatus.AwaitingLongDocument); oEnhancement.AddLog(intEnhancement, 0, "Sent Back to Client for Additonal Requirements", intProfile, ""); } else if (panEnhancement.Visible && radEnhancementDuplicate.Checked) { oResourceRequest.UpdateStatusOverall(intResourceParent, (int)EnhancementStatus.Duplicate); oEnhancement.AddLog(intEnhancement, 0, "Duplicate", intProfile, ""); } else { if (oResourceRequest.Get(intResourceParent, "assigned") == "") // hasn't already been assigned. { string strComments = ""; if (txtComments.Text != "") { strComments = "<p>The following comments were added:<br/>" + oFunction.FormatText(txtComments.Text) + "</p>"; } if (panEnhancement.Visible) { oEnhancement.UpdateModuleID(intResourceParent, Int32.Parse(ddlModule.SelectedItem.Value)); oEnhancement.AddLog(intEnhancement, 0, "Assigned", intProfile, ""); } bool boolSolo = (oResourceRequest.Get(intResourceParent, "solo") == "1"); int intAssigned = 0; bool boolRejected = (oResourceRequest.Get(intResourceParent, "accepted") == "-1"); if (boolRejected == true) { oResourceRequest.UpdateRejected(intResourceParent, 1); intAssigned = Int32.Parse(Request.Form[hdnManager.UniqueID]); } else { intAssigned = Int32.Parse(ddlUser.SelectedItem.Value); oResourceRequest.UpdateAccepted(intResourceParent, 1); } # region "Send Service Center Notification" // intAssigned = USERID //if (intService = Configuration.AppSettings["DECOMMISSION_SERVER_NEW"] // get serverid from cv_WM_server_decommission based on requestid, itemid, number // generate SC email with attachment in HTML format with "Assign TO: USER" at the top (only for non-vmware) //int intServerDecommServiceID = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_SERVER_DECOMMISSION"]); //if (intService == intServerDecommServiceID) //{ // SendServiceCenterNotification(intRequest, intItem, intNumber, intAssigned); //} #endregion oProject.Update(intProject, 2); int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, oResourceRequest.Get(intResourceParent, "name"), intAssigned, Int32.Parse(txtQuantity.Text), double.Parse(txtHours.Text), 2, 0); oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug); oResourceRequest.UpdateComments(intResourceParent, txtComments.Text); oResourceRequest.UpdateAssignedBy(intResourceParent, intProfile); ProjectRequest oProjectRequest = new ProjectRequest(intProfile, dsn); string strDefault = oUser.GetApplicationUrl(intAssigned, intViewPage); string strNotify = ""; string strSpacerRow = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>"; if (txtHours.Enabled == true) { oResourceRequest.UpdateDevices(intResourceParent, Int32.Parse(txtQuantity.Text), double.Parse(txtHours.Text)); } if (boolSolo == true) { oResourceRequest.UpdateStatusOverall(intResourceParent, 2); if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "") { oProject.Update(intProject, oProjectNumber.New()); } if (intItem != intImplementorDistributed && intItem != intImplementorMidrange) { string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT"); //if (oProject.Get(intProject, "number").StartsWith("CV") == false) // strNotify = "<p><span style=\"color:#0000FF\"><b>PROJECT COORDINATOR:</b> Please allocate the hours listed above for each resource in Clarity.</span></p>"; if (strDefault == "") { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } else { if (intProject > 0) { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } else { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } } string strActivity = "<tr><td><b>Resource:</b></td><td> </td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>"; strActivity += strSpacerRow; strActivity += "<tr><td><b>Service:</b></td><td> </td><td>" + strService + "</td></tr>"; strActivity = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>"; string strDeliverable = oApplication.Get(intApp, "deliverables_doc"); if (strDeliverable.Trim() != "") { strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>"; } if (oService.Get(intService, "notify_client") != "0") { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>A resource has been assigned to the following request...</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false); } } } else { // ADD PM string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT"); if (strDefault == "") { oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p>", true, false); } else { if (intProject > 0) { oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } else { oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p>" + strComments + "<p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } } string strExecutive = oProject.Get(intProject, "executive"); string strWorking = oProject.Get(intProject, "working"); string strActivity = "<tr><td><b>Resource:</b></td><td> </td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>"; strActivity += strSpacerRow; strActivity += "<tr><td><b>Service:</b></td><td> </td><td>Project Coordinator</td></tr>"; strActivity = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>"; string strDeliverable = oApplication.Get(intApp, "deliverables_doc"); if (strDeliverable.Trim() != "") { strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>"; } if (oService.Get(intService, "notify_client") != "0") { oFunction.SendEmail("Request Assignment", oUser.GetName(intRequester), strExecutive + ";" + strWorking + ";" + strCC, strEMailIdsBCC, "Request Assignment", "<p><b>A resource has been assigned to the following project...</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false); } } } } } }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oResourceRequest = new ResourceRequest(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oProject = new Projects(intProfile, dsn); oProjectNumber = new ProjectNumber(intProfile, dsn); oService = new Services(intProfile, dsn); oUser = new Users(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); if (Request.QueryString["action"] != null && Request.QueryString["action"] != "") { panFinish.Visible = true; } else { panForm.Visible = true; if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "") { int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); DataSet ds = oResourceRequest.Get(intResourceParent); if (ds.Tables[0].Rows.Count > 0) { int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); int intApp = oRequestItem.GetItemApplication(intItem); //if (intProfile == intUser || oService.IsManager(intService, intProfile) || oDelegate.Get(intUser, intProfile) > 0 || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1") || (oUser.IsManager(intUser, intProfile, true) && oApplication.Get(intApp, "disable_manager") != "1")) //{ int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); hdnRequestID.Value = intRequest.ToString(); int intProject = oRequest.GetProjectNumber(intRequest); string strPath = ""; if (intItem == 0) { strPath = strPCWM; } else if (intItem == -1) { strPath = strTaskWM; } else { if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "") { oProject.Update(intProject, oProjectNumber.New()); } strPath = oService.Get(intService, "wm_path"); } if (strPath != "") { oForm.Controls.Add((Control)LoadControl(strPath)); } string strTitle = "Task"; if (intProject > 0) { strTitle = oProject.Get(intProject, "name"); } Master.Page.Title = strTitle + " | " + oService.GetName(intService); //} //else // panDenied.Visible = true; } else { panDenied.Visible = true; } } } btnFinish.Attributes.Add("onclick", "return CloseWindow();"); btnClose.Attributes.Add("onclick", "return CloseWindow();"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oProject = new Projects(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oPage = new Pages(intProfile, dsn); oResourceRequest = new ResourceRequest(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oService = new Services(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oRequestField = new RequestFields(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oServiceDetail = new ServiceDetails(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oDocument = new Documents(intProfile, dsn); oOnDemandTasks = new OnDemandTasks(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["rrid"] != null && Request.QueryString["rrid"] != "") { // Start Workflow Change lblResourceWorkflow.Text = Request.QueryString["rrid"]; int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); ds = oResourceRequest.Get(intResourceParent); // End Workflow Change intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); lblRequestedBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest)); lblRequestedOn.Text = DateTime.Parse(oRequest.Get(intRequest, "created")).ToString(); lblDescription.Text = oRequest.Get(intRequest, "description"); if (lblDescription.Text == "") { lblDescription.Text = "<i>No information</i>"; } intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); // Start Workflow Change bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3"); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); boolJoined = (oResourceRequest.GetWorkflow(intResourceWorkflow, "joined") == "1"); // End Workflow Change intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); lblService.Text = oService.Get(intService, "name"); int intApp = oRequestItem.GetItemApplication(intItem); if (Request.QueryString["save"] != null && Request.QueryString["save"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>"); } if (Request.QueryString["status"] != null && Request.QueryString["status"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Weekly Status has been Added');<" + "/" + "script>"); } if (!IsPostBack) { double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent); if (dblAllocated == dblUsed) { if (boolComplete == false) { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?');"); } else { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;"); } } else { btnComplete.ImageUrl = "/images/tool_complete_dbl.gif"; btnComplete.Enabled = false; } if (oService.Get(intService, "sla") != "") { oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla"); int intDays = oResourceRequest.GetSLA(intResourceParent); if (intDays < 1) { btnSLA.Style["border"] = "solid 2px #FF0000"; } else if (intDays < 3) { btnSLA.Style["border"] = "solid 2px #FF9999"; } btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');"); } else { btnSLA.ImageUrl = "/images/tool_sla_dbl.gif"; btnSLA.Enabled = false; } oFunction.ConfigureToolButton(btnEmail, "/images/tool_email"); btnEmail.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_EMAIL','?rrid=" + intResourceWorkflow.ToString() + "&type=GENERIC');"); dblUsed = (dblUsed / dblAllocated) * 100; strCheckboxes = oServiceDetail.LoadCheckboxes(intRequest, intItem, intNumber, intResourceWorkflow, intService); if (oService.Get(intService, "tasks") != "1" || strCheckboxes == "") { if (oService.Get(intService, "no_slider") == "1") { panNoSlider.Visible = true; btnComplete.ImageUrl = "/images/tool_complete.gif"; btnComplete.Enabled = true; btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?');"); btnComplete.CommandArgument = "FAST"; } else { panSlider.Visible = true; sldHours._StartPercent = dblUsed.ToString(); sldHours._TotalHours = dblAllocated.ToString(); } } else { panCheckboxes.Visible = true; } intProject = oRequest.GetProjectNumber(intRequest); hdnTab.Value = "D"; panWorkload.Visible = true; LoadStatus(intResourceWorkflow); LoadChange(intResourceWorkflow); LoadInformation(intResourceWorkflow); chkDescription.Checked = (Request.QueryString["doc"] != null); lblDocuments.Text = oDocument.GetDocuments_Request(intRequest, 0, Request.PhysicalApplicationPath, 1, (Request.QueryString["doc"] != null)); // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine) //lblDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, 0, intRequest, 0, 1, (Request.QueryString["doc"] != null), false); btnDenied.Attributes.Add("onclick", "return CloseWindow();"); oFunction.ConfigureToolButton(btnSave, "/images/tool_save"); oFunction.ConfigureToolButton(btnPrint, "/images/tool_print"); btnPrint.Attributes.Add("onclick", "return PrintWindow();"); oFunction.ConfigureToolButton(btnClose, "/images/tool_close"); btnClose.Attributes.Add("onclick", "return ExitWindow();"); btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "');"); btnChange.Attributes.Add("onclick", "return ValidateText('" + txtNumber.ClientID + "','Please enter a change control number')" + " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid implementation date')" + " && ValidateTime('" + txtTime.ClientID + "','Please enter a valid implementation time')" + ";"); imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');"); // 6/1/2009 - Load ReadOnly View if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) { oFunction.ConfigureToolButtonRO(btnSave, btnComplete); //panDenied.Visible = true; } } } else { panDenied.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oFunction = new Functions(intProfile, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oPage = new Pages(intProfile, dsn); oResourceRequest = new ResourceRequest(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oAccountRequest = new AccountRequest(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oService = new Services(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); } string strAttributes = ""; bool boolIncomplete = false; if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "") { intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); DataSet ds = oResourceRequest.Get(intResourceParent); if (ds.Tables[0].Rows.Count > 0) { intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); // Workflow start bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3"); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); // Workflow end intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); int intApp = oRequestItem.GetItemApplication(intItem); if (Request.QueryString["save"] != null && Request.QueryString["save"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>"); } if (oService.Get(intService, "sla") != "") { oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla"); int intDays = oResourceRequest.GetSLA(intResourceParent); if (intDays < 1) { btnSLA.Style["border"] = "solid 2px #FF0000"; } else if (intDays < 3) { btnSLA.Style["border"] = "solid 2px #FF9999"; } btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');"); } else { btnSLA.ImageUrl = "/images/tool_sla_dbl.gif"; btnSLA.Enabled = false; } if (!IsPostBack) { if (intResourceWorkflow > 0) { ds = oRequest.Get(intRequest); if (ds.Tables[0].Rows.Count > 0) { ds = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["completed"].ToString() == "") { boolIncomplete = true; } else { lblComplete.Text = ds.Tables[0].Rows[0]["completed"].ToString(); panComplete.Visible = true; } lblRequestBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest)); lblRequestOn.Text = DateTime.Parse(oRequest.Get(intRequest, "created")).ToLongDateString(); int intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()); Domains oDomain = new Domains(intProfile, dsn); intDomain = Int32.Parse(oDomain.Get(intDomain, "environment")); AD oAD = new AD(intProfile, dsn, intDomain); DataSet dsParameters = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber); switch (ds.Tables[0].Rows[0]["maintenance"].ToString()) { case "DISABLE": lblType.Text = "Account Disable"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; break; case "UNLOCK": lblType.Text = "Account Unlock"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; break; case "ENABLE": lblType.Text = "Account Enable"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; break; case "EMAIL": lblType.Text = "Email Enable an Account"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; break; case "MOVE": lblType.Text = "Account Move"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; strDetails += "<tr><td><b>New Location:</b></td><td>" + dsParameters.Tables[0].Rows[0]["value"].ToString() + "</td>"; break; case "PASSWORD": lblType.Text = "Account Password Change"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; break; case "COPY": lblType.Text = "Account Copy"; panPassword.Visible = true; strAttributes += "ValidateText('" + txtPassword.ClientID + "','Please enter a password') && "; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; panID.Visible = true; txtID.Text = dsParameters.Tables[0].Rows[0]["value"].ToString(); panFirst.Visible = true; txtFirst.Text = dsParameters.Tables[0].Rows[1]["value"].ToString(); panLast.Visible = true; txtLast.Text = dsParameters.Tables[0].Rows[2]["value"].ToString(); panGroups.Visible = true; string[] strGroups; char[] strSplit = { ';' }; strGroups = dsParameters.Tables[0].Rows[3]["value"].ToString().Split(strSplit); for (int ii = 0; ii < strGroups.Length; ii++) { if (strGroups[ii].Trim() != "") { ListItem oList = new ListItem(strGroups[ii].Trim()); chkGroups.Items.Add(oList); oList.Selected = true; } } break; case "DELETE": lblType.Text = "Account Deletion"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; break; case "RENAME": lblType.Text = "Account Rename"; strDetails += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>"; strDetails += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>"; panID.Visible = true; txtID.Text = dsParameters.Tables[0].Rows[0]["value"].ToString(); panFirst.Visible = true; txtFirst.Text = dsParameters.Tables[0].Rows[1]["value"].ToString(); panLast.Visible = true; txtLast.Text = dsParameters.Tables[0].Rows[2]["value"].ToString(); break; default: lblType.Text = "Unavailable"; strDetails += "<tr><td colspan=\"2\"><b>Invalid Maintenance Code!</b></td>"; break; } panWorkload.Visible = true; } else { panDenied.Visible = true; } } else { panDenied.Visible = true; } } else { panDenied.Visible = true; } btnDenied.Attributes.Add("onclick", "return CloseWindow();"); oFunction.ConfigureToolButton(btnApprove, "/images/tool_approve"); oFunction.ConfigureToolButton(btnDeny, "/images/tool_deny"); if (boolIncomplete == true) { btnApprove.Attributes.Add("onclick", "return " + strAttributes + "confirm('Are you sure you want to APPROVE this request?');"); btnDeny.Attributes.Add("onclick", "return ValidateText('" + txtComments.ClientID + "','Please enter a reason') && confirm('Are you sure you want to DENY this request?');"); } else { btnApprove.Attributes.Add("onclick", "alert('This request has already been completed.\\n\\nIf this request continues to appear in your work queue, please contact a ClearView administrator.');return false;"); btnDeny.Attributes.Add("onclick", "alert('This request has already been completed.\\n\\nIf this request continues to appear in your work queue, please contact a ClearView administrator.');return false;"); } oFunction.ConfigureToolButton(btnPrint, "/images/tool_print"); btnPrint.Attributes.Add("onclick", "return PrintWindow();"); oFunction.ConfigureToolButton(btnClose, "/images/tool_close"); btnClose.Attributes.Add("onclick", "return ExitWindow();"); // 6/1/2009 - Load ReadOnly View if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) { oFunction.ConfigureToolButtonRO(btnApprove, btnDeny); //panDenied.Visible = true; } } } else { panDenied.Visible = true; } } else { panDenied.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oProject = new Projects(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oPage = new Pages(intProfile, dsn); oResourceRequest = new ResourceRequest(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oService = new Services(intProfile, dsn); oRequestField = new RequestFields(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oOnDemandTasks = new OnDemandTasks(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oClass = new Classes(intProfile, dsn); oServer = new Servers(0, 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["rrid"] != null && Request.QueryString["rrid"] != "") { lblResourceWorkflow.Text = Request.QueryString["rrid"]; int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); DataSet ds = oResourceRequest.Get(intResourceParent); intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); // Workflow start bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3"); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); // Workflow end int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); lblService.Text = oService.Get(intService, "name"); int intApp = oRequestItem.GetItemApplication(intItem); double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent); dblUsed = (dblUsed / dblAllocated) * 100; if (Request.QueryString["save"] != null && Request.QueryString["save"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>"); } if (Request.QueryString["status"] != null && Request.QueryString["status"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Weekly Status has been Added');<" + "/" + "script>"); } intProject = oRequest.GetProjectNumber(intRequest); hdnTab.Value = "D"; panWorkload.Visible = true; LoadStatus(intResourceWorkflow); bool boolDone = LoadInformation(intResourceWorkflow); if (boolDone == true) { if (boolComplete == false) { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "return ValidateDropDown('" + ddlSuccess.ClientID + "','Please select a status') && confirm('Are you sure you want to mark this as completed and remove it from your workload?');"); } else { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;"); } imgSuccess.ImageUrl = "/images/green_arrow.gif"; btnSave.ImageUrl = "/images/tool_save.gif"; btnSave.Enabled = false; } else { btnComplete.ImageUrl = "/images/tool_complete_dbl.gif"; btnComplete.Enabled = false; oFunction.ConfigureToolButton(btnSave, "/images/tool_save"); } btnDenied.Attributes.Add("onclick", "return CloseWindow();"); oFunction.ConfigureToolButton(btnSave, "/images/tool_save"); oFunction.ConfigureToolButton(btnPrint, "/images/tool_print"); btnPrint.Attributes.Add("onclick", "return PrintWindow();"); oFunction.ConfigureToolButton(btnClose, "/images/tool_close"); btnClose.Attributes.Add("onclick", "return ExitWindow();"); btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtIssues.ClientID + "');"); // 6/1/2009 - Load ReadOnly View if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) { oFunction.ConfigureToolButtonRO(btnSave, btnComplete); //panDenied.Visible = true; } } else { panDenied.Visible = true; } }
protected void btnApprove_Click(Object Sender, EventArgs e) { if (Request.QueryString["rrid"] != null) { // Approved; Send to team lead for assignment int intResource = Int32.Parse(Request.QueryString["rrid"]); int intRequest = Int32.Parse(oResourceRequest.Get(intResource, "requestid")); int intService = Int32.Parse(oResourceRequest.Get(intResource, "serviceid")); int intNumber = Int32.Parse(oResourceRequest.Get(intResource, "number")); string strCVT = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(); int ApprovalID = 0; DataSet dsApproval = oResourceRequest.GetApprovals(intRequest, intService, intNumber); foreach (DataRow drApproval in dsApproval.Tables[0].Rows) { if (Int32.Parse(drApproval["userid"].ToString()) == intProfile) { if (String.IsNullOrEmpty(drApproval["approved"].ToString()) == false || String.IsNullOrEmpty(drApproval["denied"].ToString()) == false) { ApprovalID = Int32.Parse(drApproval["id"].ToString()); break; } } } if (ApprovalID == 0) { oLog.AddEvent(intRequest.ToString(), strCVT, "Not already approved for user " + oUser.GetName(intProfile), LoggingType.Debug); oResourceRequest.UpdateStatusOverall(intResource, 2); if (oResourceRequest.Get(intResource, "platform_approval") == "0") { // Platform Approve oResourceRequest.ApprovePlatform(intResource, 1); SendEmail(intRequest, true, "PLATFORM", txtReason.Text); oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved PLATFORM", LoggingType.Debug); } else if (oService.GetSelected(intRequest, intService, intNumber, "approved") == "0") { // Service Manager Approve oService.UpdateSelectedApprove(intRequest, intService, intNumber, 1, intProfile, DateTime.Now, ""); SendEmail(intRequest, true, "SERVICE MANAGER", txtReason.Text); oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved SERVICE MANAGER", LoggingType.Debug); } else { oResourceRequest.UpdateApproval(intRequest, intService, intNumber, intProfile, txtReason.Text, DateTime.Now.ToString(), ""); SendEmail(intRequest, true, "3RD PARTY APPROVER", txtReason.Text); oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved 3RD PARTY APPROVER", LoggingType.Debug); } int intItem = Int32.Parse(oResourceRequest.Get(intResource, "itemid")); if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false) { oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0); } } else { oLog.AddEvent(intRequest.ToString(), strCVT, "Already approved for user " + oUser.GetName(intProfile), LoggingType.Debug); } } if (Request.QueryString["srid"] != null) { // Approved; Permit submission int intServiceSelectedID = Int32.Parse(Request.QueryString["srid"]); DataSet dsServiceSelected = oService.GetSelectedById(intServiceSelectedID); 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()); string strCVT = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(); oService.UpdateSelectedApprove(intRequest, intService, intNumber, 1, intProfile, DateTime.Now, ""); SendEmail(intRequest, true, "SERVICE MANAGER", txtReason.Text); oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved SERVICE MANAGER", LoggingType.Debug); // Kick off any automated processing... Workstations oWorkstation = new Workstations(intProfile, dsn); oWorkstation.ExecuteVMware(intRequest); } if (Request.QueryString["rid"] != null) { // Manager Approve int intRequest = Int32.Parse(Request.QueryString["rid"]); oServiceRequest.UpdateApproval(intRequest, 1); oResourceRequest.UpdateStatusRequest(intRequest, 2); SendEmail(intRequest, true, "MANAGER", txtReason.Text); DataSet dsForm = oRequestItem.GetForms(intRequest); foreach (DataRow drForm in dsForm.Tables[0].Rows) { int intService = 0; Int32.TryParse(drForm["serviceid"].ToString(), out intService); int intNumber = 0; Int32.TryParse(drForm["number"].ToString(), out intNumber); if (intService > 0 && intNumber > 0) { if (oServiceRequest.NotifyApproval(intRequest, intService, intNumber, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false) { // Send to Team Lead for assignment ds = oResourceRequest.GetUnAssigned(intRequest, 0); foreach (DataRow dr in ds.Tables[0].Rows) { int intItem = Int32.Parse(dr["itemid"].ToString()); oServiceRequest.NotifyTeamLead(intItem, Int32.Parse(dr["id"].ToString()), intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0); } } } } } Response.Redirect(oPage.GetFullLink(intPage) + "?action=finish"); }
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 + "');"); }
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(" "); } 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(" ** WARNING: Information Unavailable (# " + strCatch + ") ** "); } 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); }
private void LoadRequest() { int intRequest = Int32.Parse(Request.QueryString["rid"]); int intProject = oRequest.GetProjectNumber(intRequest); int intPriority = 3; int intService = Int32.Parse(lblService.Text); int intItem = oService.GetItemId(intService); string strStatement = ""; string strExpedite = ""; if (oService.Get(intService, "statement") == "1") { panStatement.Visible = true; strStatement += " && ValidateText('" + txtStatement.ClientID + "','Please enter a statement of work')"; } else { panStatement.Visible = false; } panUpload.Visible = (oService.Get(intService, "upload") == "1"); //if (oService.Get(intService, "expedite") == "1") //{ // panExpedite.Visible = true; // strExpedite += " && ValidateRadioButtons('" + radExpediteYes.ClientID + "','" + radExpediteNo.ClientID + "','Please select whether or not you want to expedite this request')"; //} //else panExpedite.Visible = false; if (Request.QueryString["formid"] != null && Request.QueryString["formid"] != "") { panUpdate.Visible = true; btnCancelR.Visible = boolReqReturned; btnCancel.Visible = (boolReqReturned == false); DataSet ds = oServiceEditor.GetRequestData(intRequest, intService, Int32.Parse(lblNumber.Text), 0, dsn); if (ds.Tables[0].Rows.Count > 0) { txtTitle.Text = ds.Tables[0].Rows[0]["title"].ToString(); txtStatement.Text = ds.Tables[0].Rows[0]["statement"].ToString(); intPriority = Int32.Parse(ds.Tables[0].Rows[0]["priority"].ToString()); radExpediteYes.Checked = (ds.Tables[0].Rows[0]["expedite"].ToString() == "1"); radExpediteNo.Checked = (ds.Tables[0].Rows[0]["expedite"].ToString() == "0"); } strForm = oServiceEditor.LoadForm(intService, false, false, "", intEnvironment, ds, dsn); } else { panNavigation.Visible = true; strForm = oServiceEditor.LoadForm(intService, false, false, "", intEnvironment, null, dsn); } // Priority and SLA int intApp = oRequestItem.GetItemApplication(intItem); int intWorkingDays = oApplication.GetLead(intApp, intPriority); if (intWorkingDays > 0) { panDeliverable.Visible = true; //oApplication.AssignPriority(intApp, radPriority, lblDeliverable.ClientID, txtEnd.ClientID, hdnEnd.ClientID); lblDeliverable.Text = intWorkingDays.ToString(); //if (boolFound == false) // txtEnd.Text = DateTime.Today.AddDays(intWorkingDays).ToShortDateString(); hdnEnd.Value = DateTime.Today.AddDays(intWorkingDays).ToShortDateString(); } radPriority.SelectedValue = intPriority.ToString(); string strRequired = oServiceEditor.GetRequired(); // Load Title if no project if (intProject == -1) { panTitle.Visible = true; if (oService.Get(intService, "title_override") == "1") { lblTitleName.Text = oService.Get(intService, "title_name"); } btnNext.Attributes.Add("onclick", "return ValidateText('" + txtTitle.ClientID + "','Please enter a title')" + strStatement + strRequired + strExpedite + " && ProcessButton(this) && LoadWait();"); btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtTitle.ClientID + "','Please enter a title')" + strStatement + strRequired + strExpedite + " && ProcessButton(this) && LoadWait();"); } else { btnNext.Attributes.Add("onclick", "return true" + strStatement + strRequired + strExpedite + " && ProcessButton(this) && LoadWait();"); btnUpdate.Attributes.Add("onclick", "return true" + strStatement + strRequired + strExpedite + " && ProcessButton(this) && LoadWait();"); } //Check for returned requests if (boolReqReturned == true || boolReqDenied == true) { int intReturned = 0; Int32.TryParse(lblReturned.Text, out intReturned); ResourceRequest oResourceRequest = new ResourceRequest(0, dsn); DataSet dsResource = oResourceRequest.GetAllService(intRequest, intReturned, Int32.Parse(lblNumber.Text)); if (dsResource.Tables[0].Rows.Count > 0) { int intResource = Int32.Parse(dsResource.Tables[0].Rows[0]["rrid"].ToString()); DataSet dsRR = oResourceRequest.Get(intResource); Users oUser = new Users(0, dsn); if (dsRR.Tables[0].Rows.Count > 0) { if (dsRR.Tables[0].Rows[0]["status"].ToString() == "-1") { // Request Denied lblReqDenyCommentValue.Text = dsRR.Tables[0].Rows[0]["reason"].ToString(); if (lblReqDenyCommentValue.Text == "") { int intApproved = 0; // Try getting from service approval. DataSet dsSelected2 = oService.GetSelected(intRequest, intReturned, Int32.Parse(lblNumber.Text)); for (int ii = Int32.Parse(lblNumber.Text); ii > 0 && dsSelected2.Tables[0].Rows.Count == 0; ii--) { dsSelected2 = oService.GetSelected(intRequest, intReturned, ii - 1); } if (dsSelected2.Tables[0].Rows.Count > 0) { intApproved = Int32.Parse(dsSelected2.Tables[0].Rows[0]["approved"].ToString()); } if (intApproved < 0) { lblReqDenyCommentValue.Text = dsSelected2.Tables[0].Rows[0]["reason"].ToString(); } } pnlReqDenied.Visible = true; } else if (dsRR.Tables[0].Rows[0]["status"].ToString() == "7") { DataSet dsRRReturn = oResourceRequest.getResourceRequestReturn(intResource, intReturned, Int32.Parse(lblNumber.Text), 0, 0); if (dsRRReturn.Tables[0].Rows.Count > 0) { lblReqReturnedId.Text = dsRRReturn.Tables[0].Rows[0]["Id"].ToString(); lblReqReturnCommentValue.Text = oFunction.FormatText(dsRRReturn.Tables[0].Rows[0]["Comments"].ToString()); lblReqReturnedByValue.Text = oUser.GetName(Int32.Parse(dsRRReturn.Tables[0].Rows[0]["ReturnedByUser"].ToString())); lblReqReturnedByValue.Text = oUser.GetFullName(Int32.Parse(dsRRReturn.Tables[0].Rows[0]["ReturnedByUser"].ToString())); pnlReqReturn.Visible = true; } DataSet dsRRReturn2 = oResourceRequest.getResourceRequestReturn(intResource, intReturned, Int32.Parse(lblNumber.Text), 1, 0); if (dsRRReturn2.Tables[0].Rows.Count > 0) { lblReqReturnedId2.Text = dsRRReturn2.Tables[0].Rows[0]["Id"].ToString(); lblReqReturnCommentValue2.Text = oFunction.FormatText(dsRRReturn2.Tables[0].Rows[0]["Comments"].ToString()); lblReqReturnedByValue2.Text = oUser.GetName(Int32.Parse(dsRRReturn2.Tables[0].Rows[0]["ReturnedByUser"].ToString())); lblReqReturnedByValue2.Text = oUser.GetFullName(Int32.Parse(dsRRReturn2.Tables[0].Rows[0]["ReturnedByUser"].ToString())); pnlReqReturn2.Visible = true; } } else { pnlReqReturn.Visible = false; pnlReqReturn2.Visible = false; } } } } }
protected void btnSubmit_Click(Object Sender, EventArgs e) { int intResourceParent = Int32.Parse(lblResourceParent.Text); ds = oResourceRequest.Get(intResourceParent); if (ds.Tables[0].Rows.Count > 0) { int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); string strCVT = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString(); string strService = oService.GetName(intService); if (intService == 0) { strService = oRequestItem.GetItemName(intItem); } int intApp = oRequestItem.GetItemApplication(intItem); int intProject = Int32.Parse(oRequest.Get(intRequest, "projectid")); Projects oProject = new Projects(intProfile, dsn); ProjectsPending oProjectsPending = new ProjectsPending(intProfile, dsn, intEnvironment); Functions oFunction = new Functions(intProfile, dsn, intEnvironment); Variables oVariable = new Variables(intEnvironment); RequestFields oRequestField = new RequestFields(intProfile, dsn); int intRequester = Int32.Parse(oRequest.Get(intRequest, "userid")); int intPC = 0; int intIE = 0; if (intProject > 0) { if (oProject.Get(intProject, "lead") != "") { intPC = Int32.Parse(oProject.Get(intProject, "lead")); } if (oProject.Get(intProject, "engineer") != "") { intIE = Int32.Parse(oProject.Get(intProject, "engineer")); } } else { try { intPC = Int32.Parse(oProjectsPending.GetRequest(intRequest, "lead")); intIE = Int32.Parse(oProjectsPending.GetRequest(intRequest, "engineer")); } catch { } } string strCC = ""; if (intPC > 0) { strCC += oUser.GetName(intPC) + ";"; } if (intIE > 0) { strCC += oUser.GetName(intIE) + ";"; } if (radReject.Checked == true) { string strComments = ""; if (txtComments.Text.Trim() != "") { strComments = "<p>The following comments were added:<br/>" + txtComments.Text + "</p>"; } string strDefault = oUser.GetApplicationUrl(intRequester, intAssignPage); strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT,EMAILGRP_REQUEST_STATUS"); if (strDefault == "" || oApplication.Get(intApp, "tpm") != "1") { oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p><b>The following request has been rejected by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments, true, false); } else { oFunction.SendEmail("Request REJECTED: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request REJECTED: " + strService, "<p><b>The following request has been rejected by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + strComments + "<p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intAssignPage) + "?rrid=" + intResourceParent.ToString() + "\" target=\"_blank\">Click here to assign a new project manager to your request.</a></p>", true, false); } oResourceRequest.UpdateAccepted(intResourceParent, -1); oResourceRequest.UpdateReason(intResourceParent, txtComments.Text); } else if (radHold.Checked == true) { oResourceRequest.UpdateStatusOverall(intResourceParent, 5); oResourceRequest.UpdateReason(intResourceParent, txtHold.Text); } else { if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "") { oProject.Update(intProject, oProjectNumber.New()); } oProject.Update(intProject, 2); bool boolSolo = (oResourceRequest.Get(intResourceParent, "solo") == "1"); int intAssigned = 0; bool boolRejected = (oResourceRequest.Get(intResourceParent, "accepted") == "-1"); ProjectRequest oProjectRequest = new ProjectRequest(intProfile, dsn); string strNotify = ""; string strSpacerRow = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>"; if (boolRejected == true) { oResourceRequest.UpdateRejected(intResourceParent, 1); intAssigned = Int32.Parse(Request.Form[hdnManager.UniqueID]); int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, oResourceRequest.Get(intResourceParent, "name"), intAssigned, Int32.Parse(txtQuantity.Text), double.Parse(txtHours.Text), 2, 0); oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug); string strDefault = oUser.GetApplicationUrl(intAssigned, intViewPage); if (boolSolo == false) { strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT"); // ADD PM if (strDefault == "") { oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p>", true, false); } else { if (intProject > 0) { oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } else { oFunction.SendEmail("Request Assignment", oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following project has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } } string strExecutive = oProject.Get(intProject, "executive"); string strWorking = oProject.Get(intProject, "working"); string strActivity = "<tr><td><b>Resource:</b></td><td> </td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>"; strActivity += strSpacerRow; strActivity += "<tr><td><b>Service:</b></td><td> </td><td>Project Coordinator</td></tr>"; strActivity = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>"; string strDeliverable = oApplication.Get(intApp, "deliverables_doc"); if (strDeliverable.Trim() != "") { strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>"; } if (oService.Get(intService, "notify_client") != "0") { strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT"); oFunction.SendEmail("Request Assignment", oUser.GetName(intRequester), strExecutive + ";" + strWorking + ";" + strCC, strEMailIdsBCC, "Request Assignment", "<p><b>A resource has been assigned to the following project...</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false); } } else { strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DEVELOPER_ERROR"); oFunction.SendEmail("ERROR: Request Assignment", strEMailIdsBCC, "", "", "ERROR: Request Assignment", "<p><b>A REJECTED resource request with a SOLO status of 1 has been assigned to " + oUser.GetName(intAssigned) + "...</b><p><p>" + oProjectRequest.GetBody(intRequest, intEnvironment, true) + "</p>", true, false); } } else { oResourceRequest.UpdateAccepted(intResourceParent, 1); if (boolSolo == true) { string strResources = ""; DataSet dsAssigned = oResourceRequest.GetWorkflowsAssign(intResourceParent); foreach (DataRow drAssigned in dsAssigned.Tables[0].Rows) { intAssigned = Int32.Parse(drAssigned["userid"].ToString()); int intQuantity = Int32.Parse(drAssigned["devices"].ToString()); double dblHours = double.Parse(drAssigned["allocated"].ToString()); int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, oResourceRequest.Get(intResourceParent, "name"), intAssigned, intQuantity, dblHours, 2, 0); oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug); oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 2, true); if (intItem != intImplementorDistributed && intItem != intImplementorMidrange) { //if (oProject.Get(intProject, "number").StartsWith("CV") == false) // strNotify = "<p><span style=\"color:#0000FF\"><b>PROJECT COORDINATOR:</b> Please allocate the hours listed above for each resource in Clarity.</span></p>"; string strDefault = oUser.GetApplicationUrl(intAssigned, intViewPage); strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT"); if (strDefault == "") { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } else { if (intProject > 0) { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } else { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intAssigned), "", strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned to you by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflow.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p>", true, false); } } if (strResources != "") { strResources += ", "; } strResources += oUser.GetFullName(intAssigned); } } string strActivity = "<tr><td><b>Resource(s):</b></td><td> </td><td>" + strResources + "</td></tr>"; strActivity += strSpacerRow; strActivity += "<tr><td><b>Service:</b></td><td> </td><td>" + strService + "</td></tr>"; strActivity = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strActivity + "</table>"; string strDeliverable = oApplication.Get(intApp, "deliverables_doc"); strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT"); if (strDeliverable.Trim() != "") { strDeliverable = "<p><a href=\"" + oVariable.URL() + strDeliverable + "\">Click here to view the service deliverables</a></p>"; } if (oService.Get(intService, "notify_client") != "0") { oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intRequester), strCC, strEMailIdsBCC, "Request Assignment: " + strService, "<p><b>The following request has been assigned...</b><p><p>" + oResourceRequest.GetSummary(intResourceParent, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p><p>" + strActivity + "</p>" + strDeliverable + strNotify, true, false); } } else { strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DEVELOPER_ERROR"); oFunction.SendEmail("ERROR: Request Assignment", strEMailIdsBCC, "", "", "ERROR: Request Assignment", "<p><b>An ACCEPTED resource request with a SOLO status of 0 has been assigned... RRID = " + intResourceParent.ToString() + "</b></p>", true, false); } } oResourceRequest.UpdateStatusOverall(intResourceParent, 2); oResourceRequest.UpdateAssignedBy(intResourceParent, intProfile); } } Response.Redirect(oPage.GetFullLink(intPage) + "?action=finish"); }
protected void btnCancelR_Click(Object Sender, EventArgs e) { int intRequest = Int32.Parse(Request.QueryString["rid"]); ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn); ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn); Requests oRequest = new Requests(intProfile, dsn); Users oUser = new Users(intProfile, dsn); Projects oProject = new Projects(intProfile, dsn); int intItem = Int32.Parse(lblItem.Text); int intNumber = Int32.Parse(lblNumber.Text); int intService = Int32.Parse(lblService.Text); int intProject = oRequest.GetProjectNumber(intRequest); // Remove Resource Request DataSet dsForm = oRequestItem.GetForms(intRequest, intService); string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT,EMAILGRP_REQUEST_STATUS"); foreach (DataRow drForm in dsForm.Tables[0].Rows) { int intCancelNum = Int32.Parse(drForm["number"].ToString()); if (intNumber > 0) { intCancelNum = intNumber; } DataSet dsResource = oResourceRequest.Get(intRequest, intItem, intCancelNum); if (dsResource.Tables[0].Rows.Count > 0) { int intResourceWorkflow = Int32.Parse(dsResource.Tables[0].Rows[0]["id"].ToString()); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); oResourceRequest.UpdateStatusOverall(intResourceParent, -2); DataSet dsManager = oService.GetUser(intService, 1); DataSet dsResources = oResourceRequest.GetWorkflowsParent(intResourceParent); foreach (DataRow drResources in dsResources.Tables[0].Rows) { int intUser = Int32.Parse(drResources["userid"].ToString()); if (intUser == 0) { foreach (DataRow drManager in dsManager.Tables[0].Rows) { int intManager = Int32.Parse(drManager["userid"].ToString()); oFunction.SendEmail("ClearView Service Request CANCELLED", oUser.GetName(intManager), "", strEMailIdsBCC, "ClearView Service Request CANCELLED", "<p><b>The following service request has been cancelled by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(Int32.Parse(drResources["id"].ToString()), intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } } else { foreach (DataRow drManager in dsManager.Tables[0].Rows) { int intManager = Int32.Parse(drManager["userid"].ToString()); oFunction.SendEmail("ClearView Service Request CANCELLED", oUser.GetName(intUser), oUser.GetName(intManager), strEMailIdsBCC, "ClearView Service Request CANCELLED", "<p><b>The following service request has been cancelled by " + oUser.GetFullName(intProfile) + "</b><p><p>" + oResourceRequest.GetWorkflowSummary(Int32.Parse(drResources["id"].ToString()), intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false); } } } } oService.CancelSelected(intRequest, intService, intCancelNum); if (intCancelNum > 0) { break; } } DataSet ds = oRequest.Gets(intProject); if (ds.Tables[0].Rows.Count == 0) { oProject.Delete(intProject); } Response.Redirect(oPage.GetFullLink(intPage)); }
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); oRequestItem = new RequestItems(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oVariable = new Variables(intEnvironment); oService = new Services(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oStatusLevel = new StatusLevels(); oServiceDetail = new ServiceDetails(intProfile, dsn); oLog = new Log(intProfile, dsn); if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.QueryString["action"] != null && Request.QueryString["action"] != "") { panFinish.Visible = true; } else { 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); } if (!IsPostBack) { if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "") { lblResourceParent.Text = Request.QueryString["rrid"]; int intResourceParent = Int32.Parse(lblResourceParent.Text); ds = oResourceRequest.Get(intResourceParent); if (ds.Tables[0].Rows.Count > 0) { int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); int intProject = Int32.Parse(oRequest.Get(intRequest, "projectid")); int intApp = oRequestItem.GetItemApplication(intItem); int intForecast = 0; Forecast oForecast = new Forecast(intProfile, dsn); DataSet dsForecast = oForecast.GetProject(intProject); if (dsForecast.Tables[0].Rows.Count > 0) { intForecast = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString()); } if (intForecast > 0) { btnView.Attributes.Add("oncontextmenu", "return OpenWindow('NEW_WINDOW','" + oPage.GetFullLink(intDesignBuilder) + "?id=" + intForecast.ToString() + "');"); } else { btnView.Attributes.Add("oncontextmenu", "alert('There is no design for this project');return false;"); } if (ds.Tables[0].Rows[0]["solo"].ToString() == "0") { btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');"); btnView.Text = "Click here to view the project details"; lblType.Text = "Project Request"; } else { btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResourceParent.ToString() + "');"); if (oApplication.Get(intApp, "tpm") == "1") { btnView.Text = "Click here to view the project details"; } else { btnView.Text = "Click here to view this request"; } lblType.Text = "Service Request"; } btnAssignments.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intSearchPage.ToString() + "&pid=" + intProject + "&aid=" + intApp.ToString() + "&sort=userid');"); lblItem.Text = intItem.ToString(); lblService.Text = oService.GetName(intService); lblServiceID.Text = intService.ToString(); if (oApplication.Get(intApp, "request_items") == "1") { lblGroup.Text = oApplication.GetName(intApp) + " | " + oRequestItem.GetItemName(intItem); } else { lblGroup.Text = oApplication.GetName(intApp); } int intUser = Int32.Parse(oRequest.Get(intRequest, "userid")); int intAppManager = oApplication.GetManager(intApp); if (ds.Tables[0].Rows[0]["accepted"].ToString() == "-1" && oApplication.Get(intApp, "tpm") == "1") { if (intUser == intProfile || oDelegate.Get(intUser, intProfile) > 0) { panRequest.Visible = true; panAssignSingle.Visible = true; txtHours.Text = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F"); lblHoursOverall.Text = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F"); txtQuantityOverall.Text = ds.Tables[0].Rows[0]["devices"].ToString(); txtQuantityOverall.Enabled = false; txtQuantity.Text = txtQuantityOverall.Text; txtQuantity.Enabled = false; lblHours.Visible = true; lblHours.Text = txtHours.Text; lblStatus.Text = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString())); txtQuantity.Text = ds.Tables[0].Rows[0]["devices"].ToString(); btnAssign.Enabled = (txtQuantity.Text != "0"); lblAssignBy.Text = oUser.GetFullName(intProfile); strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false); } else { Response.Write("no rights"); panDenied.Visible = true; } btnSubmit.Attributes.Add("onclick", "return ValidateNumber0('" + txtHours.ClientID + "','Please enter a valid number for the hours allocated') && ValidateHidden('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter a valid LAN ID') && ProcessButton(this);"); } else { if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile) || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1")) { panRequest.Visible = true; panAssignMultiple.Visible = true; btnSubmit.Enabled = (ds.Tables[0].Rows[0]["assigned"].ToString() == ""); if (ds.Tables[0].Rows[0]["status"].ToString() == "5") { radHold.Checked = true; divChoice.Style["display"] = "inline"; divHold.Style["display"] = "inline"; txtHold.Text = ds.Tables[0].Rows[0]["reason"].ToString(); } else { divChoice.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "0" ? "inline" : "none"); if (Request.QueryString["assign"] != null) { divAccept.Style["display"] = "inline"; radAccept.Checked = true; } else { divAccept.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "1" ? "inline" : "none"); } } panDelete.Visible = (intItem == intImplementorDistributed || intItem == intImplementorMidrange); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this request');"); txtHours.Text = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F"); lblHoursOverall.Text = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F"); txtQuantityOverall.Text = ds.Tables[0].Rows[0]["devices"].ToString(); if (oApplication.Get(intApp, "tpm") == "1") { lblHours.Visible = true; lblHours.Text = txtHours.Text; txtQuantityOverall.Enabled = false; txtQuantity.Enabled = false; btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" + " && ProcessButton(this)" + ";"); } else if (oServiceDetail.Gets(intService, 1).Tables[0].Rows.Count > 0) { lblHours.Visible = true; lblHours.Text = "TBD "; btnWhy.Visible = true; btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" + " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" + " && ProcessButton(this)" + ";"); } else if (oService.Get(intService, "disable_hours") == "1") { lblHours.Visible = true; lblHours.Text = txtHours.Text; btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" + " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" + " && ProcessButton(this)" + ";"); } else { txtHours.Visible = true; btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" + " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" + " && ValidateNumber0('" + txtHours.ClientID + "','Please enter the hours')" + " && ProcessButton(this)" + ";"); } btnUpdate.Attributes.Add("onclick", "return ValidateNumber0('" + txtQuantityOverall.ClientID + "') && ProcessButton(this);"); DataSet dsAssigned = oResourceRequest.GetWorkflowsAssign(intResourceParent); int intQuantity = Int32.Parse(ds.Tables[0].Rows[0]["devices"].ToString()); foreach (DataRow drAssigned in dsAssigned.Tables[0].Rows) { intQuantity = intQuantity - Int32.Parse(drAssigned["devices"].ToString()); } txtQuantity.Text = intQuantity.ToString(); btnAssign.Enabled = (txtQuantity.Text != "0"); lblStatus.Text = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString())); lblAssigned.Visible = !(btnSubmit.Enabled); string strAssign = ""; DataSet dsManager = oService.GetUser(intService, 1); foreach (DataRow drManager in dsManager.Tables[0].Rows) { if (strAssign != "") { strAssign += ", "; } strAssign += oUser.GetFullName(Int32.Parse(drManager["userid"].ToString())); } lblAssignBy.Text = strAssign; DataSet dsReports = oUser.GetManagerReports(intAppManager, intRequest, intService, intNumber); DataTable dtReports = dsReports.Tables[0].Copy(); dtReports.Clear(); DataSet dsAssignment = oService.GetUser(intService, -100); foreach (DataRow drAssignment in dsAssignment.Tables[0].Rows) { int intAssignment = Int32.Parse(drAssignment["userid"].ToString()); DataSet dsAssignees = oUser.GetManagerReports(intAssignment, intRequest, intService, intNumber); foreach (DataRow drAssignee in dsAssignees.Tables[0].Rows) { dtReports.ImportRow(drAssignee); } } if (dtReports.Rows.Count > 0) { // Use custom assignment list // First, remove duplicates Hashtable hTable = new Hashtable(); ArrayList duplicateList = new ArrayList(); foreach (DataRow drow in dtReports.Rows) { if (hTable.Contains(drow["userid"])) { duplicateList.Add(drow); } else { hTable.Add(drow["userid"], string.Empty); } } foreach (DataRow dRow in duplicateList) { dtReports.Rows.Remove(dRow); } // Next, sort by username dtReports.DefaultView.Sort = "username"; // Now add to dataset dsReports = new DataSet(); dsReports.Tables.Add(dtReports.DefaultView.ToTable()); } LoadList(dsReports, intApp); LoadAvailable(dsReports, intApp); rptAssign.DataSource = dsAssigned; rptAssign.DataBind(); foreach (RepeaterItem ri in rptAssign.Items) { ((LinkButton)ri.FindControl("btnDeleteAssign")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this assignment?');"); } lblAssign.Visible = (rptAssign.Items.Count == 0); strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false); btnSubmit.Attributes.Add("onclick", "return ValidateChoice('" + divChoice.ClientID + "','" + radAccept.ClientID + "','" + radReject.ClientID + "','" + radHold.ClientID + "'," + dsAssigned.Tables[0].Rows.Count.ToString() + ") && ProcessButton(this);"); } else { Response.Write("no delegate"); panDenied.Visible = true; } } } else { panDenied.Visible = true; } } else { panDenied.Visible = true; } } } btnClose.Attributes.Add("onclick", "return CloseWindow();"); lnkAvailable.Attributes.Add("onclick", "return ShowHideAvailable('" + divAvailable.ClientID + "');"); radAccept.Attributes.Add("onclick", "ShowHideDiv('" + divAccept.ClientID + "','inline');ShowHideDiv('" + divReject.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');"); radReject.Attributes.Add("onclick", "ShowHideDiv('" + divReject.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');"); radHold.Attributes.Add("onclick", "ShowHideDiv('" + divHold.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divReject.ClientID + "','none');"); txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);"); lstManager.Attributes.Add("ondblclick", "AJAXClickRow();"); btnWhy.Attributes.Add("onclick", "return ShowHideAvailable('" + divWhy.ClientID + "');"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oProject = new Projects(intProfile, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oUser = new Users(intProfile, dsn); oPage = new Pages(intProfile, dsn); oResourceRequest = new ResourceRequest(intProfile, dsn); oRequestItem = new RequestItems(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oService = new Services(intProfile, dsn); oServiceRequest = new ServiceRequests(intProfile, dsn); oRequestField = new RequestFields(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oServiceDetail = new ServiceDetails(intProfile, dsn); oDelegate = new Delegates(intProfile, dsn); oCustomized = new Customized(intProfile, dsn); oVariable = new Variables(intEnvironment); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); oLocation = new Locations(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["rrid"] != null && Request.QueryString["rrid"] != "") { // Start Workflow Change lblResourceWorkflow.Text = Request.QueryString["rrid"]; int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); ds = oResourceRequest.Get(intResourceParent); // End Workflow Change intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); lblRequestedBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest)); lblRequestedOn.Text = DateTime.Parse(oResourceRequest.Get(intResourceParent, "created")).ToString(); intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); // Start Workflow Change bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3"); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); // End Workflow Change intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); lblService.Text = oService.Get(intService, "name"); int intApp = oRequestItem.GetItemApplication(intItem); if (Request.QueryString["save"] != null && Request.QueryString["save"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>"); } if (Request.QueryString["status"] != null && Request.QueryString["status"] != "") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Status Updates has been Added');<" + "/" + "script>"); } if (!IsPostBack) { double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); lblUpdated.Text = oResourceRequest.GetUpdated(intResourceWorkflow); if (dblAllocated == dblUsed) { if (boolComplete == false) { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?');"); } else { oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete"); btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;"); } panComplete.Visible = true; } else { btnComplete.ImageUrl = "/images/tool_complete_dbl.gif"; btnComplete.Enabled = false; } dblUsed = (dblUsed / dblAllocated) * 100; intProject = oRequest.GetProjectNumber(intRequest); hdnTab.Value = "D"; panWorkload.Visible = true; LoadStatus(intResourceWorkflow); LoadInformation(intResourceWorkflow); LoadDetails(); btnDenied.Attributes.Add("onclick", "return CloseWindow();"); oFunction.ConfigureToolButton(btnSave, "/images/tool_save"); oFunction.ConfigureToolButton(btnPrint, "/images/tool_print"); btnPrint.Attributes.Add("onclick", "return PrintWindow();"); oFunction.ConfigureToolButton(btnClose, "/images/tool_close"); btnClose.Attributes.Add("onclick", "return ExitWindow();"); btnSave.Attributes.Add("onclick", "return ValidateNumber0('" + txtAmount.ClientID + "','Please enter the total amount of storage')" + " && ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" + ";"); // 6/1/2009 - Load ReadOnly View if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) { oFunction.ConfigureToolButtonRO(btnSave, btnComplete); //panDenied.Visible = true; } } } else { panDenied.Visible = true; } }
private void LoadRequest() { // Get Workflow Details lblResourceWorkflow.Text = Request.QueryString["rrid"]; int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3"); double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); bool boolJoined = (oResourceRequest.GetWorkflow(intResourceWorkflow, "joined") == "1"); DataSet ds = oResourceRequest.Get(intResourceParent); //Project or Task Details intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); intProject = oRequest.GetProjectNumber(intRequest); if (intProject > 0) { lblName.Text = oProject.Get(intProject, "name"); lblNumber.Text = oProject.Get(intProject, "number"); lblType.Text = "Project"; } else { lblName.Text = oResourceRequest.GetWorkflow(intRequest, "name"); lblNumber.Text = "CVT" + intRequest.ToString(); lblType.Text = "Task"; } intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString()); intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString()); int intApp = oRequestItem.GetItemApplication(intItem); lblService.Text = oService.Get(intService, "name"); lblRequestedBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest)); lblRequestedOn.Text = DateTime.Parse(oResourceRequest.Get(intResourceParent, "created")).ToString(); lblDescription.Text = oRequest.Get(intRequest, "description"); if (lblDescription.Text == "") { lblDescription.Text = "<i>No information</i>"; } txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent); if (!IsPostBack) { double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); if (dblAllocated == dblUsed) { if (boolComplete == false) { btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?');"); } else { btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;"); } } else { btnComplete.ImageUrl = "/images/tool_complete_dbl.gif"; btnComplete.Enabled = false; } bool boolSLABreached = false; if (oService.Get(intService, "sla") != "") { int intDays = oResourceRequest.GetSLA(intResourceParent); if (intDays > -99999) { if (intDays < 1) { btnSLA.Style["border"] = "solid 2px #FF0000"; } else if (intDays < 3) { btnSLA.Style["border"] = "solid 2px #FF9999"; } boolSLABreached = (intDays < 0); btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');"); } else { btnSLA.ImageUrl = "/images/tool_sla_dbl.gif"; btnSLA.Enabled = false; } } else { btnSLA.ImageUrl = "/images/tool_sla_dbl.gif"; btnSLA.Enabled = false; } btnEmail.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_EMAIL','?rrid=" + intResourceWorkflow.ToString() + "&type=GENERIC');"); dblUsed = (dblUsed / dblAllocated) * 100; panWorkload.Visible = true; bool boolRed = LoadStatus(intResourceWorkflow); if (boolRed == false && boolSLABreached == true) { btnComplete.Attributes.Add("onclick", "alert('NOTE: Your Service Level Agreement (SLA) has been breached!\\n\\nYou must provide a RED STATUS update with an explanation of why your SLA was breached for this request.\\n\\nOnce a RED STATUS update has been provided, you will be able to complete this request.');return false;"); } LoadInformation(); chkDescription.Checked = (Request.QueryString["doc"] != null); //Change Control and Documents //ucWMStatusUpdates.RRWorkflowId = intResourceWorkflow; LoadChange(intResourceWorkflow); lblDocuments.Text = oDocument.GetDocuments_Service(intRequest, intService, oVariable.DocumentsFolder(), 1, (Request.QueryString["doc"] != null)); // 6/1/2009 - Load ReadOnly View if ((oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) || boolComplete == true) { oFunction.ConfigureToolButtonRO(btnSave, btnComplete); } btnReturn.Visible = false; //btnComplete.Visible = false; } //div selection if (Request.QueryString["div"] != null) { switch (Request.QueryString["div"]) { case "E": boolExecution = true; break; case "C": boolChange = true; break; case "D": boolDocuments = true; break; case "S": boolStatusUpdates = true; break; } } if (boolDetails == false && boolExecution == false && boolStatusUpdates == false && boolChange == false && boolDocuments == false) { boolDetails = true; } }
private wucWorkflowItem LoadWorkflow(int _requestid, int _serviceid, int _number, bool _workflow) { StringBuilder strReturn = new StringBuilder(); bool boolHasChildren = false; // Load Workflow services First! DataSet dsReceive = oService.GetWorkflowsReceive(_serviceid); foreach (DataRow drReceive in dsReceive.Tables[0].Rows) { int intWorkflowService = Int32.Parse(drReceive["serviceid"].ToString()); wucWorkflowItem _child = LoadWorkflow(RequestID, intWorkflowService, Number, true); strReturn.Append(_child.Html); if (_child.Children > 0) { boolHasChildren = true; } } // Now Load this service bool boolPending = false; //DataSet dsWorkflow = oResourceRequest.GetWorkflow(_requestid, _serviceid, _number); DataSet dsWorkflow = oServiceEditor.GetWorkflow(_requestid, _serviceid, _number); foreach (DataRow drWorkflow in dsWorkflow.Tables[0].Rows) { int intStatus = 0; Int32.TryParse(drWorkflow["status"].ToString(), out intStatus); int intResource = 0; Int32.TryParse(drWorkflow["userid"].ToString(), out intResource); int intRR = 0; Int32.TryParse(drWorkflow["resourceid"].ToString(), out intRR); string strStep = drWorkflow["step"].ToString(); string strComments = drWorkflow["comments"].ToString(); //if (strComments != "") // strComments = "Additional Comments:<br/>" + strComments; string strNotified = drWorkflow["created"].ToString(); string strWorkflowCompleted = strCompletedLast; string strCompleted = strCompletedLast = drWorkflow["completed"].ToString(); string strLabel = ""; string strFinish = "Completed"; string strHeader = ""; string strAdditional = ""; string strStatus = ""; string strPicture = ""; string strResource = ""; string strIcon = ""; bool boolActive = false; bool boolReturned = false; bool boolHide = false; bool boolComment = true; // only show comment gif for actual comments. switch (strStep) { case "REQUESTOR": strIcon = "/images/check_small.gif"; strNotified = ""; string strWorkflowTitle = oService.Get(_serviceid, "workflow_title"); if (dsReceive.Tables[0].Rows.Count > 0) { strHeader = "Workflow Generated"; intResource = -999; strComments = "<b>" + (strWorkflowTitle == "" ? oService.GetName(_serviceid) : strWorkflowTitle) + "</b> generated as part of a workflow"; boolComment = false; strCompleted = strWorkflowCompleted; strStatus = "Initiated"; strLabel = "Initiated By"; } else { strHeader = "Request Initiated"; strComments = "<b>" + (strWorkflowTitle == "" ? oService.GetName(_serviceid) : strWorkflowTitle) + "</b> submitted"; boolComment = false; strStatus = "Submitted"; strLabel = "Submitted By"; } strFinish = "Initiated On"; break; case "MANAGER_APPROVAL": case "SERVICE_APPROVAL": case "PLATFORM_APPROVAL": case "3RD_PARTY_APPROVAL": if (strStep == "MANAGER_APPROVAL") { strHeader = "Requestor's Manager Approval"; } else if (strStep == "SERVICE_APPROVAL") { strHeader = "Service Manager Approval"; } else if (strStep == "PLATFORM_APPROVAL") { strHeader = "Platform Manager Approval"; } else if (strStep == "3RD_PARTY_APPROVAL") { strHeader = "3rd Party Approval"; } switch (intStatus) { case 1: strIcon = "/images/check_small.gif"; strStatus = "Approved"; strFinish = "Approved"; break; case 0: strIcon = "/images/active.gif"; strStatus = "Pending Approval"; boolActive = true; boolPending = true; break; case -1: strIcon = "/images/cancel.gif"; strStatus = "Denied"; strFinish = "Denied"; break; } strLabel = "Approver"; break; case "RETURN": case "TECHNICIAN": strHeader = oService.GetName(_serviceid); strStatus = "In Progress"; if (strStep == "RETURN") { //strHeader = "Request Returned"; strLabel = "Resource"; strIcon = "/images/returned.gif"; strStatus = "Returned"; if (intStatus == 0) { boolReturned = true; } } else if (strStep == "TECHNICIAN") { //strHeader = "Resource Assigned"; strLabel = "Resource"; if (intStatus == (int)ResourceRequestStatus.Cancelled) { strIcon = "/images/cancel.gif"; strStatus = "Cancelled by Requestor"; strFinish = "Cancelled"; strCompleted = drWorkflow["modified"].ToString(); } else if (intStatus == (int)ResourceRequestStatus.OnHold) { strIcon = "/images/pending.gif"; strStatus = "On Hold"; } else if (intStatus == (int)ResourceRequestStatus.AwaitingResponse) { strIcon = "/images/delegate2.gif"; strStatus = "Awaiting Response"; } else if (strCompleted != "") { strIcon = "/images/check_small.gif"; strStatus = "Completed"; } //if (strIcon != "/images/ico_check.gif" && strComments.ToUpper() == "COMPLETED") // strComments = ""; } if (intRR > 0) { bool boolThis = false; DataSet dsRR = oResourceRequest.Get(intRR); if (dsRR.Tables[0].Rows.Count > 0) { DataRow drRR = dsRR.Tables[0].Rows[0]; int intRequest = 0; int intService = 0; int intNumber = 0; if (Int32.TryParse(drRR["requestid"].ToString(), out intRequest) && Int32.TryParse(drRR["serviceid"].ToString(), out intService) && Int32.TryParse(drRR["number"].ToString(), out intNumber)) { if (intRequest == RequestID && intService == ServiceID && intNumber == Number) { boolThis = true; } } } if (boolThis == false) { strAdditional = "<p><a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(drWorkflow["resourceid"].ToString()) + "', '800', '600');\">View Request Detail</a></p>"; } } break; case "MANAGER_ASSIGNMENT": strHeader = "Service Manager Assignment"; switch (intStatus) { case 1: if (strCompleted == "") { strIcon = "/images/active.gif"; strStatus = "Awaiting Assignment"; boolActive = true; } else { strIcon = "/images/check_small.gif"; strStatus = "Assigned to a Resource"; strFinish = "Assigned"; } break; case 0: if (boolPending == true) { // Still pending one or more approvals strIcon = "/images/pending.gif"; strStatus = "Awaiting Approval"; } else { strIcon = "/images/active.gif"; strStatus = "Awaiting Assignment"; boolActive = true; } break; case -1: strIcon = "/images/cancel.gif"; strStatus = "Rejected by service manager"; strFinish = "Rejected"; break; } strLabel = "Manager(s)"; break; } if (intResource == -999) { strResource = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('ClearView is a system account which is used for automated tasks.');\">ClearView</a>"; strPicture = "/images/clearview.gif"; } else { if (strStep == "MANAGER_ASSIGNMENT" && intResource == 0) { // Pending assignment, intRR = SERVICEID DataSet dsManagers = oService.GetUser(intRR, 1); // get managers strResource = ""; foreach (DataRow drManager in dsManagers.Tables[0].Rows) { int intManager = Int32.Parse(drManager["userid"].ToString()); strResource += "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intManager.ToString() + "');\">" + oUser.GetFullName(intManager) + " (" + oUser.GetName(intManager) + ")</a><br/>"; } } else if (intResource > 0) { strResource = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intResource.ToString() + "');\">" + oUser.GetFullName(intResource) + " (" + oUser.GetName(intResource) + ")</a>"; } else { strResource = "---"; } if (intResource > 0) { strPicture = "/frame/picture.aspx?xid=" + oUser.GetName(intResource); } else if (intResource == -1) { strPicture = "/images/nobody.gif"; } else { strPicture = "/images/nophoto.gif"; } } if (boolHide == false) { if (intCount > 0) { strReturn.Append("<tr>"); strReturn.Append("<td align=\"center\">"); strReturn.Append("<img src=\"/images/down_arrow_black.gif\" border=\"0\" align=\"absmiddle\" />"); //strReturn.Append("<img src=\"/images/arrow_down.png\" border=\"0\" align=\"absmiddle\" />"); strReturn.Append("</td>"); strReturn.Append("</tr>"); } intCount++; strReturn.Append("<tr>"); //strReturn.Append("<td valign=\"top\"></td>"); strReturn.Append("<td style=\"border:solid 1px #CCC\">"); strReturn.Append("<table width=\"500\" cellpadding=\"0\" cellspacing=\"5\" border=\"0\"" + (boolReturned ? " style=\"background-color:#FCDAD4\"" : (boolActive ? " style=\"background-color:#FFFF99\"" : (intCount % 2 == 0 ? "" : " style=\"background-color:#E6E6E6\">")))); strReturn.Append("<tr>"); strReturn.Append("<td valign=\"top\" align=\"center\">"); strReturn.Append("<img src=\""); strReturn.Append(strPicture); strReturn.Append("\" align=\"absmiddle\" border=\"0\" style='height:90px;width:90px;border-width:0px;border:solid 1px #666666;' />"); strReturn.Append("</td>"); strReturn.Append("<td width=\"100%\" valign=\"top\">"); // Right side table strReturn.Append("<table cellpadding=\"3\" cellspacing=\"5\" border=\"0\">"); // Header strReturn.Append("<tr>"); strReturn.Append("<td colspan=\"2\" valign=\"top\" class=\"header\">" + strHeader + "</td>"); strReturn.Append("</tr>"); // Status if (strAdditional != "") { strReturn.Append("<tr>"); strReturn.Append("<td colspan=\"2\" valign=\"top\">" + strAdditional + "</td>"); strReturn.Append("</tr>"); } strReturn.Append("</table>"); strReturn.Append("<table cellpadding=\"0\" cellspacing=\"5\" border=\"0\">"); // Status strReturn.Append("<tr>"); strReturn.Append("<td nowrap><b>Status</b>:</td>"); strReturn.Append("<td width=\"100%\">"); strReturn.Append((strIcon == "" ? "" : "<img src=\"" + strIcon + "\" align=\"absmiddle\" border=\"0\" /> ") + strStatus); strReturn.Append("</td>"); strReturn.Append("</tr>"); // Submitted strReturn.Append("<tr>"); strReturn.Append("<td nowrap valign=\"top\"><b>" + strLabel + "</b>:</td>"); strReturn.Append("<td width=\"100%\">"); strReturn.Append(strResource); strReturn.Append("</td>"); strReturn.Append("</tr>"); // Notified if (strNotified != "") { strReturn.Append("<tr>"); strReturn.Append("<td nowrap><b>Notified</b>:</td>"); strReturn.Append("<td width=\"100%\">"); strReturn.Append(strNotified); strReturn.Append("</td>"); strReturn.Append("</tr>"); } // Completed strReturn.Append("<tr>"); strReturn.Append("<td nowrap><b>" + strFinish + "</b>:</td>"); strReturn.Append("<td width=\"100%\">"); strReturn.Append(strCompleted); strReturn.Append("</td>"); strReturn.Append("</tr>"); strReturn.Append("</table>"); strReturn.Append("</td>"); strReturn.Append("</tr>"); if (strComments != "") // added a comment { strReturn.Append("<tr>"); strReturn.Append("<td colspan=\"2\">"); strReturn.Append("<table width=\"100%\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\">"); strReturn.Append("<tr>"); if (boolComment) { strReturn.Append("<td valign=\"top\"><img src=\"/images/comment.gif\" border=\"0\" /></td>"); } else { strReturn.Append("<td valign=\"top\"><img src=\"/images/biggerPlus.gif\" border=\"0\" /></td>"); } strReturn.Append("<td valign=\"top\" colspan=\"2\" width=\"100%\">" + strComments + "</td>"); strReturn.Append("</tr>"); strReturn.Append("</table>"); strReturn.Append("</td>"); strReturn.Append("</tr>"); } strReturn.Append("</table>"); strReturn.Append("</td>"); strReturn.Append("</tr>"); } } wucWorkflowItem _return = new wucWorkflowItem(); _return.Html = strReturn; _return.Children = dsWorkflow.Tables[0].Rows.Count; return(_return); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oResourceRequest = new ResourceRequest(intProfile, dsn); if (Request.QueryString["save"] != null) { lblUpdate.Visible = true; } if (!IsPostBack) { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { int intId = Int32.Parse(Request.QueryString["id"]); DataSet ds = oResourceRequest.GetChangeControl(intId); if (ds.Tables[0].Rows.Count > 0) { int intResourceWorkflow = Int32.Parse(ds.Tables[0].Rows[0]["parent"].ToString()); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); int intUser = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid")); int intRequest = Int32.Parse(oResourceRequest.Get(intResourceParent, "requestid")); Requests oRequest = new Requests(intProfile, dsn); ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn); Projects oProject = new Projects(intProfile, dsn); Users oUser = new Users(intProfile, dsn); int intProject = oRequest.GetProjectNumber(intRequest); if (intProject > 0) { panProject.Visible = true; lblName.Text = oProject.Get(intProject, "name"); lblNumber.Text = oProject.Get(intProject, "number"); } else { panTask.Visible = true; lblTName.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name"); lblTNumber.Text = "CVT" + intRequest.ToString(); } lblImplementor.Text = oUser.GetFullName(intUser); string strComments = ds.Tables[0].Rows[0]["comments"].ToString().Trim(); if (intProfile == intUser) { txtChange.Visible = true; txtDate.Visible = true; txtTime.Visible = true; btnSubmit.Visible = true; btnDelete.Visible = true; txtComments.Visible = true; txtChange.Text = ds.Tables[0].Rows[0]["number"].ToString(); txtDate.Text = DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToShortDateString(); txtTime.Text = DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToShortTimeString(); txtComments.Text = strComments; btnSubmit.Attributes.Add("onclick", "return ValidateText('" + txtChange.ClientID + "','Please enter a change control number')" + " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid implementation date')" + " && ValidateTime('" + txtTime.ClientID + "','Please enter a valid implementation time')" + ";"); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this change control?');"); } else { lblChange.Visible = true; lblDate.Visible = true; lblTime.Visible = true; panComments.Visible = true; lblChange.Text = ds.Tables[0].Rows[0]["number"].ToString(); lblDate.Text = DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToLongDateString(); lblTime.Text = DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToLongTimeString(); if (strComments == "") { strComments = "<i>No additional information</i>"; } lblComments.Text = strComments; } btnToday.Text += DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToShortDateString(); } } } }