Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var b = Request.QueryString["id"];
            if (b != null)
                ((TIA)(this.Master)).accordion_selectedIndexChanged(System.Convert.ToInt16(b));

            int revenue = 0;
            int projects = 0;

            ProlianceController prj = new ProlianceController();
            ProlianceConnection conn = new ProlianceConnection("https://na2.agpmis.com", "na", "admin", "?aecom");

            RegionTotals tot = GetData("pgmprj://na/tia/rvly", prj, conn);
            revenue += tot.TotalRevenueCollected;
            projects += tot.TotalProjects;

            tot = GetData("pgmprj://na/tia/csra", prj, conn);
            revenue += tot.TotalRevenueCollected;
            projects += tot.TotalProjects;

            tot = GetData("pgmprj://na/tia/hoga", prj, conn);
            revenue += tot.TotalRevenueCollected;
            projects += tot.TotalProjects;

            totProjects.Text = projects.ToString();
            totRevenue.Text = revenue.ToString("C0");
        }
Ejemplo n.º 2
0
        public IQueryable<County> GetCounties(ProlianceConnection conn, string prjAccount, string attrib)
        {
            //CurrentUser = (ProlianceUser)CurrentContext.Session["user"];
            using (var proliance = new LookupProxy(conn, prjAccount))
            {
                try
                {
                    var ver = proliance.GetLookupVersionByType("ProjectOfficeUnitType");

                    var query = from item in ver.Items.AsEnumerable()
                                where item.Attributes[0].Value.ToString() == attrib
                                select new County
                                {
                                    Code = item.Code,
                                    FullCode = item.FullCode,
                                    Description = item.Description,
                                    level = item.Level,
                                    Display = item.Code + " : " + item.Description,
                                    SortValue = item.SortValue
                                };
                    return query.AsQueryable();
                }
                catch (Exception ex)
                {
                    throw new Exception("Error occured reading lookup: ", ex);
                }
            }
        }
