Exemplo n.º 1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (tbFName.Text != null && tbLName.Text != null)
            {
                StudentList = new StudentDetail();
                if (int.TryParse(tbSId.Text.ToString(), out int SId))
                {
                    StudentList.studentId = SId;
                }
                StudentList.firstName = tbFName.Text;
                StudentList.lastName  = tbLName.Text;
                if (int.TryParse(tbEId.Text.ToString(), out int EId))
                {
                    StudentList.educatorId = EId;
                }
                if (int.TryParse(tbGLevel.Text.ToString(), out int gLvl))
                {
                    StudentList.gradeLevel = gLvl;
                }
                StudentList.sFullName = tbLName.Text.ToString() + "," + tbFName.Text.ToString();

                Sqlite.ExecuteNonQuery(Query.insertStudent(StudentList));

                Close();
            }
        }
Exemplo n.º 2
0
        private void dgAllStudents_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            StudentDetail group = (StudentDetail)dgAllStudents.SelectedItem;

            addstudentnum = group.index;
            addgroupNum   = groupID;
        }
Exemplo n.º 3
0
        public List <StudentDetail> makeStudentList()
        {
            List <StudentDetail> tempStudentList = new List <StudentDetail>();
            int     retVal = 0;
            DataSet ds     = Sqlite.ExecuteSQLStatement(Query.getStudentData(), ref retVal);


            for (int i = 0; i < retVal; i++)
            {
                StudentDetail temp = new StudentDetail();
                //index
                if (int.TryParse(ds.Tables[0].Rows[i].ItemArray[0].ToString(), out int index))
                {
                    temp.index = index;
                }
                //studnet Id
                if (int.TryParse(ds.Tables[0].Rows[i].ItemArray[1].ToString(), out int sId))
                {
                    temp.studentId = sId;
                }
                //studnet first name
                temp.firstName = ds.Tables[0].Rows[i].ItemArray[2].ToString();
                //student last name
                temp.lastName = ds.Tables[0].Rows[i].ItemArray[3].ToString();
                //gradeLevel
                if (int.TryParse(ds.Tables[0].Rows[i].ItemArray[4].ToString(), out int gradeLevel))
                {
                    temp.gradeLevel = gradeLevel;
                }
                //educator Id
                if (int.TryParse(ds.Tables[0].Rows[i].ItemArray[4].ToString(), out int educatorId))
                {
                    temp.educatorId = educatorId;
                }

                temp.sFullName = temp.lastName.ToString() + "," + temp.firstName.ToString();

                tempStudentList.Add(temp);
            }


            return(tempStudentList);
        }
Exemplo n.º 4
0
 public void addStudent(StudentDetail student)
 {
     StudentList.Add(student);
 }
Exemplo n.º 5
0
 public string UpdateStudent(StudentDetail student)
 {
     return("UPDATE Student SET FirstName = '" + student.firstName + "', LastName = '" + student.lastName + "', StudentId = " + student.studentId + ", GradeLevel = " + student.gradeLevel + ",Educator_id= " + student.gradeLevel + " WHERE(_id =" + student.index + ");");
 }
Exemplo n.º 6
0
 public string insertStudent(StudentDetail student)
 {
     return("INSERT INTO Student (StudentId,FirstName,LastName,GradeLevel,Educator_id)" +
            "VALUES (" + student.studentId + ",'" + student.firstName + "','" + student.lastName + "'," + student.gradeLevel + "," + student.educatorId + ");");
 }