Ejemplo n.º 1
0
        public List <WorkDoneandPlans> GetWorkDoneAndPlansbyDate(User user, DateTime dateTime)
        {
            var plans = from plan in db.Plans
                        join work in db.TodoLists on plan.work_id equals work.id
                        where plan.work_plan_time == dateTime.Date && work.user_id == user.id
                        orderby plan.id ascending
                        select new WorkDoneandPlans
            {
                PlanDate      = plan.work_plan_time,
                Priority      = work.priority,
                RequestNumber = work.request_number,
                AddDate       = plan.add_time,
                PlanID        = plan.id
            };
            List <WorkDoneandPlans> workDoneandPlans = plans.ToList();

            for (int i = 0; i < workDoneandPlans.Count(); i++)
            {
                WorkDone workDone = GetWorkDoneByPlanID(workDoneandPlans[i].PlanID);
                if (workDone != null)
                {
                    workDoneandPlans[i].WorkDescription = workDone.description;
                    workDoneandPlans[i].WorkDoneDate    = workDone.workDoneTime.Value;
                }
            }
            return(workDoneandPlans);
        }
Ejemplo n.º 2
0
        public byte EditWorkDone(WorkDone workDone)
        {
            if (!db.WorkDones.Any(x => x.id == workDone.id))
            {
                return(0);
            }
            db.WorkDones.Attach(workDone);
            db.Entry(workDone).State = EntityState.Modified;
            db.SaveChanges();

            return(1);
        }
Ejemplo n.º 3
0
 public void MoveWorkToWorkDone(WorkDone workdone)
 {
     db.WorkDones.Add(workdone);
     db.SaveChanges();
 }
Ejemplo n.º 4
0
 public void RemoveWorkdone(WorkDone workdone)
 {
     db.WorkDones.Remove(workdone);
     db.SaveChanges();
 }