Example #1
0
 public DeleteTuple(string tableName, String tc, DataComparator c, String data)
 {
     TableName  = tableName;
     Tc         = tc;
     Data       = data;
     comparator = c;
 }
Example #2
0
 public SelectAll(String table, DataComparator compare, String condiC, String value)
 {
     Table   = table;
     Compare = compare;
     CondiC  = condiC;
     Value   = value;
 }
Example #3
0
        public void Update(String tableName, String tc, String data, DataComparator compare, String conditionData, String columnCondition)
        {
            TableColumn t  = Tables.Find(table => table.GetTableName().Equals(tableName)).GetListTableColumn().Find(column => column.GetColumnName().Equals(tc));
            TableColumn t2 = Tables.Find(table => table.GetTableName().Equals(tableName)).GetListTableColumn().Find(column => column.GetColumnName().Equals(columnCondition));

            Tables.Find(table => table.GetTableName().Equals(tableName)).Update(t, data, compare, conditionData, t2);
        }
Example #4
0
 public Select(String table, List <String> selectedC, DataComparator compare, String condiC, String value)
 {
     Table     = table;
     SelectedC = selectedC;
     Compare   = compare;
     CondiC    = condiC;
     Value     = value;
 }
Example #5
0
 public Update(string table, string tc, string data, DataComparator compare, string conditionData, string columnCondition)
 {
     this.Table           = table;
     this.Tc              = tc;
     this.Data            = data;
     this.Compare         = compare;
     this.ConditionData   = conditionData;
     this.ColumnCondition = columnCondition;
 }
Example #6
0
        public void Update(TableColumn tc, String data, DataComparator compare, String conditionData, TableColumn columnCondition)
        {
            String tcT = columnCondition.GetTypeC();

            if (tcT != "Text")
            {
                if (compare == DataComparator.Equal)
                {
                    for (int i = 0; i < columnCondition.GetList().Count; i++)
                    {
                        if (columnCondition.GetList()[i].Equals(conditionData))
                        {
                            TableColumn tcE = Columns.Find(c => c.GetColumnName().Equals(tc.GetColumnName()));
                            tcE.GetList()[i] = data;
                        }
                    }
                }
                if (compare == DataComparator.Bigger)
                {
                    for (int i = 0; i < columnCondition.GetList().Count; i++)
                    {
                        if (double.Parse(columnCondition.GetList()[i]) > double.Parse(conditionData))
                        {
                            TableColumn tcE = Columns.Find(c => c.GetColumnName().Equals(tc.GetColumnName()));
                            tcE.GetList()[i] = data;
                        }
                    }
                }
                if (compare == DataComparator.Less)
                {
                    for (int i = 0; i < columnCondition.GetList().Count; i++)
                    {
                        if (double.Parse(columnCondition.GetList()[i]) < double.Parse(conditionData))
                        {
                            TableColumn tcE = Columns.Find(c => c.GetColumnName().Equals(tc.GetColumnName()));
                            tcE.GetList()[i] = data;
                        }
                    }
                }
            }
            else
            {
                if (compare == DataComparator.Equal)
                {
                    for (int i = 0; i < columnCondition.GetList().Count; i++)
                    {
                        if (columnCondition.GetList()[i].Equals(conditionData))
                        {
                            TableColumn tcE = Columns.Find(c => c.GetColumnName().Equals(tc.GetColumnName()));
                            tcE.GetList()[i] = data;
                        }
                    }
                }
            }
        }
Example #7
0
        private void UpdateDataWindow_Initialized(object sender, EventArgs e)
        {
            const String link      = @"https://bdu.fstec.ru/files/documents/thrlist.xlsx";
            var          webClient = new WebClient();

            webClient.DownloadFile(new Uri(link), "thrlist.xlsx");
            MainWindow.FilePath = "thrlist.xlsx";

            try
            {
                var result = DataComparator
                             .Compare(MainWindow.Data, new ObservableCollection <Data>(Parser.EnumerateFullData(MainWindow.FilePath)));
                var comparisonPage = new ComparisonPage(result);
                UpdateDataWindowFrame.Navigate(comparisonPage);
            }
            catch (Exception exception)
            {
                var badComparisonPage = new BadComparisonPage(exception.Message);
                UpdateDataWindowFrame.Navigate(badComparisonPage);
            }
        }
