Ejemplo n.º 1
0
        private async Task<Database> GetDatabase()
        {
            if (_database == null)
            {
                _database = new Database(new SQLitePlatformWP8(),
                    Path.Combine(Path.Combine(ApplicationData.Current.LocalFolder.Path, "todo.sqlite")));
                await _database.Initialize();
            }

            return _database;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            picker = new ScanditSDK.SIBarcodePicker (appKey);
            picker.OverlayController.DidScanBarcode += (object sender, SIOverlayControllerDidScanEventArgs e) => {
                picker.StopScanning ();
                ProcessBarcode (convertToNumber(e.Barcode ["barcode"].ToString ().ToUpper()));
            };
            picker.OverlayController.DidManualSearch += (object sender, SIOverlayControllerDidManualSearchEventArgs e) => {
                ProcessBarcode (convertToNumber(e.Text.ToUpper()));
            };
            picker.OverlayController.ShowSearchBar (true);
            picker.OverlayController.SetSearchBarKeyboardType (UIKeyboardType.ASCIICapable);
            picker.OverlayController.setSearchBarActionButtonCaption ("Search");
            View.AddSubview (picker.View);

            Shared.Database db = new Shared.Database();
            db.Initialize();
            int campusID = db.getCampusID();

            classPicker = new UIPickerView ();
            List<Area> Classes = dl.getSecureAreas (campusID).ToList();
            classPicker.Model = new Shared.ClassPickerViewModel (Classes);
            View.AddSubview (classPicker);

            eventPicker = new UIPickerView ();
            List<Event> Events = dl.getUpcomingEvents (campusID).ToList ();
            eventPicker.Model = new Shared.EventPickerViewModel (Events);
            View.AddSubview (eventPicker);

            checkInOut = new UISegmentedControl ();
            checkInOut.InsertSegment ("Check IN", 0, true);
            checkInOut.InsertSegment ("Check OUT", 1, true);
            checkInOut.SelectedSegment = 0;
            View.AddSubview (checkInOut);

            note = new UILabel ();
            note.Text = "Select the class and event you are checking kids INTO or OUT of:";
            View.AddSubview (note);

            picker.StartScanning ();
            ConfigureSizing ();
        }
Ejemplo n.º 3
0
        public void Parse(string path, AssemblyDefinition assembly, string id, bool fullParse)
        {
            if (m_database == null)
                m_database = new Database(m_path, "ParseAssembly-" + Path.GetFileNameWithoutExtension(m_path));

            //	Console.WriteLine("    parsing {0} for thread {1}", assembly.Name.FullName, System.Threading.Thread.CurrentThread.ManagedThreadId);
            var namespaces = new HashSet<string>();
            foreach (ModuleDefinition module in assembly.Modules)
            {
                foreach (TypeDefinition type in module.Types)
                {
                    if (fullParse || type.IsPublic)
                    {
                        if (!namespaces.Contains(type.Namespace))
                            namespaces.Add(type.Namespace);

                        DoParseType(type, id, fullParse);			// max time here is 0.8 secs on a fast machine for type System.Xml.Serialization.XmlSerializationReader (with the old schema)
            //						System.Threading.Thread.Sleep(50);	// this doesn't seem to help the main thread too much
                    }
                }
            }

            DoAddNamespaces(namespaces, id);
        }
