Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/services_pending.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oService       = new Services(intProfile, dsn);
     oServiceEditor = new ServiceEditor(intProfile, dsn);
     oRequestItem   = new RequestItems(intProfile, dsn);
     oApplication   = new Applications(intProfile, dsn);
     oUser          = new Users(intProfile, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intService      = Int32.Parse(Request.QueryString["id"]);
         panView.Visible = true;
         if (!IsPostBack)
         {
             LoadServices(0);
             lblName.Text = oService.GetName(intService);
             int intItem = oService.GetItemId(intService);
             lblItem.Text        = oRequestItem.GetItemName(intItem);
             lblApplication.Text = oApplication.GetName(oRequestItem.GetItemApplication(intItem));
             DataSet ds = oService.GetUser(intService, -1);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 lblUser.Text = oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString()));
             }
         }
     }
     else
     {
         panAll.Visible     = true;
         rptView.DataSource = oService.GetPending();
         rptView.DataBind();
     }
     btnSave.Attributes.Add("onclick", "return confirm('Are you sure you want to save this service?');");
     btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this service?');");
 }
        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>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                                    strActivity += strSpacerRow;
                                    strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                                strActivity += strSpacerRow;
                                strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</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);
                                }
                            }
                        }
                    }
                }
            }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            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 + "');");
        }
Example #5
0
        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>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                            strActivity += strSpacerRow;
                            strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</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>&nbsp;&nbsp;&nbsp;</td><td>" + strResources + "</td></tr>";
                            strActivity += strSpacerRow;
                            strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</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");
        }
