예제 #1
0
        public EntriesTab(TimeEntry[] e)
        {
            entries = e;
            const int lastMonth = 30;
            var now = DateTime.Now;
            var title = new Label {
                Text = "Your Recent Entries",
                HorizontalOptions = LayoutOptions.Center,
                FontAttributes = FontAttributes.Bold, FontSize = 24
            };
            var entryLabel = new Label ();
            var sb = new StringBuilder ();

            var entryText = new List<string> ();
            for (int i = 0; i < entries.Count(); i++) {
                var s =  string.Format("{0} {1} from: {2} to: {3} {4}",
                    entries [i].Description, entries [i].Code,	entries [i].Start,
                    entries [i].Stop, entries [i].isSynched == 1 ? " Synched" : " Not Synched");
                entryText.Add (s);
            }
            var listview = new ListView {
                RowHeight = 65
            };
            listview.ItemsSource = entryText.ToArray ();;

            Content = new StackLayout {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { title, listview }
            };
        }
예제 #2
0
 public WorkHistory TimeEntryToWorkHistory(TimeEntry e)
 {
     return new WorkHistory {
         Header = e.Description,
         Description = "Code: " + e.Code + "\nElapsed Time: " + String.Format ("{0:g}", e.Stop - e.Start),
         Code = e.Code,
         Job = e.Description
     };
 }
예제 #3
0
 public static int SaveTimeEntry(TimeEntry item)
 {
     return me.db.SaveItem <TimeEntry> (item);
 }
예제 #4
0
 public static void DeleteTimeEntry(TimeEntry item)
 {
     me.db.Delete<TimeEntry> (item);
 }
예제 #5
0
        void onStartClicked(object sender, EventArgs e)
        {
            //check for null boxes
            if (String.IsNullOrEmpty (generalEntry.Text)) {
                var action = DisplayAlert ("Billable Work",
                    "You need some description to start this entry.", "OK");
                return;
            }
            if (this.selectedCodeId < 0) {
                var action = DisplayAlert ("Billable Work",
                    "You need to select a code to start non billable work", "OK");
                return;
            }

            //populate current time entry
            DateTime now = DateTime.Now;
            var activeEntry = TimeManager.GetActiveTimeEntry ();
            if (activeEntry != null) {
                activeEntry.Stop = now;
                TimeManager.SaveTimeEntry (activeEntry);
                //refreshes history
                h.Add (history.TimeEntryToWorkHistory(activeEntry));
            }
            var newEntry = new TimeEntry {
                isBillable = 0,
                device_id = imei,
                Description = generalEntry.Text,
                Code = selectedCodeDescription,
                Start = now,
                Stop = null,
                isSynched = 0
            };

            //start job
            TimeManager.SaveTimeEntry (newEntry);

            //switch buttons
            var masterPage = this.Parent as TabbedPage;
            var bTab = masterPage.Children [0] as BillableTab;
            buttons.btnStop.IsEnabled = bTab.buttons.btnStop.IsEnabled = true;
            buttons.btnStop.BackgroundColor = bTab.buttons.btnStop.BackgroundColor = Color.Red;

            //let current view visible
            currentJobLabel.Text = "Active on:" + newEntry.Description + " " + newEntry.Code;
            currentJobLabel.TextColor = Color.Green;

            bTab.currentJobLabel.Text = "Active on:" + newEntry.Description + " " + newEntry.Code;
            bTab.currentJobLabel.TextColor = Color.Green;

            //start location service
            new Thread (() => Forms.Context.StartService (new Intent (Forms.Context, typeof(StartLocationTimer)))).Start ();
        }
예제 #6
0
		public static void DeleteTimeEntry (TimeEntry item)
		{
			ETCDbRepository.DeleteTimeEntry (item);
		}
예제 #7
0
		public static int SaveTimeEntry (TimeEntry item)
		{
			return ETCDbRepository.SaveTimeEntry (item);
		}