Ejemplo n.º 1
0
        public void Add(TimeLog timeLog)
        {
            string dataRow = $"{timeLog.Date}{_delimeter}{timeLog.LastName}{_delimeter}" +
                             $"{timeLog.WrokingHours}{_delimeter}{timeLog.Comment}\n";

            File.AppendAllText(_path, dataRow);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets all working times from database.
        /// </summary>
        /// <returns>The list of TimeLog objects from db</returns>
        public List <TimeLog> GetAllWorkingTimes()
        {
            List <TimeLog> loglist = new List <TimeLog>();
            SqlConnection  sqlconn = new SqlConnection(connString);

            using (sqlconn)
            {
                SqlCommand command = new SqlCommand(
                    "SELECT * FROM dbo.Logs",
                    sqlconn);
                sqlconn.Open();

                SqlDataReader reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        TimeLog tl = new TimeLog();
                        tl.id      = Convert.ToInt32(reader["LogID"]);
                        tl.Project = reader["Project"].ToString();
                        tl.Comment = reader["Comment"].ToString();
                        tl.Date    = reader["Date"].ToString();
                        tl.Time    = Convert.ToInt32(reader["Time"]);
                        loglist.Add(tl);
                    }
                }
                reader.Close();
                sqlconn.Close();
                return(loglist);
            }
        }
Ejemplo n.º 3
0
        private static void AddExampleData(ApiContext context)
        {
            var testProject1 = new Project
            {
                Id   = 1,
                Name = "e-conomic Interview"
            };
            var testProject2 = new Project
            {
                Id   = 2,
                Name = "Secret project"
            };

            context.Projects.Add(testProject1);
            context.Projects.Add(testProject2);

            var testTimeLog1 = new TimeLog {
                TimeSpent = 2.5,
                Date      = DateTime.Now,
                ProjectId = testProject1.Id
            };
            var testTimeLog2 = new TimeLog {
                TimeSpent = 5.23,
                Date      = DateTime.Now,
                ProjectId = testProject1.Id
            };

            context.TimeLogs.Add(testTimeLog1);
            context.TimeLogs.Add(testTimeLog2);

            context.SaveChanges();
        }
Ejemplo n.º 4
0
        public void TrackTime_ChiefEmployee_ShouldReturnTrue()
        {
            // arrange
            var expectedLastName = "TestUser";

            UserSessions.Sessions.Add(expectedLastName);

            var timeLog = new TimeLog
            {
                Date      = DateTime.Now,
                WorkHours = 1,
                LastName  = expectedLastName,
                Comment   = Guid.NewGuid().ToString()
            };

            _timesheetRepositoryMock
            .Setup(x => x.Add(timeLog));

            _employeeRepositoryMock
            .Setup(x => x.GetEmployee(expectedLastName))
            .Returns(() => new ChiefEmployee(expectedLastName, 0m, 0m))
            .Verifiable();

            // act
            var result = _service.TrackTime(timeLog, expectedLastName);

            // assert
            _employeeRepositoryMock.VerifyAll();
            _timesheetRepositoryMock.Verify(x => x.Add(timeLog), Times.Once);
            Assert.IsTrue(result);
        }
