public bool Contains(MonthPlan entity) { return base.Contains(entity); }
public int IndexOf(MonthPlan entity) { return base.IndexOf(entity); }
public bool Remove(MonthPlan entity) { return base.Remove(entity); }
public void Add(MonthPlan entity) { base.Add(entity); }
private static void SetData(ListLogicalView weekView, MonthPlan plan) { var weekIndex = TimeHelper.CurrentWeekIndex; var weekSummaryList = new WeekSummaryList(); weekSummaryList.AutoTreeIndexEnabled = false; //把 plan.TaskOrCategoryList 中的数据复制到 WeekSummaryList 中。 foreach (TaskOrCategory category in plan.TaskOrCategoryList) { var categoryWeek = new WeekSummary(); categoryWeek.IsCategory = true; categoryWeek.TreeIndex = category.TreeIndex; categoryWeek.Name = category.Name; categoryWeek.Content = category.Content; categoryWeek.Id = category.Id; categoryWeek.TreePId = category.TreePId; weekSummaryList.Add(categoryWeek); foreach (TaskOrCategory task in category.TreeChildren) { var taskWeek = new WeekSummary(); taskWeek.IsTask = true; taskWeek.TreeIndex = task.TreeIndex; taskWeek.Name = task.Name; taskWeek.Content = task.Content; taskWeek.ObjectiveName = task.ObjectiveName; taskWeek.Id = task.Id; taskWeek.TreePId = task.TreePId; taskWeek.MonthObjectiveNum = task.ObjectiveNum; taskWeek.MonthCompletedNum = task.SumCompletedRO; var weekCompletion = task.WeekCompletionList[weekIndex] as WeekCompletion; taskWeek.WeekCompletion = weekCompletion; taskWeek.ObjectiveNum = weekCompletion.ObjectiveNum; taskWeek.NumCompleted = weekCompletion.NumCompleted; taskWeek.WeekSummaryNote = weekCompletion.Note; categoryWeek.TreeChildren.Add(taskWeek); weekSummaryList.Add(taskWeek); } } weekView.Data = weekSummaryList; }
public void Insert(int index, MonthPlan entity) { base.Insert(index, entity); }
private static void ReadData(ListLogicalView weekView, MonthPlan plan) { foreach (WeekSummary week in weekView.Data) { if (week.IsTask) { var completion = week.WeekCompletion; completion.NumCompleted = week.NumCompleted; completion.Note = week.WeekSummaryNote; } } }
private static string CheckPlan(MonthPlan plan) { var tasks = plan.TaskOrCategoryList; var allPercent = tasks.Cast<TaskOrCategory>().Sum(c => c.MonthPercent); if (allPercent != 100) { return "类别百分比的和应该是 100,目前总和为:" + allPercent; } foreach (TaskOrCategory category in tasks) { if (category.IsCategoryRO) { if (category.TreeChildren.Count == 0) { return "每个类别下最少必须有一个任务,保存失败。"; } } } return null; }
public Dictionary <string, object> Index([FromBody] SearchModel model) { if (model.SearchDate == null) { model.SearchDate = DateTime.Now; } List <int> PostIds = new List <int>(); if (model.FkId != null && model.FkId > 0) { Post post = db.Posts.FirstOrDefault(w => w.PostId == model.FkId); if (post.PostType == "depart") { setPostIds(PostIds, post.PostId); } else { PostIds.Add(post.PostId); } } var a = from b in db.Employees where b.QuitDate == null select b; if (PostIds.Count > 0) { a = a.Where(w => PostIds.Contains(w.PostId)); } if (model.Fk2Id != null) { a = a.Where(w => w.EstateId == model.Fk2Id); } else if (!user.IsSuper) { a = a.Where(w => user.EstateIds.Contains(w.EstateId)); } var employee = from b in a select new { b.EmployeeId, b.EmployeeName, b.PostId, b.EstateId }; //var plan = (from x in db.WorkPlans where SqlFunctions.DateDiff("MM", model.SearchDate, x.WorkDate) == 0 select x).ToList(); //var planTimes = (from x in db.WorkPlanTimes where (from p in plan select p.PlanId).Contains(x.PlanId) select x).ToList(); var planTimes = (from d in db.WorkPlans join t in db.WorkPlanTimes on d.PlanId equals t.PlanId where SqlFunctions.DateDiff("MM", model.SearchDate, d.WorkDate) == 0 select new { d.EmployeeId, d.WorkDate, t.ConfigId, t.IsWork }).ToList(); List <WorkTimeConfig> TimeConfig = db.WorkTimeConfigs.Where(w => w.IsAble == true).OrderBy(w => w.TimeStart).ToList(); List <MonthPlan> list = new List <MonthPlan>(); DateTime start = DateTime.Parse(model.SearchDate.Value.ToString("yyyy-MM") + "-01"); DateTime end = start.AddMonths(1).AddDays(-1); int length = end.Day - start.Day + 1; int count = TimeConfig.Count; foreach (var item in a) { MonthPlan emplan = new MonthPlan(item.EmployeeId, item.EmployeeName, item.PostId, item.EstateId); emplan.Works = new Boolean[length]; emplan.WorkTimes = new Boolean[length, count]; for (int i = 0; i < emplan.Works.Length; i++) { int day = i + 1; for (int j = 0; j < count; j++) { int ConfigId = TimeConfig[j].ConfigId; if (planTimes.Count(w => w.EmployeeId == emplan.EmployeeId && w.WorkDate.Day == day && w.ConfigId == ConfigId && w.IsWork == true) > 0) { emplan.WorkTimes[i, j] = true; if (model.Fk3Id == null) { emplan.Works[i] = true; } else if (model.Fk3Id.Value == ConfigId) { emplan.Works[i] = true; } } } //if (plan.Count(w => w.EmployeeId == emplan.EmployeeId && w.WorkDate.Day == day && w.IsWork == true) > 0) // emplan.Works[i] = true; } list.Add(emplan); } int[] days = new int[length]; for (int i = 0; i < length; i++) { days[i] = i + 1; } result["days"] = days; result["times"] = TimeConfig; result["datalist"] = list; return(result); }
public string EditMonthPlan(int id, MonthPlan monthPlan) { return(_monthPlanService.EditPlan(id, monthPlan)); }
public string InsertMontPlan(MonthPlan monthPlan) { return(_monthPlanService.InsertPlan(monthPlan)); }