Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile      = Int32.Parse(Request.Cookies["profileid"].Value);
     oProjectRequest = new ProjectRequest(intProfile, dsn);
     oApprove        = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
     oPage           = new Pages(intProfile, dsn);
     oAppPage        = new AppPages(intProfile, dsn);
     oApplication    = new Applications(intProfile, dsn);
     oUser           = new Users(intProfile, dsn);
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
     {
         intApplication = Int32.Parse(Request.Cookies["application"].Value);
     }
     strRedirect   = oPage.GetFullLink(intWorkflowPage);
     lblTitle.Text = oPage.Get(intPage, "title");
     oPage.LoadPaging(oApprove.GetAwaiting(intProfile), Request, intPage, lblPage, lblSort, lblTopPaging, lblBottomPaging, txtPage, lblPages, lblRecords, rptView, lblNone);
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/projects_approve.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oProject        = new Projects(intProfile, dsn);
     oRequest        = new Requests(intProfile, dsn);
     oProjectRequest = new ProjectRequest(intProfile, dsn);
     oApprove        = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
     oUser           = new Users(intProfile, dsn);
     oOrganization   = new Organizations(intProfile, dsn);
     if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
     {
         panView.Visible = true;
         intRequest      = Int32.Parse(Request.QueryString["rid"]);
         if (!IsPostBack)
         {
             for (int ii = 1; ii <= 4; ii++)
             {
                 string strName = "Manager";
                 if (ii == 2)
                 {
                     strName = "Platform";
                 }
                 else if (ii == 3)
                 {
                     strName = "Board";
                 }
                 else if (ii == 4)
                 {
                     strName = "Director";
                 }
                 TreeNode oParent = new TreeNode();
                 oParent.Text         = strName;
                 oParent.Value        = ii.ToString();
                 oParent.ToolTip      = strName;
                 oParent.ImageUrl     = "/images/folder.gif";
                 oParent.SelectAction = TreeNodeSelectAction.Expand;
                 oTreeview.Nodes.Add(oParent);
                 DataSet ds = oApprove.GetAwaitingRequest(intRequest, ii);
                 foreach (DataRow dr in ds.Tables[0].Rows)
                 {
                     TreeNode oNode = new TreeNode();
                     oNode.Text         = dr["username"].ToString();
                     oNode.Value        = dr["userid"].ToString();
                     oNode.ToolTip      = dr["username"].ToString();
                     oNode.ShowCheckBox = true;
                     oNode.SelectAction = TreeNodeSelectAction.None;
                     oParent.ChildNodes.Add(oNode);
                 }
             }
         }
     }
     else
     {
         panAll.Visible     = true;
         rptView.DataSource = oApprove.GetAwaiting();
         rptView.DataBind();
     }
     btnApprove.Attributes.Add("onclick", "return confirm('Are you sure you want to continue?');");
     btnReject.Attributes.Add("onclick", "return confirm('Are you sure you want to continue?');");
     btnFuture.Attributes.Add("onclick", "return confirm('Are you sure you want to continue?');");
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            Users oUser = new Users(intProfile, dsn);

            oPlatform        = new Platforms(intProfile, dsn);
            oOrganization    = new Organizations(intProfile, dsn);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oVariable        = new Variables(intEnvironment);
            oApplication     = new Applications(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oAppPage         = new AppPages(intProfile, dsn);
            oApprove         = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);



            ClientScriptManager cm = Page.ClientScript;
            String cbReference     = cm.GetCallbackEventReference(this, "arg", "ReceiveServerData", "");
            String callbackScript  = "function CallCheck(arg, context) {" + cbReference + "; }";

            cm.RegisterClientScriptBlock(this.GetType(), "CallCheck", callbackScript, true);


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

            lblTitle.Text = "Manage Prioritization";
            if (!IsPostBack)
            {
                ds = oOrganization.Gets(1);
                ddlOrganization.DataValueField = "organizationid";
                ddlOrganization.DataTextField  = "name";
                ddlOrganization.DataSource     = ds;
                ddlOrganization.DataBind();
                ddlOrganization.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            }


            QuestionOrder();
            ResponseOrder();

            if ((Request.QueryString["bd"] != null && Request.QueryString["bd"] != "") && (Request.QueryString["oid"] != null && Request.QueryString["oid"] != ""))
            {
                panShow.Visible               = true;
                ddlBaseDisc.SelectedValue     = Request.QueryString["bd"];
                ddlOrganization.SelectedValue = Request.QueryString["oid"];
                LoadQAs(ddlBaseDisc.SelectedItem.Value, Int32.Parse(ddlOrganization.SelectedValue), false);
            }

            if (Request.QueryString["coll"] != "" && Request.QueryString["coll"] != null)
            {
                chkAll.Checked = true;
                LoadQAs(ddlBaseDisc.SelectedItem.Value, Int32.Parse(ddlOrganization.SelectedValue), true);
            }

            btnView.Attributes.Add("onclick", "return ValidateDropDown('" + ddlBaseDisc.ClientID + "','Please make a selection for the project type') " +
                                   " && ValidateDropDown('" + ddlOrganization.ClientID + "','Please make a selection for organization');");

            btnCopy.Attributes.Add("onclick", "return OpenWindow('PRIORITIZATION_QA','?bd=" + ddlBaseDisc.SelectedItem.Value + "&oid=" + ddlOrganization.SelectedValue + " ');");
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage            = new Pages(intProfile, dsn);
            oOrganization    = new Organizations(intProfile, dsn);
            oSegment         = new Segment(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oSearch          = new Search(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oStatusLevel     = new StatusLevels();
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oStatus          = new StatusLevels();
            oApprove         = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
            oCustomized      = new Customized(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            bool boolUserSearch = false;

            if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
            {
                int intProject = Int32.Parse(Request.QueryString["pid"]);
                strProjectName      = oProject.GetName(intProject);
                lblProjectName.Text = "&quot;" + strProjectName + "&quot;";
                // INVOLVEMENT
                DataSet dsInvolvement = oResourceRequest.GetWorkflowProject(intProject);
                int     intOldUser    = 0;
                foreach (DataRow dr in dsInvolvement.Tables[0].Rows)
                {
                    if (intOldUser == Int32.Parse(dr["userid"].ToString()))
                    {
                        dr.Delete();
                    }
                    else
                    {
                        intOldUser = Int32.Parse(dr["userid"].ToString());
                    }
                }
                dsInvolvement = oResourceRequest.GetWorkflowProject(intProject);
                int intOldItem = 0;
                intOldUser = 0;
                foreach (DataRow dr in dsInvolvement.Tables[0].Rows)
                {
                    if (intOldItem == Int32.Parse(dr["itemid"].ToString()) && intOldUser == Int32.Parse(dr["userid"].ToString()))
                    {
                        dr.Delete();
                    }
                    else
                    {
                        intOldItem = Int32.Parse(dr["itemid"].ToString());
                        intOldUser = Int32.Parse(dr["userid"].ToString());
                    }
                }
                rptInvolvement.DataSource = dsInvolvement;
                rptInvolvement.DataBind();
                lblNoInvolvement.Visible = (rptInvolvement.Items.Count == 0);
                foreach (RepeaterItem ri in rptInvolvement.Items)
                {
                    Label _id       = (Label)ri.FindControl("lblId");
                    Label _user     = (Label)ri.FindControl("lblUser");
                    Label _status   = (Label)ri.FindControl("lblStatus");
                    Label _image    = (Label)ri.FindControl("lblImage");
                    int   intStatus = Int32.Parse(_status.Text);
                    int   intUser   = Int32.Parse(_user.Text);
                    _user.Text = oUser.GetFullName(intUser);
                    Label  _item        = (Label)ri.FindControl("lblItem");
                    int    intItem2     = Int32.Parse(_item.Text);
                    Label  _allocated   = (Label)ri.FindControl("lblAllocated");
                    Label  _used        = (Label)ri.FindControl("lblUsed");
                    double dblAllocated = oResourceRequest.GetAllocated(intProject, intUser, intItem2);
                    double dblUsed      = oResourceRequest.GetUsed(intProject, intUser, intItem2);
                    Label  _percent     = (Label)ri.FindControl("lblPercent");
                    _allocated.Text = dblAllocated.ToString();
                    _used.Text      = dblUsed.ToString();
                    if (dblAllocated > 0)
                    {
                        dblUsed       = dblUsed / dblAllocated;
                        _percent.Text = dblUsed.ToString("P");
                    }
                    else
                    {
                        _percent.Text = dblAllocated.ToString("P");
                    }
                    bool boolTPMDone = false;
                    if (intItem2 == 0)
                    {
                        _item.Text = "Project Coordinator";
                    }
                    else if (intItem2 == -1)
                    {
                        _item.Text = "Design Implementation (Pending Execution)";
                    }
                    else
                    {
                        int intApp = oRequestItem.GetItemApplication(intItem2);
                        _item.Text = oApplication.GetName(intApp);
                    }
                    _status.Text = oStatus.Name(intStatus);
                    if (boolTPMDone == true)
                    {
                        _status.Text = "Closed";
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            Users oUser = new Users(intProfile, dsn);

            oPlatform        = new Platforms(intProfile, dsn);
            oOrganization    = new Organizations(intProfile, dsn);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oVariable        = new Variables(intEnvironment);
            oApplication     = new Applications(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oAppPage         = new AppPages(intProfile, dsn);
            oApprove         = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oService         = new Services(intProfile, dsn);


            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            lblDate.Text = DateTime.Now.ToLongDateString();
            lblName.Text = oUser.Get(intProfile, "fname") + " " + oUser.Get(intProfile, "lname");
            //ddlOrganization.Attributes.Add("onchange", "PopulateSegments('" + ddlOrganization.ClientID + "','" + ddlSegment.ClientID + "');");
            //ddlSegment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlSegment.ClientID + "','" + hdnSegment.ClientID + "');");
            //imgRequirement.Attributes.Add("onclick", "return ShowCalendar('" + txtRequirement.ClientID + "');");
            //imgEndLife.Attributes.Add("onclick", "return ShowCalendar('" + txtEndLife.ClientID + "');");
            imgStart.Attributes.Add("onclick", "return ShowCalendar('" + txtStart.ClientID + "');");
            imgCompletion.Attributes.Add("onclick", "return ShowCalendar('" + txtCompletion.ClientID + "');");
            txtExecutive.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divExecutive.ClientID + "','" + lstExecutive.ClientID + "','" + hdnExecutive.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstExecutive.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtWorking.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divWorking.ClientID + "','" + lstWorking.ClientID + "','" + hdnWorking.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstWorking.Attributes.Add("ondblclick", "AJAXClickRow();");
            //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();");
            btnPlatformAdd.Attributes.Add("onclick", "return MoveList('" + lstPlatformsAvailable.ClientID + "','" + lstPlatformsCurrent.ClientID + "','" + hdnPlatforms.ClientID + "','" + lstPlatformsCurrent.ClientID + "');");
            lstPlatformsAvailable.Attributes.Add("ondblclick", "return MoveList('" + lstPlatformsAvailable.ClientID + "','" + lstPlatformsCurrent.ClientID + "','" + hdnPlatforms.ClientID + "','" + lstPlatformsCurrent.ClientID + "');");
            btnPlatformRemove.Attributes.Add("onclick", "return MoveList('" + lstPlatformsCurrent.ClientID + "','" + lstPlatformsAvailable.ClientID + "','" + hdnPlatforms.ClientID + "','" + lstPlatformsCurrent.ClientID + "');");
            lstPlatformsCurrent.Attributes.Add("ondblclick", "return MoveList('" + lstPlatformsCurrent.ClientID + "','" + lstPlatformsAvailable.ClientID + "','" + hdnPlatforms.ClientID + "','" + lstPlatformsCurrent.ClientID + "');");
            // chkRequirement.Attributes.Add("onclick", "ShowHideDivCheck('" + divRequirement.ClientID + "',this);");
            //chkEndLife.Attributes.Add("onclick", "ShowHideDivCheck('" + divEndLife.ClientID + "',this);");
            //radTPMYes.Attributes.Add("onclick", "ShowHideDiv('" + divTPMYes.ClientID + "','inline');ShowHideDiv('" + divTPMNo.ClientID + "','none');");
            //radTPMNo.Attributes.Add("onclick", "ShowHideDiv('" + divTPMNo.ClientID + "','inline');ShowHideDiv('" + divTPMYes.ClientID + "','none');");
            //ddlInterdependency.Attributes.Add("onclick", "ShowHideDivDropDown('" + divInterdependency.ClientID + "',this,2,3);");
            //btnPName.Attributes.Add("onclick", "return ShowProjectInfo('" + txtProjectTask.ClientID + "','" + ddlBaseDisc.ClientID + "','" + ddlOrganization.ClientID + "','" + txtClarityNumber.ClientID + "','" + txtProjectTask.ClientID + "','PNAME_SEARCH_NOCV');");
            //txtProjectTask.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnPName.ClientID + "').click();return false;}} else {return true}; ");
            //btnPNumber.Attributes.Add("onclick", "return ShowProjectInfo('" + txtProjectTask.ClientID + "','" + ddlBaseDisc.ClientID + "','" + ddlOrganization.ClientID + "','" + txtClarityNumber.ClientID + "','" + txtClarityNumber.ClientID + "','PNUMBER_SEARCH_NOCV');");
            //txtClarityNumber.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnPNumber.ClientID + "').click();return false;}} else {return true}; ");
            //txtInitiative.Attributes.Add("onfocusin", "InitiativeIn(this);");
            //txtInitiative.Attributes.Add("onfocusout", "InitiativeOut(this);");
            //txtInitiative.Attributes.Add("onkeypress", "return CancelEnter();");
            //txtCapability.Attributes.Add("onkeypress", "return CancelEnter();");
            //lblInvalid.Visible = false;
            lblTitle.Text = "New Project Request";
            if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
            {
                panFinish.Visible = true;
                lblRequest.Text   = Request.QueryString["rid"];
            }
            else if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
            {
                lblProject.Text    = Request.QueryString["pid"];
                intProject         = Int32.Parse(lblProject.Text);
                txtInitiative.Text = "(Number of Devices) (Description of Project/Problem)";
                LoadLists();
                panForm.Visible = true;
                btnDocuments.Attributes.Add("onclick", "return OpenWindow('DOCUMENTS_SECURE','?pid=" + intProject.ToString() + "&PR=true');");
            }
            else
            {
                if (!IsPostBack)
                {
                    LoadLists();
                    panIntro.Visible = true;
                    txtProjectTask.Focus();
                }
            }
            //btnSubmit.Attributes.Add("onclick", "return ValidateText('" + txtProjectTask.ClientID + "','Please enter a project or task name') && ValidateDropDown('" + ddlBaseDisc.ClientID + "','Please choose if this is a base or Discretionary project') && ValidateDropDown('" + ddlOrganization.ClientID + "','Please choose the organization sponsoring this initiative') && (document.getElementById('" + ddlBaseDisc.ClientID + "').selectedIndex == 1 || ValidateText('" + txtClarityNumber.ClientID + "','Please enter a clarity number'));");
            btnSave.Attributes.Add("onclick", "return ValidateHidden('" + hdnExecutive.ClientID + "','" + txtExecutive.ClientID + "','Please enter the LAN ID of your executive sponsor')" +
                                   " && ValidateHidden('" + hdnWorking.ClientID + "','" + txtWorking.ClientID + "','Please enter the LAN ID of your working sponsor')" +
                                   " && ValidateText('" + txtInitiative.ClientID + "','Please enter the initiative opportunity')" +
                                   " && EnsureInitiative('" + txtInitiative.ClientID + "')" +
                                   " && ValidateList('" + lstPlatformsCurrent.ClientID + "','Please select at least one platform')" +
                                   " && ValidateDate('" + txtCompletion.ClientID + "','Please enter a valid project completion date')" +
                                   ";");
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            btnDiscretionary.Attributes.Add("onclick", "return CloseWindow();");


            // Vijay Code - Start
            ds = oProjectRequest.GetQAs();
            DataSet dsProj = oProject.Get(intProject);

            string strText = "";

            foreach (DataRow drprj in dsProj.Tables[0].Rows)
            {
                foreach (DataRow drqa in ds.Tables[0].Rows)
                {
                    if ((drprj["bd"].ToString() == drqa["bd"].ToString()) && (drprj["organization"].ToString() == drqa["organizationid"].ToString()))
                    {
                        // Response.Write(drqa["questionid"].ToString() + " " + drqa["deleted"].ToString()+"<br>");
                        int intQuestion = Int32.Parse(drqa["questionid"].ToString());
                        int intRequired = oProjectRequest.GetQuestion(intQuestion, "required") == "" ? 0 : Int32.Parse(oProjectRequest.GetQuestion(intQuestion, "required"));

                        oHTMLcontrol = new HtmlGenericControl();
                        TableRow  tr = new TableRow();
                        TableCell td = new TableCell();

                        Label lbl = new Label();
                        lbl.Text    = oProjectRequest.GetQuestion(intQuestion, "question");
                        strText     = lbl.Text;
                        lbl.Width   = Unit.Pixel(150);
                        td.Wrap     = false;
                        td.CssClass = "default";
                        if (intRequired == 1)
                        {
                            lbl.Text += " <font class=\"required\">*</font>";
                        }
                        td.Controls.Add(lbl);


                        tr.Controls.Add(td);
                        dsResp = oProjectRequest.GetResponses(intQuestion, 1);

                        DropDownList ddl = new DropDownList();
                        ddl.CssClass       = "default";
                        ddl.Width          = Unit.Pixel(400);
                        ddl.DataSource     = dsResp;
                        ddl.DataTextField  = "response";
                        ddl.DataValueField = "id";
                        ddl.DataBind();
                        ddl.Items.Insert(0, "--SELECT--");

                        td = new TableCell();
                        td.Controls.Add(ddl);
                        tr.Controls.Add(td);
                        oHTMLcontrol.Controls.Add(tr);
                        phTest.Controls.Add(oHTMLcontrol);

                        string attributes = btnSave.Attributes["onclick"].Replace(";", "");
                        if (intRequired == 1)
                        {
                            attributes += " && ValidateDropDown('" + ddl.UniqueID + "','Please make a selection for " + strText + "');";
                            btnSave.Attributes["onclick"] = attributes;
                        }

                        ddl.Attributes.Add("onchange", "UpdateHidden2('" + intQuestion + "','" + hdnResponseID.ClientID + "'," + ddl.ClientID + ");");
                        //hdnSubmissionID.Value += intQuestion.ToString() + ":" + ddl.SelectedValue + "<br>";
                    }
                }
            }

            // Vijay Code - End
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile      = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest = new ProjectRequest(intProfile, dsn);
            oApprove        = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
            oProject        = new Projects(intProfile, dsn);
            oAD             = new AD(intProfile, dsn, intEnvironment);
            oFunction       = new Functions(intProfile, dsn, intEnvironment);
            oUser           = new Users(intProfile, dsn);
            int intRequest = 0;

            oApplication     = new Applications(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oAppPage         = new AppPages(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oOrganization    = new Organizations(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            bool boolWorkflow = false;

            if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
            {
                panFinish.Visible = true;
                if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
                {
                    lblRequest.Text = Request.QueryString["rid"];
                }
            }
            else
            {
                if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
                {
                    intApplication = Int32.Parse(Request.QueryString["applicationid"]);
                }
                if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
                {
                    intPage = Int32.Parse(Request.QueryString["pageid"]);
                }
                if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
                {
                    intApplication = Int32.Parse(Request.Cookies["application"].Value);
                }
                if (!IsPostBack)
                {
                    if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
                    {
                        intRequest      = Int32.Parse(Request.QueryString["rid"]);
                        lblRequest.Text = Request.QueryString["rid"];
                    }
                    if (intRequest > 0)
                    {
                        ds = oApprove.Get(intRequest, intProfile);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            bool boolButtons = false;
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                if (dr["approval"].ToString() == "0")
                                {
                                    boolButtons  = true;
                                    lblStep.Text = dr["step"].ToString();
                                }
                                boolWorkflow           = true;
                                panDiscussion.Visible  = true;
                                rptComments.DataSource = oProjectRequest.GetComments(intRequest);
                                rptComments.DataBind();
                                foreach (RepeaterItem ri in rptComments.Items)
                                {
                                    LinkButton oDelete = (LinkButton)ri.FindControl("btnDelete");
                                    oDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this comment?');");
                                }
                                lblNoComments.Visible = (rptComments.Items.Count == 0);
                                lblUser.Text          = oUser.GetFullName(oUser.GetName(intProfile));
                            }
                            btnApprove.Enabled = boolButtons;
                            btnDeny.Enabled    = boolButtons;
                            btnShelf.Enabled   = boolButtons;
                        }
                    }
                    else if (Int32.Parse(oProjectRequest.Get(intRequest, "userid")) == intProfile)
                    {
                        boolWorkflow           = true;
                        panDiscussionX.Visible = true;
                    }
                    if (boolWorkflow == true)
                    {
                        panWorkflow.Visible = true;
                        string strApplication = "";
                        if (intApplication > 0)
                        {
                            ds             = oApplication.Get(intApplication);
                            strApplication = ds.Tables[0].Rows[0]["url"].ToString();
                        }
                        ds = oProjectRequest.Get(intRequest);
                        DataSet dsRequest  = oRequest.Get(intRequest);
                        int     intProject = Int32.Parse(dsRequest.Tables[0].Rows[0]["projectid"].ToString());
                        DataSet dsProject  = oProject.Get(intProject);
                        // PRIORITY
                        strPriority = "<div align=\"center\">" + oProjectRequest.GetPriority(intRequest, intEnvironment) + "</div>";
                        // DOCUMENTS
                        chkDescription.Checked = (Request.QueryString["doc"] != null);
                        lblDocuments.Text      = oDocument.GetDocuments_Project(intProject, intProfile, oVariable.DocumentsFolder(), 1, (Request.QueryString["doc"] != null));
                        // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine)
                        //lblDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, intProject, 0, intProfile, 1, (Request.QueryString["doc"] != null), false);
                        // DETAILS
                        int intRequestor = Int32.Parse(dsRequest.Tables[0].Rows[0]["userid"].ToString());
                        lblName2.Text        = oUser.GetFullName(intRequestor);
                        lblDate2.Text        = ds.Tables[0].Rows[0]["modified"].ToString();
                        lblProjectTask.Text  = dsProject.Tables[0].Rows[0]["name"].ToString();
                        lblOrganization.Text = oOrganization.GetName(Int32.Parse(dsProject.Tables[0].Rows[0]["organization"].ToString()));
                        lblBaseDisc.Text     = dsProject.Tables[0].Rows[0]["bd"].ToString();
                        lblClarity2.Text     = dsProject.Tables[0].Rows[0]["number"].ToString();
                        if (lblClarity2.Text == "")
                        {
                            lblClarity2.Text = "<i>To Be Determined</i>";
                        }
                        lblExecutive2.Text = oUser.GetFullName(Int32.Parse(oProject.Get(intProject, "executive")));
                        lblWorking2.Text   = oUser.GetFullName(Int32.Parse(oProject.Get(intProject, "working")));
                        lblC1.Text         = (ds.Tables[0].Rows[0]["c1"].ToString() == "1" ? "Yes" : "No");
                        lblEndLife.Text    = (ds.Tables[0].Rows[0]["endlife"].ToString() == "1" ? "Yes" : "No");
                        if (ds.Tables[0].Rows[0]["endlife_date"].ToString() == "")
                        {
                            lblEndLifeDate.Text = "<i>Not Applicable</i>";
                        }
                        else
                        {
                            lblEndLifeDate.Text = DateTime.Parse(ds.Tables[0].Rows[0]["endlife_date"].ToString()).ToShortDateString();
                        }
                        lblInitiative.Text  = dsRequest.Tables[0].Rows[0]["description"].ToString();
                        lblRequirement.Text = (ds.Tables[0].Rows[0]["req_type"].ToString() == "1" ? "Yes" : "No");
                        if (ds.Tables[0].Rows[0]["req_date"].ToString() == "")
                        {
                            lblRequirementDate.Text = "<i>Not Applicable</i>";
                        }
                        else
                        {
                            lblRequirementDate.Text = DateTime.Parse(ds.Tables[0].Rows[0]["req_date"].ToString()).ToShortDateString();
                        }
                        lblInterdependency.Text      = ds.Tables[0].Rows[0]["interdependency"].ToString();
                        lblProjects.Text             = ds.Tables[0].Rows[0]["projects"].ToString();
                        lblCapability.Text           = ds.Tables[0].Rows[0]["capability"].ToString();
                        lblHours.Text                = ds.Tables[0].Rows[0]["man_hours"].ToString();
                        lblStart.Text                = DateTime.Parse(dsRequest.Tables[0].Rows[0]["start_date"].ToString()).ToShortDateString();
                        lblCompletion.Text           = DateTime.Parse(dsRequest.Tables[0].Rows[0]["end_date"].ToString()).ToShortDateString();
                        lblCapital.Text              = ds.Tables[0].Rows[0]["expected_capital"].ToString();
                        lblInternal.Text             = ds.Tables[0].Rows[0]["internal_labor"].ToString();
                        lblExternal.Text             = ds.Tables[0].Rows[0]["external_labor"].ToString();
                        lblMaintenance.Text          = ds.Tables[0].Rows[0]["maintenance_increase"].ToString();
                        lblExpenses.Text             = ds.Tables[0].Rows[0]["project_expenses"].ToString();
                        lblCostAvoidance.Text        = ds.Tables[0].Rows[0]["estimated_avoidance"].ToString();
                        lblSavings.Text              = ds.Tables[0].Rows[0]["estimated_savings"].ToString();
                        lblRealized.Text             = ds.Tables[0].Rows[0]["realized_savings"].ToString();
                        lblBusinessAvoidance.Text    = ds.Tables[0].Rows[0]["business_avoidance"].ToString();
                        lblMaintenanceAvoidance.Text = ds.Tables[0].Rows[0]["maintenance_avoidance"].ToString();
                        lblReusability.Text          = ds.Tables[0].Rows[0]["asset_reusability"].ToString();
                        lblInternalImpact.Text       = ds.Tables[0].Rows[0]["internal_impact"].ToString();
                        lblExternalImpact.Text       = ds.Tables[0].Rows[0]["external_impact"].ToString();
                        lblImpact.Text               = ds.Tables[0].Rows[0]["business_impact"].ToString();
                        lblStrategic.Text            = ds.Tables[0].Rows[0]["strategic_opportunity"].ToString();
                        lblAcquisition.Text          = ds.Tables[0].Rows[0]["acquisition"].ToString();
                        lblCapabilities.Text         = ds.Tables[0].Rows[0]["technology_capabilities"].ToString();
                        lblTPM2.Text = (ds.Tables[0].Rows[0]["tpm"].ToString() == "1" ? "Yes" : "No");
                        if (ds.Tables[0].Rows[0]["modified"].ToString() != "")
                        {
                            lblUpdated.Visible = true;
                            DateTime _updated = DateTime.Parse(ds.Tables[0].Rows[0]["modified"].ToString());
                            lblUpdated.Text = "<img src='/images/bigAlert.gif' border='0' align='absmiddle' /> This project request was updated on " + _updated.ToShortDateString() + " at " + _updated.ToShortTimeString();
                        }
                        ds = oProjectRequest.GetPlatforms(intRequest);
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            lblPlatforms.Text += dr["name"].ToString() + "<br/>";
                        }
                        dsProject = oProjectRequest.GetResources(intRequest);
                        if (dsProject.Tables[0].Rows.Count > 0)
                        {
                            int intItem     = Int32.Parse(dsProject.Tables[0].Rows[0]["itemid"].ToString());
                            int intService  = Int32.Parse(dsProject.Tables[0].Rows[0]["serviceid"].ToString());
                            int intAccepted = Int32.Parse(dsProject.Tables[0].Rows[0]["accepted"].ToString());
                            int intManager  = Int32.Parse(dsProject.Tables[0].Rows[0]["userid"].ToString());
                            if (intItem > 0)
                            {
                                lblTPMService.Text = oService.GetName(intService);
                                panTPM.Visible     = true;
                            }
                            panPM.Visible = true;
                            if (intAccepted == -1)
                            {
                                lblPM.Text = "Pending Assignment (" + oUser.GetFullName(intRequestor) + ")";
                            }
                            else if (intManager > 0)
                            {
                                lblPM.Text = oUser.GetFullName(intManager);
                            }
                            else if (intItem > 0)
                            {
                                lblPM.Text = "Pending Assignment";
                            }
                        }
                        // HISTORY
                        rptHistory.DataSource = oApprove.Get(intRequest);
                        rptHistory.DataBind();
                        int intStep = oApprove.GetStep(intRequest);
                        foreach (RepeaterItem ri in rptHistory.Items)
                        {
                            Label oStep   = (Label)ri.FindControl("lblStep");
                            Label oUserId = (Label)ri.FindControl("lblUserId");
                            int   intUser = Int32.Parse(oUserId.Text);
                            if (intUser > 0)
                            {
                                oUserId.Text = oUser.GetFullName(intUser);
                            }
                            else
                            {
                                oUserId.Text = "---";
                            }
                            Label oImage    = (Label)ri.FindControl("lblImage");
                            Label oModified = (Label)ri.FindControl("lblModified");
                            Label oApproval = (Label)ri.FindControl("lblApproval");
                            switch (oApproval.Text)
                            {
                            case "-100":
                                oApproval.Text     = "<span class=\"expedited\">EXPEDITED</span>";
                                oModified.Text     = "Not Available";
                                oModified.CssClass = "pending";
                                break;

                            case "-10":
                                oApproval.Text = "<span class=\"waiting\">Waiting</span>";
                                break;

                            case "-1":
                                oApproval.Text = "<span class=\"denied\">Denied</span>";
                                break;

                            case "0":
                                oApproval.Text = "<span class=\"pending\">Pending</span>";
                                if (Int32.Parse(oStep.Text) == intStep)
                                {
                                    oImage.Text = "<img src=\"/images/green_right.gif\" border=\"0\" align=\"absmiddle\">&nbsp;";
                                }
                                break;

                            case "1":
                                oApproval.Text = "<span class=\"approved\">Approved</span>";
                                break;

                            case "10":
                                oApproval.Text = "<span class=\"shelved\">Shelved</span>";
                                break;

                            case "100":
                                if (oStep.Text == "2")
                                {
                                    oApproval.Text = "<span class=\"pending\">Already Approved</span>";
                                }
                                else
                                {
                                    oApproval.Text = "<span class=\"pending\">Majority Voted</span>";
                                }
                                oModified.Text     = "Not Available";
                                oModified.CssClass = "pending";
                                break;
                            }
                            switch (oStep.Text)
                            {
                            case "1":
                                oStep.Text = "Manager";
                                break;

                            case "2":
                                oStep.Text = "Platform";
                                break;

                            case "3":
                                oStep.Text = "Board";
                                break;

                            case "4":
                                oStep.Text = "Director";
                                break;
                            }
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                    }
                }
            }
            if (Request.QueryString["div"] != null)
            {
                switch (Request.QueryString["div"])
                {
                case "D":
                    boolDocuments = true;
                    break;

                case "C":
                    boolDiscussion = true;
                    break;
                }
            }
            if (boolDetails == false && boolDocuments == false && boolDiscussion == false)
            {
                boolDetails = true;
            }
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            btnFinish.Attributes.Add("onclick", "return CloseWindow();");
            btnApprove.Attributes.Add("onclick", "return confirm('Are you sure you want to APPROVE this request?');");
            btnDeny.Attributes.Add("onclick", "return confirm('Are you sure you want to DENY this request?');");
            btnShelf.Attributes.Add("onclick", "return confirm('Are you sure you want to SHELF this request?');");
        }