Ejemplo n.º 4
0
        private void DoParseAssemblies(string path)
        {
            m_database = new Database(path, "Populate-" + Path.GetFileNameWithoutExtension(path));
            DoCreateTables();

            while (true)
            {
                try
                {
                    DoDeleteAssemblies();
                    DoDeleteShadowAssemblies();

                    var files = new List<string>();
                    lock (m_lock)
                    {
                        while (m_files.Count == 0 && m_running)
                        {
            //	Console.WriteLine("thread {0} is blocking", Thread.CurrentThread.ManagedThreadId);
                            Log.WriteLine(TraceLevel.Info, "ObjectModel", "waiting");
                            Unused.Value = Monitor.Wait(m_lock);
                        }

                        if (!m_running)
                            break;

                        files.AddRange(m_files);
                        m_files.Clear();
                    }

                    bool added = false;
                    foreach (string file in files)
                    {
                        if (!file.Contains(".app/") && !file.Contains("/.svn") && !file.Contains("ShadowCopyCache/") && !m_blackList.Contains(file))
                        {
                            if (DoAddAssembly(file))
                                added = true;
                        }
                    }

                    if (added)
                        DoCheckAssemblyVersions();
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine("{0}", e);
                    throw;			// TODO: trapping the exception ties up lots of cpu as the thread tries to redo the op
                }
            }
            //	Console.WriteLine("thread {0} is exiting", Thread.CurrentThread.ManagedThreadId);

            Log.WriteLine(TraceLevel.Verbose, "ObjectModel", "exiting thread for {0}", m_path);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            string imgurl = "http://41.185.30.19/Indemnities/" + MarriedRelationshipID.ToString () + ".jpg";
            //if(RemoteFileExists(imgurl) == false) {
                // Put alternative content/message here
                btnSaveIndemnity.SetTitle ("Snap Indemnity", UIControlState.Normal);
                btnSaveIndemnity.SetTitleColor (UIColor.Red, UIControlState.Normal);
            //}
            //else
            //{
            //	// Put Internet Required Code here
            //	btnSaveIndemnity.SetTitle ("View Indemnity", UIControlState.Normal);
            //	btnSaveIndemnity.SetTitleColor (UIColor.Green, UIControlState.Normal);
            //}

            if (MarriedRelationshipID == 0) {
                DataLayer dl = new DataLayer ();
                dl.Sync ();
                MarriedRelationshipID = dl.createMarriedRelationship (0, 0);
            }

            btnSpouse1Detail.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                PersonViewController pdvc = parent.Storyboard.InstantiateViewController("PersonViewController") as PersonViewController;
                pdvc.PersonID = Spouse1ID;
                parent.PushViewController(pdvc,true);
            };

            btnSpouse2Detail.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                PersonViewController pdvc = parent.Storyboard.InstantiateViewController("PersonViewController") as PersonViewController;
                pdvc.PersonID = Spouse2ID;
                parent.PushViewController(pdvc,true);
            };

            btnChild1Detail.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                pdvc.PersonID = Child1ID;
                parent.PushViewController(pdvc,true);
            };

            btnChild2Detail.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                pdvc.PersonID = Child2ID;
                parent.PushViewController(pdvc,true);
            };

            btnChild3Detail.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                pdvc.PersonID = Child3ID;
                parent.PushViewController(pdvc,true);
            };

            btnChild4Detail.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                pdvc.PersonID = Child4ID;
                parent.PushViewController(pdvc,true);
            };

            btnChild5Detail.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;
                ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                pdvc.PersonID = Child5ID;
                parent.PushViewController(pdvc,true);
            };

            btnSpouse1.TouchUpInside += (object sender, EventArgs e) => {
                if (Spouse1ID == 0)
                {
                    UINavigationController parent = this.NavigationController;
                    PersonViewController pdvc = parent.Storyboard.InstantiateViewController("PersonViewController") as PersonViewController;
                    pdvc.PersonID = 0;
                    pdvc.MarriedRelionshipID = MarriedRelationshipID;
                    pdvc.Relationship = 1;
                    parent.PushViewController(pdvc,true);
                }
                else
                {
                    if (Spouse2ID == 0)
                    {
                        DataLayer db = new DataLayer();
                        db.deleteSpouse1(MarriedRelationshipID);
                        this.Title = "Add Household";
                        loadHousehold();
                    }
                    else
                    {
                        UIAlertView alert = new UIAlertView("Can't delete","Delete the second spouse before deleting the first",null,"OK",null);
                        alert.Show();
                    }

                }
            };

            btnSpouse2.TouchUpInside += (object sender, EventArgs e) => {
                if (Spouse2ID == 0)
                {
                    UINavigationController parent = this.NavigationController;
                    PersonViewController pdvc = parent.Storyboard.InstantiateViewController("PersonViewController") as PersonViewController;
                    pdvc.PersonID = 0;
                    pdvc.MarriedRelionshipID = MarriedRelationshipID;
                    pdvc.Relationship = 2;
                    parent.PushViewController(pdvc,true);
                }
                else
                {
                    DataLayer db = new DataLayer();
                    db.deleteSpouse2(MarriedRelationshipID);
                    loadHousehold();
                }
            };

            btnChild1.TouchUpInside += (object sender, EventArgs e) => {
                if (Child1ID == 0)
                {
                    UINavigationController parent = this.NavigationController;
                    ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                    pdvc.PersonID = 0;
                    pdvc.MarriedRelionshipID = MarriedRelationshipID;
                    pdvc.Relationship = 3;
                    parent.PushViewController(pdvc,true);
                }
                else
                {
                    DataLayer db = new DataLayer();
                    db.deleteChild(MarriedRelationshipID, Child1ID);
                    loadHousehold();
                }
            };

            btnChild2.TouchUpInside += (object sender, EventArgs e) => {
                if (Child2ID == 0)
                {
                    UINavigationController parent = this.NavigationController;
                    ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                    pdvc.PersonID = 0;
                    pdvc.MarriedRelionshipID = MarriedRelationshipID;
                    pdvc.Relationship = 4;
                    parent.PushViewController(pdvc,true);
                }
                else
                {
                    DataLayer db = new DataLayer();
                    db.deleteChild(MarriedRelationshipID, Child2ID);
                    loadHousehold();
                }
            };

            btnChild3.TouchUpInside += (object sender, EventArgs e) => {
                if (Child3ID == 0)
                {
                    UINavigationController parent = this.NavigationController;
                    ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                    pdvc.PersonID = 0;
                    pdvc.MarriedRelionshipID = MarriedRelationshipID;
                    pdvc.Relationship = 5;
                    parent.PushViewController(pdvc,true);
                }
                else
                {
                    DataLayer db = new DataLayer();
                    db.deleteChild(MarriedRelationshipID, Child3ID);
                    loadHousehold();
                }
            };

            btnChild4.TouchUpInside += (object sender, EventArgs e) => {
                if (Child4ID == 0)
                {
                    UINavigationController parent = this.NavigationController;
                    ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                    pdvc.PersonID = 0;
                    pdvc.MarriedRelionshipID = MarriedRelationshipID;
                    pdvc.Relationship = 6;
                    parent.PushViewController(pdvc,true);
                }
                else
                {
                    DataLayer db = new DataLayer();
                    db.deleteChild(MarriedRelationshipID, Child4ID);
                    loadHousehold();
                }
            };

            btnChild5.TouchUpInside += (object sender, EventArgs e) => {
                if (Child5ID == 0)
                {
                    UINavigationController parent = this.NavigationController;
                    ChildViewController pdvc = parent.Storyboard.InstantiateViewController("ChildViewController") as ChildViewController;
                    pdvc.PersonID = 0;
                    pdvc.MarriedRelionshipID = MarriedRelationshipID;
                    pdvc.Relationship = 7;
                    parent.PushViewController(pdvc,true);
                }
                else
                {
                    DataLayer db = new DataLayer();
                    db.deleteChild(MarriedRelationshipID, Child5ID);
                    loadHousehold();
                }
            };

            btnCheck1.TouchUpInside += (object sender, EventArgs e) => {
                if (Child1Selected == false)
                {
                    btnCheck1.SetImage (UIImage.FromFile ("1040-checkmark-selected.png"), UIControlState.Normal);
                    Child1Selected = true;
                }
                else
                {
                    btnCheck1.SetImage (UIImage.FromFile ("1040-checkmark.png"), UIControlState.Normal);
                    Child1Selected = false;
                }
            };

            btnCheck2.TouchUpInside += (object sender, EventArgs e) => {
                if (Child2Selected == false)
                {
                    btnCheck2.SetImage (UIImage.FromFile ("1040-checkmark-selected.png"), UIControlState.Normal);
                    Child2Selected = true;
                }
                else
                {
                    btnCheck2.SetImage (UIImage.FromFile ("1040-checkmark.png"), UIControlState.Normal);
                    Child2Selected = false;
                }
            };

            btnCheck3.TouchUpInside += (object sender, EventArgs e) => {
                if (Child3Selected == false)
                {
                    btnCheck3.SetImage (UIImage.FromFile ("1040-checkmark-selected.png"), UIControlState.Normal);
                    Child3Selected = true;
                }
                else
                {
                    btnCheck3.SetImage (UIImage.FromFile ("1040-checkmark.png"), UIControlState.Normal);
                    Child3Selected = false;
                }
            };

            btnCheck4.TouchUpInside += (object sender, EventArgs e) => {
                if (Child4Selected == false)
                {
                    btnCheck4.SetImage (UIImage.FromFile ("1040-checkmark-selected.png"), UIControlState.Normal);
                    Child4Selected = true;
                }
                else
                {
                    btnCheck4.SetImage (UIImage.FromFile ("1040-checkmark.png"), UIControlState.Normal);
                    Child4Selected = false;
                }
            };

            btnCheck5.TouchUpInside += (object sender, EventArgs e) => {
                if (Child5Selected == false)
                {
                    btnCheck5.SetImage (UIImage.FromFile ("1040-checkmark-selected.png"), UIControlState.Normal);
                    Child5Selected = true;
                }
                else
                {
                    btnCheck5.SetImage (UIImage.FromFile ("1040-checkmark.png"), UIControlState.Normal);
                    Child5Selected = false;
                }
            };

            btnPrint.TouchUpInside += (object sender, EventArgs e) => {
                Kidz.PrintService.Linc printService = new Kidz.PrintService.Linc();
                Database db = new Database();
                db.Initialize();
                int parentLabelId = 0;
                string printer = db.getPrinter();
                try
                {
                    Shared.Person parent1 = dl.getPerson(Spouse1ID);
                    PrintService.Person parent1New = new Kidz.PrintService.Person();
                    parent1New.CampusID = parent1.CampusID;
                    parent1New.Comments = parent1.Comments;
                    parent1New.DoB = parent1.DoB;
                    parent1New.EMail = parent1.EMail;
                    parent1New.FirstName = parent1.FirstName;
                    parent1New.Gender = parent1.Gender;
                    parent1New.ID = parent1.ID;
                    parent1New.IsTemporary = parent1.IsTemporary;
                    parent1New.LastName = parent1.LastName;
                    parent1New.Mobile = parent1.Mobile;
                    parentLabelId = parent1.ID;

                    Shared.Person parent2;
                    try {
                        parent2 = dl.getPerson(Spouse2ID);
                    }
                    catch
                    {
                        parent2 = new Shared.Person();
                    }
                    PrintService.Person parent2New = new Kidz.PrintService.Person();
                    parent2New.CampusID = parent2.CampusID;
                    parent2New.Comments = parent2.Comments;
                    parent2New.DoB = parent2.DoB;
                    parent2New.EMail = parent2.EMail;
                    parent2New.FirstName = parent2.FirstName;
                    parent2New.Gender = parent2.Gender;
                    parent2New.ID = parent2.ID;
                    parent2New.IsTemporary = parent2.IsTemporary;
                    parent2New.LastName = parent2.LastName;
                    parent2New.Mobile = parent2.Mobile;

                    printService.PrintParentLabel_New(parent1New, parent2New, printer);
                }
                catch {}

                if (Child1Selected)
                {
                    try
                    {
                        Shared.Person child1 = dl.getPerson(Child1ID);
                        Kidz.PrintService.Person childNew = new Kidz.PrintService.Person();
                        childNew.CampusID = child1.CampusID;
                        childNew.Comments = child1.Comments;
                        childNew.DoB = child1.DoB;
                        childNew.EMail = child1.EMail;
                        childNew.FirstName = child1.FirstName;
                        childNew.Gender = child1.Gender;
                        childNew.ID = child1.ID;
                        childNew.IsTemporary = child1.IsTemporary;
                        childNew.LastName = child1.LastName;
                        childNew.Mobile = child1.Mobile;
                        childNew.Grade = child1.Grade;
                        childNew.MarriedRelationshipID = parentLabelId;

                        printService.PrintChildLabel_New(childNew, printer);

                        DateTime kidBDay = child1.DoB;
                        kidBDay = new DateTime(DateTime.Now.Year, kidBDay.Month, kidBDay.Day);
                        if (DateTime.Now > kidBDay.AddDays(-3) && DateTime.Now < kidBDay.AddDays(3))
                        {
                            try
                            {
                                printService.PrintBirthdayLabel_New(childNew, printer);
                            }
                            catch {}
                        }
                    }
                    catch {}
                }

                if (Child2Selected)
                {
                    try
                    {
                        Shared.Person child2 = dl.getPerson(Child2ID);
                        Kidz.PrintService.Person childNew = new Kidz.PrintService.Person();
                        childNew.CampusID = child2.CampusID;
                        childNew.Comments = child2.Comments;
                        childNew.DoB = child2.DoB;
                        childNew.EMail = child2.EMail;
                        childNew.FirstName = child2.FirstName;
                        childNew.Gender = child2.Gender;
                        childNew.ID = child2.ID;
                        childNew.IsTemporary = child2.IsTemporary;
                        childNew.LastName = child2.LastName;
                        childNew.Mobile = child2.Mobile;
                        childNew.Grade = child2.Grade;
                        childNew.MarriedRelationshipID = parentLabelId;

                        printService.PrintChildLabel_New(childNew, printer);

                        DateTime kidBDay = child2.DoB;
                        kidBDay = new DateTime(DateTime.Now.Year, kidBDay.Month, kidBDay.Day);
                        if (DateTime.Now > kidBDay.AddDays(-3) && DateTime.Now < kidBDay.AddDays(3))
                        {
                            try
                            {
                                printService.PrintBirthdayLabel_New(childNew, printer);
                            }
                            catch {}
                        }
                    }
                    catch {}
                }

                if (Child3Selected)
                {
                    try
                    {
                        Shared.Person child3 = dl.getPerson(Child3ID);
                        Kidz.PrintService.Person childNew = new Kidz.PrintService.Person();
                        childNew.CampusID = child3.CampusID;
                        childNew.Comments = child3.Comments;
                        childNew.DoB = child3.DoB;
                        childNew.EMail = child3.EMail;
                        childNew.FirstName = child3.FirstName;
                        childNew.Gender = child3.Gender;
                        childNew.ID = child3.ID;
                        childNew.IsTemporary = child3.IsTemporary;
                        childNew.LastName = child3.LastName;
                        childNew.Mobile = child3.Mobile;
                        childNew.Grade = child3.Grade;
                        childNew.MarriedRelationshipID = parentLabelId;

                        printService.PrintChildLabel_New(childNew, printer);

                        DateTime kidBDay = child3.DoB;
                        kidBDay = new DateTime(DateTime.Now.Year, kidBDay.Month, kidBDay.Day);
                        if (DateTime.Now > kidBDay.AddDays(-3) && DateTime.Now < kidBDay.AddDays(3))
                        {
                            try
                            {
                                printService.PrintBirthdayLabel_New(childNew, printer);
                            }
                            catch {}
                        }
                    }
                    catch {}
                }

                if (Child4Selected)
                {
                    try
                    {
                        Shared.Person child4 = dl.getPerson(Child4ID);
                        Kidz.PrintService.Person childNew = new Kidz.PrintService.Person();
                        childNew.CampusID = child4.CampusID;
                        childNew.Comments = child4.Comments;
                        childNew.DoB = child4.DoB;
                        childNew.EMail = child4.EMail;
                        childNew.FirstName = child4.FirstName;
                        childNew.Gender = child4.Gender;
                        childNew.ID = child4.ID;
                        childNew.IsTemporary = child4.IsTemporary;
                        childNew.LastName = child4.LastName;
                        childNew.Mobile = child4.Mobile;
                        childNew.Grade = child4.Grade;
                        childNew.MarriedRelationshipID = parentLabelId;

                        printService.PrintChildLabel_New(childNew, printer);

                        DateTime kidBDay = child4.DoB;
                        kidBDay = new DateTime(DateTime.Now.Year, kidBDay.Month, kidBDay.Day);
                        if (DateTime.Now > kidBDay.AddDays(-3) && DateTime.Now < kidBDay.AddDays(3))
                        {
                            try
                            {
                                printService.PrintBirthdayLabel_New(childNew, printer);
                            }
                            catch {}
                        }
                    }
                    catch {}
                }

                if (Child5Selected)
                {
                    try
                    {
                        Shared.Person child5 = dl.getPerson(Child5ID);
                        Kidz.PrintService.Person childNew = new Kidz.PrintService.Person();
                        childNew.CampusID = child5.CampusID;
                        childNew.Comments = child5.Comments;
                        childNew.DoB = child5.DoB;
                        childNew.EMail = child5.EMail;
                        childNew.FirstName = child5.FirstName;
                        childNew.Gender = child5.Gender;
                        childNew.ID = child5.ID;
                        childNew.IsTemporary = child5.IsTemporary;
                        childNew.LastName = child5.LastName;
                        childNew.Mobile = child5.Mobile;
                        childNew.Grade = child5.Grade;
                        childNew.MarriedRelationshipID = parentLabelId;

                        printService.PrintChildLabel_New(childNew, printer);

                        DateTime kidBDay = child5.DoB;
                        kidBDay = new DateTime(DateTime.Now.Year, kidBDay.Month, kidBDay.Day);
                        if (DateTime.Now > kidBDay.AddDays(-3) && DateTime.Now < kidBDay.AddDays(3))
                        {
                            try
                            {
                                printService.PrintBirthdayLabel_New(childNew, printer);
                            }
                            catch {}
                        }
                    }
                    catch {}
                }

                UIAlertView alert = new UIAlertView("Labels", "Barcoded labels have been sent to '" + printer + "'",null,"OK",null);
                alert.Show();
            };

            btnSaveIndemnity.TouchUpInside += (object sender, EventArgs e) => {
                UINavigationController parent = this.NavigationController;

                if (btnSaveIndemnity.TitleLabel.Text == "Snap Indemnity")
                {
                    UIImagePickerController picker = new UIImagePickerController();
                    picker.SourceType = UIImagePickerControllerSourceType.Camera;
                    picker.FinishedPickingMedia += (object senderPic, UIImagePickerMediaPickedEventArgs ePic) => {

                        // Create a new WebClient instance.
                        WebClient myWebClient = new WebClient();

                        var documentsDirectory = Environment.GetFolderPath
                            (Environment.SpecialFolder.Personal);
                        string jpgFilename = System.IO.Path.Combine (documentsDirectory, MarriedRelationshipID.ToString() + ".jpg"); // hardcoded filename, overwritten each time
                        NSData imgData = ePic.OriginalImage.AsJPEG();
                        NSError err = null;
                        if (imgData.Save(jpgFilename, false, out err)) {
                            Console.WriteLine("saved as " + jpgFilename);

                            // Upload the file to the URI.
                            // The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method.
                            var url = "http://41.185.30.19/fileupload.aspx";
                            Uri uri = new Uri (url);

                            myWebClient.UploadFile (uri, jpgFilename);
                            //byte[] responseArray = myWebClient.UploadFile("http://41.185.30.157/fileupload.aspx",jpgFilename);
                        } else {
                            Console.WriteLine("NOT saved as " + jpgFilename + " because" + err.LocalizedDescription);
                        }

                        picker.DismissViewController(true, null);
                    };
                    parent.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
                    parent.PresentViewController(picker, true, null);
                }
                else {
                    ImageViewController pdvc = parent.Storyboard.InstantiateViewController("ImageViewController") as ImageViewController;
                    pdvc.MarriedRelationshipID = MarriedRelationshipID;
                    parent.PushViewController(pdvc,true);
                }
            };
        }
        void loadHouseholds()
        {
            Database db = new Database ();
            DataLayer dl = new DataLayer ();
            LoadingOverlay loadingOverlay = new LoadingOverlay (View.Bounds);
            db.Initialize ();
            dl.Sync ();
            int campusID = db.getCampusID ();
            households = dl.getHouseholds(campusID);

            searchBar.Text = "";
            tblHouseholds.Source = new HouseholdTableSource(households,"", this);
            tblHouseholds.ReloadData();
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear (animated);

            Shared.Database db = new Shared.Database();
            db.Initialize();
            int campusID = db.getCampusID();

            Events = dl.getUpcomingEvents (campusID);
            int x = 0;
            foreach (Event myevent in Events) {
                if (x > segEvent.NumberOfSegments - 1) {
                    segEvent.InsertSegment("",x, true);
                }
                segEvent.SetTitle (myevent.ID.ToString() + ": " + myevent.StartDate.ToString ("HH:mm"), x);
                x += 1;

            }
            loadKids ();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Shared.Database db = new Shared.Database();
            db.Initialize();
            int campusID = db.getCampusID();

            Events = dl.getUpcomingEvents (campusID);
            int x = 0;
            foreach (Event myevent in Events) {
                if (x > segEvent.NumberOfSegments - 1) {
                    segEvent.InsertSegment("",x, true);
                }
                segEvent.SetTitle (myevent.ID.ToString() + ": " + myevent.StartDate.ToString ("HH:mm"), x);
                x += 1;

            }

            loadKids ();

            segStatus.ValueChanged += (object sender, EventArgs e) => {
                loadKids();
            };

            segEvent.ValueChanged += (object sender, EventArgs e) => {
                loadKids();
            };

            //			btnSync.TouchUpInside += (object sender, EventArgs e) => {
            //				dl.loadingOverlay = new LoadingOverlay(View.Bounds);
            //				View.AddSubview(dl.loadingOverlay);
            //				dl.Sync();
            //			};
        }