Ejemplo n.º 5
0
        public List <TimeLog> GetAll()
        {
            List <TimeLog> result = new List <TimeLog>();

            FileStream   fs = new FileStream(this.filePath, FileMode.OpenOrCreate);
            StreamReader sr = new StreamReader(fs);

            try
            {
                while (!sr.EndOfStream)
                {
                    TimeLog tl = new TimeLog();
                    tl.Id             = Convert.ToInt32(sr.ReadLine());
                    tl.TaskId         = Convert.ToInt32(sr.ReadLine());
                    tl.UserId         = Convert.ToInt32(sr.ReadLine());
                    tl.HoursWork      = Convert.ToInt32(sr.ReadLine());
                    tl.DateOfCreation = Convert.ToDateTime(sr.ReadLine());
                    result.Add(tl);
                }
            }
            finally
            {
                sr.Close();
                fs.Close();
            }

            return(result);
        }
        public async Task <IActionResult> Edit(int id, [Bind("TimeLogID,Username,ActivityID,StartTime,EndTime")] TimeLog timeLog)
        {
            if (id != timeLog.TimeLogID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(timeLog);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TimeLogExists(timeLog.TimeLogID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["ActivityID"] = new SelectList(_context.Activities.Where(o => o.Username == User.Identity.Name), "ActivityID", "Username", timeLog.ActivityID);
            return(View(timeLog));
        }
Ejemplo n.º 7
0
        private int GetNextId()
        {
            FileStream   fs = new FileStream(this.filePath, FileMode.OpenOrCreate);
            StreamReader sr = new StreamReader(fs);

            int id = 1;

            try
            {
                while (!sr.EndOfStream)
                {
                    TimeLog tl = new TimeLog();
                    tl.Id             = Convert.ToInt32(sr.ReadLine());
                    tl.TaskId         = Convert.ToInt32(sr.ReadLine());
                    tl.UserId         = Convert.ToInt32(sr.ReadLine());
                    tl.HoursWork      = Convert.ToInt32(sr.ReadLine());
                    tl.DateOfCreation = Convert.ToDateTime(sr.ReadLine());

                    if (id <= tl.Id)
                    {
                        id = tl.Id + 1;
                    }
                }
            }
            finally
            {
                sr.Close();
                fs.Close();
            }

            return(id);
        }
Ejemplo n.º 8
0
        [TestCase("Сидоров", 1000, 281000)] // ставка за час = 1000; 1000 * 281
        public void GetEmployeeReport_ShouldReturnReportPerSeveralMonth(string expectedLastName, decimal salary, decimal expectedTotal)
        {
            //arrange
            var timesheetRepositoryMock = new Mock <ITimesheetRepository>();
            var employeeRepositoryMock  = new Mock <IEmployeeRepository>();

            var expectedTotalHours = 281m;

            employeeRepositoryMock
            .Setup(x => x.GetEmployee(It.Is <string>(x => x == expectedLastName)))
            .Returns(() => new StaffEmployee
            {
                LastName = expectedLastName,
                Salary   = salary
            })
            .Verifiable();

            timesheetRepositoryMock
            .Setup(x => x.GetTimeLogs(It.Is <string>(x => x == expectedLastName)))
            .Returns(() =>
            {
                TimeLog[] timeLogs = new TimeLog[35];
                DateTime dateTime  = new DateTime(2020, 11, 1);
                timeLogs[0]        = new TimeLog
                {
                    LastName     = expectedLastName,
                    Comment      = Guid.NewGuid().ToString(),
                    Date         = dateTime,
                    WorkingHours = 9
                };
                for (int i = 1; i < timeLogs.Length; i++)
                {
                    dateTime    = dateTime.AddDays(1);
                    timeLogs[i] = new TimeLog
                    {
                        LastName     = expectedLastName,
                        Comment      = Guid.NewGuid().ToString(),
                        Date         = dateTime,
                        WorkingHours = 8
                    };
                }
                return(timeLogs);
            })
            .Verifiable();

            var service = new ReportService(timesheetRepositoryMock.Object, employeeRepositoryMock.Object);
            //act
            var result = service.GetEmployeeReport(expectedLastName);

            //assert

            Assert.IsNotNull(result);

            Assert.AreEqual(expectedLastName, result.LastName);
            Assert.IsNotNull(result.TimeLogs);
            Assert.IsNotEmpty(result.TimeLogs);

            Assert.AreEqual(expectedTotal, result.Bill);
            Assert.AreEqual(expectedTotalHours, result.TotalHours);
        }
Ejemplo n.º 9
0
        public void TrackTime_Freelancer_ShouldReturnFalse()
        {
            // arrange
            var expectedLastName = "TestUser";

            UserSessions.Sessions.Add(expectedLastName);

            var timeLog = new TimeLog
            {
                Date      = DateTime.Now.AddDays(-3),
                WorkHours = 2,
                LastName  = expectedLastName,
                Comment   = Guid.NewGuid().ToString()
            };

            _employeeRepositoryMock
            .Setup(x => x.GetEmployee(expectedLastName))
            .Returns(() => new FreelancerEmployee(expectedLastName, 0m))
            .Verifiable();

            // act
            var result = _service.TrackTime(timeLog, expectedLastName);

            // assert
            Assert.IsFalse(result);

            _employeeRepositoryMock.VerifyAll();
            _timesheetRepositoryMock.Verify(x => x.Add(timeLog), Times.Never);
        }
Ejemplo n.º 10
0
        public void TrackTime_ShouldReturnTrue()
        {
            //arrange
            var expectedLastName = "TestUser";

            UserSessions.Sessions.Add(expectedLastName);

            var timeLog = new TimeLog
            {
                Date         = new DateTime(),
                WorkingHours = 1,
                LastName     = expectedLastName,
                Comment      = Guid.NewGuid().ToString()
            };

            var timesheetRepositoryMock = new Mock <ITimesheetRepository>();

            timesheetRepositoryMock
            .Setup(x => x.Add(timeLog))
            .Verifiable();

            var service = new TimesheetService(timesheetRepositoryMock.Object);

            //act
            var result = service.TrackTime(timeLog);

            //assert
            timesheetRepositoryMock.Verify(x => x.Add(timeLog), Times.Once);
            Assert.IsTrue(result);
        }
Ejemplo n.º 11
0
        public void TrackTime_ShouldReturnFalse(int hours, string lastName)
        {
            //arrange

            var timeLog = new TimeLog
            {
                Date         = new DateTime(),
                WorkingHours = hours,
                LastName     = lastName,
                Comment      = Guid.NewGuid().ToString()
            };

            var timesheetRepositoryMock = new Mock <ITimesheetRepository>();

            timesheetRepositoryMock
            .Setup(x => x.Add(timeLog))
            .Verifiable();

            var service = new TimesheetService(timesheetRepositoryMock.Object);

            //act
            var result = service.TrackTime(timeLog);

            //assert
            timesheetRepositoryMock.Verify(x => x.Add(timeLog), Times.Never);
            Assert.IsFalse(result);
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> PutTimeLog(int id, TimeLog timeLog)
        {
            if (id != timeLog.TimeLogId)
            {
                return(BadRequest());
            }

            _context.Entry(timeLog).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TimeLogExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 13
0
        public bool TrackTime(TimeLog timeLog, string lastName)
        {
            bool isValid = timeLog.WorkHours > 0 &&
                           timeLog.WorkHours <= 24 &&
                           !string.IsNullOrWhiteSpace(timeLog.LastName);

            var employee = _employeeRepository.GetEmployee(timeLog.LastName);

            if (!isValid || employee == null)
            {
                return(false);
            }

            if (employee is FreelancerEmployee)
            {
                if (DateTime.Now.AddDays(-2) > timeLog.Date)
                {
                    return(false);
                }
            }

            if (employee is FreelancerEmployee || employee is StaffEmployee)
            {
                if (timeLog.LastName != lastName)
                {
                    return(false);
                }
            }

            _timesheetRepository.Add(timeLog);

            return(true);
        }
Ejemplo n.º 14
0
        public void QuickScanBombCount()
        {
            if (BombCountRectangles == null)
            {
                throw new InvalidOperationException();
            }

            var captureLog = TimeLog.Stopwatch("Capture Bomb Count");
            var bitmaps    = BombCountRectangles.Select(GetCapture).ToArray();

            captureLog.Dispose();

            var readLog         = TimeLog.Stopwatch("Read Face");
            var bombCountDigits = bitmaps.Select(bitmap =>
            {
                using (var integerMap = new IntegerMap(bitmap))
                {
                    var bombCountIcon = bombCountScanner.QuickRead(integerMap, Point.Empty);
                    if (bombCountIcon == null)
                    {
                        throw new GameScanException("Scan bomb count failed");
                    }

                    return(MapBombCount(bombCountIcon));
                }
            });

            BombCount = bombCountDigits.Aggregate((total, curr) => total * 10 + curr);
            readLog.Dispose();
        }
Ejemplo n.º 15
0
        public void QuickScanFace()
        {
            if (FaceRectangle == Rectangle.Empty)
            {
                throw new InvalidOperationException();
            }

            var captureLog = TimeLog.Stopwatch("Capture Face");
            var bitmap     = GetCapture(FaceRectangle);

            captureLog.Dispose();

            var readLog = TimeLog.Stopwatch("Read Face");

            using (var integerMap = new IntegerMap(bitmap))
            {
                var faceIcon = faceScanner.QuickRead(integerMap, Point.Empty);
                if (faceIcon == null)
                {
                    throw new GameScanException("Scan face failed");
                }

                Face = MapFace(faceIcon);
            }
            readLog.Dispose();
        }
Ejemplo n.º 16
0
        public ContentResult Save(string objdata, string value)
        {
            JsonObject js = new JsonObject();

            js.StatusCode = 200;
            js.Message    = "Upload Success";
            try
            {
                TimeLog obj = JsonConvert.DeserializeObject <TimeLog>(objdata);
                obj = TimeLogManager.Update(obj);
                if (obj.TimeLogId == 0)
                {
                    js.StatusCode = 400;
                    js.Message    = "Has Errors. Please contact Admin for more information";
                }
                else
                {
                    js.Data = obj;
                }
            }
            catch (Exception objEx)
            {
                js.StatusCode = 400;
                js.Message    = objEx.Message;
            }

            return(Content(JsonConvert.SerializeObject(js), "application/json"));
        }
Ejemplo n.º 17
0
        /// <summary>
        /// use for setting up default value
        /// </summary>
        /// <returns></returns>
        public ActionResult Update(int TimeLogId, string TargetID = "TimeLoglist")
        {
            TimeLog objItem = TimeLogManager.GetById(TimeLogId);

            objItem.TargetDisplayID = TargetID;
            return(View(ViewFolder + "Create.cshtml", objItem));
        }
Ejemplo n.º 18
0
 public ActionResult Create(TimeLog model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             //model.CreatedUser = CurrentUser.UserName;
             if (model.TimeLogId != 0)
             {
                 //get default value
                 //	TimeLog b = TimeLogManager.GetById(model.TimeLogId);
                 TimeLogManager.Update(model);
             }
             else
             {
                 // TODO: Add insert logic here
                 // model.CreatedDate = SystemConfig.CurrentDate;
                 TimeLogManager.Add(model);
             }
             return(View(ViewFolder + "list.cshtml", TimeLogManager.GetAll()));
         }
     }
     catch
     {
         return(View(model));
     }
     return(View(model));
 }
Ejemplo n.º 19
0
 private void AddToTimeLog()
 {
     if (TimeLog != null)
     {
         TimeLog.AddActivity(currentActivity);
     }
 }
Ejemplo n.º 20
0
 public static void RemoveCache(TimeLog objItem)
 {
     HttpCache.RemoveByPattern(SETTINGS_ALL_KEY);
     HttpCache.RemoveByPattern(string.Format(SETTINGS_ID_KEY, objItem.TimeLogId));
     //HttpCache.RemoveByPattern(string.Format(SETTINGS_User_KEY, objItem.CreatedUser));
     HttpCache.RemoveSearchCache(SystemConfig.AllowSearchCache, SETTINGS_Search_KEY);
 }
Ejemplo n.º 21
0
        public TimeLog GetById(int id)
        {
            FileStream   fs = new FileStream(this.filePath, FileMode.OpenOrCreate);
            StreamReader sr = new StreamReader(fs);

            try
            {
                while (!sr.EndOfStream)
                {
                    TimeLog tl = new TimeLog();
                    tl.Id             = Convert.ToInt32(sr.ReadLine());
                    tl.TaskId         = Convert.ToInt32(sr.ReadLine());
                    tl.UserId         = Convert.ToInt32(sr.ReadLine());
                    tl.HoursWork      = Convert.ToInt32(sr.ReadLine());
                    tl.DateOfCreation = Convert.ToDateTime(sr.ReadLine());

                    if (tl.Id == id)
                    {
                        return(tl);
                    }
                }
            }
            finally
            {
                sr.Close();
                fs.Close();
            }

            return(null);
        }
Ejemplo n.º 22
0
        public TimeLog[] GetTimeLogs(string lastName)
        {
            var data     = File.ReadAllText(_path);
            var dataRows = data.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            var timeLogs = new List <TimeLog>();

            foreach (var dataRow in dataRows)
            {
                if (dataRow.Contains(lastName))
                {
                    var timeLog = new TimeLog();

                    var dataMembers = dataRow.Split(_delimeter);

                    timeLog.Comment      = dataMembers[0];
                    timeLog.Date         = DateTime.TryParse(dataMembers[1], out var date) ? date : new DateTime();
                    timeLog.LastName     = dataMembers[2];
                    timeLog.WorkingHours = int.TryParse(dataMembers[3], out var workingHours) ? workingHours : 0;

                    timeLogs.Add(timeLog);
                }
            }

            return(timeLogs.ToArray());
        }
Ejemplo n.º 23
0
        public async Task <bool> DeleteLog(int logId)
        {
            TimeLog logToDelete = await _context.TimeLogs.FirstOrDefaultAsync(x => x.Id == logId);

            await DeleteAsync(logToDelete);

            return(true);
        }
Ejemplo n.º 24
0
 public override void Analyze(TimeLogReportingServiceContext context, TimeLog workitem)
 {
     ValidateByrole(context, workitem, TaskOwnerType.Architect, "Architect code review");
     ValidateByrole(context, workitem, TaskOwnerType.Peer, "Peer code review");
     ValidateByrole(context, workitem, TaskOwnerType.Developer, "Development");
     ValidateByrole(context, workitem, TaskOwnerType.Tester, "Testing");
     ValidateByrole(context, workitem, TaskOwnerType.Team, "Generic");
 }
 public IActionResult Add([FromBody] TimeLog timeLog)
 {
     if (_timesheetService.TrackTime(timeLog, timeLog.EmployeeLogin))
     {
         return(Ok(timeLog.Comment));
     }
     return(NoContent());
 }
        public void Add(TimeLog timeLog)
        {
            var dataRow = $"{timeLog.LastName}{_delimeter}" +
                          $"{timeLog.WorkingTimeHours}{_delimeter}" +
                          $"{timeLog.Date}\n";

            File.AppendAllText(_path, dataRow);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TimeLog timeLog = db.TimeLogs.Find(id);

            db.TimeLogs.Remove(timeLog);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 28
0
        private TimeLog GetPreviousEntry(TimeLog currentItem)
        {
            IQueryable <TimeLog> results = QueryResultset();

            Int32   index     = results.ToList().IndexOf(results.Where(x => x.Id == currentItem.Id).First());
            TimeLog prevEntry = results.ToList().ElementAt(index - 1);

            return(prevEntry);
        }
Ejemplo n.º 29
0
        public void Add(TimeLog timeLog)
        {
            var dataRow = $"{timeLog.Comment}{DELIMETER}" +
                          $"{timeLog.Date}{DELIMETER}" +
                          $"{timeLog.LastName}{DELIMETER}" +
                          $"{timeLog.WorkingHours}\n";

            File.AppendAllText(PATH, dataRow, System.Text.Encoding.UTF8);
        }
Ejemplo n.º 30
0
 //以后不用这个了
 //public void NewOneTime(Guid id) {
 //    if (TimeLog.Count(m=>m.ID==id)==0)
 //    {
 //        TimeLog.Add(new OneTime { ID = id, startDate = DateTime.Now ,endDate= DateTime.Now, Log="",leaveSecound=0});
 //    }
 //}
 public void NewOneTime(Guid id, string section, string file, string log, string formname)
 {
     if (TimeLog.Count(m => m.ID == id) == 0)
     {
         TimeLog.Add(new OneTime {
             ID = id, startDate = DateTime.Now, endDate = DateTime.Now, Log = log, leaveSecound = 0, section = section, fileFullName = file, formName = formname
         });
     }
 }
Ejemplo n.º 31
0
        public static void LoadTilesets(GameProject project, GraphicsDevice device)
        {
            var timeLog = new TimeLog();

            if (project.Tilesets != null)
            {
                foreach (Tileset set in project.Tilesets)
                {
                    set.LoadTexture(device);
                }
            }
            timeLog.Log("load tilesets");
        }
Ejemplo n.º 32
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            var caption = "Reset database";
              var message = "Are you sure you want to clear all database entries?\r\nThis operation cannot be undone.";
              if(DialogResult.Yes != MessageBox.Show(message,
            caption,
            MessageBoxButtons.YesNo,
            MessageBoxIcon.Warning,
            MessageBoxDefaultButton.Button2))
            return;

              var log = new TimeLog();
              log.ResetDb();
              RefreshReport();
        }
Ejemplo n.º 33
0
        public static void LoadMapObjectSprites(GameProject project, GraphicsDevice device)
        {
            var timeLog = new TimeLog();

            if (project.MapObjects != null)
            {
                foreach (var obj in project.MapObjects)
                {
                    if (!string.IsNullOrEmpty(obj.SpriteInfo.Name))
                    {
                        var texture = ContentLoader.LoadTexture(device, "Sprites/Objects/" + obj.SpriteInfo.Name);
                        obj.Animation = new SpriteAnimation(texture, 100, 1);
                        obj.Animation.Origin = obj.Origin;
                    }
                }
            }

            timeLog.Log("load sprites");
        }
Ejemplo n.º 34
0
        public LotuzForm()
        {
            var constructorLog = new TimeLog();

            InitializeComponent();

            splitContainer1.Enabled = false;
            editorToolbar.Enabled = false;
            itmOptions.Enabled = false;

            objectSelectionControl1.Editor = this;
            enemySelectionControl1.Editor = this;
            textureSelectionControl.Editor = this;
            npcSelectionControl1.Editor = this;
            mapControl.Editor = this;
            mapControl.Content = new ContentManager(mapControl.Services, "Content");
            UpdateTileTextureSelectionControlSize();

            pnlMap.MouseWheel += pnlMap_MouseWheel;

            LoadConfig();

            CheckContentFolder();

            CurrentMapIndex = -1;
            CurrentObject = new MapObject();

            Objects = new List<GameObject>();
            deletedMapLayers = new List<Guid>();
            CurrentLayerType = LayerType.MapLayer;

            cbbLayerType.SelectedIndex = 0;
            cbbZoom.SelectedIndex = 3;

            AddButtonsToList();

            mapControl.ControlLoaded += MapControl_ControlLoaded;

            constructorLog.Log("editor constructor");
        }
Ejemplo n.º 35
0
 void ProcessLogItemsSince(DateTime when, Action<LogEntry> action)
 {
     var log = new TimeLog();
       var entries = log.GetEntriesSince(when);
       foreach (var entry in entries) action(entry);
 }
Ejemplo n.º 36
0
        protected override void Initialize()
        {
            var log = new TimeLog();

            SpriteBatch = new SpriteBatch(GraphicsDevice);

            basicEffect = new BasicEffect(GraphicsDevice);
            basicEffect.VertexColorEnabled = true;

            MapObjectOpacity = 100;
            ScrollAmount = Vector2.Zero;
            PaintedAreaStart = new Vector2(-1, -1);
            PaintedAreaCurrentPosition = new Vector2(-1, -1);
            PreviewSelectedObjectOnMap = true;

            // Hook the idle event to constantly redraw our animation.
            Application.Idle += delegate { Invalidate(); };

            ControlLoaded?.Invoke(this);

            log.Log("mapcontrol constructor");
        }
Ejemplo n.º 37
0
        private void cmdRemove_Click(object sender, EventArgs e)
        {
            var caption = "Delete entry";
              var message = "Are you sure you want to delete this log entry?\r\nThis operation cannot be undone.";
              if (DialogResult.Yes != MessageBox.Show(message,
            caption,
            MessageBoxButtons.YesNo,
            MessageBoxIcon.Warning,
            MessageBoxDefaultButton.Button2))
            return;

              var item = (LogEntry) lstEntries.SelectedItems[0].Tag;
              ITimeLog log = new TimeLog();
              log.Remove(item);
              RefreshReport();
        }
Ejemplo n.º 38
0
        private void cmdMerge_Click(object sender, EventArgs e)
        {
            var items = lstEntries.SelectedItems.Cast<ListViewItem>().Select(i => (LogEntry) i.Tag);
              var duration = items.Sum(i => i.Duration);
              var comments = items.Where(i => !string.IsNullOrEmpty(i.Comment)).Select(i => i.Comment).ToArray();
              string desc = string.Join(", ", comments);

              var itemList = items.ToList();
              var frm = new MergeForm(itemList, desc);
              if(DialogResult.OK != frm.ShowDialog()) return;

              desc = frm.Description;

              ITimeLog log = new TimeLog();
              log.Merge(itemList, desc);
              RefreshReport();
        }
Ejemplo n.º 39
0
 public void Execute()
 {
     var log = new TimeLog();
       m_currentGroup = null;
       m_data = GetData(log);
 }
Ejemplo n.º 40
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            var item = (LogEntry) lstEntries.SelectedItems[0].Tag;
              var frm = new EntryEditor(item);
              if(DialogResult.OK != frm.ShowDialog())
            return;

              ITimeLog log = new TimeLog();
              log.Update(item);
              RefreshReport();
        }