/// <summary>
        /// Initializes a new instance of class.
        /// </summary>
        /// <param name="model">Instance we want to display</param>
        public RCInventoryDetailsView(InventoryItemList model, string sItemCategory)
        {
            // Bind our BindingContext
            Model = model;

            NavigationPage.SetHasNavigationBar(this, true);

            InitializeComponent();
            // If a specific Item Category is passed into screen then set as category of item being entered.
            if (sItemCategory != "")
            { Model.ItemCategory = sItemCategory; }
            switch (sItemCategory)
            {
                case App.ItemCategory_MODEL:
                    labelItemType.Text = "Model Type";
                    IEnumerable<ActivityLog> ActivityLogs = App.Database.GetActivityRecs(Model.ID);
                    int iTotalFlightTimeInSeconds = 0;
                    foreach (ActivityLog ALog in ActivityLogs)
                    {
                        if (ALog.ActivityType == "TIME TRACKING REPORT")
                        {
                            iTotalFlightTimeInSeconds += ALog.LogTimeInSeconds;
                        }
                    }
                    labelNoOfFlights.Text = iTotalFlightTimeInSeconds.ToString();
                    lblBatteryNo.IsVisible = false;
                    EntryBatteryNo.IsVisible = false;
                    //
                    lblDefaultTime.IsVisible = true;
                    EntryMinutes.IsVisible = true;
                    lblColon.IsVisible = true;
                    EntrySeconds.IsVisible = true;
                    break;
                case App.ItemCategory_BATTERY:
                    labelItemType.IsVisible = false;
                    entryItemType.IsVisible = false;
                    lblBatteryNo.IsVisible = true;
                    EntryBatteryNo.IsVisible = true;
                    lblDefaultTime.IsVisible = false;
                    EntryMinutes.IsVisible = false;
                    lblColon.IsVisible = false;
                    EntrySeconds.IsVisible = false;
                    break;
            }

            //
            if (Model.PurchaseDate == DateTime.MinValue)
            { DTPicker.Date = DateTime.Now; }
            else { DTPicker.Date = Model.PurchaseDate; }
            //
            // Save Button
            btnSaveSC.Clicked += (sender, e) =>
            {
                //var todoItem = (TodoItem)BindingContext;
                //
                Model.PurchaseDate = DTPicker.Date;
                InventoryItem IIRec = TransferToInventoryItemRec(Model);
                Model.ID = App.Database.SaveItem(IIRec);
                Navigation.PopAsync();
            };
            //
            // Cancel Button
            btnCancelSC.Clicked += (sender, e) =>
            {
                Navigation.PopAsync();
            };
            //
            // Delete Button
            btnDeleteSC.Clicked += (sender, e) =>
            {
                App.Database.DeleteItem(Model.ID);
                Navigation.PopAsync();
            };
            //
            // No of Flights Button
            btnNoOfFlights.Clicked += (sender, e) =>
            {
                // create a new details view with the item
                var view = new ActivityLogListView(Model.ID);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // List Media Button
            btnGallery.Clicked += (sender, e) =>
            {
                Model.PurchaseDate = DTPicker.Date;
                InventoryItem IIRec = TransferToInventoryItemRec(Model);
                Model.ID = App.Database.SaveItem(IIRec);
                // create a new details view with the item
                var view = new MediaListView(Model.ID);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Item Name list
            entryItemType.Focused += (sender, e) =>
            {
                _sCurrentListType = "ITEMTYPE";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Manufacturer list
            btnListManuf.Clicked += (sender, e) =>
            {
                _sCurrentListType = "MANUFACTURER";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            //LoadItemNamePicker();
        }
Beispiel #2
0
        public ActivityLogDetailsView(Model.ActivityLogList model)
        {
            _iBatteryListDisplayedID = 0;
            // Bind our BindingContext
            Model = model;

            NavigationPage.SetHasNavigationBar(this, true);

            InitializeComponent();
            //
            LoadFields();
            //
            // Save Button
            btnSaveSC.Clicked += (sender, e) => {
                // Save the Date/Time value.
                Model.LogDateTime = PickerLogDate.Date;
                Model.LogDateTime = Model.LogDateTime.Add(PickerLogTime.Time);
                if ((EntryMinutes.Text != "") && (EntrySeconds.Text != ""))
                {
                    int iMinutesInSecs = Convert.ToInt32(EntryMinutes.Text) * 60;
                    int iTimeInSecs    = iMinutesInSecs + Convert.ToInt32(EntrySeconds.Text);
                    Model.LogTimeInSeconds = iTimeInSecs;
                }
                ActivityLog ALRec = TransferToActivityLogRec(Model);
                Model.ID = App.Database.SaveActivityLog(ALRec);
                Navigation.PopAsync();
            };
            //
            // Cancel Button
            btnCancelSC.Clicked += (sender, e) => {
                Navigation.PopAsync();
            };
            //
            // Delete Button
            btnDeleteSC.Clicked += (sender, e) => {
                App.Database.DeleteActivityLog(Model.ID);
                Navigation.PopAsync();
            };
            //
            // Display Item Name list
            entryActivityType.Focused += (sender, e) =>
            {
                _sCurrentListType = "ACTIVITYTYPE";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Item Name list
            entryModelName.Focused += (sender, e) =>
            {
                // create a new details view with the item
                var view = new RCModelListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 1 Name list
            entryBattery1Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 1;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 2 Name list
            entryBattery2Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 2;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
        }
        /// <summary>
        /// Initializes a new instance of class.
        /// </summary>
        /// <param name="model">Instance we want to display</param>
        public RCInventoryDetailsView(InventoryItemList model, string sItemCategory)
        {
            // Bind our BindingContext
            Model = model;

            NavigationPage.SetHasNavigationBar(this, true);

            InitializeComponent();
            // If a specific Item Category is passed into screen then set as category of item being entered.
            if (sItemCategory != "")
            {
                Model.ItemCategory = sItemCategory;
            }
            switch (sItemCategory)
            {
            case App.ItemCategory_MODEL:
                labelItemType.Text = "Model Type";
                IEnumerable <ActivityLog> ActivityLogs = App.Database.GetActivityRecs(Model.ID);
                int iTotalFlightTimeInSeconds          = 0;
                foreach (ActivityLog ALog in ActivityLogs)
                {
                    if (ALog.ActivityType == "TIME TRACKING REPORT")
                    {
                        iTotalFlightTimeInSeconds += ALog.LogTimeInSeconds;
                    }
                }
                labelNoOfFlights.Text    = iTotalFlightTimeInSeconds.ToString();
                lblBatteryNo.IsVisible   = false;
                EntryBatteryNo.IsVisible = false;
                //
                lblDefaultTime.IsVisible = true;
                EntryMinutes.IsVisible   = true;
                lblColon.IsVisible       = true;
                EntrySeconds.IsVisible   = true;
                break;

            case App.ItemCategory_BATTERY:
                labelItemType.IsVisible  = false;
                entryItemType.IsVisible  = false;
                lblBatteryNo.IsVisible   = true;
                EntryBatteryNo.IsVisible = true;
                lblDefaultTime.IsVisible = false;
                EntryMinutes.IsVisible   = false;
                lblColon.IsVisible       = false;
                EntrySeconds.IsVisible   = false;
                break;
            }

            //
            if (Model.PurchaseDate == DateTime.MinValue)
            {
                DTPicker.Date = DateTime.Now;
            }
            else
            {
                DTPicker.Date = Model.PurchaseDate;
            }
            //
            // Save Button
            btnSaveSC.Clicked += (sender, e) =>
            {
                //var todoItem = (TodoItem)BindingContext;
                //
                Model.PurchaseDate = DTPicker.Date;
                InventoryItem IIRec = TransferToInventoryItemRec(Model);
                Model.ID = App.Database.SaveItem(IIRec);
                Navigation.PopAsync();
            };
            //
            // Cancel Button
            btnCancelSC.Clicked += (sender, e) =>
            {
                Navigation.PopAsync();
            };
            //
            // Delete Button
            btnDeleteSC.Clicked += (sender, e) =>
            {
                App.Database.DeleteItem(Model.ID);
                Navigation.PopAsync();
            };
            //
            // No of Flights Button
            btnNoOfFlights.Clicked += (sender, e) =>
            {
                // create a new details view with the item
                var view = new ActivityLogListView(Model.ID);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // List Media Button
            btnGallery.Clicked += (sender, e) =>
            {
                Model.PurchaseDate = DTPicker.Date;
                InventoryItem IIRec = TransferToInventoryItemRec(Model);
                Model.ID = App.Database.SaveItem(IIRec);
                // create a new details view with the item
                var view = new MediaListView(Model.ID);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Item Name list
            entryItemType.Focused += (sender, e) =>
            {
                _sCurrentListType = "ITEMTYPE";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Manufacturer list
            btnListManuf.Clicked += (sender, e) =>
            {
                _sCurrentListType = "MANUFACTURER";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            //LoadItemNamePicker();
        }
        public ActivityLogDetailsView(Model.ActivityLogList model)
        {
            _iBatteryListDisplayedID = 0;
            // Bind our BindingContext
            Model = model;

            NavigationPage.SetHasNavigationBar(this, true);

            InitializeComponent();
            //
            LoadFields();
            //
            // Save Button
            btnSaveSC.Clicked += (sender, e) => {
                // Save the Date/Time value.
                Model.LogDateTime = PickerLogDate.Date;
                Model.LogDateTime = Model.LogDateTime.Add(PickerLogTime.Time);
                if ((EntryMinutes.Text != "") && (EntrySeconds.Text != ""))
                {
                    int iMinutesInSecs = Convert.ToInt32(EntryMinutes.Text) * 60;
                    int iTimeInSecs = iMinutesInSecs + Convert.ToInt32(EntrySeconds.Text);
                    Model.LogTimeInSeconds = iTimeInSecs;
                }
                ActivityLog ALRec = TransferToActivityLogRec(Model);
                Model.ID = App.Database.SaveActivityLog(ALRec);
                Navigation.PopAsync();
            };
            //
            // Cancel Button
            btnCancelSC.Clicked += (sender, e) => {
                Navigation.PopAsync();
            };
            //
            // Delete Button
            btnDeleteSC.Clicked += (sender, e) => {
                App.Database.DeleteActivityLog(Model.ID);
                Navigation.PopAsync();
            };
            //
            // Display Item Name list
            entryActivityType.Focused += (sender, e) =>
            {
                _sCurrentListType = "ACTIVITYTYPE";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Item Name list
            entryModelName.Focused += (sender, e) =>
            {
                // create a new details view with the item
                var view = new RCModelListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 1 Name list
            entryBattery1Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 1;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 2 Name list
            entryBattery2Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 2;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
        }