Example #6
0
        protected void LoadSearch(int _search)
        {
            Search          oSearch          = new Search(intProfile, dsn);
            RequestItems    oRequestItem     = new RequestItems(intProfile, dsn);
            Services        oService         = new Services(intProfile, dsn);
            Applications    oApplication     = new Applications(intProfile, dsn);
            StatusLevels    oStatusLevel     = new StatusLevels();
            Users           oUser            = new Users(intProfile, dsn);
            Projects        oProject         = new Projects(intProfile, dsn);
            ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn);
            ServiceRequests oServiceRequest  = new ServiceRequests(intProfile, dsn);
            DataSet         ds             = oSearch.GetProject(_search);
            int             intApplication = 0;

            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 (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["userid"].ToString() == intProfile.ToString())
                {
                    string strType        = ds.Tables[0].Rows[0]["type"].ToString();
                    string strClause      = "cv_projects.deleted = 0 AND cv_projects.number NOT LIKE 'CV%' AND cv_projects.number NOT LIKE 'EPS%'";
                    string strOr1         = "";
                    string strOr2         = "";
                    string strSQL         = "SELECT DISTINCT '?pid=' + CAST(cv_projects.projectid AS varchar(10)) + '&sid=" + _search.ToString() + "' AS query, cv_projects.name, cv_projects.number, cv_projects.status, cv_projects.modified FROM cv_projects INNER JOIN cv_requests LEFT OUTER JOIN cv_service_requests ON cv_service_requests.requestid = cv_requests.requestid AND cv_service_requests.deleted = 0 LEFT OUTER JOIN cv_project_requests ON cv_project_requests.requestid = cv_requests.requestid AND cv_project_requests.deleted = 0 INNER JOIN cv_resource_requests INNER JOIN cv_request_items INNER JOIN cv_applications ON cv_request_items.applicationid = cv_applications.applicationid AND cv_applications.deleted = 0 ON cv_request_items.itemid = cv_resource_requests.itemid AND cv_request_items.deleted = 0 INNER JOIN cv_users ON cv_resource_requests.userid = cv_users.userid AND cv_users.deleted = 0 AND cv_users.enabled = 1 ON cv_requests.requestid = cv_resource_requests.requestid AND cv_resource_requests.deleted = 0 ON cv_requests.projectid = cv_projects.projectid AND cv_requests.deleted = 0 WHERE ";
                    string strApplication = " AND cv_request_items.applicationid = " + intApplication.ToString();
                    switch (strType)
                    {
                    case "O":
                        strApplication = "";
                        string strOName   = ds.Tables[0].Rows[0]["oname"].ToString().Trim();
                        string strONumber = ds.Tables[0].Rows[0]["onumber"].ToString().Trim();
                        if (strONumber != "")
                        {
                            strClause      += " AND cv_projects.number LIKE '%" + strONumber + "%'";
                            lblResults.Text = "Project Number LIKE &quot;" + strONumber + "&quot;";
                        }
                        else
                        {
                            strClause      += " AND cv_projects.name LIKE '%" + strOName + "%'";
                            lblResults.Text = "Project Name LIKE &quot;" + strOName + "&quot;";
                        }
                        string strOStatus = ds.Tables[0].Rows[0]["ostatus"].ToString();
                        if (strOStatus != "0")
                        {
                            strClause += " AND cv_projects.status = " + strOStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strOStatus)) + "&quot;";
                        }
                        string strOStart = ds.Tables[0].Rows[0]["ostart"].ToString();
                        if (strOStart != "")
                        {
                            strOStart  = DateTime.Parse(strOStart).ToShortDateString();
                            strClause += " AND cv_projects.modified > " + strOStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Project Date > &quot;" + strOStart + "&quot;";
                        }
                        string strOEnd = ds.Tables[0].Rows[0]["oend"].ToString();
                        if (strOEnd != "")
                        {
                            strOEnd    = DateTime.Parse(strOEnd).ToShortDateString();
                            strClause += " AND cv_projects.modified < " + strOEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Project Date < &quot;" + strOEnd + "&quot;";
                        }
                        break;

                    case "P":
                        string strDepartment = ds.Tables[0].Rows[0]["department"].ToString();
                        if (strDepartment == "0")
                        {
                            strApplication   = "";
                            lblResults.Text += "Department = &quot;ALL&quot;";
                        }
                        else
                        {
                            strApplication   = " AND cv_request_items.applicationid = " + strDepartment;
                            lblResults.Text += "Department = &quot;" + oApplication.GetName(Int32.Parse(strDepartment)) + "&quot;";
                        }
                        string strDStatus = ds.Tables[0].Rows[0]["dstatus"].ToString();
                        if (strDStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strDStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strDStatus)) + "&quot;";
                        }
                        string strDStart = ds.Tables[0].Rows[0]["dstart"].ToString();
                        if (strDStart != "")
                        {
                            strDStart  = DateTime.Parse(strDStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strDStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strDStart + "&quot;";
                        }
                        string strDEnd = ds.Tables[0].Rows[0]["dend"].ToString();
                        if (strDEnd != "")
                        {
                            strDEnd    = DateTime.Parse(strDEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strDEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strDEnd + "&quot;";
                        }
                        break;

                    case "T":
                        string strTechnician = ds.Tables[0].Rows[0]["technician"].ToString();
                        if (strTechnician != "0")
                        {
                            strClause       += " AND cv_resource_requests.userid = " + strTechnician;
                            lblResults.Text += "Technician = &quot;" + oUser.GetFullName(Int32.Parse(strTechnician)) + "&quot;";
                        }
                        string strTStatus = ds.Tables[0].Rows[0]["tstatus"].ToString();
                        if (strTStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strTStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strTStatus)) + "&quot;";
                        }
                        string strTStart = ds.Tables[0].Rows[0]["tstart"].ToString();
                        if (strTStart != "")
                        {
                            strTStart  = DateTime.Parse(strTStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strTStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strTStart + "&quot;";
                        }
                        string strTEnd = ds.Tables[0].Rows[0]["tend"].ToString();
                        if (strTEnd != "")
                        {
                            strTEnd    = DateTime.Parse(strTEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strTEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strTEnd + "&quot;";
                        }
                        break;

                    case "L":
                        string strLead = ds.Tables[0].Rows[0]["lead"].ToString();
                        if (strLead != "0")
                        {
                            int intLead = Int32.Parse(strLead);
                            strClause       += " AND cv_users.manager = " + intLead.ToString();
                            lblResults.Text += "Team Lead = &quot;" + oUser.GetFullName(intLead) + "&quot;";
                        }
                        string strLStatus = ds.Tables[0].Rows[0]["lstatus"].ToString();
                        if (strLStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strLStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strLStatus)) + "&quot;";
                        }
                        string strLStart = ds.Tables[0].Rows[0]["lstart"].ToString();
                        if (strLStart != "")
                        {
                            strLStart  = DateTime.Parse(strLStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strLStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strLStart + "&quot;";
                        }
                        string strLEnd = ds.Tables[0].Rows[0]["lend"].ToString();
                        if (strLEnd != "")
                        {
                            strLEnd    = DateTime.Parse(strLEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strLEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strLEnd + "&quot;";
                        }
                        break;

                    case "G":
                        string strItem = ds.Tables[0].Rows[0]["itemid"].ToString();
                        if (strItem != "0")
                        {
                            strClause       += " AND cv_resource_requests.itemid = " + strItem;
                            lblResults.Text += "Activity Type = &quot;" + oRequestItem.GetItemName(Int32.Parse(strItem)) + "&quot;";
                        }
                        string strGStatus = ds.Tables[0].Rows[0]["gstatus"].ToString();
                        if (strGStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strGStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strGStatus)) + "&quot;";
                        }
                        string strGStart = ds.Tables[0].Rows[0]["gstart"].ToString();
                        if (strGStart != "")
                        {
                            strGStart  = DateTime.Parse(strGStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strGStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strGStart + "&quot;";
                        }
                        string strGEnd = ds.Tables[0].Rows[0]["gend"].ToString();
                        if (strGEnd != "")
                        {
                            strGEnd    = DateTime.Parse(strGEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strGEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strGEnd + "&quot;";
                        }
                        break;

                    case "S":
                        break;
                    }
                    strClause = strClause + strApplication;
                    if (strOr1 != "" && strOr2 != "")
                    {
                        strClause = strClause + " AND " + strOr1 + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND " + strOr1 + " AND cv_service_requests.id IS NOT NULL OR " + strClause + " AND " + strOr2 + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND " + strOr2 + " AND cv_service_requests.id IS NOT NULL";
                    }
                    else
                    {
                        strClause = strClause + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND cv_service_requests.id IS NOT NULL";
                    }
                    ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, strSQL + strClause);
                    DataView dv = ds.Tables[0].DefaultView;
                    if (Request.QueryString["sort"] != null)
                    {
                        dv.Sort = Request.QueryString["sort"];
                    }
                    rptView.DataSource = dv;
                    rptView.DataBind();
                    foreach (RepeaterItem ri in rptView.Items)
                    {
                        Label _progress = (Label)ri.FindControl("lblProgress");
                        Label _status   = (Label)ri.FindControl("lblStatus");
                        _status.Text = oStatusLevel.HTML(Int32.Parse(_status.Text));
                        Label _updated = (Label)ri.FindControl("lblUpdated");
                        Label _number  = (Label)ri.FindControl("lblNumber");
                        if (_number.Text == "")
                        {
                            _number.Text = "<i>TBD...</i>";
                        }
                        double dblUsed      = 0.00;
                        double dblAllocated = 0.00;
                        if (_progress.Text.Contains("?pid=") == true)
                        {
                            int intProject = 0;
                            if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
                            {
                                string strProgress = _progress.Text.Substring(0, _progress.Text.IndexOf("&"));
                                intProject = Int32.Parse(strProgress.Substring(5));
                            }
                            else
                            {
                                intProject = Int32.Parse(_progress.Text.Substring(5));
                            }
                            _updated.Text = oProject.GetLastUpdated(intProject);
                            DataSet dsAll = oResourceRequest.GetWorkflowProject(intProject);
                            foreach (DataRow drAll in dsAll.Tables[0].Rows)
                            {
                                int intResourceWorkflow = Int32.Parse(drAll["id"].ToString());
                                dblAllocated += double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                                dblUsed      += oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                            }
                        }
                        else if (_progress.Text.Contains("?rid=") == true)
                        {
                            int     intRequest = Int32.Parse(_progress.Text.Substring(5));
                            DataSet dsAll      = oResourceRequest.GetWorkflowRequestAll(intRequest);
                            foreach (DataRow drAll in dsAll.Tables[0].Rows)
                            {
                                int intResourceWorkflow = Int32.Parse(drAll["id"].ToString());
                                dblAllocated += double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                                dblUsed      += oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                            }
                        }
                        double dblProgress = 0.00;
                        if (dblAllocated > 0.00)
                        {
                            dblProgress = (dblUsed / dblAllocated) * 100.00;
                        }
                        _progress.Text = oServiceRequest.GetStatusBar(dblProgress, "100", "6", true);
                    }
                    lblNone.Visible = (rptView.Items.Count == 0);
                }
            }
        }
