Example #1
0
        public static LocationInfo[] GetAllLocations()
        {
            ArrayList al = new ArrayList();

            int retValue = -1;


            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetAllLocations(out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {
                    LocationInfo location = new LocationInfo();
                    location.LocationId    = Convert.ToInt32(dr["location_id"]);
                    location.LocationName  = dr["location_name"].ToString();
                    location.CreatedDate   = Convert.ToDateTime(dr["created_date"]);
                    location.ChangedDate   = Convert.ToDateTime(dr["changed_date"]);
                    location.ChangedByName = dr["changed_by"].ToString();
                    al.Add(location);
                }
                //dr.Close();
            }

            LocationInfo[] allInfo = new LocationInfo[al.Count];
            al.CopyTo(allInfo);
            return(allInfo);
        }
Example #2
0
        public static HighChartsBarGraphInfo GetReportProjectFundsAtLocation() //Parameter list
        {
            int retValue = -1;


            IList <string>             projects  = new List <string>();
            IList <string>             locations = new List <string>();
            IList <BarGraphSeriesInfo> series    = new List <BarGraphSeriesInfo>();
            HighChartsBarGraphInfo     result    = new HighChartsBarGraphInfo();

            result.categories = new List <string>();
            IList <ReportData> data = new List <ReportData>();

            using (SqlDataReader dr = ProjManagementAdmin.GetAllLocations(out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {
                    string locationName = dr["location_name"].ToString();
                    locations.Add(locationName);
                }

                //dr.Close();
            }
            using (SqlDataReader dr = ProjManagementAdmin.GetAllProjects(out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {
                    string projectName = dr["project_name"].ToString();
                    projects.Add(projectName);
                }

                //dr.Close();
            }
            using (SqlDataReader dr = ProjManagementAdmin.GetReportProjectsFunds(out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {
                    ReportData d = new ReportData();
                    d.LocationName = dr["location_name"].ToString();
                    d.ProjectName  = dr["project_name"].ToString();
                    d.FundAmount   = Convert.ToInt32(dr["amount"]);
                    data.Add(d);
                }
            }
            result.series = new List <BarGraphSeriesInfo>();
            foreach (string l in locations)
            {
                BarGraphSeriesInfo b = new BarGraphSeriesInfo();
                b.data = new List <int>();
                b.name = l;
                foreach (string p in projects)
                {
                    bool flag = false;

                    for (int i = 0; i < data.Count; i++)
                    {
                        if (data[i].ProjectName.Equals(p) && data[i].LocationName.Equals(l))
                        {
                            b.data.Add(data[i].FundAmount);
                            flag = true;
                        }
                    }
                    if (flag == false)
                    {
                        b.data.Add(0);
                    }
                }
                result.series.Add(b);
            }
            result.categories = projects;
            return(result);
        }