Ejemplo n.º 1
0
        public Admin()
        {


            var versionstring = "100";

            version = double.Parse(versionstring);
            dc = new AlsiTMDataContext();
            mac = Utilities.GetMacAddress().First();
            CreateNewUserIfNotExist();
            UserID = dc.tblUsers.Where(z => z.USER_MACADRESS == mac).Select(z => z.ID).First();
            UserList = dc.tblUsers.ToList();
            var user = dc.tblUsers.Where(z => z.USER_MACADRESS == mac).First();
            if (GetNewVersionNumber(user) > version)
            {
                var u = new UpdateForm("https://www.dropbox.com/s/rcnhl5eab7f2ywp/WebNotify.zip");
                u.ShowDialog();
            }

            var log = new tblLog
            {
                LOG_TS = DateTime.UtcNow.AddHours(2),
                LOG_USER_ID = user.ID,
                LOG_VERSION = version.ToString(),
            };
            dc.tblLogs.InsertOnSubmit(log);
            dc.SubmitChanges();
        }
        private void userListView_DoubleClick(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            
            if(userListView.SelectedItems.Count==0)return;
            var user = (tblUser)userListView.SelectedItems[0].Tag;
            var dc = new AlsiTMDataContext();
            var dbu = dc.tblUsers.Where(z => z.USER_MACADRESS == user.USER_MACADRESS).First();
            dbu.USER_ADMIN = !dbu.USER_ADMIN;
            dc.SubmitChanges();

            PopulateListView();
            Cursor = Cursors.Default;
        }