Ejemplo n.º 3
0
        private RegionTotals GetData(string prjAccount, ProlianceController prj, ProlianceConnection conn)
        {
            RegionTotals rtrn = null;

            rtrn = HttpContext.Current.Cache.Get(prjAccount + "cacheKey") as RegionTotals;
            if (rtrn == null)
            {
                rtrn = new RegionTotals();
                DataSet data = prj.GetPreProjectList(conn, prjAccount);
                if (data.Tables != null && data.Tables.Count > 0)
                {
                    //rtrn.TotalRevenueCollected = 0;
                    //int val = int.MinValue;
                    //foreach (DataRow row in data.Tables[0].Rows)
                    //{
                    //    string textVal = row["SmallProjectDocument_ApproximateValueText"] as string;
                    //    if (!string.IsNullOrEmpty(textVal))
                    //    {
                    //        textVal = textVal.Replace("$", string.Empty).Replace(",", string.Empty);
                    //        MatchCollection mc = Regex.Matches(textVal, "\\d+");
                    //        if (mc.Count > 0)
                    //        {
                    //            if (int.TryParse(mc[0].Value, out val))
                    //                rtrn.TotalRevenueCollected += val;
                    //        }
                    //    }
                    //}

                    string appVal = null;

                    DataSet ds = prj.GetProjectApproxValues(conn, prjAccount);
                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        appVal = ds.Tables[0].Rows[0]["ProjectDocument_ProjectApproximateValueText"] as string;
                    }

                    if (!string.IsNullOrEmpty(appVal))
                    {
                        appVal = appVal.Replace("$", string.Empty).Replace(",", string.Empty);
                        MatchCollection mc = Regex.Matches(appVal, "\\d+");
                        if (mc.Count > 0)
                        {
                            int val = int.MinValue;
                            if (int.TryParse(mc[0].Value, out val))
                                rtrn.TotalRevenueCollected = val;
                        }
                    }

                    rtrn.ApproximateRevenueCollected = appVal;
                    rtrn.TotalProjects = data.Tables[0].Rows.Count;
                    rtrn.ProjectAccount = prjAccount;
                }

                HttpContext.Current.Cache.Add(prjAccount + "cacheKey", rtrn, null, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
            }

            return rtrn;
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                var b = Request.QueryString["id"];
                if (b != null)
                    ((TIA)(this.Master)).accordion_selectedIndexChanged(System.Convert.ToInt16(b));

                ProlianceController prj = new ProlianceController();
                ProlianceConnection conn = new ProlianceConnection("https://na2.agpmis.com", "na", "admin", "?aecom");
                string prjAccount = "pgmprj://na/tia/rvly";

                List<County> theCountites = prj.GetCounties(conn, prjAccount, "rvly").ToList();
                foreach (County cty in theCountites)
                {
                    ListItem li = new ListItem { Enabled = true, Text = cty.Description, Value = cty.FullCode };
                    this.DropDownListCounty.Items.Add(li);
                }

                List<Band> theBands = prj.GetBands(conn, prjAccount).ToList();
                foreach (Band bnd in theBands)
                {
                    ListItem li = new ListItem { Enabled = true, Text = bnd.Description, Value = bnd.FullCode };
                    this.DropDownListBand.Items.Add(li);
                }

                List<ProjectTypes> theProjectTypes = prj.GetProjectTypes(conn, prjAccount).ToList();
                foreach (ProjectTypes pt in theProjectTypes)
                {
                    ListItem li = new ListItem { Enabled = true, Text = pt.Description, Value = pt.FullCode };
                    this.DropDownListProjectType.Items.Add(li);
                }

                List<ProjectStatus> theProjectStatus = prj.GetProjectStatus(conn, prjAccount).ToList();
                foreach (ProjectStatus st in theProjectStatus)
                {
                    ListItem li = new ListItem { Enabled = true, Text = st.Description, Value = st.FullCode };
                    this.DropDownListProjectStatus.Items.Add(li);
                }

                //List<Status> theStatusTypes = prj.GetStatusTypes(conn, prjAccount).ToList();
                //foreach (Status pt in theStatusTypes)
                //{
                //    ListItem li = new ListItem { Enabled = true, Text = pt.Description, Value = pt.FullCode };
                //    this.DropDownListActive.Items.Add(li);
                //}

                theData = prj.GetPreProjectList(conn, prjAccount);
                Cache["PrjData"] = theData;
                this.RepeaterProjectList.DataSource = theData;
                this.RepeaterProjectList.DataBind();
                if (!(theData.Tables[0].Rows.Count > 0))
                    this.Label1.Visible = true;
            }
        }
