use of com.remswork.project.alice.model.Teacher in project classify-system by anverliedoit.
the class TeacherServiceImpl method getTeacherById.
@Override
public Teacher getTeacherById(long id) throws TeacherException {
try {
StringBuilder uri = new StringBuilder();
uri.append(targetProperties.getDomain());
uri.append("/");
uri.append(targetProperties.getBaseUri());
uri.append("/");
uri.append(payload);
uri.append("/");
uri.append(id);
Client client = ClientBuilder.newClient();
WebTarget target = client.target(uri.toString());
Response response = target.request().get();
if (response.getStatus() == 200) {
return (Teacher) response.readEntity(Teacher.class);
} else if (response.getStatus() == 404) {
Message message = (Message) response.readEntity(Message.class);
throw new TeacherServiceException(message.getMessage());
} else
throw new TeacherServiceException("The request might invalid or server is down");
} catch (TeacherServiceException e) {
throw new TeacherException(e.getMessage());
}
}
use of com.remswork.project.alice.model.Teacher in project classify-system by anverliedoit.
the class ActivityConfirmPassword method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_confirmpassword);
btnConfirm = findViewById(R.id.activityt_confirmpassword_button);
btnCancel = findViewById(R.id.activityt_confirmpassword_button_cancel);
txPassword = findViewById(R.id.activity_confirmpassword_text);
status = findViewById(R.id.message_status_confirm);
teacherService = new TeacherServiceImpl();
try {
teacher = teacherService.getTeacherById(getIntent().getExtras().getLong("teacherId"));
} catch (Exception e) {
e.printStackTrace();
teacher = new Teacher();
}
btnConfirm.setOnClickListener(this);
btnCancel.setOnClickListener(this);
}
use of com.remswork.project.alice.model.Teacher in project classify-system by anverliedoit.
the class Teacher_Activity_Teacher_Profile method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TeacherServiceImpl teacherService = new TeacherServiceImpl();
Teacher teacher;
try {
teacher = teacherService.getTeacherById(getIntent().getExtras().getLong("teacherId"));
} catch (Exception e) {
e.printStackTrace();
teacher = new Teacher();
}
setContentView(R.layout.teacher_activity_view_teacher_profile);
txtvName = (TextView) findViewById(R.id.txtv_fullname);
txtvDept = (TextView) findViewById(R.id.txtv_dept);
buttonback = (Button) findViewById(R.id.add_backsubject);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_view_subject);
SubjectServiceImpl subjectService = new SubjectServiceImpl();
SubjectAdapter subjectAdapter = null;
try {
subjectAdapter = new SubjectAdapter(this, subjectService.getSubjectListByTeacherId(teacher.getId()));
} catch (SubjectException e) {
e.printStackTrace();
}
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setAdapter(subjectAdapter);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
txtvName.setText(teacher.getFirstName() + " " + teacher.getMiddleName().substring(0, 1) + ". " + teacher.getLastName());
txtvDept.setText(teacher.getDepartment() != null ? teacher.getDepartment().getName() : "None");
buttonback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
finish();
}
});
}
use of com.remswork.project.alice.model.Teacher in project classify-system by anverliedoit.
the class Teacher_GradingFactor_Activity_Midterm method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.teacher_gradingfactor_activity_midterm);
final Subject subject;
final Teacher teacher;
try {
subject = new SubjectServiceImpl().getSubjectById(getIntent().getExtras().getLong("subjectId"));
teacher = new TeacherHelper(this).loadUser().get();
linearLayoutm = (LinearLayout) findViewById(R.id.midterm_save);
// textViewm1 = (TextView) findViewById(R.id.midterm_subjectname);
// textViewm2 = (TextView) findViewById(R.id.txtv_midterm_percent);
// spinnerm = (Spinner) findViewById(R.id.midterm_spinner_percent);
textViewm3 = (TextView) findViewById(R.id.total_percentm);
textViewm1.setText(subject.getName());
seekBar1 = (SeekBar) findViewById(R.id.activity_seekbarm);
seekBar1.setMax(100);
seekBar1.setProgress(progress);
seekBar2 = (SeekBar) findViewById(R.id.assignment_seekbarm);
seekBar2.setMax(100);
seekBar2.setProgress(progress);
seekBar3 = (SeekBar) findViewById(R.id.attendance_seekbarm);
seekBar3.setMax(100);
seekBar3.setProgress(progress);
seekBar4 = (SeekBar) findViewById(R.id.exam_seekbarm);
seekBar4.setMax(100);
seekBar4.setProgress(progress);
seekBar5 = (SeekBar) findViewById(R.id.project_seekbarm);
seekBar5.setMax(100);
seekBar5.setProgress(progress);
seekBar6 = (SeekBar) findViewById(R.id.quiz_seekbarm);
seekBar6.setMax(100);
seekBar6.setProgress(progress);
textView1 = (TextView) findViewById(R.id.activity_percent_textm);
textView2 = (TextView) findViewById(R.id.assignment_percent_textm);
textView3 = (TextView) findViewById(R.id.attendance_percent_textm);
textView4 = (TextView) findViewById(R.id.exam_percent_textm);
textView5 = (TextView) findViewById(R.id.project_percent_textm);
textView6 = (TextView) findViewById(R.id.quiz_percent_textm);
aSwitch1 = (Switch) findViewById(R.id.activity_switch_redm);
aSwitch2 = (Switch) findViewById(R.id.assignment_switch_redm);
aSwitch3 = (Switch) findViewById(R.id.attendance_switch_redm);
aSwitch4 = (Switch) findViewById(R.id.exam_switch_redm);
aSwitch5 = (Switch) findViewById(R.id.project_switch_redm);
aSwitch6 = (Switch) findViewById(R.id.quiz_switch_redm);
linearLayout1 = (LinearLayout) findViewById(R.id.activty_linearm);
linearLayout1.setVisibility(View.GONE);
linearLayout2 = (LinearLayout) findViewById(R.id.assignment_linearm);
linearLayout2.setVisibility(View.GONE);
linearLayout3 = (LinearLayout) findViewById(R.id.attendance_linearm);
linearLayout3.setVisibility(View.GONE);
linearLayout4 = (LinearLayout) findViewById(R.id.exam_linearm);
linearLayout4.setVisibility(View.GONE);
linearLayout5 = (LinearLayout) findViewById(R.id.project_linearm);
linearLayout5.setVisibility(View.GONE);
linearLayout6 = (LinearLayout) findViewById(R.id.quiz_linearm);
linearLayout6.setVisibility(View.GONE);
seekBar1.setKeyProgressIncrement(5);
seekBar2.setKeyProgressIncrement(5);
seekBar3.setKeyProgressIncrement(5);
seekBar4.setKeyProgressIncrement(5);
seekBar5.setKeyProgressIncrement(5);
seekBar6.setKeyProgressIncrement(5);
linearLayoutm.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
Formula formula = new Formula();
formula.setActivityPercentage(percent[0]);
formula.setAssignmentPercentage(percent[1]);
formula.setAttendancePercentage(percent[2]);
formula.setExamPercentage(percent[3]);
formula.setProjectPercentage(percent[4]);
formula.setQuizPercentage(percent[5]);
try {
formula = new FormulaServiceImpl().addFormula(formula, subject.getId(), teacher.getId());
} catch (GradingFactorException e) {
e.printStackTrace();
}
if (formula != null) {
new FormulaHelper(Teacher_GradingFactor_Activity_Midterm.this).saveUser(teacher.getId() + "-midterm", formula.getId());
Intent intent = new Intent(Teacher_GradingFactor_Activity_Midterm.this, SubjectViewActivity.class);
intent.putExtra("subjectId", subject.getId());
startActivity(intent);
finish();
} else
Toast.makeText(Teacher_GradingFactor_Activity_Midterm.this, "Please try again", Toast.LENGTH_SHORT).show();
}
});
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, values);
spinnerm.setAdapter(spinnerAdapter);
aSwitch1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// do something when check is selected
linearLayout1.setVisibility(View.VISIBLE);
} else {
// do something when unchecked
linearLayout1.setVisibility(View.GONE);
}
int x = 0;
percent[0] = 0;
for (int i = 0; i < percent.length; i++) x += percent[i];
textViewm3.setText(x + "%");
seekBar1.setProgress(0);
}
});
aSwitch2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// do something when check is selected
linearLayout2.setVisibility(View.VISIBLE);
} else {
// do something when unchecked
linearLayout2.setVisibility(View.GONE);
}
int x = 0;
percent[1] = 0;
for (int i = 0; i < percent.length; i++) x += percent[i];
textViewm3.setText(x + "%");
seekBar2.setProgress(0);
}
});
aSwitch3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// do something when check is selected
linearLayout3.setVisibility(View.VISIBLE);
} else {
// do something when unchecked
linearLayout3.setVisibility(View.GONE);
}
int x = 0;
percent[2] = 0;
for (int i = 0; i < percent.length; i++) x += percent[i];
textViewm3.setText(x + "%");
seekBar3.setProgress(0);
}
});
aSwitch4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// do something when check is selected
linearLayout4.setVisibility(View.VISIBLE);
} else {
// do something when unchecked
linearLayout4.setVisibility(View.GONE);
}
int x = 0;
percent[3] = 0;
for (int i = 0; i < percent.length; i++) x += percent[i];
textViewm3.setText(x + "%");
seekBar4.setProgress(0);
}
});
aSwitch5.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// do something when check is selected
linearLayout5.setVisibility(View.VISIBLE);
} else {
// do something when unchecked
linearLayout5.setVisibility(View.GONE);
}
int x = 0;
percent[4] = 0;
for (int i = 0; i < percent.length; i++) x += percent[i];
textViewm3.setText(x + "%");
seekBar5.setProgress(0);
}
});
aSwitch6.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// do something when check is selected
linearLayout6.setVisibility(View.VISIBLE);
} else {
// do something when unchecked
linearLayout6.setVisibility(View.GONE);
}
int x = 0;
percent[5] = 0;
for (int i = 0; i < percent.length; i++) x += percent[i];
textViewm3.setText(x + "%");
seekBar6.setProgress(0);
}
});
seekBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
int x = 0;
for (int count = 0; count < percent.length; count++) {
if (count == 0)
continue;
x += percent[count];
}
if ((x + i) <= 100) {
percent[0] = i;
textView1.setText(i + "");
;
textViewm3.setText(x + percent[0] + "%");
} else if ((x + i) > 100) {
percent[0] = 100 - x;
textView1.setText(percent[0] + "");
;
textViewm3.setText((x + percent[0]) + "%");
seekBar.setProgress(percent[0]);
} else
percent[0] = 0;
}
@Override
public void onStartTrackingTouch(SeekBar bar) {
}
@Override
public void onStopTrackingTouch(SeekBar bar) {
}
});
seekBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
int x = 0;
for (int count = 0; count < percent.length; count++) {
if (count == 1)
continue;
x += percent[count];
}
if ((x + i) <= 100) {
percent[1] = i;
textView2.setText(i + "");
;
textViewm3.setText(x + percent[1] + "%");
} else if ((x + i) > 100) {
percent[1] = 100 - x;
textView2.setText(percent[1] + "");
;
textViewm3.setText((x + percent[1]) + "%");
seekBar.setProgress(percent[1]);
} else
percent[1] = 0;
}
@Override
public void onStartTrackingTouch(SeekBar bar) {
}
@Override
public void onStopTrackingTouch(SeekBar bar) {
}
});
seekBar3.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
int x = 0;
for (int count = 0; count < percent.length; count++) {
if (count == 2)
continue;
x += percent[count];
}
if ((x + i) <= 100) {
percent[2] = i;
textView3.setText(i + "");
;
textViewm3.setText(x + percent[2] + "%");
} else if ((x + i) > 100) {
percent[2] = 100 - x;
textView3.setText(percent[2] + "");
;
textViewm3.setText((x + percent[2]) + "%");
seekBar.setProgress(percent[2]);
} else
percent[2] = 0;
}
@Override
public void onStartTrackingTouch(SeekBar bar) {
}
@Override
public void onStopTrackingTouch(SeekBar bar) {
}
});
seekBar4.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
int x = 0;
for (int count = 0; count < percent.length; count++) {
if (count == 3)
continue;
x += percent[count];
}
if ((x + i) <= 100) {
percent[3] = i;
textView4.setText(i + "");
;
textViewm3.setText(x + percent[3] + "%");
} else if ((x + i) > 100) {
percent[3] = 100 - x;
textView4.setText(percent[3] + "");
;
textViewm3.setText((x + percent[3]) + "%");
seekBar.setProgress(percent[3]);
} else
percent[3] = 0;
}
@Override
public void onStartTrackingTouch(SeekBar bar) {
}
@Override
public void onStopTrackingTouch(SeekBar bar) {
}
});
seekBar5.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
int x = 0;
for (int count = 0; count < percent.length; count++) {
if (count == 4)
continue;
x += percent[count];
}
if ((x + i) <= 100) {
percent[4] = i;
textView5.setText(i + "");
;
textViewm3.setText(x + percent[4] + "%");
} else if ((x + i) > 100) {
percent[4] = 100 - x;
textView5.setText(percent[4] + "");
;
textViewm3.setText((x + percent[4]) + "%");
seekBar.setProgress(percent[4]);
} else
percent[4] = 0;
}
@Override
public void onStartTrackingTouch(SeekBar bar) {
}
@Override
public void onStopTrackingTouch(SeekBar bar) {
}
});
seekBar6.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
int x = 0;
for (int count = 0; count < percent.length; count++) {
if (count == 5)
continue;
x += percent[count];
}
if ((x + i) <= 100) {
percent[5] = i;
textView6.setText(i + "");
;
textViewm3.setText(x + percent[5] + "%");
} else if ((x + i) > 100) {
percent[5] = 100 - x;
textView6.setText(percent[5] + "");
;
textViewm3.setText((x + percent[5]) + "%");
seekBar.setProgress(percent[5]);
} else
percent[5] = 0;
}
@Override
public void onStartTrackingTouch(SeekBar bar) {
}
@Override
public void onStopTrackingTouch(SeekBar bar) {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.remswork.project.alice.model.Teacher in project classify-system by anverliedoit.
the class TeacherController method updateTeacherById.
@RequestMapping(value = "update", method = RequestMethod.POST)
public String updateTeacherById(@RequestParam("id") long id, @RequestParam("firstName") String firstName, @RequestParam("middleName") String middleName, @RequestParam("lastName") String lastName, @RequestParam("email") String email, @RequestParam("departmentId") long departmentId, ModelMap modelMap) {
try {
Teacher newTeacher = new Teacher(firstName, lastName, middleName, email);
try {
teacherService.updateTeacherById(id, newTeacher, departmentId);
} catch (TeacherException e) {
try {
e.printStackTrace();
departmentId = 0;
teacherService.updateTeacherById(id, newTeacher, departmentId);
} catch (TeacherException e2) {
e2.printStackTrace();
}
}
List<Teacher> teacherList = teacherService.getTeacherList();
List<Department> departmentList = departmentService.getDepartmentList();
modelMap.put("teacherList", teacherList);
modelMap.put("departmentList", departmentList);
return "teacher";
} catch (TeacherException | DepartmentException e) {
e.printStackTrace();
return "error";
}
}
Aggregations