Пример #1
0
        public void ShouldTickNCalc()
        {
            MainModel model = new MainModel();

            model.InjectPath(Directory.GetCurrentDirectory());

            DayInfoRow            today  = model.GetTodayRow();
            ConfigurationSettings config = ConfigurationSettings.GetInstance();

            // set start as now-1hr
            today.Start     = Utils.SecondsToString((int)DateTime.Now.TimeOfDay.TotalSeconds - 3600);
            config.Subtract = false;
            config.Workload = 60;
            model.UpdateRow(today);
            Assert.AreEqual <string>("01:00", model.GetTodayRow().Net);
            Assert.AreEqual <string>("00:00", model.GetTodayRow().Delta);
            Assert.AreEqual <string>("01:00", model.GetTodayRow().Difference);
            config.Subtract          = true;
            config.SubtractCondition = -1;
            config.SubtractQuantity  = 60;
            config.Workload          = 480;
            model.UpdateRow(today);
            Assert.AreEqual <string>("00:00", model.GetTodayRow().Net);
            Assert.AreEqual <string>("-08:00", model.GetTodayRow().Delta);
            Assert.AreEqual <string>("01:00", model.GetTodayRow().Difference);
        }
Пример #2
0
        public void UpdateWorkingHour()
        {
            DayInfoRow data = model.GetTodayRow();

            view.WorkingHours = data;
            view.TrayIcon     = "Today you've worked " + data.Net;
        }
Пример #3
0
        public void ShowComment(DayInfoRow row)
        {
            CommentModel model = new CommentModel();

            model.Comment = row.Comment;
            CommentView      view      = new CommentView();
            CommentPresenter presenter = new CommentPresenter(model, view);

            view.ShowDialog();
            if (model.HasChanged)
            {
                Presenter.GridCommentEntryHasChanged(model.Comment);
            }
        }
Пример #4
0
        public void RequestDateEdit(int index, int column, bool today)
        {
            DateTime date;

            edit = today ? model.GetTodayRow() : model.GetDataSet()[index];
            if (column == 0)
            {
                date           = Utils.StringToTime(edit.Start);
                editStartField = true;
            }
            else
            {
                date           = Utils.StringToTime(edit.End);
                editStartField = false;
            }

            if (edit.Day == model.GetToday().GetDay() && edit.Month.Equals(model.GetToday().GetMonth()) && !editStartField)
            {
                return;
            }

            view.ShowDateInputForm(date);
        }
Пример #5
0
 public void RequestTodayCommentEdit()
 {
     edit = model.GetTodayRow();
     view.ShowComment(edit);
 }
Пример #6
0
 public void RequestCommentEdit(int index)
 {
     edit = model.GetDataSet()[index];
     view.ShowComment(edit);
 }