Ejemplo n.º 5
0
        private void FillData(string prjAccount, ProlianceController prj, ProlianceConnection conn, Literal revenue, Literal projects, string appVal)
        {
            RegionTotals tot = null;

            tot = HttpContext.Current.Cache.Get(prjAccount + "cacheKey") as RegionTotals;
            if (tot == null)
            {
                tot = new RegionTotals();
                DataSet data = prj.GetPreProjectList(conn, prjAccount);
                if (data.Tables != null && data.Tables.Count > 0)
                {
                    //tot.TotalRevenueCollected = 0;
                    //int val = int.MinValue;
                    //foreach (DataRow row in data.Tables[0].Rows)
                    //{
                    //    string textVal = row["SmallProjectDocument_ApproximateValueText"] as string;
                    //    if (!string.IsNullOrEmpty(textVal))
                    //    {
                    //        textVal = textVal.Replace("$", string.Empty).Replace(",", string.Empty);
                    //        MatchCollection mc = Regex.Matches(textVal, "\\d+");
                    //        if (mc.Count > 0)
                    //        {
                    //            if (int.TryParse(mc[0].Value, out val))
                    //                tot.TotalRevenueCollected += val;
                    //        }
                    //    }
                    //}

                    if (!string.IsNullOrEmpty(appVal))
                    {
                        appVal = appVal.Replace("$", string.Empty).Replace(",", string.Empty);
                        MatchCollection mc = Regex.Matches(appVal, "\\d+");
                        if (mc.Count > 0)
                        {
                            int val = int.MinValue;
                            if (int.TryParse(mc[0].Value, out val))
                                tot.TotalRevenueCollected = val;
                        }
                    }

                    tot.ApproximateRevenueCollected = appVal;
                    tot.TotalProjects = data.Tables[0].Rows.Count;
                    tot.ProjectAccount = prjAccount;
                }

                HttpContext.Current.Cache.Add(prjAccount + "cacheKey", tot, null, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
            }

            projects.Text = tot.TotalProjects.ToString();
            revenue.Text = tot.TotalRevenueCollected.ToString("C0");
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var b = Request.QueryString["id"];
            if (b != null)
                ((TIA)(this.Master)).accordion_selectedIndexChanged(System.Convert.ToInt16(b));

            ProlianceController prj = new ProlianceController();
            ProlianceConnection conn = new ProlianceConnection("https://na2.agpmis.com", "na", "admin", "?aecom");

            //DataSet ds = prj.GetProjectApproxValues(conn, "pgmprj://na/tia/rvly");
            //foreach (DataTable dt in ds.Tables)
            //{
            //    int count = dt.Rows.Count;
            //}

            ProcessProject("pgmprj://na/tia/rvly", prj, conn, rvRevenue, rvProjects);
            ProcessProject("pgmprj://na/tia/csra", prj, conn, csRevenue, csProjects);
            ProcessProject("pgmprj://na/tia/hoga", prj, conn, hgRevenue, hgProjects);
        }
Ejemplo n.º 7
0
 private DataSet GetPrjCache()
 {
     ProlianceController prj = new ProlianceController();
     ProlianceConnection conn = new ProlianceConnection("https://na2.agpmis.com", "na", "admin", "?aecom");
     string prjAccount = "pgmprj://na/tia/rvly";
     string cacheKey = "PRjData";
     object cacheItem = Cache[cacheKey] as DataSet;
     if( (cacheItem == null))
     {
         cacheItem = prj.GetPreProjectList(conn, prjAccount);
     }
     return (DataSet)cacheItem;
 }
Ejemplo n.º 8
0
        public DataSet GetPreProjectList(ProlianceConnection conn, string prjAccount)
        {
            DataSet nData = new DataSet();
            //List<Attachment> Attachments = GetAttachmentCache();
            //List<PreProjectDocument> docs = new List<PreProjectDocument>();
            using (var proliance = new GatewayProxy(conn, prjAccount))
            {
                try
                {
                    var pageInfo = new PageInfo();
                    pageInfo.SelectFields = new List<OutputField>
                                       {
                                           new OutputField("SmallProjectDocument_DocumentGuid"),
                                           new OutputField("SmallProjectDocument_DocVisualId"),
                                           new OutputField("SmallProjectDocument_DocTitle"),
                                           new OutputField("SmallProjectDocument_DocSubTypeName"),
                                           new OutputField("SmallProjectDocument_WorkflowStateDisplayName"),
                                           new OutputField("SmallProjectDocument_MarketSector_FullCode"),
                                           new OutputField("SmallProjectDocument_ManagerCode_Description"),
                                           new OutputField("SmallProjectDocument_MarketSector_Description"),
                                           new OutputField("SmallProjectDocument_PlannedStartDate"),
                                           new OutputField("SmallProjectDocument_AlternateNumber1"),
                                           new OutputField("SmallProjectDocument_OfficeUnit_FullCode"),
                                           new OutputField("SmallProjectDocument_OfficeUnit_Description"),
                                           new OutputField("SmallProjectDocument_SecuredStatus_FullCode"),
                                           new OutputField("SmallProjectDocument_SecuredStatus_Description"),
                                           new OutputField("SmallProjectDocument_ServiceType_FullCode"),
                                           new OutputField("SmallProjectDocument_ServiceType_Description"),
                                           new OutputField("SmallProjectDocument_Status_FullCode"),
                                           new OutputField("SmallProjectDocument_Status_Description"),
                                           new OutputField("SmallProjectDocument_DocDescription"),
                                           new OutputField("SmallProjectDocument_DocDescriptionFull"),
                                           new OutputField("SmallProjectDocument_ApproximateValueText"),
                                           new OutputField("SmallProjectDocument_WorkflowStateUID"),
                                           new OutputField("SmallProjectDocument_AddressInfoNote"),
                                           new OutputField("SmallProjectDocument_SiteFaxInfoNote"),
                                           new OutputField("SmallProjectDocument_PhoneInfoNote")
                                       };

                    pageInfo.Filters.Add(new FilterField("SmallProjectDocument_WorkflowStateDisplayName", QueryFilterOperation.NotEqual, "Cancelled", QueryFieldType.DataField, false));
                    pageInfo.Filters.Add(new FilterField("SmallProjectDocument_DocTitle", QueryFilterOperation.NotEqual, "Program Administration", QueryFieldType.DataField, false));
                    pageInfo.Filters.FilterRelations = (" 0 & 1 ");
                    pageInfo.PagedOrderFields.Add(new OrderField("SmallProjectDocument_DocVisualId", QueryFieldType.DataField, QueryOrderAttribute.Ascending));
                    var ds = proliance.ListDocumentDataSet(DocumentTypeNames.SmallProjectDocument, pageInfo);

                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        nData = ds;
                        foreach (DataRow r in nData.Tables[0].Rows)
                        {
                            r["SmallProjectDocument_DocVisualId"] = r["SmallProjectDocument_DocVisualId"].ToString().Replace("PI-", "");
                            r["SmallProjectDocument_ServiceType_Description"] = r["SmallProjectDocument_ServiceType_Description"].ToString().Replace("Band", "");
                            r["SmallProjectDocument_ManagerCode_Description"] = r["SmallProjectDocument_ManagerCode_Description"].ToString().Replace("Congressional District", "");
                            r["SmallProjectDocument_OfficeUnit_Description"] = r["SmallProjectDocument_OfficeUnit_Description"].ToString().Replace("County", "");
                            r["SmallProjectDocument_SecuredStatus_Description"] = r["SmallProjectDocument_SecuredStatus_Description"].ToString().Replace("Status", "");

                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message, ex.InnerException);
                }
                return nData;
            }
        }
Ejemplo n.º 9
0
        public IQueryable<ProjectStatus> GetProjectStatus(ProlianceConnection conn, string prjAccount)
        {
            //CurrentUser = (ProlianceUser)CurrentContext.Session["user"];
            using (var proliance = new LookupProxy(conn, prjAccount))
            {
                try
                {
                    var ver = proliance.GetLookupVersionByType("ProjectSecuredStatusType");

                    var query = from item in ver.Items.AsEnumerable()
                                where item.Level == 0
                                select new ProjectStatus
                                {
                                    Code = item.Code,
                                    FullCode = item.FullCode,
                                    Description = item.Description,
                                    level = item.Level,
                                    Display = item.Code + " : " + item.Description,
                                    SortValue = item.SortValue
                                };
                    return query.AsQueryable();
                }
                catch (Exception ex)
                {
                    throw new Exception("Error occured reading lookup: ", ex);
                }
            }
        }
Ejemplo n.º 10
0
        private void ProcessProject(string prjAccount, ProlianceController prj, ProlianceConnection conn, Literal revenue, Literal projects)
        {
            string appVal = null;

            DataSet ds = prj.GetProjectApproxValues(conn, prjAccount);
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                appVal = ds.Tables[0].Rows[0]["ProjectDocument_ProjectApproximateValueText"] as string;
            }

            FillData(prjAccount, prj, conn, revenue, projects, appVal);
        }
