Esempio n. 1
0
        public void populateListView()
        {
            List <string> listItemsFac = new List <string>();
            List <string> listItemsDim = new List <string>();
            List <string> listItemsFun = new List <string>();
            DataSet       dimensions   = DimensionHandler.getDimensions(Application.Current.Resources["ProjectPrefix"].ToString());
            DataSet       facts        = FactHandler.getFacts(Application.Current.Resources["ProjectPrefix"].ToString());
            DataSet       functions    = FunctionHandler.getFunctions(Application.Current.Resources["ProjectPrefix"].ToString());

            foreach (DataRow row in dimensions.Tables["result"].Rows)
            {
                listItemsDim.Add(row[0].ToString());
            }
            foreach (DataRow row in facts.Tables["result"].Rows)
            {
                listItemsFac.Add(row[0].ToString());
            }
            foreach (DataRow row in functions.Tables["result"].Rows)
            {
                listItemsFun.Add(row[0].ToString());
            }

            listViewFacts.ItemsSource = listItemsFac;
            listViewDim.ItemsSource   = listItemsDim;
            listViewFun.ItemsSource   = listItemsFun;
        }
Esempio n. 2
0
        private void SetButtonFacts()
        {
            DataSet testowy = FactHandler.getFacts(Application.Current.Resources["ProjectPrefix"].ToString());

            foreach (DataRow row in testowy.Tables["result"].Rows)
            {
                Button c = new Button();
                c.Content = row[0].ToString();
                c.Click  += EditFact_Click;
                this.FactsContainer.Children.Add(c);
            }
        }
 public void SetUp()
 {
     target            = new FactHandler();
     _mapperMock       = new Mock <IFactMapper>();
     _loggerMock       = new Mock <ILogger>();
     _writerMock       = new Mock <IMapWriter>();
     _readerMock       = new Mock <IFactReader>();
     target.FactReader = _readerMock.Object;
     target.MapWriter  = _writerMock.Object;
     target.Log        = _loggerMock.Object;
     target.FactMapper = _mapperMock.Object;
 }
Esempio n. 4
0
        private void fillUpdateFields(string tableName)
        {
            DataSet testowy = FactHandler.getFactColumns(tableName);
            int     i       = 0;

            foreach (DataRow row in testowy.Tables["result"].Rows)
            {
                AddColumnBar();
                ColumnList[i].TxtColumnName.Text = row[0].ToString();
                ColumnList[i].TxtColumnType.Text = row[1].ToString() + "(" + row[2].ToString() + ")";
                i++;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Method itry to drop and create table
        /// </summary>
        /// <param name="prefix">Project prefix</param>
        /// <param name="tableName">Table name</param>
        /// <param name="tableType">New columns types</param>
        /// <param name="columns">New table columns</param>
        /// <param name="drop">If true table with the same name will be drop</param>
        private static string tryCreateTable(string prefix, string tableName, string tableType, string columns, bool drop)
        {
            if (tableName != "" && tableType != "" && columns != "")
            {
                Result result;

                if (tableType == "DIMENSION")
                {
                    if (drop == true)
                    {
                        DimensionHandler.dropDimension(prefix, tableName);
                    }
                    result = DimensionHandler.addDimension(tableName, columns, prefix);
                    if (result.errormsg != "OK")
                    {
                        return("Import status: Cannot create table. Please check if old table contains foreign keys or if all required inforamtion are correct.");
                    }
                    return("OK");
                }
                else
                {
                    if (drop == true)
                    {
                        FactHandler.dropFact(prefix, tableName);
                    }
                    result = FactHandler.addFact(tableName, columns, prefix);
                    if (result.errormsg != "OK")
                    {
                        return("Import status: Cannot create table. Please check if old table exists or contains foreign keys or if all required inforamtion are correct.");
                    }
                    return("OK");
                }
                if (tableType == "FUNCTION")
                {
                    if (drop == true)
                    {
                        FunctionHandler.dropFunction(prefix + "_" + tableType + "_" + tableName);
                    }
                    result = FunctionHandler.addFunction(tableName, columns, prefix);
                    if (result.errormsg != "OK")
                    {
                        return("Import status: Cannot create table. Please check if old table exists or contains foreign keys or if all required inforamtion are correct.");
                    }
                    return("OK");
                }
            }
            return("Import status: Please check if csv contains all required information - table type, table name and columns name with types");
        }
Esempio n. 6
0
        private bool CreateNewFact()
        {
            if (updating)
            {
                FactHandler.dropFact(Application.Current.Resources["ProjectPrefix"].ToString(), TxtTableName.Text.ToString().ToUpper());
            }

            string tmpStr     = "";
            bool   allFill    = true;
            bool   onlyNumber = true;

            foreach (ColumnBar2 tmp in ColumnList)
            {
                if (tmp.TxtColumnName.Text.ToString() == "" || tmp.TxtColumnType.Text.ToString() == "")
                {
                    allFill = false;
                }

                if (!(tmp.TxtColumnType.Text.ToString().Contains("number") || tmp.TxtColumnType.Text.ToString().Contains("number")))
                {
                    onlyNumber = false;
                }

                tmpStr = tmpStr + tmp.TxtColumnName.Text.ToString() + " " + tmp.TxtColumnType.Text.ToString() + " " + tmp.TxtColumnCons.Text.ToString() + ",";
            }

            tmpStr = tmpStr.Remove(tmpStr.Length - 1);

            if (TxtTableName.Text.ToString() == "")
            {
                allFill = false;
            }
            if (allFill && onlyNumber)
            {
                Result wynik = new Result();
                wynik = FactHandler.addFact(TxtTableName.Text, tmpStr, Application.Current.Resources["ProjectPrefix"].ToString());
                if (wynik.errormsg != "OK")
                {
                    textBlockError.Text = wynik.errormsg;
                }
                else
                {
                    DataSet testowy = FactHandler.getFacts(Application.Current.Resources["ProjectPrefix"].ToString());
                    Console.WriteLine(testowy.Tables["result"].ToString());
                    return(true);
                }
            }
            else
            {
                if (!allFill)
                {
                    MessageBox.Show("Fill all Textbox!!!");
                }
                if (!onlyNumber)
                {
                    MessageBox.Show("Column types can only be of type number");
                }
            }


            return(false);
        }
 public void SetUp()
 {
     target = new FactHandler();
     _mapperMock = new Mock<IFactMapper>();
     _loggerMock = new Mock<ILogger>();
     _writerMock = new Mock<IMapWriter>();
     _readerMock = new Mock<IFactReader>();
     target.FactReader = _readerMock.Object;
     target.MapWriter = _writerMock.Object;
     target.Log = _loggerMock.Object;
     target.FactMapper = _mapperMock.Object;
 }