public void create_progress_tracker() { List<Module> modules = DocumentorDBM.Modules.ToList(); int total_sections=modules.Sum(x=>x.no_of_sections??0); List<UserProgress> modules_progress=new List<UserProgress>(); List<UserModuleTimeStatistic> times_progress = new List<UserModuleTimeStatistic>(); foreach (Module module in modules) { if(module.no_of_sections>0) for (int resource_no = 1; resource_no <= module.no_of_sections; resource_no++) { UserProgress module_progress = new UserProgress(); module_progress.student_id = this.id; module_progress.module_id = module.id; module_progress.resource_no = resource_no; modules_progress.Add(module_progress); } UserModuleTimeStatistic module_time_stat = new UserModuleTimeStatistic(); module_time_stat.student_id = this.id; module_time_stat.module_id = module.id; module_time_stat.time_spend = 0; times_progress.Add(module_time_stat); } DocumentorDBM.UserProgresses.InsertAllOnSubmit(modules_progress); DocumentorDBM.UserModuleTimeStatistics.InsertAllOnSubmit(times_progress); DocumentorDBM.SubmitChanges(); }
private void detach_UserModuleTimeStatistics(UserModuleTimeStatistic entity) { this.SendPropertyChanging(); entity.Student = null; }
private void attach_UserModuleTimeStatistics(UserModuleTimeStatistic entity) { this.SendPropertyChanging(); entity.Module = this; }
partial void DeleteUserModuleTimeStatistic(UserModuleTimeStatistic instance);
partial void UpdateUserModuleTimeStatistic(UserModuleTimeStatistic instance);
partial void InsertUserModuleTimeStatistic(UserModuleTimeStatistic instance);