コード例 #1
0
        public void LoadActivityLogs()
        {
            //AddActivityLogRecs();
            ActivityLogsLV.Clear();

            IEnumerable<ActivityLog> ALogs = App.Database.GetAllActivities();

            foreach (var ALog in ALogs)
            {
                ActivityLogList ALList = new ActivityLogList();
                ALList.ID = ALog.ID;
                ALList.ItemID = ALog.ItemID;
                ALList.ActivityType = ALog.ActivityType;
                if (ALList.ItemID != 0)
                {
                    InventoryItem ItemRec = App.Database.GetItemRec(ALog.ItemID);
                    // Load Model Name by looking up the ItemID in the InventoryItem table.
                    ALList.ModelName = ItemRec.ItemName;
                }
                else
                {
                    ALList.ModelName = null;
                }
                ALList.LogDateTime = ALog.LogDateTime;
                ALList.LogTimeInSeconds = ALog.LogTimeInSeconds;
                ALList.Location = ALog.Location;
                ALList.LogNotes = ALog.LogNotes;
                ALList.Battery1ItemID = ALog.Battery1ItemID;
                // Load 1st Battery Name by looking up the ItemID in the InventoryItem table.
                if (ALog.Battery1ItemID != 0)
                {
                    InventoryItem Battery1Rec = App.Database.GetItemRec(ALog.Battery1ItemID);
                    if (Battery1Rec != null)
                    { ALList.Battery1Name = Battery1Rec.ItemName; }
                }
                ALList.Battery2ItemID = ALog.Battery2ItemID;
                // Load 2nd Battery Name by looking up the ItemID in the InventoryItem table.
                if (ALog.Battery2ItemID != 0)
                {
                    InventoryItem Battery2Rec = App.Database.GetItemRec(ALog.Battery2ItemID);
                    if (Battery2Rec != null)
                    { ALList.Battery2Name = Battery2Rec.ItemName; }
                }
                //
                ActivityLogsLV.Add(ALList);
            }

        }
コード例 #2
0
        public ActivityLogListView(int ItemID)
        {
            _ItemID = ItemID;
            InitializeComponent();

            vm = new ActivityLogListViewModel();
            BindingContext = vm;

            // Load the Activity Log report into ListView class.
            vm.LoadActivityLogs();

            ToolbarItem tbi = null;
            if (Device.OS == TargetPlatform.iOS)
            {
                tbi = new ToolbarItem("+", null, () => {
                    var ALogRec = new ActivityLogList();
                    // create a new details view with the item
                    var view = new ActivityLogDetailsView(ALogRec);
                    // tell the navigator to show the new view
                    Navigation.PushAsync(view);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.Android)
            { // BUG: Android doesn't support the icon being null
                tbi = new ToolbarItem("+", "plus", () =>
                {
                    var ALogRec = new ActivityLogList();
                    // create a new details view with the item
                    var view = new ActivityLogDetailsView(ALogRec);
                    // tell the navigator to show the new view
                    Navigation.PushAsync(view);
                }, 0, 0);
            }
            //
            ToolbarItems.Add(tbi);
            //
            lblNoOfItems.Text = "No. of Activities: " + vm.ActivityLogsLV.Count.ToString();
        }
コード例 #3
0
 private ActivityLog TransferToActivityLogRec(ActivityLogList ALList)
 {
     ActivityLog ALogRec = new ActivityLog();
     //
     ALogRec.ID = ALList.ID;
     ALogRec.ActivityType = ALList.ActivityType;
     ALogRec.ItemID = ALList.ItemID;
     ALogRec.LogDateTime = ALList.LogDateTime;
     ALogRec.LogTimeInSeconds = ALList.LogTimeInSeconds;
     ALogRec.Location = ALList.Location;
     ALogRec.LogNotes = ALList.LogNotes;
     ALogRec.Battery1ItemID = ALList.Battery1ItemID;
     ALogRec.Battery2ItemID = ALList.Battery2ItemID;
     //
     return ALogRec;
 }