Example #8
0
        //solo una condiciĆ³n en el select()
        public List <List <String> > Select(List <String> selectedC, DataComparator compare, TableColumn condiC, String value)
        {
            List <List <String> > allSelected = new List <List <String> >();
            String dateT = condiC.GetTypeC();

            for (int i = 0; i < selectedC.Count; i++)
            {
                allSelected.Add(new List <string>());
            }
            for (int i = 0; i < condiC.GetList().Count; i++)
            {
                //SE puede crear una lista donde se guarden los idnices que cumplan la condicion
                if (compare == DataComparator.Equal)
                {
                    if (condiC.GetList()[i] == value)
                    {
                        for (int j = 0; j < selectedC.Count; j++)
                        {
                            TableColumn t = Columns.Find(column => column.GetColumnName().Equals(selectedC[j]));
                            allSelected[j].Add(t.GetList()[i]);
                        }
                    }
                }
                else if (compare == DataComparator.Bigger)
                {
                    if (dateT.Equals("Int"))
                    {
                        if (double.Parse(condiC.GetList()[i]) > double.Parse(value))
                        {
                            for (int j = 0; j < selectedC.Count; j++)
                            {
                                TableColumn t = Columns.Find(column => column.GetColumnName().Equals(selectedC[j]));
                                allSelected[j].Add(t.GetList()[i]);
                            }
                        }
                    }
                    else if (dateT.Equals("Double"))
                    {
                        if (double.Parse(condiC.GetList()[i]) > double.Parse(value))
                        {
                            for (int j = 0; j < selectedC.Count; j++)
                            {
                                TableColumn t = Columns.Find(column => column.GetColumnName().Equals(selectedC[j]));
                                allSelected[j].Add(t.GetList()[i]);
                            }
                        }
                    }
                }
                else //"Less"
                {
                    if (dateT.Equals("Int"))
                    {
                        if (double.Parse(condiC.GetList()[i]) < double.Parse(value))
                        {
                            for (int j = 0; j < selectedC.Count; j++)
                            {
                                TableColumn t = Columns.Find(column => column.GetColumnName().Equals(selectedC[j]));
                                allSelected[j].Add(t.GetList()[i]);
                            }
                        }
                    }
                    else if (dateT.Equals("Double"))
                    {
                        if (double.Parse(condiC.GetList()[i]) < double.Parse(value))
                        {
                            for (int j = 0; j < selectedC.Count; j++)
                            {
                                TableColumn t = Columns.Find(column => column.GetColumnName().Equals(selectedC[j]));
                                allSelected[j].Add(t.GetList()[i]);
                            }
                        }
                    }
                }
            }
            if (allSelected[0].Count == 0)
            {
                allSelected.Clear();
            }
            return(allSelected);
        }
