Пример #1
0
        public DataTable buildProperWantsList(string sListId)
        {
            try
            {
                var doc = MKMInteract.RequestHelper.getWantsListByID(sListId);

                var xmlReader = new XmlNodeReader(doc);

                var ds = new DataSet();

                ds.ReadXml(xmlReader);

                if (!ds.Tables.Contains("item"))
                {
                    return(new DataTable());
                }

                DataTable eS = MKMHelpers.ReadSQLiteToDt("expansions");

                var dv = MKMHelpers.JoinDataTables(dt, eS,
                                                   (row1, row2) => row1.Field <string>("Expansion ID") == row2.Field <string>("idExpansion"));

                dv = MKMHelpers.JoinDataTables(dv, ds.Tables["item"],
                                               (row1, row2) => row1.Field <string>("idProduct") == row2.Field <string>("idProduct"));

                return(dv);
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.ToString());
                return(new DataTable());
            }
        }
Пример #2
0
        public StockView()
        {
            InitializeComponent();

            try
            {
                eS = MKMHelpers.ReadSQLiteToDt("expansions");

                stockGridView.ReadOnly = true;
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.ToString());
            }

            try
            {
                var doc = MKMInteract.RequestHelper.readStock();

                var xmlReader = new XmlNodeReader(doc);

                var ds = new DataSet();

                ds.ReadXml(xmlReader);

                var dj = MKMHelpers.JoinDataTables(ds.Tables[0], dt,
                                                   (row1, row2) => row1.Field <string>("idProduct") == row2.Field <string>("idProduct"));

                dj = MKMHelpers.JoinDataTables(dj, eS,
                                               (row1, row2) => row1.Field <string>("Expansion ID") == row2.Field <string>("idExpansion"));

                dj.Columns.Remove("article_Id");
                dj.Columns.Remove("Date Added");
                dj.Columns.Remove("Category ID");
                dj.Columns.Remove("Category");
                dj.Columns.Remove("Metacard ID");
                dj.Columns.Remove("idArticle");
                dj.Columns.Remove("idProduct");
                dj.Columns.Remove("Expansion ID");
                dj.Columns.Remove("idExpansion");

                dj.Columns[dj.Columns.IndexOf("Name")].SetOrdinal(0);

                stockGridView.DataSource = dj;
                //dataGridView1.DataSource = dt;
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.ToString());
            }
        }
Пример #3
0
        public StockView()
        {
            InitializeComponent();

            try
            {
                eS = MKMHelpers.ReadSQLiteToDt("expansions");

                stockGridView.ReadOnly = true;
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.ToString());
            }

            try
            {
                int     start    = 1;
                var     articles = new DataTable();
                Boolean first    = true;
                while (true)
                {
                    var doc       = MKMInteract.RequestHelper.readStock(start);
                    var xmlReader = new XmlNodeReader(doc);
                    var ds        = new DataSet();
                    ds.ReadXml(xmlReader);
                    var articleTable = ds.Tables[0];
                    var elementCount = articleTable.Rows.Count;
                    if (first)
                    {
                        articles = articleTable;
                        first    = false;
                    }
                    else
                    {
                        foreach (DataRow dr in articleTable.Rows)
                        {
                            dr["article_Id"] = articles.Rows.Count;
                            articles.ImportRow(dr);
                        }
                    }
                    if (elementCount != 100)
                    {
                        break;
                    }
                    start += elementCount;
                }

                var dj = MKMHelpers.JoinDataTables(articles, dt,
                                                   (row1, row2) => row1.Field <string>("idProduct") == row2.Field <string>("idProduct"));

                dj = MKMHelpers.JoinDataTables(dj, eS,
                                               (row1, row2) => row1.Field <string>("Expansion ID") == row2.Field <string>("idExpansion"));

                dj.Columns.Remove("article_Id");
                dj.Columns.Remove("Date Added");
                dj.Columns.Remove("Category ID");
                dj.Columns.Remove("Category");
                dj.Columns.Remove("Metacard ID");
                dj.Columns.Remove("idArticle");
                dj.Columns.Remove("idProduct");
                dj.Columns.Remove("Expansion ID");
                dj.Columns.Remove("idExpansion");

                dj.Columns[dj.Columns.IndexOf("Name")].SetOrdinal(0);

                stockGridView.DataSource = dj;
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.ToString());
            }
        }