示例#1
0
        public void addnoteInDb(Jasper.PopUpUserControl.onCreateNote res, string name)
        {
            userDB = new DbDataContext(DbDataContext.DBConnectionString);
            var userInDB = from NoteText _user in userDB.notetext select _user;

            notetext = new ObservableCollection <NoteText>(userInDB);

            var dbData = notetext.ToList();

            string _t = JsonConvert.SerializeObject(dbData);

            System.Diagnostics.Debug.WriteLine(_t);

            NoteText newUser = new NoteText
            {
                NoteId = res.Id,
                Name   = name
            };

            try
            {
                NotifyPropertyChanging("notetext");
                notetext.Add(newUser);
                userDB.notetext.InsertOnSubmit(newUser);
                userDB.SubmitChanges();
                NotifyPropertyChanged("notetext");
                System.Diagnostics.Debug.WriteLine("Added note in notetext database");
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
            }
        }
示例#2
0
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     userDB = new DbDataContext(DbDataContext.DBConnectionString);
     // Set the data context of the listbox control to the sample data
     DataContext = App.ViewModel;
 }
示例#3
0
        public string returnEmailofUser()
        {
            userDB = new DbDataContext(DbDataContext.DBConnectionString);
            var userInDB = from userData _user in userDB.userdata select _user;

            userdata = new ObservableCollection <userData>(userInDB);
            return(userdata[0].email);
        }
示例#4
0
        public List <userData> getAllUser()
        {
            userDB = new DbDataContext(DbDataContext.DBConnectionString);
            var userInDB1 = from userData _user in userDB.userdata select _user;

            userdata = new ObservableCollection <userData>(userInDB1);
            List <userData> n = new List <userData>(userdata);

            return(n);
        }
示例#5
0
        public List <NoteText> getAllNotes()
        {
            userDB = new DbDataContext(DbDataContext.DBConnectionString);
            var userInDB = from NoteText _user in userDB.notetext select _user;

            notetext = new ObservableCollection <NoteText>(userInDB);
            List <NoteText> n = new List <NoteText>(notetext);

            return(n);
        }
示例#6
0
        public int getNoteId(string name)
        {
            userDB = new DbDataContext(DbDataContext.DBConnectionString);
            var userInDB = from NoteText _user in userDB.notetext select _user;

            notetext = new ObservableCollection <NoteText>(userInDB);

            foreach (NoteText n in notetext)
            {
                if (n.Name == name)
                {
                    return(n.NoteId);
                }
            }
            return(-1);
        }
示例#7
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();


            //Console.WriteLine("Success");

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            using (DbDataContext db = new DbDataContext(DbDataContext.DBConnectionString))
            {
                if (db.DatabaseExists() == false)
                {
                    db.CreateDatabase();
                }
            }
        }
示例#8
0
 public dbServices()
 {
     userDB = new DbDataContext(DbDataContext.DBConnectionString);
 }