예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            GroupModule groupModule = db.GroupModules.Find(id);

            db.GroupModules.Remove(groupModule);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "GroupId,ModuleId")] GroupModule groupModule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(groupModule).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GroupId  = new SelectList(db.Groups, "GroupID", "Name", groupModule.GroupId);
     ViewBag.ModuleId = new SelectList(db.Modules, "ModuleID", "Name", groupModule.ModuleId);
     return(View(groupModule));
 }
        public ActionResult AssignModulesToTeachers(int ModuleID, int[] TeacherIDs, int GroupID)
        {
            bool flag = false;

            TempData["Message"] = "<ul>";
            foreach (int fId in TeacherIDs)
            {
                if (db.Teacher_Modules.Where(fd => fd.ModuleID == ModuleID && fd.TeacherID == fId && fd.GroupID == GroupID).FirstOrDefault() != null)
                {
                    TempData["Message"] += "<li>" + "Teacher " + db.Teachers.Where(f => f.TeacherID == fId).FirstOrDefault().Name + " Is Already Assigned To " + db.Modules.Where(d => d.ModuleID == ModuleID).FirstOrDefault().Name + ". " + "</li>";
                    flag = true;
                }
                if (!flag)
                {
                    Teacher_Module mTeacher = new Teacher_Module();
                    mTeacher.ModuleID  = ModuleID;
                    mTeacher.TeacherID = fId;
                    mTeacher.GroupID   = GroupID;
                    db.Teacher_Modules.Add(mTeacher);
                    db.SaveChanges();
                    try
                    {
                        TeacherGroup tGroup = new TeacherGroup();
                        tGroup.TeacherID = fId;
                        tGroup.GroupID   = GroupID;
                        db.TeacherGroups.Add(tGroup);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                    }

                    try
                    {
                        GroupModule dCourse = new GroupModule();
                        dCourse.ModuleId = ModuleID;
                        dCourse.GroupId  = GroupID;
                        db.GroupModules.Add(dCourse);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            if (flag)
            {
                TempData["Message"] += "</ul>";
                return(RedirectToAction("AssignModulesToTeachers"));
            }
            return(RedirectToAction("Index", "Teacher_Modlue"));
        }
예제 #4
0
        public ActionResult CreateGroupModules([Bind(Include = "GroupId,ModuleId")] GroupModule groupModule)
        {
            if (ModelState.IsValid)
            {
                db.GroupModules.Add(groupModule);
                db.SaveChanges();
                return(RedirectToAction("GroupModules"));
            }

            ViewBag.GroupId  = new SelectList(db.Groups, "GroupID", "Name", groupModule.GroupId);
            ViewBag.ModuleId = new SelectList(db.Modules, "ModuleID", "Name", groupModule.ModuleId);
            return(View(groupModule));
        }
예제 #5
0
        // GET: GroupModules/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GroupModule groupModule = db.GroupModules.Find(id);

            if (groupModule == null)
            {
                return(HttpNotFound());
            }
            return(View(groupModule));
        }
예제 #6
0
        // GET: GroupModules/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GroupModule groupModule = db.GroupModules.Find(id);

            if (groupModule == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GroupId  = new SelectList(db.Groups, "GroupID", "Name", groupModule.GroupId);
            ViewBag.ModuleId = new SelectList(db.Modules, "ModuleID", "Name", groupModule.ModuleId);
            return(View(groupModule));
        }
예제 #7
0
        public static void Setup()
        {
            Console.WriteLine("E3");
            Driver = GetWebDriver(ConfigurationSettings.AppSettings["browser"]);
            string baseUrl = ConfigurationSettings.AppSettings["baseUrl"];

            Console.WriteLine("E4");
            Driver.Manage().Window.Maximize();
            Driver.Navigate().GoToUrl(baseUrl);
            LoginModule        = new LoginModule(Driver);
            CompanyModule      = new CompanyModule(Driver);
            DashboardModule    = new DashboardModule(Driver);
            ArtistModule       = new ArtistModule(Driver);
            GroupModule        = new GroupModule(Driver);
            ContentModule      = new ContentModule(Driver);
            ElementPresentTest = new ElementPresentTest(Driver);
        }
예제 #8
0
 public void SMK05_VerifyGroupCreation()
 {
     TestGroupName = GetType().Name;
     TestName      = TestContext.TestName;
     CreateFolders(TestGroupName, TestName);
     try
     {
         var tmp = File.ReadAllText(@datapath + "\\path.txt");
         DashboardModule.NavigateToDashboard(TestGroupName, TestName);
         GroupModule.VerifyAddGroup(tmp, TestGroupName, TestName);
     }
     catch (Exception e)
     {
         _verificationErrors.Append(e.Message);
         Assert.Fail(e.Message);
     }
 }
예제 #9
0
        public InvokeResult SaveModule4AreaGroup(string areaId, string groupId, List <string> moduleIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                GroupModule groupModule = new GroupModule {
                    AreaId = areaId, GroupId = groupId.ToGuid()
                };
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = groupModule.GetDeleteMethodName(), ParameterObject = groupModule.ToStringObjectDictionary(false), Type = SqlExecuteType.DELETE
                });
                if (moduleIds != null && moduleIds.Count > 0)
                {
                    foreach (string moduleId in moduleIds)
                    {
                        groupModule.ModuleId = moduleId.ToGuid();
                        statements.Add(new IBatisNetBatchStatement {
                            StatementName = groupModule.GetCreateMethodName(), ParameterObject = groupModule.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                        });
                    }
                }

                /***********************begin 自定义代码*******************/
                /***********************end 自定义代码*********************/

                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/

                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);

                //SPParam theSPParam = groupModule.ToSPParam();
                //BuilderFactory.DefaultBulder().ExecuteSPNoneQuery("SP_Auth_ImportGroupModuleSetting", theSPParam);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
        public ActionResult DeleteFacultyCourse(int id1, int id2, int id3)
        {
            Teacher_Module fd1 = db.Teacher_Modules.Where(fd => fd.ModuleID == id1 && fd.TeacherID == id2 && fd.GroupID == id3).FirstOrDefault();

            db.Teacher_Modules.Remove(fd1);
            db.SaveChanges();
            Teacher_Module fd2 = db.Teacher_Modules.Where(fd => fd.TeacherID == id2 && fd.GroupID == id3).FirstOrDefault();

            db.Teacher_Modules.Remove(fd2);
            db.SaveChanges();
            var count = db.Teacher_Modules.Where(fd => fd.ModuleID == id1 && fd.GroupID == id3).Count();

            if (count == 0)
            {
                GroupModule fd = db.GroupModules.Where(fd3 => fd3.GroupId == id3 && fd3.ModuleId == id1).FirstOrDefault();
                db.GroupModules.Remove(fd);
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
예제 #11
0
 public GroupController(GroupModule groupModule)
 {
     _groupModule = groupModule;
 }
예제 #12
0
 // https://autofaccn.readthedocs.io/en/latest/integration/aspnetcore.html#asp-net-core-3-0-and-generic-hosting
 public void ConfigureContainer(ContainerBuilder builder)
 {
     GroupModule.InjectDependencies(builder);
 }
예제 #13
0
        public ActionResult InsertSampleData()
        {
            if (_env.IsDevelopment())
            {
                Questionnaire           ExampleQuestionnaire = new Questionnaire();
                QuestionnaireCategories ExampleCategory1     = new QuestionnaireCategories
                {
                    CategoryID      = 1,
                    CategoryName    = "Test Category 1",
                    QuestionnaireID = ExampleQuestionnaire,
                    Weighting       = 30
                };
                QuestionnaireCategories ExampleCategory2 = new QuestionnaireCategories
                {
                    CategoryID      = 2,
                    CategoryName    = "Test Category 2",
                    QuestionnaireID = ExampleQuestionnaire,
                    Weighting       = 30
                };
                QuestionnaireQuestions ExampleQuestionA = new QuestionnaireQuestions
                {
                    QuestionID            = 1,
                    Description           = "How good was the big data visualized",
                    GoodReference         = "Easily understandable",
                    BadReference          = "Confusing",
                    Weighting             = 10,
                    QuestionnaireCategory = ExampleCategory1
                };
                QuestionnaireQuestions ExampleQuestionB = new QuestionnaireQuestions
                {
                    QuestionID            = 2,
                    Description           = "What is big data analytics",
                    GoodReference         = "Difficult to understand ",
                    BadReference          = "Very less details ",
                    Weighting             = 20,
                    QuestionnaireCategory = ExampleCategory1
                };
                QuestionnaireQuestions ExampleQuestionC = new QuestionnaireQuestions
                {
                    QuestionID            = 3,
                    Description           = "What is big data ",
                    GoodReference         = "Meaningfull data",
                    BadReference          = " Some key points were misssing ",
                    Weighting             = 20,
                    QuestionnaireCategory = ExampleCategory2
                };
                QuestionnaireQuestions ExampleQuestionD = new QuestionnaireQuestions
                {
                    QuestionID            = 4,
                    Description           = " Give some examples of big data ",
                    GoodReference         = " awesome",
                    BadReference          = " Lot of details ",
                    Weighting             = 10,
                    QuestionnaireCategory = ExampleCategory2
                };

                QuestionnaireAnswers ExampleAnswers1 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionA,
                    AnswerID = 1,
                    Score    = 10
                };
                QuestionnaireAnswers ExampleAnswers2 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionA,
                    AnswerID = 2,
                    Score    = 10
                };
                QuestionnaireAnswers ExampleAnswers3 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionB,
                    AnswerID = 1,
                    Score    = 20
                };
                QuestionnaireAnswers ExampleAnswers4 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionB,
                    AnswerID = 2,
                    Score    = 20
                };
                QuestionnaireAnswers ExampleAnswers5 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionC,
                    AnswerID = 1,
                    Score    = 20
                };

                QuestionnaireAnswers ExampleAnswers6 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionC,
                    AnswerID = 2,
                    Score    = 20
                };
                QuestionnaireAnswers ExampleAnswers7 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionD,
                    AnswerID = 1,
                    Score    = 10
                };
                QuestionnaireAnswers ExampleAnswers8 = new QuestionnaireAnswers
                {
                    Question = ExampleQuestionD,
                    AnswerID = 2,
                    Score    = 10
                };
                Module ExampleModule = new Module
                {
                    TemplateQuestionnaireID = ExampleQuestionnaire,
                    Description             = "SAD"
                };

                ModuleDetails ExampleModuleDetails = new ModuleDetails
                {
                    ModuleID          = ExampleModule,
                    CourseNumber      = 1,
                    QuestionnaireID   = ExampleQuestionnaire,
                    StartTime         = new DateTime(2017, 04, 23),
                    EndTime           = new DateTime(2017, 05, 18),
                    UserNameProfessor = "*****@*****.**"
                };

                GroupModule ExampleGroupModule = new GroupModule
                {
                    ModuleDetail = ExampleModuleDetails,
                    GroupName    = "abc",
                };
                StudentCourse ExampleStudentCourse = new StudentCourse
                {
                    UserNameStudent     = "*****@*****.**",
                    Course              = ExampleModuleDetails,
                    SelfEvaluationID    = 1,
                    AnswerID            = 2,
                    GroupGradeOK        = true,
                    Group               = ExampleGroupModule,
                    SelfEvaluationGrade = 3,
                    GroupGrade          = 4,
                    ProfessorGuessGrade = 10,
                    Grade               = 10,
                };



                _context.Questionnaire.Add(ExampleQuestionnaire);
                _context.QuestionnaireCategories.Add(ExampleCategory1);
                _context.QuestionnaireCategories.Add(ExampleCategory2);
                _context.QuestionnaireQuestions.Add(ExampleQuestionA);
                _context.QuestionnaireQuestions.Add(ExampleQuestionB);
                _context.QuestionnaireQuestions.Add(ExampleQuestionC);
                _context.QuestionnaireQuestions.Add(ExampleQuestionD);
                _context.QuestionnaireAnswers.Add(ExampleAnswers1);
                _context.QuestionnaireAnswers.Add(ExampleAnswers2);
                _context.QuestionnaireAnswers.Add(ExampleAnswers3);
                _context.QuestionnaireAnswers.Add(ExampleAnswers4);
                _context.QuestionnaireAnswers.Add(ExampleAnswers5);
                _context.QuestionnaireAnswers.Add(ExampleAnswers6);
                _context.QuestionnaireAnswers.Add(ExampleAnswers7);
                _context.QuestionnaireAnswers.Add(ExampleAnswers8);
                _context.Module.Add(ExampleModule);
                _context.ModuleDetails.Add(ExampleModuleDetails);
                _context.GroupModule.Add(ExampleGroupModule);
                _context.StudentCourse.Add(ExampleStudentCourse);
                _context.SaveChanges();
                ViewData["SampleDataInserted"] = "True";
            }


            return(View("Index"));
        }