Beispiel #1
0
        //создание идентификатора проекта
        public int InsertProjectNumber(ProjectNumber projectNumber)
        {
            using (DataEntities db = new DataEntities())
            {
                var check = (from prmnb in db.ProjectNumbers
                             where prmnb.Number == projectNumber.Number
                             select prmnb).SingleOrDefault();

                if (check == null)
                {
                    db.ProjectNumbers.Add(projectNumber);
                    db.SaveChanges();

                    var id = (from prnmb in db.ProjectNumbers
                              where prnmb.Number == projectNumber.Number
                              select prnmb.Id).SingleOrDefault();

                    return(id);
                }
                else
                {
                    return(0);
                }
            }
        }
Beispiel #2
0
        public void ProjectNumber_Default_Constructor()
        {
            // Arrange
            // Act
            var number = new ProjectNumber();

            // Assert
            number.Id.Should().Be(0);
        }
Beispiel #3
0
        //поиск
        private void Find()
        {
            ProjectNumber pridobject = new ProjectNumber();

            pridobject.Number = txtFindNumber.Text;
            projectBindingSource.DataSource = ProjectServices.GetAllProject(ProjectServices.GetProjectNumberId(pridobject), _idState,
                                                                            _idManager, _idImplementer, dtpDateFrom.Value.ToString(),
                                                                            dtpDateTo.Value.ToString(), _idStage);
        }
Beispiel #4
0
        public void ProjectNumber_ToString()
        {
            // Arrange
            var number = new ProjectNumber();

            // Act
            var result = number.ToString();

            // Assert
            result.Should().Be(number.Id.ToString());
        }
Beispiel #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = ExtractionJobIdentifier.GetHashCode();
         hashCode = (hashCode * 397) ^ ProjectNumber.GetHashCode();
         hashCode = (hashCode * 397) ^ ExtractionDirectory.GetHashCode();
         hashCode = (hashCode * 397) ^ JobSubmittedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ IsIdentifiableExtraction.GetHashCode();
         hashCode = (hashCode * 397) ^ IsNoFilterExtraction.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #6
0
        private void AddAsShortcut_OnClick(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                ProjectNumber pn = button.Tag as ProjectNumber;
                if (pn != null && this.AddShortCutService != null)
                {
                    this.AddShortCutService.AddShortCut(string.Empty, string.Format("{0}-000({1})", pn.Number, pn.Description));
                }
            }
        }
Beispiel #7
0
 //получить id-проекта
 public int GetProjectNumberId(ProjectNumber projectNumber)
 {
     using (DataEntities db = new DataEntities())
     {
         var result = (from prid in db.ProjectNumbers
                       where prid.Number == projectNumber.Number
                       select prid).SingleOrDefault();
         if (result == null)
         {
             return(0);
         }
         else
         {
             return(result.Id);
         }
     }
 }
Beispiel #8
0
        void ReleaseDesignerOutlets()
        {
            if (Budget != null)
            {
                Budget.Dispose();
                Budget = null;
            }

            if (ExpensesButton != null)
            {
                ExpensesButton.Dispose();
                ExpensesButton = null;
            }

            if (Mileage != null)
            {
                Mileage.Dispose();
                Mileage = null;
            }

            if (NotesHeader != null)
            {
                NotesHeader.Dispose();
                NotesHeader = null;
            }

            if (ProjectName != null)
            {
                ProjectName.Dispose();
                ProjectName = null;
            }

            if (ProjectNumber != null)
            {
                ProjectNumber.Dispose();
                ProjectNumber = null;
            }

            if (ReceiptsButton != null)
            {
                ReceiptsButton.Dispose();
                ReceiptsButton = null;
            }
        }