Example #7
0
        protected void btnComplete_Click(Object Sender, EventArgs e)
        {
            int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text);
            int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
            //oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 3, true);
            //oResourceRequest.CloseWorkflow(intResourceWorkflow, intEnvironment, strBCC, 0, dsnServiceEditor, true, intResourceRequestApprove, intAssignPage, intViewPage, dsnAsset, dsnIP);

            int     intAnswer = 0;
            int     intModel  = 0;
            DataSet ds        = oOnDemandTasks.GetServerOther(intRequest, intService, intNumber);

            if (ds.Tables[0].Rows.Count > 0)
            {
                intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                intModel  = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
            }

            bool boolComplete = true;

            //Check for all the service are complete and kick of the other services
            int     intService1 = 0;
            DataSet dsRR;

            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_SAV_ESM"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }

            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_HIDS"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);

            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_ECM"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_NETIQ"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            intService1 = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_AUDIT"]);
            dsRR        = oResourceRequest.GetRequestService(intRequest, intService1, intNumber);
            if (dsRR.Tables[0].Rows.Count > 0)
            {
                int intStatus = Int32.Parse(dsRR.Tables[0].Rows[0]["status"].ToString());
                if (intStatus != 3)
                {
                    boolComplete = false;
                }
            }


            if (boolComplete == true)
            {
                // Send next 3 services

                Forecast oForecast = new Forecast(0, dsn);

                bool boolCluster = false;

                if (oForecast.IsHACluster(intAnswer) == true)
                {
                    boolCluster = true;
                }

                if (boolCluster == true)
                {
                    // send Cluster
                    int intImplementorUser     = 0;
                    int intImplementorResource = 0;

                    DataSet dsImplementor = oOnDemandTasks.GetPending(intAnswer);
                    if (dsImplementor.Tables[0].Rows.Count > 0)
                    {
                        intImplementorResource = Int32.Parse(dsImplementor.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementorUser     = Int32.Parse(oResourceRequest.GetWorkflow(intImplementorResource, "userid"));
                    }

                    if (intImplementorUser > 0)
                    {
                        Variables oVariable        = new Variables(intEnvironment);
                        int       intServiceId     = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_CLUSTER"]);
                        int       intServiceItemId = oService.GetItemId(intServiceId);
                        int       intServiceNumber = 1;
                        oOnDemandTasks.AddServerOther(intRequest, intServiceId, intServiceNumber, intAnswer, intModel);
                        double dblServiceHours = oServiceDetail.GetHours(intServiceId, 1);
                        int    intResource     = oServiceRequest.AddRequest(intRequest, intServiceItemId, intServiceId, 1, dblServiceHours, 2, intServiceNumber, dsnServiceEditor);
                        // Comment the following...
                        //oServiceRequest.NotifyTeamLead(intServiceItemId, intResource, intAssignPage, intViewPage, intEnvironment, strBCC, "", dsnServiceEditor, dsnAsset, dsnIP);
                        // Include the following...
                        int    intResourceWorkflowNEW = oResourceRequest.AddWorkflow(intResource, 0, oResourceRequest.Get(intResource, "name"), intImplementorUser, Int32.Parse(oResourceRequest.Get(intResource, "devices")), double.Parse(oResourceRequest.Get(intResource, "allocated")), 2, 1);
                        string strService             = oService.GetName(intServiceId);
                        if (intServiceId == 0)
                        {
                            strService = oRequestItem.GetItemName(intServiceItemId);
                        }
                        int    intApp     = oRequestItem.GetItemApplication(intServiceItemId);
                        string strDefault = oUser.GetApplicationUrl(intImplementorUser, intViewPage);
                        if (strDefault == "")
                        {
                            oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intImplementorUser), "", strBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflowNEW, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                        }
                        else
                        {
                            if (intProject > 0)
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intImplementorUser), "", strBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><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><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflowNEW, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + oVariable.EmailFooter(), true, false);
                            }
                            else
                            {
                                oFunction.SendEmail("Request Assignment: " + strService, oUser.GetName(intImplementorUser), "", strBCC, "Request Assignment: " + strService, "<p><b>The following request has been automatically assigned to you</b><p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/frame/resource_request.aspx?rrid=" + intResourceWorkflowNEW.ToString() + "\" target=\"_blank\">Click here to review your new assignment.</a></p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflowNEW, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>" + oVariable.EmailFooter(), true, false);
                            }
                        }
                        oProject.Update(intProject, 2);
                        oResourceRequest.UpdateAccepted(intResource, 1);
                        oResourceRequest.UpdateAssignedBy(intResource, -1000);
                    }
                }

                //Send SQL Task
                bool boolSQL = false;

                Servers oServer = new Servers(0, dsn);

                DataSet dsServers = oServer.GetAnswer(intAnswer);

                foreach (DataRow drServer in dsServers.Tables[0].Rows)
                {
                    int intServer = Int32.Parse(drServer["id"].ToString());

                    DataSet dsComponents = oServer.GetComponents(intServer);

                    foreach (DataRow drComponent in dsComponents.Tables[0].Rows)
                    {
                        boolSQL = (drComponent["code"].ToString() == "SQL");

                        if (boolSQL == true)
                        {
                            break;
                        }
                    }

                    if (boolSQL == true)
                    {
                        break;
                    }
                }

                if (boolSQL == true)
                {
                    // send SQL
                    //Generate HIDS Task
                    int intServiceId     = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_PNC_SQL"]);
                    int intServiceItemId = oService.GetItemId(intServiceId);
                    int intServiceNumber = 1;
                    oOnDemandTasks.AddServerOther(intRequest, intServiceId, intServiceNumber, intAnswer, intModel);
                    double dblServiceHours = oServiceDetail.GetHours(intServiceId, 1);
                    int    intResource     = oServiceRequest.AddRequest(intRequest, intServiceItemId, intServiceId, 1, dblServiceHours, 2, intServiceNumber, dsnServiceEditor);
                    oServiceRequest.NotifyTeamLead(intServiceItemId, intResource, intAssignPage, intViewPage, intEnvironment, strBCC, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                }

                //Lotus notes task generation
            }



            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">if(window.opener!=null)window.opener.navigate('" + oPage.GetFullLink(intMyWork) + "');window.close();<" + "/" + "script>");
        }
