Exemple #1
0
        public void Return_values_per_week(int RangA, int RangB, string TypeOfGraph, out int[] all, out int[] good)
        {
            all  = new int[RangB - RangA + 1];
            good = new int[RangB - RangA + 1];
            int index = 0;

            DataRow[] foundRows;
            int       j = 0;
            string    query = "";
            DateTime  OvalueInDT, TvalueInDT;
            long      Oint      = 0;
            long      Tint      = 0;
            int       count     = 0;
            int       AllValues = 0;

            for (j = RangA; j <= RangB; j++)
            {
                if (TypeOfGraph == "O")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'О') and [неделя] = 'W" + j + "')";
                }                                                                                                                      //англ\русс
                if (TypeOfGraph == "О")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'O') and [неделя] = 'W" + j + "')";
                }                                                                                                                      //русс\англ
                if (TypeOfGraph == "P")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'Р') and [неделя] = 'W" + j + "')";
                }                                                                                                                      //англ\русс
                if (TypeOfGraph == "Р")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'P') and [неделя] = 'W" + j + "')";
                }                                                                                                                      //русс\англ
                if (TypeOfGraph == "S")
                {
                    query = "([O/P/S] = '" + TypeOfGraph + "' and [неделя] = 'W" + j + "')";
                }
                foundRows = ds.Tables[0].Select(query);
                count     = 0;
                for (int i = 0; i < foundRows.Length; i++)
                {
                    if (foundRows[i].ItemArray[19] is DateTime)
                    {
                        AllValues++;
                        object O = foundRows[i].ItemArray[14];
                        object T = foundRows[i].ItemArray[19];
                        if (O is DateTime)
                        {
                            OvalueInDT = (DateTime)O; Oint = OvalueInDT.ToFileTime();
                        }
                        if (T is DateTime)
                        {
                            TvalueInDT = (DateTime)T; Tint = TvalueInDT.ToFileTime();
                        }
                        long res = Oint - Tint;
                        if ((res == 0) || (res > 0))
                        {
                            count++;
                        }
                    }
                }
                all[index]  = AllValues;
                good[index] = count;
                index++;
                AllValues = 0;
            }
            { }
        }
Exemple #2
0
        public void Return_values_per_month(int RangA, int RangB, string TypeOfGraph, string[] CheckedValuesFromCities, out int[] all, out int[] good)
        {
            all  = new int[CheckedValuesFromCities.Length];
            good = new int[CheckedValuesFromCities.Length];
            int index = 0;

            DataRow[] foundRows;
            string    query = "";
            DateTime  OvalueInDT, TvalueInDT;
            long      Oint      = 0;
            long      Tint      = 0;
            int       count     = 0;
            int       AllValues = 0;

            foreach (var item in CheckedValuesFromCities)
            {
                count     = 0;
                AllValues = 0;
                if (TypeOfGraph == "O")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'О') and [Регион] = '" + item + "')";
                }                                                                                                                        //англ\русс
                if (TypeOfGraph == "О")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'O') and [Регион] = '" + item + "')";
                }                                                                                                                        //русс\англ
                if (TypeOfGraph == "P")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'Р') and [Регион] = '" + item + "')";
                }                                                                                                                        //англ\русс
                if (TypeOfGraph == "Р")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "' or [O/P/S] = 'P') and [Регион] = '" + item + "')";
                }                                                                                                                        //русс\англ
                if (TypeOfGraph == "S")
                {
                    query = "(([O/P/S] = '" + TypeOfGraph + "') and [Регион] = '" + item + "'";
                }
                foundRows = ds.Tables[0].Select(query);
                for (int j = RangA; j <= RangB; j++)
                {
                    for (int i = 0; i < foundRows.Length; i++)
                    {
                        if ((foundRows[i].ItemArray[19] is DateTime) && ((DateTime)foundRows[i].ItemArray[19] >= StartMonth[j - 1]) && ((DateTime)foundRows[i].ItemArray[19]) < EndMonth[j - 1])
                        {
                            AllValues++;
                            object O = foundRows[i].ItemArray[14];
                            object T = foundRows[i].ItemArray[19];
                            if (O is DateTime)
                            {
                                OvalueInDT = (DateTime)O; Oint = OvalueInDT.ToFileTime();
                            }
                            if (T is DateTime)
                            {
                                TvalueInDT = (DateTime)T; Tint = TvalueInDT.ToFileTime();
                            }
                            long res = Oint - Tint;
                            if ((res == 0) || (res > 0))
                            {
                                count++;
                            }
                        }
                    }
                }
                all[index]  = AllValues;
                good[index] = count;
                index++;
            }
        }
Exemple #3
0
        public void Return_values_per_month(int RangA, int RangB, out List <object> Designers, out List <float> RESULT)
        {
            Dictionary <string, float> assessment = new Dictionary <string, float>();

            DataRow[] foundRows;
            foundRows = ds.Tables[0].Select();
            RESULT    = new List <float>();
            Designers = new List <object>();
            foreach (var item in foundRows)
            {
                for (int r = RangA; r <= RangB; r++)
                {
                    if ((item.ItemArray[19] is DateTime) && ((DateTime)item.ItemArray[19] >= StartMonth[r - 1]) && ((DateTime)item.ItemArray[19]) < EndMonth[r - 1])
                    {
                        Designers.Add(item.ItemArray[2]);
                    }
                }
            }
            Designers = Designers.Distinct().ToList();//Все уникальные дизайнеры в диапазоне месяцов
            DateTime OvalueInDT, TvalueInDT;
            long     Oint      = 0;
            long     Tint      = 0;
            float    count     = 0;
            float    AllValues = 0;

            foreach (var item in Designers)
            {
                count     = 0;
                AllValues = 0;
                for (int j = RangA; j <= RangB; j++)
                {
                    for (int i = 0; i < foundRows.Length; i++)
                    {
                        if ((foundRows[i].ItemArray[19] is DateTime) && ((DateTime)foundRows[i].ItemArray[19] >= StartMonth[j - 1]) && ((DateTime)foundRows[i].ItemArray[19]) < EndMonth[j - 1] && (foundRows[i].ItemArray[2].ToString() == item.ToString()))
                        {
                            AllValues++;
                            object O = foundRows[i].ItemArray[16];
                            object T = foundRows[i].ItemArray[17];
                            if (O is DateTime)
                            {
                                OvalueInDT = (DateTime)O; Oint = OvalueInDT.ToFileTime();
                            }
                            if (T is DateTime)
                            {
                                TvalueInDT = (DateTime)T; Tint = TvalueInDT.ToFileTime();
                            }
                            long     res   = Tint - Oint;
                            DateTime start = new DateTime(res);
                            if ((res == 0))
                            {
                                count++;
                            }
                            else
                            {
                                var a = start.Day;
                                count += a;
                            }
                        }
                    }
                }
                RESULT.Add(count / AllValues);
                assessment.Add(item.ToString(), count / AllValues);//для наглядности)
            }
        }