public void fillNumbers(c_DataUpdateObject obj)
        {
            int i = 0;

            foreach (DictionaryEntry v in obj.Get())
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = $"{i++}".PadLeft(2, '0');
                lvi.SubItems.Add(v.Key.ToString().Substring(v.Key.ToString().IndexOf("_") + 1));
                lvi.SubItems.Add(v.Value.ToString());
                lvi.BackColor = i % 2 == 0 ? Color.WhiteSmoke : Color.LightYellow;
                lv_UpdateNumbers.Items.Add(lvi);
            }

            foreach (ListViewItem lvi in lv_UpdateNumbers.Items)
            {
                if (lvi.SubItems[1].Text.ToLower().Contains("image") && _l is null)
                {
                    _l = lvi;
                    continue;
                }

                if (lvi.SubItems[1].Text.ToLower().Contains("files") && _l2 is null)
                {
                    _l2 = lvi;
                    continue;
                }
            }
        }
Beispiel #2
0
        public c_DataUpdateObject checkUpdate()
        {
            c_DataUpdateObject d        = new c_DataUpdateObject();
            string             username = _dbh.getUserName();

            username = "******";
            string data = "";

            if (username != null)
            {
                data = createConnection("http://wpss.atoldavid.hu/api/check_update.php", $"username={username}");
            }


            if (data != "")
            {
                var jr = JObject.Parse(data)["Count of outdated data"].Children();
                d.Name = "Updatable Data Count";
                foreach (JToken v in jr)
                {
                    d.Add(v.Path.Split('.').Last(), v.First.ToString());
                }
            }

            return(d);
        }
Beispiel #3
0
        public dataObject getUpdate()
        {
            dataObject dObj = new dataObject();

            string username = _dbh.getUserName();

            username = "******";
            string data = "";

            if (username != null)
            {
                data = createConnection("http://wpss.atoldavid.hu/api/get_data.php", $"username={username}");
            }

            if (data != "")
            {
                //TODO:::FIX DIS BS
                var obj = JObject.Parse(data)["Data to update:"].Children();

                foreach (JToken v in obj)
                {
                    var o = v.First;
                    c_DataUpdateObject d = new c_DataUpdateObject();
                    d.Name = o.First().First().ToString();
                    foreach (var vv in o.Children())
                    {
                        d.Add(vv.Path.Split('.').Last(), vv.First().ToString());
                    }
                    dObj.Add(d);
                }
            }

            return(dObj);
        }
Beispiel #4
0
        public void openUpdateScreen(c_DataUpdateObject obj = null)
        {
            f_DatabaseUpdater du = new f_DatabaseUpdater(obj)
            {
                _dbh = _dbh
            };

            du.ShowDialog();
        }
        public f_DatabaseUpdater(c_DataUpdateObject obj = null)
        {
            InitializeComponent();

            if (obj != null)
            {
                fillNumbers(obj);
            }

            Load += DataUpdate_Load;
        }
Beispiel #6
0
        private void btn_Menu_Data_CheckUpdates_Click(object sender, EventArgs e)
        {
            c_DataUpdateObject v  = uh.checkUpdate();
            Hashtable          vv = v.Get();
            int i = 0;

            foreach (DictionaryEntry vvv in vv)
            {
                if (int.TryParse(vvv.Value.ToString(), out int ii))
                {
                    i += ii;
                }
            }

            if (i > 0)
            {
                openUpdateScreen(v);
            }
        }