Exemple #1
0
        public List <WTFC> GetWorstCarsByYearMakeModel(string make, string model, ref string page)
        {
            if (string.IsNullOrEmpty(page))
            {
                page = "1";
            }

            //Data d = new Data();
            List <WTFC> lWTFC = new List <WTFC>();

            List <SqlParameter> lParams = new List <SqlParameter>
            {
                new SqlParameter("page", page),
                new SqlParameter("make", make),
                new SqlParameter("model", model)
            };

            DataTable dt = ExecuteStoredProcWithPage("GetWorstCarsByYearMakeModel", lParams, ref page);


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                WTFC c = new WTFC
                {
                    year     = dt.Rows[i][0].ToString(),
                    make     = dt.Rows[i][1].ToString(),
                    model    = dt.Rows[i][2].ToString(),
                    Totalpts = dt.Rows[i][3].ToString()
                };
                lWTFC.Add(c);
            }

            return(lWTFC);
        }
Exemple #2
0
        public List <WTFC> GetWorstCarMakes(ref string page)
        {
            //Data d = new Data();
            List <WTFC> lWTFC = new List <WTFC>();

            int result = -1;

            Int32.TryParse(page, out result);

            if (result > 0)
            {
                SqlParameter        sqlP  = new SqlParameter("page", Convert.ToInt32(page));
                List <SqlParameter> lSqlP = new List <SqlParameter>
                {
                    sqlP
                };

                DataTable dt = ExecuteStoredProcWithPage("GetWorstCarMakes", lSqlP, ref page);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    WTFC c = new WTFC
                    {
                        make     = dt.Rows[i][0].ToString(),
                        Totalpts = dt.Rows[i][1].ToString()
                    };
                    lWTFC.Add(c);
                }
            }

            return(lWTFC);
        }
Exemple #3
0
        public List <WTFC> GetWorstCars(string page)
        {
            List <WTFC> lWTFC = new List <WTFC>();

            List <SqlParameter> lParams = new List <SqlParameter>();

            SqlParameter p = new SqlParameter("page", page);

            lParams.Add(p);

            DataTable dt = ExecuteStoredProcSQL("GetWorstNewCars", true, lParams);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                WTFC c = new WTFC
                {
                    year     = dt.Rows[i][0].ToString(),
                    make     = dt.Rows[i][1].ToString(),
                    model    = dt.Rows[i][2].ToString(),
                    Totalpts = dt.Rows[i][3].ToString()
                };
                lWTFC.Add(c);
            }

            return(lWTFC);
        }
Exemple #4
0
        internal List <WTFC> GetWorstCarsAllTime(string sortBy, string yearBegin, string yearEnd, string page)
        {
            List <WTFC> lWTFC = new List <WTFC>();

            List <SqlParameter> lParams = new List <SqlParameter>();

            SqlParameter p = new SqlParameter("page", page);

            lParams.Add(p);

            if (sortBy != "")
            {
                p = new SqlParameter("sortBy", sortBy);
                lParams.Add(p);
            }

            if (yearBegin != "")
            {
                p = new SqlParameter("yearBegin", yearBegin);
                lParams.Add(p);
            }


            if (yearEnd != "")
            {
                p = new SqlParameter("yearEnd", yearEnd);
                lParams.Add(p);
            }



            DataTable dt = ExecuteStoredProcSQL("GetWorstCarsAllTime", true, lParams);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                WTFC c = new WTFC
                {
                    year     = dt.Rows[i][0].ToString(),
                    make     = dt.Rows[i][1].ToString(),
                    model    = dt.Rows[i][2].ToString(),
                    Totalpts = dt.Rows[i][3].ToString()
                };
                lWTFC.Add(c);
            }

            return(lWTFC);
        }
Exemple #5
0
        public List <WTFC> GetWorstCarMakeModels()
        {
            //Data d = new Data();
            List <WTFC> lWTFC = new List <WTFC>();

            DataTable dt = ExecuteStoredProcSQL("GetWorstCarMakeModels", true, null);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                WTFC c = new WTFC
                {
                    make     = dt.Rows[i][0].ToString(),
                    model    = dt.Rows[i][1].ToString(),
                    Totalpts = dt.Rows[i][2].ToString()
                };
                lWTFC.Add(c);
            }

            return(lWTFC);
        }
Exemple #6
0
        public List <WTFC> GetWorstCarByMake(string make)
        {
            //Data d = new Data();
            List <WTFC> lWTFC = new List <WTFC>();

            List <SqlParameter> lParams = new List <SqlParameter>
            {
                new SqlParameter("make", make)
            };

            DataTable dt = ExecuteStoredProcSQL("GetWorstCarsByMake", true, lParams);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                WTFC c = new WTFC
                {
                    make     = dt.Rows[i][0].ToString(),
                    Totalpts = dt.Rows[i][1].ToString()
                };
                lWTFC.Add(c);
            }

            return(lWTFC);
        }
