public void InsertOrUpdate(TimeLog timelog)
 {
     if (timelog.LogID == default(long)) {
         // New entity
         context.TimeLogs.Add(timelog);
     } else {
         // Existing entity
         //context.Entry(timelog).State = System.Data.EntityState.Modified;
         context.Entry(timelog).State = System.Data.Entity.EntityState.Modified;
     }
 }
Beispiel #2
0
        //public PartialViewResult AddMessage(TaskMessage taskMessage)
        public ActionResult AddTimeLog(TimeLog timeLog)
        {
            if (timeLog != null)
            {
                timeLog.UserID = (int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey;
                timeLog.CreatedBy = (int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey;
                timeLog.ModifiedBy = (int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey;
                timeLog.CreateDate = DateTime.Now;
                timeLog.ModificationDate = DateTime.Now;
                timeLog.ActionDate = DateTime.Now;

                unitOfWork.TimeLogRepository.InsertOrUpdate(timeLog);

                unitOfWork.Save();
            }
            return RedirectToAction("_TaskEntryLog", new { @taskId = timeLog.TaskID });
        }
Beispiel #3
0
        public ActionResult CreateTimeLog(TimeLog timeLog)
        {
            timeLog.CreatedBy = (int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey;
            timeLog.ModifiedBy = (int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey;
            timeLog.UserID = (int)Membership.GetUser(WebSecurity.CurrentUserName).ProviderUserKey;
            timeLog.CreateDate = DateTime.Now;
            timeLog.ModificationDate = DateTime.Now;
            timeLog.ActionDate = DateTime.Now;

            if (ModelState.IsValid)
            {
                unitOfWork.TimeLogRepository.InsertOrUpdate(timeLog);
                unitOfWork.Save();
                return RedirectToAction("TaskTimeLog", new { @taskId = timeLog.TaskID, @sprintId = timeLog.SprintID });
            }
            return RedirectToAction("TaskTimeLog", new { @id = timeLog.TaskID });
        }
Beispiel #4
0
 public PartialViewResult AddTimeLog(long id)
 //public ViewResult AddTimeLog(long id)
 {
     Task task = unitOfWork.TaskRepository.Find(id);
     ViewBag.Task = task;
     ViewBag.TaskTimeLog = unitOfWork.TimeLogRepository.GetTimeLogByTaskId(id);
     TimeLog timeLog = new TimeLog();
     timeLog.SprintID = task.SprintID;
     timeLog.TaskID = id;
     //return View(timeLog);
     return PartialView(timeLog);
 }
Beispiel #5
0
        public ActionResult CreateTimeLog(long taskId, string sprintId)
        {
            //Task task = unitOfWork.TaskRepository.get
            TimeLog timelog = new TimeLog();
            timelog.TaskID = taskId;
            if (sprintId != string.Empty)
            {
                timelog.SprintID =Convert.ToInt64(sprintId);
            }

            List<TimeLog> timeLog = new List<TimeLog>();
            timeLog = unitOfWork.TimeLogRepository.All.Where(p => p.TaskID == taskId).OrderByDescending(b => b.EntryDate).ToList();
            foreach (TimeLog item in timeLog)
            {
                ViewBag.RemainingHour = item.RemainingHour.ToString();
                break;
                
            }

           
            

            return View(timelog);
        }