Example #9
0
        public void DeleteTupleWithC(TableColumn tc, String data, DataComparator compare)
        {
            String tcT = tc.GetTypeC();

            if (tcT != "Text")
            {
                if (compare == DataComparator.Equal)
                {
                    for (int i = 0; i < tc.GetList().Count; i++)
                    {
                        if (tc.GetList()[i].Equals(data))
                        {
                            for (int j = 0; j < Columns.Count(); j++)
                            {
                                Columns[j].GetList().RemoveAt(i);
                            }
                            i--;
                        }
                    }
                }
                if (compare == DataComparator.Bigger)
                {
                    for (int i = 0; i < tc.GetList().Count; i++)
                    {
                        if (double.Parse(tc.GetList()[i]) > double.Parse(data))
                        {
                            for (int j = 0; j < Columns.Count(); j++)
                            {
                                Columns[j].GetList().RemoveAt(i);
                            }
                            i--;
                        }
                    }
                }
                if (compare == DataComparator.Less)
                {
                    for (int i = 0; i < tc.GetList().Count; i++)
                    {
                        if (double.Parse(tc.GetList()[i]) < double.Parse(data))
                        {
                            for (int j = 0; j < Columns.Count(); j++)
                            {
                                Columns[j].GetList().RemoveAt(i);
                            }
                            i--;
                        }
                    }
                }
            }
            else
            {
                if (compare == DataComparator.Equal)
                {
                    for (int i = 0; i < tc.GetList().Count; i++)
                    {
                        if (tc.GetList()[i].Equals(data))
                        {
                            for (int j = 0; j < Columns.Count(); j++)
                            {
                                Columns[j].GetList().RemoveAt(i);
                            }
                            i--;
                        }
                    }
                }
            }
        }
Example #10
0
        public List <List <String> > SelectAll(DataComparator compare, TableColumn condiC, String value)//aqui solo se manda la condicion
        {
            List <List <String> > allSelected = new List <List <String> >();
            String dateT = condiC.GetTypeC();


            for (int i = 0; i < Columns.Count; i++)
            {
                allSelected.Add(new List <string>());
            }

            for (int i = 0; i < condiC.GetList().Count; i++)
            {
                //SE puede crear una lista donde se guarden los indices que cumplan la condicion
                if (compare == DataComparator.Equal)
                {
                    if (condiC.GetList()[i] == value)
                    {
                        for (int j = 0; j < Columns.Count; j++)
                        {
                            allSelected[j].Add(Columns[j].GetList()[i]);
                        }
                    }
                }

                else if (compare == DataComparator.Bigger)
                {
                    if (dateT.Equals("Int"))
                    {
                        if (int.Parse(condiC.GetList()[i]) > int.Parse(value))
                        {
                            for (int j = 0; j < Columns.Count; j++)
                            {
                                allSelected[j].Add(Columns[j].GetList()[i]);
                            }
                        }
                    }
                    else if (dateT.Equals("Double"))
                    {
                        if (double.Parse(condiC.GetList()[i]) > double.Parse(value))
                        {
                            for (int j = 0; j < Columns.Count; j++)
                            {
                                allSelected[j].Add(Columns[j].GetList()[i]);
                            }
                        }
                    }
                }
                else     //"Less"
                {
                    if (dateT.Equals("Int"))
                    {
                        if (int.Parse(condiC.GetList()[i]) < int.Parse(value))
                        {
                            for (int j = 0; j < Columns.Count; j++)
                            {
                                allSelected[j].Add(Columns[j].GetList()[i]);
                            }
                        }
                    }
                    else if (dateT.Equals("Double"))
                    {
                        if (double.Parse(condiC.GetList()[i]) < double.Parse(value))
                        {
                            for (int j = 0; j < Columns.Count; j++)
                            {
                                allSelected[j].Add(Columns[j].GetList()[i]);
                            }
                        }
                    }
                }
            }

            if (allSelected[0].Count == 0)
            {
                allSelected.Clear();
            }

            return(allSelected);
        }
Example #11
0
        public void Delete(string tableName, String tc, DataComparator c, String data)
        {
            TableColumn t = Tables.Find(table => table.GetTableName().Equals(tableName)).GetListTableColumn().Find(column => column.GetColumnName().Equals(tc));

            Tables.Find(table => table.GetTableName().Equals(tableName)).DeleteTupleWithC(t, data, c);
        }
Example #12
0
        public List <List <String> > SelectAll(string tableName, DataComparator compare, String condiC, String value)
        {
            TableColumn t = Tables.Find(table => table.GetTableName().Equals(tableName)).GetListTableColumn().Find(column => column.GetColumnName().Equals(condiC));

            return(Tables.Find(table => table.GetTableName().Equals(tableName)).SelectAll(compare, t, value));
        }