Exemple #7
0
        public List <WTFC> GetWorstCarsByMake(string make, ref string page)
        {
            //Data d = new Data();
            List <WTFC> lWTFC = new List <WTFC>();

            List <SqlParameter> lParams = new List <SqlParameter>();
            SqlParameter        m       = new SqlParameter("make", make);

            lParams.Add(m);

            SqlParameter p = new SqlParameter("page", Convert.ToInt32(page));

            lParams.Add(p);

            DataTable dt = ExecuteStoredProcWithPage("GetWorstCarsByMake", lParams, ref page);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                WTFC c = new WTFC
                {
                    year  = dt.Rows[i][0].ToString(),
                    make  = dt.Rows[i][1].ToString(),
                    model = dt.Rows[i][2].ToString()
                };

                if (dt.Rows[i][8] != null)
                {
                    c.Totalpts = dt.Rows[i][8].ToString();
                }


                lWTFC.Add(c);
            }

            return(lWTFC);
        }
Exemple #8
0
        public List <WTFC> GetCurrentCarInfo(string year, string make, string model)
        {
            //Data d = new Data();
            List <WTFC> lWTFC = new List <WTFC>();

            List <SqlParameter> lParams = new List <SqlParameter>();
            SqlParameter        y       = new SqlParameter("year", year);
            SqlParameter        m       = new SqlParameter("make", make);
            SqlParameter        mo      = new SqlParameter("model", model);

            lParams.Add(y);
            lParams.Add(m);
            lParams.Add(mo);

            DataTable dt = ExecuteStoredProcSQL("GetCurrentCarInfo", true, lParams);

            WTFC c = new WTFC();


            if (dt != null && dt.Rows.Count > 0)
            {
                c.year  = dt.Rows[0][0].ToString();
                c.make  = dt.Rows[0][1].ToString();
                c.model = dt.Rows[0][2].ToString();
            }


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i][3] != null && dt.Rows[i][3].ToString() != "" && dt.Rows[i][3].ToString() != "0")
                {
                    c.EnginePts = dt.Rows[i][3].ToString();
                }
                if (dt.Rows[i][4] != null && dt.Rows[i][4].ToString() != "" && dt.Rows[i][4].ToString() != "0")
                {
                    c.ElectricalPts = dt.Rows[i][4].ToString();
                }
                if (dt.Rows[i][5] != null && dt.Rows[i][5].ToString() != "" && dt.Rows[i][5].ToString() != "0")
                {
                    c.AirbagPts = dt.Rows[i][5].ToString();
                }
                if (dt.Rows[i][6] != null && dt.Rows[i][6].ToString() != "" && dt.Rows[i][6].ToString() != "0")
                {
                    c.PowertrainPts = dt.Rows[i][6].ToString();
                }
                if (dt.Rows[i][7] != null && dt.Rows[i][7].ToString() != "" && dt.Rows[i][7].ToString() != "0")
                {
                    c.OtherComplaints = dt.Rows[i][7].ToString();
                }

                if (dt.Rows[i][11] != null && dt.Rows[i][11].ToString() != "" && dt.Rows[i][11].ToString() != "0")
                {
                    c.Totalsales = dt.Rows[i][11].ToString();
                }


                //averages

                if (dt.Rows[i][11] != null && dt.Rows[i][11].ToString() != "" && dt.Rows[i][11].ToString() != "0")
                {
                    c.AverageEnginePts = dt.Rows[i][11].ToString();
                }
                if (dt.Rows[i][12] != null && dt.Rows[i][12].ToString() != "" && dt.Rows[i][12].ToString() != "0")
                {
                    c.AverageElectricalPts = dt.Rows[i][12].ToString();
                }
                if (dt.Rows[i][13] != null && dt.Rows[i][13].ToString() != "" && dt.Rows[i][13].ToString() != "0")
                {
                    c.AverageAirbagPts = dt.Rows[i][13].ToString();
                }
                if (dt.Rows[i][14] != null && dt.Rows[i][14].ToString() != "" && dt.Rows[i][14].ToString() != "0")
                {
                    c.AveragePowertrainPts = dt.Rows[i][14].ToString();
                }
                if (dt.Rows[i][15] != null && dt.Rows[i][15].ToString() != "" && dt.Rows[i][15].ToString() != "0")
                {
                    c.AverageOtherComplaints = dt.Rows[i][15].ToString();
                }
                if (dt.Rows[i][16] != null && dt.Rows[i][16].ToString() != "" && dt.Rows[i][16].ToString() != "0")
                {
                    c.AverageYearPts = dt.Rows[i][16].ToString();
                }

                if (dt.Rows[i][17] != null && dt.Rows[i][17].ToString() != "" && dt.Rows[i][17].ToString() != "0")
                {
                    c.ComplaintCount = dt.Rows[i][17].ToString();
                }

                if (dt.Rows[i][18] != null && dt.Rows[i][18].ToString() != "" && dt.Rows[i][18].ToString() != "0")
                {
                    c.ProblemRatio = dt.Rows[i][18].ToString();
                }

                c.WordCloudList = GetWordClouds(year, make, model);

                c.ForumURL = GetForumUrl(make);

                lWTFC.Add(c);
            }

            return(lWTFC);
        }