Exemplo 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();
        }
Exemplo n.º 2
0
        private bool CheckISAdmin()
        {
            if (Loaded) return _IsAdmin;
            else
                Loaded = true;
            dc = new AlsiTMDataContext();

            _IsAdmin = dc.tblUsers.Any(z => z.USER_MACADRESS == AlsiUtils.Utilities.GetMacAddress().First() && z.USER_ADMIN == true);
            return _IsAdmin;
        }
        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;
        }
 public ChangeUserNameForm(Admin admin)
 {
     InitializeComponent();
     dc = new AlsiTMDataContext();
     _admin = admin;
 }
Exemplo n.º 5
0
 public Table<tblUser> GetAllUsers()
 {
     dc = new AlsiTMDataContext();
     return dc.tblUsers;
 }