Ejemplo n.º 9
0
 public void Opened()
 {
     string path = Populate.GetDatabasePath(m_boss);
     m_database = new Database(path, "ObjectModel-" + Path.GetFileNameWithoutExtension(path));
 }
Ejemplo n.º 10
0
 public TargetDatabase(Database database)
 {
     m_database = database;
 }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear (animated);

            Shared.Database db = new Shared.Database();
            db.Initialize();
            int campusID = db.getCampusID();

            List<Area> Classes = dl.getSecureAreas (campusID).ToList();
            classPicker.Model = new Shared.ClassPickerViewModel (Classes);

            List<Event> Events = dl.getUpcomingEvents (campusID).ToList ();
            eventPicker.Model = new Shared.EventPickerViewModel (Events);

            ConfigureSizing ();
            if (picker.IsScanning == false) {
                picker.StartScanning ();
            }
        }
        private void ProcessBarcode(string text)
        {
            try
            {
                Shared.Database db = new Shared.Database();
                db.Initialize();

                int campusID = db.getCampusID();
                List<Area> classes = dl.getSecureAreas(campusID).ToList();
                List<Event> events = dl.getUpcomingEvents(campusID).ToList();

                int row = classPicker.SelectedRowInComponent (0);
                int rowEvent = eventPicker.SelectedRowInComponent(0);
                int InOUT = checkInOut.SelectedSegment;

                if (text.Length == 6) {
                    Person parent = dl.getPerson(Convert.ToInt32(text.Substring(1)));
                    List<Person> children = dl.getChildren(parent.ID).ToList();
                    string message = "";
                    UIActionSheet action = new UIActionSheet("Which child would you like to check in/out");
                    foreach (Person child in children)
                    {
                        action.AddButton(child.ID.ToString() + ":" + child.FirstName);
                    }
                    action.AddButton("Cancel");
                    action.CancelButtonIndex = action.ButtonCount - 1;
                    action.Clicked += (object sender, UIButtonEventArgs e) => {
                        string val = action.ButtonTitle(e.ButtonIndex);
                        if (val.IndexOf(":") > 0)
                        {
                            int personid = Convert.ToInt32(val.Substring(0, val.IndexOf(":")));
                            Person child = dl.getPerson (personid);
                            dl.checkinToSecureArea(personid, classes [row].ID, events[rowEvent].ID, InOUT);
                            bool boVal = (InOUT == 0 ? true : false);
                            UIAlertView alert = new UIAlertView ("Checkin", child.LastName + ", " + child.FirstName + " has been checked " + (boVal ? "INTO " + classes [row].Description : "OUT"), null, "OK", null);
                            alert.Clicked += (object senderAlert, UIButtonEventArgs eAlert) => {
                                picker.StartScanning();
                            };
                            alert.Canceled += (object senderCancelled, EventArgs eCancelled) => {
                                picker.StartScanning();
                            };
                            alert.Show ();
                        }
                        else
                        {
                            picker.StartScanning();
                        }
                    };
                    action.Canceled += (object sender, EventArgs e) => {
                        picker.StartScanning();
                    };
                    action.ShowInView(View);
                } else {
                    Person child = dl.getPerson (Convert.ToInt32 (text));
                    dl.checkinToSecureArea(child.ID, classes [row].ID, events[rowEvent].ID, InOUT);
                    dl.loadingOverlay = new LoadingOverlay(View.Bounds);
                    View.AddSubview(dl.loadingOverlay);
                    dl.Sync();
                    bool val = (InOUT == 0 ? true : false);
                    UIAlertView alert = new UIAlertView ("Checkin", child.LastName + ", " + child.FirstName + " has been checked " + (val ? "INTO " + classes [row].Description : "OUT"), null, "OK", null);
                    alert.Clicked += (object sender, UIButtonEventArgs e) => {
                        picker.StartScanning();
                    };
                    alert.Canceled += (object sender, EventArgs e) => {
                        picker.StartScanning();
                    };
                    alert.Show ();
                }
            }
            catch {
                UIAlertView alert = new UIAlertView ("Error", "Unrecognizable barcode", null, "OK", null);
                alert.Show ();
                picker.StartScanning ();
            }
        }