示例#1
0
        public static Class getClassById(Dictionary <string, string> whereFields)
        {
            Dictionary <string, string> _class = dbConnector.DoQueryStatement(
                dbConnector.CreateSelectCommandWithParams("classes", whereFields))[0];

            return(new Class(
                       Convert.ToInt32(_class["id"]),
                       Convert.ToInt32(_class["dif_dig"]),
                       Convert.ToInt32(_class["dif_lei"]),
                       Convert.ToInt32(_class["dif_rec"]),
                       Convert.ToInt32(_class["dif_atv"]),
                       Convert.ToInt32(_class["dif_int"]),
                       StudentsDTO.getStudents(new Dictionary <string, string> {
                { "id", _class["id_student"].ToString() }
            })[0],
                       InstructorDTO.getInstructors(new Dictionary <string, string> {
                { "id", _class["id_instructor"].ToString() }
            })[0],
                       ActivityDTO.getActivities(new Dictionary <string, string> {
                { "id", _class["id_activity"].ToString() }
            })[0],
                       DateTime.Parse(_class["dt_created"]),
                       _class["obs_atv"].ToString(),
                       _class["obs_int"].ToString()
                       ));
        }
示例#2
0
        public static List <Class> searchForClass(string searchField)
        {
            List <Class> listClass = new List <Class>();
            List <Dictionary <string, string> > dbResult = dbConnector.DoQueryStatement(
                dbConnector.CreateSelectCommandWithProcedure("classes", searchField));

            foreach (var _class in dbResult)
            {
                listClass.Add(new Class(
                                  Convert.ToInt32(_class["id"]),
                                  Convert.ToInt32(_class["dif_dig"]),
                                  Convert.ToInt32(_class["dif_lei"]),
                                  Convert.ToInt32(_class["dif_rec"]),
                                  Convert.ToInt32(_class["dif_atv"]),
                                  Convert.ToInt32(_class["dif_int"]),
                                  StudentsDTO.getStudents(new Dictionary <string, string> {
                    { "id", _class["id_student"].ToString() }
                })[0],
                                  InstructorDTO.getInstructors(new Dictionary <string, string> {
                    { "id", _class["id_instructor"].ToString() }
                })[0],
                                  ActivityDTO.getActivities(new Dictionary <string, string> {
                    { "id", _class["id_activity"].ToString() }
                })[0],
                                  DateTime.Parse(_class["dt_created"]),
                                  _class["obs_atv"].ToString(),
                                  _class["obs_int"].ToString()
                                  ));
            }

            return(listClass);
        }