Beispiel #9
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = ExtractionJobIdentifier.GetHashCode();
         hashCode = (hashCode * 397) ^ Header.GetHashCode();
         hashCode = (hashCode * 397) ^ ProjectNumber.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)JobStatus;
         hashCode = (hashCode * 397) ^ ExtractionDirectory.GetHashCode();
         hashCode = (hashCode * 397) ^ JobSubmittedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ KeyTag.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)KeyCount;
         hashCode = (hashCode * 397) ^ (ExtractionModality != null ? ExtractionModality.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsIdentifiableExtraction.GetHashCode();
         hashCode = (hashCode * 397) ^ IsNoFilterExtraction.GetHashCode();
         hashCode = (hashCode * 397) ^ (FailedJobInfoDoc != null ? FailedJobInfoDoc.GetHashCode() : 0);
         return hashCode;
     }
 }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/projects_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");
     }
     oProject        = new Projects(intProfile, dsn);
     oProjectNumber  = new ProjectNumber(intProfile, dsn);
     oRequest        = new Requests(intProfile, dsn);
     oRequestItem    = new RequestItems(intProfile, dsn);
     oService        = new Services(intProfile, dsn);
     oProjectPending = new ProjectsPending(intProfile, dsn, intEnvironment);
     oOrganization   = new Organizations(intProfile, dsn);
     oDocument       = new Documents(intProfile, dsn);
     oUser           = new Users(intProfile, dsn);
     oForecast       = new Forecast(intProfile, dsn);
     oServiceRequest = new ServiceRequests(intProfile, dsn);
     if (!IsPostBack)
     {
         if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
         {
             // Process Service Requests
             int     intRequest = Int32.Parse(Request.QueryString["rid"]);
             DataSet dsForm     = oRequestItem.GetForms(intRequest);
             foreach (DataRow drForm in dsForm.Tables[0].Rows)
             {
                 if (drForm["done"].ToString() == "0")
                 {
                     int    intItem    = Int32.Parse(drForm["itemid"].ToString());
                     int    intNumber  = Int32.Parse(drForm["number"].ToString());
                     int    intService = Int32.Parse(drForm["serviceid"].ToString());
                     string strPath    = oService.Get(intService, "cp_path");
                     if (strPath.Trim() == "")
                     {
                         // For now, bypass
                         oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                     }
                     else
                     {
                         Control oControl = (Control)LoadControl(strPath);
                         PHcp.Controls.Add(oControl);
                     }
                 }
             }
             panPH.Visible = true;
         }
         else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             DataSet ds         = oProjectPending.Get(Int32.Parse(Request.QueryString["id"]));
             int     intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
             if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
             {
                 int intProject = Int32.Parse(Request.QueryString["pid"]);
                 if (intProject > 0)
                 {
                     // Process Design Builder
                     DataSet dsForecast = oForecast.GetRequest(intRequest);
                     if (dsForecast.Tables[0].Rows.Count > 0)
                     {
                         int             intForecast      = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString());
                         DataSet         dsDesigns        = oForecast.GetAnswers(intForecast);
                         OnDemandTasks   oOnDemandTasks   = new OnDemandTasks(0, dsn);
                         ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                         foreach (DataRow drDesign in dsDesigns.Tables[0].Rows)
                         {
                             int intDesign        = Int32.Parse(drDesign["id"].ToString());
                             int intDesignRequest = 0;
                             if (Int32.TryParse(oForecast.GetAnswer(intDesign, "requestid"), out intDesignRequest) == true)
                             {
                                 if (intDesignRequest > 0)
                                 {
                                     // Update the REQUESTID in CV_FORECAST_ANSWERS with the new project correlation
                                     oRequest.Update(intDesignRequest, intProject);
                                 }
                             }
                             if (oForecast.CanAutoProvision(intDesign) == false)
                             {
                                 // Need to add a builder
                                 int     intImplementorD = 0;
                                 DataSet dsResourceD     = oResourceRequest.GetProjectItem(intProject, intImplementorDistributed);
                                 if (dsResourceD.Tables[0].Rows.Count > 0)
                                 {
                                     intImplementorD = Int32.Parse(dsResourceD.Tables[0].Rows[0]["userid"].ToString());
                                 }
                                 int     intImplementorM = 0;
                                 DataSet dsResourceM     = oResourceRequest.GetProjectItem(intProject, intImplementorMidrange);
                                 if (dsResourceM.Tables[0].Rows.Count > 0)
                                 {
                                     intImplementorM = Int32.Parse(dsResourceM.Tables[0].Rows[0]["userid"].ToString());
                                 }
                                 if (oForecast.GetPlatformDistributedForecast(intDesign, intWorkstationPlatform) == true)
                                 {
                                     if (intImplementorD > 0)
                                     {
                                         int intNextNumber       = oResourceRequest.GetNumber(intRequest);
                                         int intResourceParent   = oResourceRequest.Add(intRequest, -1, -1, intNextNumber, "Provisioning Task (Distributed)", 0, 6.00, 2, 1, 1, 1);
                                         int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (Distributed)", intImplementorD, 0, 6.00, 2, 0);
                                         oOnDemandTasks.AddPending(intDesign, intResourceWorkflow);
                                         oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                                     }
                                     else
                                     {
                                         // Submit for assignment
                                         if (oServiceRequest.Get(intRequest, "requestid") == "")
                                         {
                                             oServiceRequest.Add(intRequest, 1, 1);
                                         }
                                         int intResource = oServiceRequest.AddRequest(intRequest, intImplementorDistributed, intImplementorDistributedService, 0, 0.00, 2, 1, dsnServiceEditor);
                                         if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                         {
                                             oServiceRequest.NotifyTeamLead(intImplementorDistributed, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                         }
                                     }
                                 }
                                 if (oForecast.GetPlatformMidrangeForecast(intDesign) == true)
                                 {
                                     if (intImplementorM > 0)
                                     {
                                         int intNextNumber       = oResourceRequest.GetNumber(intRequest);
                                         int intResourceParent   = oResourceRequest.Add(intRequest, -1, -1, intNextNumber, "Provisioning Task (Midrange)", 0, 6.00, 2, 1, 1, 1);
                                         int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (Midrange)", intImplementorM, 0, 6.00, 2, 0);
                                         oOnDemandTasks.AddPending(intDesign, intResourceWorkflow);
                                         oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                                     }
                                     else
                                     {
                                         // Submit for assignment
                                         if (oServiceRequest.Get(intRequest, "requestid") == "")
                                         {
                                             oServiceRequest.Add(intRequest, 1, 1);
                                         }
                                         int intResource = oServiceRequest.AddRequest(intRequest, intImplementorMidrange, intImplementorMidrangeService, 0, 0.00, 2, 1, dsnServiceEditor);
                                         if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                                         {
                                             oServiceRequest.NotifyTeamLead(intImplementorMidrange, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 oRequest.Update(intRequest, intProject);
                 oDocument.Update(intRequest, intProject);
                 oProjectPending.Approve(Int32.Parse(Request.QueryString["id"]));
                 if (intProject == 0)
                 {
                     oServiceRequest.Update(intRequest, ds.Tables[0].Rows[0]["name"].ToString());
                 }
                 Response.Redirect(Request.Path + "?rid=" + intRequest.ToString());
             }
             else
             {
                 if (Request.QueryString["reject"] != null)
                 {
                     panReject.Visible = true;
                 }
                 else
                 {
                     strProject = LoadProject(0, ds.Tables[0].Rows[0], intRequest, true);
                     btnView.Attributes.Add("onclick", "return ShowServiceRequests('" + intRequest.ToString() + "');");
                     btnViewDesigns.Attributes.Add("onclick", "return ShowDesigns('" + intRequest.ToString() + "');");
                     if (Request.QueryString["c"] != null && Request.QueryString["c"] != "")
                     {
                         panCompare.Visible = true;
                         string[] strProjects;
                         char[]   strSplit = { ' ' };
                         strProjects = Request.QueryString["c"].Split(strSplit);
                         bool boolOther = false;
                         for (int jj = 0; jj < strProjects.Length; jj++)
                         {
                             if (strProjects[jj].Trim() != "")
                             {
                                 TableRow  oRow  = new TableRow();
                                 TableCell oCell = new TableCell();
                                 oCell.Text = strProject;
                                 oRow.Cells.Add(oCell);
                                 oCell = new TableCell();
                                 HyperLink oCheck = new HyperLink();
                                 oCheck.ImageUrl    = "/images/bigCheck.gif";
                                 oCheck.ToolTip     = "Click to Assign";
                                 oCheck.NavigateUrl = Request.Path + "?id=" + Request.QueryString["id"] + "&pid=" + strProjects[jj];
                                 oCheck.Attributes.Add("onclick", "return confirm('Are you sure you want to assign this project?');");
                                 oCell.Controls.Add(oCheck);
                                 oRow.Cells.Add(oCell);
                                 oCell      = new TableCell();
                                 oCell.Text = LoadProject(Int32.Parse(strProjects[jj]), null, 0, false);
                                 if (boolOther == true)
                                 {
                                     oRow.Attributes.Add("bgcolor", "#EFEFEF");
                                 }
                                 boolOther = !boolOther;
                                 oRow.Cells.Add(oCell);
                                 tblCompare.Rows.Add(oRow);
                             }
                         }
                     }
                     else
                     {
                         panView.Visible = true;
                         LoadList();
                     }
                 }
             }
         }
         else
         {
             panAll.Visible = true;
             DataSet ds = oProjectPending.Gets();
             rptView.DataSource = ds;
             rptView.DataBind();
         }
     }
     btnCreateProject.Attributes.Add("onclick", "return confirm('Are you sure you want to create this PROJECT?');");
     btnCreateTask.Attributes.Add("onclick", "return confirm('Are you sure you want to create this TASK?');");
     btnCreateTask.Enabled = false;
     btnRejectConfirm.Attributes.Add("onclick", "return confirm('Are you sure you want to reject this project / task?');");
 }
Beispiel #11
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);
            oRequest         = new Requests(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oVariable        = new Variables(intEnvironment);
            oProject         = new Projects(intProfile, dsn);
            oPlatform        = new Platforms(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);

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

            if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
            {
                panFinish.Visible = true;
            }
            else
            {
                if (!IsPostBack)
                {
                    if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
                    {
                        // PLATFORM
                        int intResource = Int32.Parse(Request.QueryString["rrid"]);
                        lblRequest.Text = Request.QueryString["rrid"];
                        if (intResource > 0)
                        {
                            DataSet dsResource = oResourceRequest.Get(intResource);
                            if (dsResource.Tables[0].Rows.Count > 0)
                            {
                                int intRequest = Int32.Parse(dsResource.Tables[0].Rows[0]["requestid"].ToString());
                                int intService = Int32.Parse(dsResource.Tables[0].Rows[0]["serviceid"].ToString());
                                int intNumber  = Int32.Parse(dsResource.Tables[0].Rows[0]["number"].ToString());
                                if (oRequest.Allowed(intRequest, intService, intNumber, intProfile, true))
                                {
                                    panRequest.Visible = true;
                                    int intProject = oRequest.GetProjectNumber(intRequest);
                                    int intItem    = Int32.Parse(dsResource.Tables[0].Rows[0]["itemid"].ToString());
                                    int intApp     = oRequestItem.GetItemApplication(intItem);
                                    lblView.Text = oRequestField.GetBodyOverall(intResource, 0, dsnServiceEditor, intEnvironment, dsnAsset, dsnIP);
                                    //LoadProject(intProject, intRequest);
                                }
                                else
                                {
                                    panDenied.Visible = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else if (Request.QueryString["srid"] != null && Request.QueryString["srid"] != "")
                    {
                        // SERVICE
                        int intServiceSelectedID = Int32.Parse(Request.QueryString["srid"]);
                        if (intServiceSelectedID > 0)
                        {
                            DataSet dsServiceSelected = oService.GetSelectedById(intServiceSelectedID);
                            if (dsServiceSelected.Tables[0].Rows.Count > 0)
                            {
                                DataRow drServiceSelected = dsServiceSelected.Tables[0].Rows[0];
                                int     intRequest        = Int32.Parse(drServiceSelected["requestid"].ToString());
                                int     intService        = Int32.Parse(drServiceSelected["serviceid"].ToString());
                                int     intItem           = oService.GetItemId(intService);
                                int     intNumber         = Int32.Parse(drServiceSelected["number"].ToString());
                                if (drServiceSelected["approvedon"].ToString() == "" || drServiceSelected["approved"].ToString() == "0")
                                {
                                    int intApp = oRequestItem.GetItemApplication(intItem);
                                    lblRequest.Text = intRequest.ToString();
                                    if (oRequest.Allowed(intRequest, intService, intNumber, intProfile, true))
                                    {
                                        panRequest.Visible = true;
                                        int intProject = oRequest.GetProjectNumber(intRequest);
                                        lblView.Text = oRequestField.GetBodyNoEnv(intRequest, intItem, intNumber, intService, 0, 0, dsnServiceEditor, intEnvironment, dsnAsset, dsnIP);
                                        //LoadProject(intProject, intRequest);
                                    }
                                    else
                                    {
                                        panDenied.Visible = true;
                                    }
                                }
                                else
                                {
                                    // Already approved
                                    litAlreadyStatus.Text = (drServiceSelected["approved"].ToString() == "1" ? "Approved" : "Denied");
                                    litAlreadyBy.Text     = oUser.GetFullNameWithLanID(Int32.Parse(drServiceSelected["approvedby"].ToString()));
                                    litAlreadyOn.Text     = " on " + drServiceSelected["approvedon"].ToString();
                                    panAlready.Visible    = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
                    {
                        // MANAGER
                        int intRequest = Int32.Parse(Request.QueryString["rid"]);
                        lblRequest.Text = Request.QueryString["rid"];
                        int intProject = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                        //ds = oResourceRequest.GetRequestAll(intRequest);
                        int intRequester = Int32.Parse(oRequest.Get(intRequest, "userid"));
                        if (intRequest > 0)
                        {
                            bool boolAllowed = oUser.IsManager(intRequester, intProfile, true);
                            if (boolAllowed == false)
                            {
                                int intManager = oUser.GetManager(intRequester, true);
                                boolAllowed = (oDelegate.Get(intManager, intProfile) > 0);
                            }
                            if (oUser.IsAdmin(intProfile) || boolAllowed)
                            {
                                trHR.Visible       = false;
                                panRequest.Visible = true;
                                lblView.Text       = "As the manager of <b>" + oUser.GetFullName(intRequester) + "</b>, you will need to approve this request before it is submitted. You can view the details of the request by clicking [<a href=\"javascript:void(0);\">View</a>] next to each item.";
                                Control oControl = (Control)LoadControl("/controls/resource_request_new.ascx");
                                PHForm.Controls.Add(oControl);
                                if (String.IsNullOrEmpty(Request.QueryString["approve"]))
                                {
                                    btnApprove.Visible = btnDeny.Visible = false;
                                    lblView.Text       = "Here are the details of the service request...";
                                }

                                if (oServiceRequest.Get(intRequest, "manager_approval") != "0")
                                {
                                    // Already approved
                                    btnApprove.Enabled    = btnDeny.Enabled = false;
                                    litAlreadyStatus.Text = (oServiceRequest.Get(intRequest, "manager_approval") == "1" ? "Approved" : "Denied");
                                    litAlreadyBy.Text     = oUser.GetFullNameWithLanID(oUser.GetManager(intRequester, true));
                                    panAlready.Visible    = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            btnFinish.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnAlready.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
            btnApprove.Attributes.Add("onclick", "return confirm('Are you sure you want to APPROVE this request?') && ProcessButton(this) && LoadWait();");
            btnDeny.Attributes.Add("onclick", "return Deny('" + divDeny.ClientID + "','" + divApprove.ClientID + "','" + txtReason.ClientID + "');");
            btnDone.Attributes.Add("onclick", "return ValidateText('" + txtReason.ClientID + "', 'Please enter a reason') && confirm('Are you sure you want to DENY this request?') && ProcessButton(this) && LoadWait();");
            btnCancel.Attributes.Add("onclick", "return Cancel('" + divDeny.ClientID + "','" + divApprove.ClientID + "');");
        }
        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();");
        }
Beispiel #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     AuthenticateUser();
     intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
     oResourceRequest = new ResourceRequest(intProfile, dsn);
     oRequestItem     = new RequestItems(intProfile, dsn);
     oApplication     = new Applications(intProfile, dsn);
     oRequest         = new Requests(intProfile, dsn);
     oProject         = new Projects(intProfile, dsn);
     oProjectNumber   = new ProjectNumber(intProfile, dsn);
     oService         = new Services(intProfile, dsn);
     oUser            = new Users(intProfile, dsn);
     oDelegate        = new Delegates(intProfile, dsn);
     if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
     {
         panFinish.Visible = true;
     }
     else
     {
         panForm.Visible = true;
         if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
         {
             int     intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]);
             int     intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
             DataSet ds = oResourceRequest.Get(intResourceParent);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 int intUser    = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid"));
                 int intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                 int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                 int intApp     = oRequestItem.GetItemApplication(intItem);
                 //if (intProfile == intUser || oService.IsManager(intService, intProfile) || oDelegate.Get(intUser, intProfile) > 0 || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1") || (oUser.IsManager(intUser, intProfile, true) && oApplication.Get(intApp, "disable_manager") != "1"))
                 //{
                 int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                 hdnRequestID.Value = intRequest.ToString();
                 int    intProject = oRequest.GetProjectNumber(intRequest);
                 string strPath    = "";
                 if (intItem == 0)
                 {
                     strPath = strPCWM;
                 }
                 else if (intItem == -1)
                 {
                     strPath = strTaskWM;
                 }
                 else
                 {
                     if (oApplication.Get(intApp, "tpm") != "1" && oProject.Get(intProject, "number") == "")
                     {
                         oProject.Update(intProject, oProjectNumber.New());
                     }
                     strPath = oService.Get(intService, "wm_path");
                 }
                 if (strPath != "")
                 {
                     oForm.Controls.Add((Control)LoadControl(strPath));
                 }
                 string strTitle = "Task";
                 if (intProject > 0)
                 {
                     strTitle = oProject.Get(intProject, "name");
                 }
                 Master.Page.Title = strTitle + " | " + oService.GetName(intService);
                 //}
                 //else
                 //    panDenied.Visible = true;
             }
             else
             {
                 panDenied.Visible = true;
             }
         }
     }
     btnFinish.Attributes.Add("onclick", "return CloseWindow();");
     btnClose.Attributes.Add("onclick", "return CloseWindow();");
 }
Beispiel #14
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 + "');");
        }
Beispiel #15
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);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oApplication     = new Applications(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oStatus          = new StatusLevels();
            oService         = new Services(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
            {
                int intProject = Int32.Parse(Request.QueryString["pid"]);
                lblProject.Text = intProject.ToString();
                ds = oProject.GetCoordinator(intProject, 0);
                int  intCoordinator  = 0;
                int  intRequest      = 0;
                int  intResource     = 0;
                bool boolCoordinator = false;
                bool boolTPM         = false;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if ((Int32.Parse(dr["userid"].ToString()) == intProfile || oDelegate.Get(Int32.Parse(dr["userid"].ToString()), intProfile) > 0) && (Request.QueryString["search"] == null))
                    {
                        if (dr["tpm"].ToString() == "1")
                        {
                            boolTPM = true;
                        }
                        else
                        {
                            boolCoordinator = true;
                        }
                    }
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //panProject.Visible = true;
                    intRequest          = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                    intResource         = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    intCoordinator      = Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString());
                    lblCoordinator.Text = oUser.GetFullName(intCoordinator);
                    lblPhone.Text       = (oUser.Get(intCoordinator, "phone") == "" ? "N / A" : oUser.Get(intCoordinator, "phone"));
                    string strEmail = oUser.GetEmail(oUser.GetName(intCoordinator), intEnvironment);
                    lblEmail.Text = (strEmail == "" ? "N / A" : "<a href=\"mailto:" + strEmail + "\" target=\"_blank\">" + strEmail + "</a>");
                    string strPager = oUser.Get(intCoordinator, "pager");
                    lblMobileDevice.Text = (strPager == "" || strPager == "0" ? "N / A" : strPager);
                    string strAt = oUser.Get(intCoordinator, "atid");
                    if (strAt != "0" && strAt != "")
                    {
                        Users_At oUserAt = new Users_At(intProfile, dsn);
                        strPager           += "@" + oUserAt.GetName(Int32.Parse(strAt));
                        lblMobileEmail.Text = "<a href=\"mailto:" + strPager + "\" target=\"_blank\">" + strPager + "</a>";
                    }
                    else
                    {
                        lblMobileEmail.Text = "N / A";
                    }
                }
                lblRequest.Text = intRequest.ToString();
                if (Request.QueryString["comm"] != null && Request.QueryString["comm"] != "")
                {
                    trCommunication.Visible = true;
                }
                if (boolTPM == true)
                {
                    //                if (CheckConfigured(intProject, intRequest, intResource) == true)
                    //                {
                    panControl.Visible = true;
                    Control oControl = (Control)LoadControl(strTPMWM);
                    phControl.Controls.Add(oControl);
                    LoadProject(intProject);
                    //                }
                    //                else
                    //                    panConfigure.Visible = true;
                }
                else if (boolCoordinator == true)
                {
                    panControl.Visible = true;
                    Control oControl = (Control)LoadControl(strPCWM);
                    phControl.Controls.Add(oControl);
                    LoadProject(intProject);
                }
                else if (oApplication.GetName(intApplication).Contains("IDC") == true || oApplication.GetName(intApplication).Contains("Integration Engineer") == true)
                {
                    panControl.Visible = true;
                    Control oControl = (Control)LoadControl("/controls/wm/wm_ie.ascx");
                    phControl.Controls.Add(oControl);
                    LoadProject(intProject);
                }
                else
                {
                    panWorkload.Visible = true;
                    ds = oResourceRequest.GetWorkflowProjectAll(intProject);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ds = oProjectRequest.GetProject(intProject);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            btnViewPR.Text = "View Original Project Request";
                            btnViewPR.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');");
                        }
                        else
                        {
                            //if (intResource > 0)
                            //{
                            //    btnViewPR.Text = "View Original Request Details";
                            //    btnViewPR.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResource.ToString() + "');");
                            //}
                            //else
                            btnViewPR.Visible = false;
                        }
                        // Documents
                        btnDocuments.Attributes.Add("onclick", "return OpenWindow('DOCUMENTS_SECURE','?pid=" + intProject.ToString() + "');");
                        chkMyDescription.Checked = (Request.QueryString["mydoc"] != null);
                        lblMyDocuments.Text      = oDocument.GetDocuments_Mine(intProject, intProfile, oVariable.DocumentsFolder(), -1, (Request.QueryString["mydoc"] != null));
                        // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine)
                        //lblMyDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, intProject, 0, intProfile, -1, (Request.QueryString["mydoc"] != null), true);
                        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);

                        /*
                         * ds = oResourceRequest.GetWorkflowProject(intProject);
                         * int intOldUser = 0;
                         * foreach (DataRow dr in ds.Tables[0].Rows)
                         * {
                         *  if (intOldUser == Int32.Parse(dr["userid"].ToString()))
                         *      dr.Delete();
                         *  else
                         *      intOldUser = Int32.Parse(dr["userid"].ToString());
                         * }
                         * ddlResource.DataValueField = "userid";
                         * ddlResource.DataTextField = "userid";
                         * ddlResource.DataSource = ds;
                         * ddlResource.DataBind();
                         * foreach (ListItem oItem in ddlResource.Items)
                         *  oItem.Text = oUser.GetFullName(Int32.Parse(oItem.Value));
                         * ddlResource.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                         * // Load Involvement
                         * DataSet dsInvolvement = oResourceRequest.GetWorkflowProject(intProject);
                         * int intOldItem = 0;
                         * intOldUser = 0;
                         * foreach (DataRow dr in dsInvolvement.Tables[0].Rows)
                         * {
                         *  if (intImplementorDistributed == Int32.Parse(dr["itemid"].ToString()))
                         *      dr.Delete();
                         *  else if (intImplementorMidrange == Int32.Parse(dr["itemid"].ToString()))
                         *      dr.Delete();
                         *  else 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");
                         *  int intStatus = Int32.Parse(_status.Text);
                         *  int intUser = Int32.Parse(_user.Text);
                         *  _user.Text = oUser.GetFullName(intUser);
                         *  Label _item = (Label)ri.FindControl("lblItem");
                         *  int intItem = Int32.Parse(_item.Text);
                         *  Label _allocated = (Label)ri.FindControl("lblAllocated");
                         *  Label _used = (Label)ri.FindControl("lblUsed");
                         *  double dblAllocated = oResourceRequest.GetAllocated(intProject, intUser, intItem);
                         *  double dblUsed = oResourceRequest.GetUsed(intProject, intUser, intItem);
                         *  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");
                         *  if (intItem == 0)
                         *      _item.Text = "Project Coordinator";
                         *  else
                         *  {
                         *      if (intItem == -1)
                         *          _item.Text = "Design Implementor";
                         *      else
                         *      {
                         *          int intApp = oRequestItem.GetItemApplication(intItem);
                         *          _item.Text = oApplication.GetName(intApp);
                         *      }
                         *  }
                         *  _status.Text = oStatus.Name(intStatus);
                         * }
                         */
                        // MY Involvement
                        DataSet dsMine = oResourceRequest.GetWorkflowProject(intProject);
                        //Check if new request
                        DataColumn oColumn;
                        oColumn            = new DataColumn();
                        oColumn.DataType   = System.Type.GetType("System.String");
                        oColumn.ColumnName = "new";
                        dsMine.Tables[0].Columns.Add(oColumn);
                        foreach (DataRow dr in dsMine.Tables[0].Rows)
                        {
                            if (intImplementorDistributed == Int32.Parse(dr["itemid"].ToString()))
                            {
                                dr.Delete();
                            }
                            else if (intImplementorMidrange == Int32.Parse(dr["itemid"].ToString()))
                            {
                                dr.Delete();
                            }
                            else if (DateTime.Parse(dr["created"].ToString()) <= DateTime.Parse(dr["modified"].ToString()))
                            {
                                dr["new"] = "1";
                            }
                            //else if (intProfile != Int32.Parse(dr["userid"].ToString()) && oDelegate.Get(Int32.Parse(dr["userid"].ToString()), intProfile) <= 0)
                            //    dr.Delete();
                        }
                        Functions oFunction = new Functions(0, dsn, intEnvironment);
                        rptMine.DataSource = dsMine;
                        rptMine.DataBind();
                        lblNoMine.Visible = (rptMine.Items.Count == 0);
                        foreach (RepeaterItem ri in rptMine.Items)
                        {
                            Label _id         = (Label)ri.FindControl("lblId");
                            Label _user       = (Label)ri.FindControl("lblUser");
                            Label _status     = (Label)ri.FindControl("lblStatus");
                            Label _color      = (Label)ri.FindControl("lblColor");
                            Label _service    = (Label)ri.FindControl("lblServiceId");
                            int   _serviceid  = Int32.Parse(_service.Text);
                            Label _name       = (Label)ri.FindControl("lblName");
                            Image imgDelegate = (Image)ri.FindControl("imgDelegate");
                            int   intStatus   = Int32.Parse(_status.Text);
                            int   intUser     = Int32.Parse(_user.Text);
                            if ((intStatus < 1 || intStatus > 2) && intStatus != 5)
                            {
                                ri.Visible = false;
                            }
                            else if (intUser != intProfile)
                            {
                                if (oDelegate.Get(intUser, intProfile) <= 0)
                                {
                                    ri.Visible = false;
                                }
                                else
                                {
                                    imgDelegate.Visible = true;
                                }
                            }
                            if (ri.Visible == true)
                            {
                                string strColor = _color.Text;
                                int    intGreen = 0;
                                Int32.TryParse(strColor.Substring(0, strColor.IndexOf("_")), out intGreen);
                                strColor = strColor.Substring(strColor.IndexOf("_") + 1);
                                int intYellow = 0;
                                Int32.TryParse(strColor.Substring(0, strColor.IndexOf("_")), out intYellow);
                                strColor = strColor.Substring(strColor.IndexOf("_") + 1);
                                int intRed = 0;
                                Int32.TryParse(strColor, out intRed);
                                strColor = "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">";
                                if (intRed > 0)
                                {
                                    strColor += "<tr><td>" + oFunction.GetBox("FF0000", 15, 8) + "</td>" + (intRed > 1 ? "<td> (" + intRed.ToString() + ")</td>" : "") + "</tr>";
                                }
                                if (intYellow > 0)
                                {
                                    strColor += "<tr><td>" + oFunction.GetBox("FFFF00", 15, 8) + "</td>" + (intYellow > 1 ? "<td> (" + intYellow.ToString() + ")</td>" : "") + "</tr>";
                                }
                                if (intGreen > 0)
                                {
                                    strColor += "<tr><td>" + oFunction.GetBox("00FF00", 15, 8) + "</td>" + (intGreen > 1 ? "<td> (" + intGreen.ToString() + ")</td>" : "") + "</tr>";
                                }
                                strColor   += "</table>";
                                _color.Text = strColor;

                                if (_name.Text == "")
                                {
                                    _name.Text = oService.GetName(_serviceid);
                                }
                                Label  _item        = (Label)ri.FindControl("lblItem");
                                Label  _allocated   = (Label)ri.FindControl("lblAllocated");
                                double dblAllocated = double.Parse(_allocated.Text);
                                Label  _used        = (Label)ri.FindControl("lblUsed");
                                double dblUsed      = oResourceRequest.GetWorkflowUsed(Int32.Parse(_id.Text));
                                Label  _percent     = (Label)ri.FindControl("lblPercent");
                                int    intItem2     = Int32.Parse(_item.Text);
                                if (intItem2 == 0)
                                {
                                    _item.Text = "Project Coordinator";
                                }
                                else
                                {
                                    if (intItem2 == -1)
                                    {
                                        _item.Text = "Pending Execution";
                                    }
                                    else
                                    {
                                        int intApp = oRequestItem.GetItemApplication(intItem2);
                                        _item.Text = oApplication.GetName(intApp);
                                    }
                                }
                                _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");
                                }
                                _status.Text = oStatus.Name(intStatus);
                            }
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                        lblTitle.Text     = "Zero Dataset ";
                    }
                    LoadProject(intProject);
                }
            }
            else
            {
                panDenied.Visible = true;
                lblTitle.Text     = "Invalid Querystring ";
            }
            btnDenied.Attributes.Add("onclick", "return CloseWindow();");
            btnConfigure.Attributes.Add("onclick", "return ValidateText('" + txtNumber.ClientID + "','Please enter the project number');");
        }
Beispiel #16
0
 //получить id-проекта
 public static int GetProjectNumberId(ProjectNumber projectNumber)
 {
     return(prjobject.GetProjectNumberId(projectNumber));
 }
Beispiel #17
0
 //создание идентификатора проекта
 public static int InsertProjectNumber(ProjectNumber projectNumber)
 {
     return(prjobject.InsertProjectNumber(projectNumber));
 }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            }
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            oDataPoint       = new DataPoint(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oStatusLevel     = new StatusLevels();
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);
            if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "SERVICE") == true || intDataPointAvailableService == 1))
            {
                panAllow.Visible = true;
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                if (Request.QueryString["clear"] != null)
                {
                    panClear.Visible = true;
                }
                if (Request.QueryString["error"] != null)
                {
                    panError.Visible = true;
                }
                if (Request.QueryString["close"] != null)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                }
                else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    string strID = oFunction.decryptQueryString(Request.QueryString["id"]);
                    intResource = Int32.Parse(strID);
                    DataSet ds = oDataPoint.GetServiceRequestResource(intResource);
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        // Load General Information

                        //string strHeader = intResource.ToString();
                        string strHeader = ds.Tables[0].Rows[0]["requestid"].ToString()
                                           + "-" + (ds.Tables[0].Rows[0]["ServiceId"] != DBNull.Value?ds.Tables[0].Rows[0]["ServiceId"].ToString():"0")
                                           + "-" + (ds.Tables[0].Rows[0]["number"] != DBNull.Value ? ds.Tables[0].Rows[0]["number"].ToString() : "0");

                        lblRequestID.Text    = strHeader;
                        lblRequestID.ToolTip = "Resource Request :" + intResource.ToString();

                        lblHeader.Text    = "&quot;" + strHeader + "&quot;";
                        Master.Page.Title = "DataPoint | Request (" + strHeader + ")";
                        lblHeaderSub.Text = "Provides all the information about a resource request...";
                        int intMenuTab = 0;
                        if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
                        {
                            intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
                        }
                        Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false);

                        oTab.AddTab("Submitted Information", "");
                        oTab.AddTab("Workflow / History", "");
                        oTab.AddTab("Resource(s) Involvement", "");
                        if (oUser.IsAdmin(intProfile) == true)
                        {
                            trAdmin.Visible = true;
                            Variables oVariable = new Variables(intEnvironment);
                            txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divUser.ClientID + "','" + lstUser.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                            lstUser.Attributes.Add("ondblclick", "AJAXClickRow();");
                            oTab.AddTab("Resource Detail", "");
                            divDetail.Visible = true;
                        }

                        if (!IsPostBack)
                        {
                            strOriginal = oResourceRequest.GetSummary(intResource, 0, intEnvironment, dsnServiceEditor, dsnAsset, dsnIP);

                            bool boolDeleted = (ds.Tables[0].Rows[0]["deleted"].ToString() != "0");
                            panDeleted.Visible = boolDeleted;
                            int intRequest   = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                            int intRequestor = oRequest.GetUser(intRequest);
                            strRequestor = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intRequestor.ToString() + "');\">" + oUser.GetFullName(intRequestor) + " [" + oUser.GetName(intRequestor) + "]</a>";
                            int intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                            int intApp     = oRequestItem.GetItemApplication(intItem);
                            int intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                            int intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                            // General Information
                            oDataPoint.LoadTextBox(txtRequest, intProfile, null, "/datapoint/service/request.aspx?t=id&q=" + oFunction.encryptQueryString("CVT" + intRequest.ToString()) + "&id=" + oFunction.encryptQueryString(intRequest.ToString()), lblRequest, fldRequest, "RESOURCE_REQUEST", "CVT" + ds.Tables[0].Rows[0]["requestid"].ToString(), "", true, false);
                            oDataPoint.LoadTextBox(txtCreated, intProfile, null, "", lblCreated, fldCreated, "RESOURCE_CREATED", ds.Tables[0].Rows[0]["created"].ToString(), "", true, false);
                            oDataPoint.LoadTextBox(txtDepartment, intProfile, null, "", lblDepartment, fldDepartment, "RESOURCE_DEPARTMENT", ds.Tables[0].Rows[0]["department"].ToString(), "", true, false);
                            oDataPoint.LoadTextBox(txtService, intProfile, null, "", lblService, fldService, "RESOURCE_SERVICE", oService.GetName(intService), "", true, false);
                            string  strOwner = "";
                            DataSet dsOwner  = oService.GetUser(intService, -1); // Service Owners
                            foreach (DataRow drOwner in dsOwner.Tables[0].Rows)
                            {
                                if (strOwner != "")
                                {
                                    strOwner += ", ";
                                }
                                int intOwner = Int32.Parse(drOwner["userid"].ToString());
                                strOwner += "<span class=\"required\">*</span> <a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intOwner.ToString() + "');\">" + oUser.GetFullName(intOwner) + " [" + oUser.GetName(intOwner) + "]</a>";
                            }
                            //strOwner = "<b>" + strOwner + "</b>";
                            DataSet dsManager = oService.GetUser(intService, 1);  // Managers
                            foreach (DataRow drManager in dsManager.Tables[0].Rows)
                            {
                                if (strOwner != "")
                                {
                                    strOwner += ", ";
                                }
                                int intManager = Int32.Parse(drManager["userid"].ToString());
                                strOwner += "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intManager.ToString() + "');\">" + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]</a>";
                            }
                            oDataPoint.LoadTextBox(txtOwner, intProfile, null, "", lblOwner, fldOwner, "RESOURCE_OWNER", strOwner, "", true, false);
                            oDataPoint.LoadTextBox(txtName, intProfile, null, "", lblName, fldName, "RESOURCE_NAME", ds.Tables[0].Rows[0]["name"].ToString(), "", false, true);
                            oDataPoint.LoadTextBox(txtDevices, intProfile, null, "", lblDevices, fldDevices, "RESOURCE_DEVICES", ds.Tables[0].Rows[0]["devices"].ToString(), "", false, true);
                            oDataPoint.LoadTextBox(txtAllocated, intProfile, null, "", lblAllocated, fldAllocated, "RESOURCE_ALLOCATED", ds.Tables[0].Rows[0]["allocated"].ToString(), "", false, true);
                            if (txtDevices.Visible == true && oService.Get(intService, "disable_hours") != "1")
                            {
                                txtAllocated.Enabled = false;
                                txtAllocated.ToolTip = intService.ToString();
                                panDynamic.Visible   = true;
                            }
                            int intAccepted = Int32.Parse(ds.Tables[0].Rows[0]["accepted"].ToString());
                            oDataPoint.LoadDropDown(ddlAccepted, intProfile, null, "", lblAccepted, fldAccepted, "REQUEST_ACCEPTED", "name", "id", SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT -1 AS id, 'No' AS name UNION ALL SELECT 0 AS id, 'Pending' AS name UNION ALL SELECT 1 AS id, 'Yes' AS name"), intAccepted, false, false, true);
                            oDataPoint.LoadDropDown(ddlStatus, intProfile, null, "", lblStatus, fldStatus, "REQUEST_STATUS", "name", "id", SqlHelper.ExecuteDataset(dsn, CommandType.Text, oStatusLevel.List()), Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()), false, false, true);
                            oDataPoint.LoadTextBox(txtReason, intProfile, null, "", lblReason, fldReason, "RESOURCE_REASON", ds.Tables[0].Rows[0]["reason"].ToString(), "", false, false);
                            int intAssigned = Int32.Parse(ds.Tables[0].Rows[0]["assignedby"].ToString());
                            oDataPoint.LoadDropDownAJAX(txtAssignedBy, hdnAssignedBy, divAssignedBy, lstAssignedBy, intEnvironment, intProfile, null, "", lblAssignedBy, fldAssignedBy, "RESOURCE_ASSIGNED", intAssigned, (intAssigned > 0 ? oUser.GetFullName(intAssigned) + " (" + oUser.GetName(intAssigned) + ")" : ""), "/frame/users.aspx", "", false, false);
                            oDataPoint.LoadTextBox(txtAssignedOn, intProfile, null, "", lblAssignedOn, fldAssignedOn, "RESOURCE_ASSIGNED", ds.Tables[0].Rows[0]["assigned"].ToString(), "", true, false);
                            btnAssign.Visible = oUser.IsAdmin(intProfile);
                            btnAssign.Enabled = (intAssigned > 0);

                            ucWorkflow.RequestID = intRequest;
                            ucWorkflow.ServiceID = intService;
                            ucWorkflow.Number    = intNumber;

                            ucResourceInvolvement.ResourceRequestId = intResource;
                            //if (ds.Tables[1].Rows.Count > 0)
                            //{
                            //    // Resource Assignment(s)
                            //    if (ds.Tables[2].Rows.Count > 0)
                            //        ds.Relations.Add("relationship", ds.Tables[1].Columns["id"], ds.Tables[2].Columns["id"]);
                            //    rptAssignments.DataSource = ds.Tables[1];
                            //    rptAssignments.DataBind();
                            //    foreach (RepeaterItem ri in rptAssignments.Items)
                            //    {
                            //        Label lblStatusR = (Label)ri.FindControl("lblStatusR");
                            //        int intStatus = Int32.Parse(lblStatusR.Text);
                            //        lblStatusR.Text = oStatusLevel.HTML(intStatus);
                            //        Label lblProgress = (Label)ri.FindControl("lblProgress");
                            //        double dblProgress = double.Parse(lblProgress.Text);
                            //        if (intStatus == 3)
                            //            dblProgress = 100.00;
                            //        if (intStatus < 1 || intStatus > 2)
                            //            lblProgress.Text = "---";
                            //        else
                            //        {
                            //            try
                            //            {
                            //                lblProgress.Text = oServiceRequest.GetStatusBar(dblProgress, "100", "12", true);
                            //            }
                            //            catch
                            //            {
                            //                lblProgress.Text = oServiceRequest.GetStatusBar(0.00, "100", "12", true);
                            //            }
                            //        }

                            //        Panel panDelete = (Panel)ri.FindControl("panDelete");
                            //        if (panDelete.ToolTip == "1")
                            //            panDelete.Visible = true;
                            //        else
                            //        {
                            //            Panel panEdit = (Panel)ri.FindControl("panEdit");
                            //            panEdit.Visible = true;
                            //            Button btnLogin = (Button)ri.FindControl("btnLogin");
                            //            btnLogin.Attributes.Add("onclick", "return OpenNewWindowMenu('/frame/resource_request.aspx?rrid=" + btnLogin.CommandArgument + "', '800', '600');");
                            //            Button btnEdit = (Button)ri.FindControl("btnEdit");
                            //            if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile))
                            //                btnEdit.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/manager.aspx?id=" + btnEdit.CommandArgument + "', '800', '600');");
                            //            else
                            //                btnEdit.Enabled = false;
                            //            LinkButton btnMore = (LinkButton)ri.FindControl("btnMore");
                            //            btnMore.Attributes.Add("onclick", "ShowHideDiv2('div_" + btnMore.CommandArgument + "');return false;");
                            //            if (ds.Tables[2].Rows.Count > 0)
                            //                btnMore.Visible = true;
                            //        }
                            //    }
                            //}
                            //lblAssignments.Visible = (rptAssignments.Items.Count == 0);


                            // This should be the last tab to load
                            DataSet dsResults = oRequest.GetResult(intRequest, intItem, intNumber);
                            if (dsResults.Tables[0].Rows.Count > 0)
                            {
                                // Request Results
                                oTab.AddTab("Request Results", "");
                                divResults.Visible    = true;
                                rptResults.DataSource = dsResults;
                                rptResults.DataBind();
                            }
                            lblResults.Visible = (rptResults.Items.Count == 0);

                            strMenuTab1 = oTab.GetTabs();
                        }
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>");
                    }
                }
                else
                {
                    Response.Redirect("/datapoint/service/datapoint_service_search.aspx");
                }
                btnAssign.Attributes.Add("onclick", "return confirm('Are you sure you want to put this request back in queue for assignment?');");
                btnClose.Attributes.Add("onclick", "window.close();return false;");
                btnPrint.Attributes.Add("onclick", "window.print();return false;");
                btnSave.Attributes.Add("onclick", oDataPoint.LoadValidation());
                btnSaveClose.Attributes.Add("onclick", oDataPoint.LoadValidation());
            }
            else
            {
                panDenied.Visible = true;
            }
        }