Esempio n. 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);
            layoutInflater = inflater;

            base.OnCreateView (inflater, container, savedInstanceState);

            View rootView = inflater.Inflate (Resource.Layout.DrugInfoFragment, container, false);

            table = rootView.FindViewById<TableLayout> (Resource.Id.difTableLayout);

            user = Common.GetCurrentUser ();

            project = Common.GetProject (user.username);

            infos = Common.GetInfos (user.username);

            List<Drug> allDrugs = Common.GetDrugs (user.username);

            if (project.drugsInWeek > 0) {
                DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;
                int currWeek = dfi.Calendar.GetWeekOfYear (DateTime.Now, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);
                int skip = (currWeek - project.startWeek) % (allDrugs.Count / project.drugsInWeek);

                drugs = (from drug in allDrugs
                         orderby drug.id
                         select drug
                        ).Skip (skip * project.drugsInWeek)
                         .Take (project.drugsInWeek)
                         .ToList<Drug> ();
            } else {
                drugs = allDrugs;
            }

            //			AttendanceResultManager.SetCurrentAttendanceResults (null);

            newAttendanceResults = AttendanceResultManager.GetCurrentAttendanceResults ();

            if ((newAttendanceResults == null) || (newAttendanceResults.Count == 0)) {
                newAttendanceResults = AttendanceResultManager.GenerateResults (infos, drugs, @"N");
            }

            RefreshTable ();

            //			Activity.Window.SetSoftInputMode (SoftInput.StateAlwaysHidden);

            return rootView;
        }
Esempio n. 2
0
        public static bool SetProject(string username, Project project)
        {
            string storeLocation = Path.Combine(DatabaseFileDir, username, @"project.xml");
            new FileInfo(storeLocation).Directory.Create();
            var serializer = new XmlSerializer(typeof(Project));
            using (var writer = new StreamWriter(storeLocation))
            {
                serializer.Serialize(writer, project);
            }

            return true;
        }