Example #8
0
        protected int Save()
        {
            int intReturn = 1;

            oResourceRequest.UpdateName(intResource, txtName.Text);
            double dblAllocated = 0.00;

            if (panDynamic.Visible == false)
            {
                dblAllocated = double.Parse(txtAllocated.Text);
            }
            else
            {
                double dblQuantity = double.Parse(txtDevices.Text);
                dblAllocated = oServiceDetail.GetHours(Int32.Parse(txtAllocated.ToolTip), dblQuantity);
            }
            oResourceRequest.UpdateDevices(intResource, Int32.Parse(txtDevices.Text), dblAllocated);
            oResourceRequest.UpdateAccepted(intResource, Int32.Parse(ddlAccepted.SelectedItem.Value));
            oResourceRequest.UpdateStatusOverall(intResource, Int32.Parse(ddlStatus.SelectedItem.Value));
            oResourceRequest.UpdateReason(intResource, txtReason.Text);
            if (Request.Form[hdnAssignedBy.UniqueID] != "" && Request.Form[hdnAssignedBy.UniqueID] != "0")
            {
                oResourceRequest.UpdateAssignedBy(intResource, Int32.Parse(Request.Form[hdnAssignedBy.UniqueID]));
            }

            if (trAdmin.Visible == true)
            {
                int intUser = 0;
                if (Int32.TryParse(Request.Form[hdnUser.UniqueID], out intUser) == true)
                {
                    // Assign resource
                    DataSet ds = oResourceRequest.Get(intResource);
                    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"));
                        Variables oVariable  = new Variables(intEnvironment);

                        DataSet dsWorkflow = oResourceRequest.GetWorkflowsParent(intResource);
                        if (dsWorkflow.Tables[0].Rows.Count == 0)
                        {
                            // New Assignment
                            Projects        oProject         = new Projects(intProfile, dsn);
                            ProjectsPending oProjectsPending = new ProjectsPending(intProfile, dsn, intEnvironment);
                            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) + ";";
                            }

                            bool boolSolo     = (oResourceRequest.Get(intResource, "solo") == "1");
                            int  intAssigned  = 0;
                            bool boolRejected = (oResourceRequest.Get(intResource, "accepted") == "-1");
                            intAssigned = intUser;
                            oResourceRequest.UpdateAccepted(intResource, 1);

                            oProject.Update(intProject, 2);
                            int intResourceWorkflow = oResourceRequest.AddWorkflow(intResource, 0, oResourceRequest.Get(intResource, "name"), intAssigned, 1, 1.00, 2, 0);
                            oLog.AddEvent(intRequest.ToString(), strCVT, "Request assigned by " + oUser.GetFullNameWithLanID(intProfile) + " (ADMIN) to " + oUser.GetFullNameWithLanID(intAssigned), LoggingType.Debug);
                            oResourceRequest.UpdateAssignedBy(intResource, 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>";
                            oResourceRequest.UpdateDevices(intResource, 1, 1.00);
                            if (boolSolo == true)
                            {
                                oResourceRequest.UpdateStatusOverall(intResource, 2);
                                if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "")
                                {
                                    oProject.Update(intProject, oProjectNumber.New());
                                }
                                if (chkEmail.Checked == false)
                                {
                                    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><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);
                                            }
                                        }
                                        string strActivity = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                                        strActivity += strSpacerRow;
                                        strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</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
                                if (chkEmail.Checked == false)
                                {
                                    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><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>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intAssigned) + "</td></tr>";
                                    strActivity += strSpacerRow;
                                    strActivity += "<tr><td><b>Service:</b></td><td>&nbsp;&nbsp;&nbsp;</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);
                                    }
                                }
                            }
                        }
                        else
                        {
                            // Update Assignee
                            int intResourceWorkflow = Int32.Parse(dsWorkflow.Tables[0].Rows[0]["id"].ToString());
                            int intOldUser          = Int32.Parse(dsWorkflow.Tables[0].Rows[0]["userid"].ToString());
                            if (chkEmail.Checked == false)
                            {
                                string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                                string strSpacerRow   = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>";
                                string strDefault     = oUser.GetApplicationUrl(intUser, intViewPage);
                                // Notify Old User
                                // NOTIFICATION
                                oFunction.SendEmail("Request Assignment", oUser.GetName(intOldUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been removed from your workload</b><p><p>" + oResourceRequest.GetWorkflowSummary(intResourceWorkflow, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP) + "</p>", true, false);
                                // Notify New User
                                if (strDefault == "")
                                {
                                    oFunction.SendEmail("Request Assignment", oUser.GetName(intUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been re-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", oUser.GetName(intUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been re-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", oUser.GetName(intUser), "", strEMailIdsBCC, "Request Assignment", "<p><b>The following request has been re-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);
                                    }
                                }
                                string strActivity = "<tr><td><b>Resource:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oUser.GetFullName(intUser) + "</td></tr>";
                                strActivity += strSpacerRow;
                                strActivity += "<tr><td><b>Activity Type:</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + oService.GetName(intService) + "</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>";
                                }
                            }
                            oResourceRequest.UpdateWorkflowAssigned(intResourceWorkflow, intUser);
                        }
                    }
                }
            }
            return(intReturn);
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = Request.Path;
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }
            oService     = new Services(intProfile, dsn);
            oRequestItem = new RequestItems(intProfile, dsn);
            oCustomized  = new Customized(intProfile, dsn);
            oFunction    = new Functions(intProfile, dsn, intEnvironment);
            int intApplication = 0;

            if (Request.QueryString["id"] == null)
            {
                if (Request.QueryString["parent"] == null)
                {
                    LoadServices(0);
                }
                else
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                }
            }
            else
            {
                panAdd.Visible = true;
                intID          = Int32.Parse(Request.QueryString["id"]);
                if (intID > 0 && !IsPostBack)
                {
                    LoadLists();
                    DataSet ds = oService.Get(intID);
                    hdnId.Value         = intID.ToString();
                    hdnOrderId.Value    = Request.QueryString["orderid"];
                    txtName.Text        = ds.Tables[0].Rows[0]["name"].ToString();
                    txtDescription.Text = ds.Tables[0].Rows[0]["description"].ToString();
                    int intItem = 0;
                    if (Int32.TryParse(ds.Tables[0].Rows[0]["itemid"].ToString(), out intItem) == true)
                    {
                        lblItem.Text   = oRequestItem.GetItemName(intItem);
                        intApplication = oRequestItem.GetItemApplication(intItem);
                    }
                    if (lblItem.Text == "" || intItem == 0)
                    {
                        lblItem.Text = "No Item";
                    }
                    hdnItem.Value = intItem.ToString();
                    int intDocument = 0;
                    if (Int32.TryParse(ds.Tables[0].Rows[0]["docid"].ToString(), out intDocument) == true)
                    {
                        lblDocument.Text = oCustomized.GetDocumentRepository(intDocument, "name");
                    }
                    if (lblDocument.Text == "" || intDocument == 0)
                    {
                        lblDocument.Text = "No Document";
                    }
                    hdnDocument.Value                   = intDocument.ToString();
                    ddlType.SelectedValue               = ds.Tables[0].Rows[0]["typeid"].ToString();
                    chkShow.Checked                     = (ds.Tables[0].Rows[0]["show"].ToString() == "1");
                    chkProject.Checked                  = (ds.Tables[0].Rows[0]["project"].ToString() == "1");
                    txtHours.Text                       = ds.Tables[0].Rows[0]["hours"].ToString();
                    txtSLA.Text                         = ds.Tables[0].Rows[0]["sla"].ToString();
                    chkCanAuto.Checked                  = (ds.Tables[0].Rows[0]["can_automate"].ToString() == "1");
                    chkStatement.Checked                = (ds.Tables[0].Rows[0]["statement"].ToString() == "1");
                    chkUpload.Checked                   = (ds.Tables[0].Rows[0]["upload"].ToString() == "1");
                    chkExpedite.Checked                 = (ds.Tables[0].Rows[0]["expedite"].ToString() == "1");
                    txtRRPath.Text                      = ds.Tables[0].Rows[0]["rr_path"].ToString();
                    txtWMPath.Text                      = ds.Tables[0].Rows[0]["wm_path"].ToString();
                    txtCPPath.Text                      = ds.Tables[0].Rows[0]["cp_path"].ToString();
                    txtCAPath.Text                      = ds.Tables[0].Rows[0]["ca_path"].ToString();
                    chkRejection.Checked                = (ds.Tables[0].Rows[0]["rejection"].ToString() == "1");
                    chkAutomate.Checked                 = (ds.Tables[0].Rows[0]["automate"].ToString() == "1");
                    chkHours.Checked                    = (ds.Tables[0].Rows[0]["disable_hours"].ToString() == "1");
                    chkQuantityDevice.Checked           = (ds.Tables[0].Rows[0]["quantity_is_device"].ToString() == "1");
                    chkQuantityMultiple.Checked         = (ds.Tables[0].Rows[0]["multiple_quantity"].ToString() == "1");
                    chkNotifyPC.Checked                 = (ds.Tables[0].Rows[0]["notify_pc"].ToString() == "1");
                    chkNotifyClient.Checked             = (ds.Tables[0].Rows[0]["notify_client"].ToString() == "1");
                    chkDisable.Checked                  = (ds.Tables[0].Rows[0]["disable_customization"].ToString() == "1");
                    chkTask.Checked                     = (ds.Tables[0].Rows[0]["tasks"].ToString() == "1");
                    txtEmail.Text                       = ds.Tables[0].Rows[0]["email"].ToString();
                    chkSameTime.Checked                 = (ds.Tables[0].Rows[0]["sametime"].ToString() == "1");
                    chkNotifyGreen.Checked              = (ds.Tables[0].Rows[0]["notify_green"].ToString() == "1");
                    chkNotifyYellow.Checked             = (ds.Tables[0].Rows[0]["notify_yellow"].ToString() == "1");
                    chkNotifyRed.Checked                = (ds.Tables[0].Rows[0]["notify_red"].ToString() == "1");
                    chkWorkflow.Checked                 = (ds.Tables[0].Rows[0]["workflow"].ToString() == "1");
                    txtWorkflow.Text                    = ds.Tables[0].Rows[0]["workflow_title"].ToString();
                    chkRestrictions.Checked             = (ds.Tables[0].Rows[0]["is_restricted"].ToString() == "1");
                    chkTitleOverrride.Checked           = (ds.Tables[0].Rows[0]["title_override"].ToString() == "1");
                    txtTitleName.Text                   = ds.Tables[0].Rows[0]["title_name"].ToString();
                    chkNoSlider.Checked                 = (ds.Tables[0].Rows[0]["no_slider"].ToString() == "1");
                    chkHideSLA.Checked                  = (ds.Tables[0].Rows[0]["hide_sla"].ToString() == "1");
                    chkApproval.Checked                 = (ds.Tables[0].Rows[0]["approval"].ToString() == "1");
                    chkManagerApprove.Checked           = (ds.Tables[0].Rows[0]["manager_approval"].ToString() == "1");
                    ddlWorkflowAssignment.SelectedValue = ds.Tables[0].Rows[0]["workflow_userid"].ToString();
                    txtNotifyComplete.Text              = ds.Tables[0].Rows[0]["notify_complete"].ToString();
                    chkWorkflowConnectable.Checked      = (ds.Tables[0].Rows[0]["workflow_connect"].ToString() == "1");
                    chkWorkflowSameTechnician.Checked   = (ds.Tables[0].Rows[0]["same_technician"].ToString() == "1");
                    chkEnabled.Checked                  = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                    btnAdd.Text                         = "Update";
                }
            }
            btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnOrderId.ClientID + "','" + hdnOrder.ClientID + "&type=SERVICES" + "',false,400,400);");
            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this service?');");
            btnItem.Attributes.Add("onclick", "return OpenWindow('ITEMBROWSER','" + hdnItem.ClientID + "','&control=" + hdnItem.ClientID + "&controltext=" + lblItem.ClientID + "',false,400,600);");
            btnDocument.Attributes.Add("onclick", "return OpenWindow('DOCUMENTBROWSER','" + hdnDocument.ClientID + "','&control=" + hdnDocument.ClientID + "&controltext=" + lblDocument.ClientID + "&applicationid=" + intApplication.ToString() + "',false,400,600);");
            btnImage.Attributes.Add("onclick", "return OpenWindow('IMAGEPATH','','" + txtImage.ClientID + "',false,500,550);");
            btnRoles.Attributes.Add("onclick", "return OpenWindow('SERVICEDETAILROLES','" + hdnId.ClientID + "','',false,'500',600);");
            btnLocation.Attributes.Add("onclick", "return OpenWindow('SERVICELOCATIONS','" + hdnId.ClientID + "','',false,'500',600);");
            btnRRBrowse.Attributes.Add("onclick", "return OpenWindow('FILEBROWSER','" + txtRRPath.ClientID + "','',false,400,600);");
            btnWMBrowse.Attributes.Add("onclick", "return OpenWindow('FILEBROWSER','" + txtWMPath.ClientID + "','',false,400,600);");
            btnCPBrowse.Attributes.Add("onclick", "return OpenWindow('FILEBROWSER','" + txtCPPath.ClientID + "','',false,400,600);");
            btnCABrowse.Attributes.Add("onclick", "return OpenWindow('FILEBROWSER','" + txtCAPath.ClientID + "','',false,400,600);");
            btnUsers.Attributes.Add("onclick", "return OpenWindow('SERVICE_USERS','" + hdnId.ClientID + "','',false,'500',500);");
            btnReport.Attributes.Add("onclick", "return OpenServiceReport('/frame/report.aspx?r=" + oFunction.encryptQueryString("419") + "');");
            if (Request.QueryString["expand"] != null)
            {
                btnExpand.Text = "Minimize All";
                oTreeview.ExpandAll();
            }
            else
            {
                btnExpand.Text        = "Expand All";
                oTreeview.ExpandDepth = 1;
            }
            oTreeview.Attributes.Add("oncontextmenu", "return false;");
        }