Ejemplo n.º 11
0
        public Region(RegionAbbrs regionAbbr)
        {
            this.Abbreviation = regionAbbr;

            switch (this.Abbreviation)
            {
                case RegionAbbrs.hoga:
                    this.Counties = new List<string> {
                        "Appling",
                        "Bleckley",
                        "Candler",
                        "Dodge",
                        "Emanuel",
                        "Evans",
                        "Jeff Davis",
                        "Johnson",
                        "Laurens",
                        "Montgomery",
                        "Tattnall",
                        "Telfair",
                        "Toombs",
                        "Treutlen",
                        "Wayne",
                        "Wheeler",
                        "Wilcox"
                    };
                    break;
                case RegionAbbrs.csra:
                    this.Counties = new List<string> {
                        "Burke",
                        "Columbia",
                        "Glascock",
                        "Hancock",
                        "Jefferson",
                        "Jenkins",
                        "Lincoln",
                        "McDuffie",
                        "Richmond",
                        "Taliaferro",
                        "Warren",
                        "Washington",
                        "Wilkes"
                    };
                    break;
                case RegionAbbrs.rvly:
                    this.Counties = new List<string> {
                        "Clay",
                        "Crisp",
                        "Dooly",
                        "Harris",
                        "Macon",
                        "Marion",
                        "Muscogee",
                        "Quitman",
                        "Randolph",
                        "Schley",
                        "Stewart",
                        "Sumter",
                        "Talbot",
                        "Taylor",
                        "Webster"
                    };
                    break;
            }

            string prjAccount = "pgmprj://na/tia/" + this.Abbreviation.ToString();
            this.ProlianceController = new ProlianceController(prjAccount);
            ProlianceConnection conn = new ProlianceConnection("https://na2.agpmis.com", "na", "admin", "?aecom");

            DataSet data = ProlianceController.GetPreProjectList(conn, prjAccount);
            if (data.Tables != null && data.Tables.Count > 0)
            {

                string appVal = null;

                DataSet ds = ProlianceController.GetProjectApproxValues(conn, prjAccount);
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    appVal = ds.Tables[0].Rows[0]["ProjectDocument_ProjectApproximateValueText"] as string;
                }

                if (!string.IsNullOrEmpty(appVal))
                {
                    appVal = appVal.Replace("$", string.Empty).Replace(",", string.Empty);
                    MatchCollection mc = Regex.Matches(appVal, "\\d+");
                    if (mc.Count > 0)
                    {
                        Double val = 0d;
                        if (Double.TryParse(mc[0].Value, out val))
                            this.TotalRevenueCollected = val;
                    }
                }

                this.ApproximateRevenueCollected = appVal;
                this.TotalProjects = data.Tables[0].Rows.Count;
                this.ProjectAccount = prjAccount;
                this.TotalFinishedProjects = 0;
                this.TotalConstructionProjects = 0;
                this.TotalFundsBudgeted = 0;
                this.TotalFundsSpent = 0;

                Regex noNumbers = new Regex("[^0-9,\\.]");
                // count projects whose status are Complete and Construction
                // and summarize budged amount from SmallProjectDocument_AddressInfoNote
                // (which contains text, such as "$1,868,002 (Blended Project - Total Budget)" or "$11,585,960 ")
                foreach (DataRow dr in data.Tables[0].Rows)
                {
                    if (dr["SmallProjectDocument_SecuredStatus_FullCode"].ToString().Contains("Complete"))
                    {
                        this.TotalFinishedProjects++;
                    }
                    if (dr["SmallProjectDocument_SecuredStatus_FullCode"].ToString().Contains("Construction"))
                    {
                        this.TotalConstructionProjects++;
                    }
                    String budgeted = dr.IsNull("SmallProjectDocument_AddressInfoNote") ? "" : dr["SmallProjectDocument_AddressInfoNote"].ToString();
                    budgeted = noNumbers.Replace(budgeted, ""); //strip out everything except numbers
                    if (budgeted.Length > 0)
                    {
                        this.TotalFundsBudgeted += Double.Parse(budgeted);
                    }
                    String invoiced = dr.IsNull("SmallProjectDocument_ApproximateValueText") ? "" : dr["SmallProjectDocument_ApproximateValueText"].ToString();
                    invoiced = noNumbers.Replace(invoiced, ""); //strip out everything except numbersif (budgeted.Length > 0)
                    {
                        this.TotalFundsSpent += Double.Parse(invoiced);
                    }
                }
            }
            //TODO: the following is never read--the idea is that we can cache the data for five minutes
            HttpContext.Current.Cache.Add(prjAccount + "cacheKey", this, null, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Default, null);
        }