public bool CreateTeacher(ref Teacher teacher, ref string message) { Boolean ret = false; ; TeacherBDO tbdo = new TeacherBDO(); TranslateTeacherDTOToTeacherBDO(teacher, tbdo); ret = tLogic.CreateTeacher(ref tbdo, ref message); return ret; }
public Teacher GetTeacher(string teacherId, ref string message) { Teacher teacher = new Teacher(); TeacherBDO tbdo = tLogic.GetTeacher(teacherId); if (tbdo != null) { TranslateTeacherBDOToTeacherDTO(tbdo, teacher); } else message = "Teacher Does Not Exists"; return teacher; }
public Teacher GetTeacher(string lname, string fname, string mname) { string message = String.Empty; Teacher teacher = new Teacher(); TeacherBDO tbdo = tLogic.GetTeacher(lname, fname, mname); if (tbdo != null) { TranslateTeacherBDOToTeacherDTO(tbdo, teacher); } else message = "Teacher Does Not Exists"; return teacher; }
private void cmbGradeLevel_SelectedValueChanged(object sender, EventArgs e) { string msg = string.Empty; if (cmbGradeLevel.SelectedIndex != -1) { sections = new List<GradeSection>(gsService.GetAllSectionsForGrade(cmbGradeLevel.SelectedValue.ToString())); cmbSection.DataSource = sections; cmbSection.SelectedIndex = 0; gradeSection = sections.Find(x => x.GradeSectionCode == int.Parse(cmbSection.SelectedValue.ToString())); if (gradeSection != null) teach = gsService.GetTeacherDetail(gradeSection.HomeRoomTeacherId, ref msg); } }
public Teacher ActivateTeacher(string fname, string mname, string lname) { String message = " "; Teacher teacher = new Teacher(); TeacherBDO tbdo = new TeacherBDO(); tbdo = tLogic.GetTeacher(lname, fname, mname); if (tbdo == null) { return null; } else { tbdo.Deactivated = false; tLogic.UpdateTeacher(ref tbdo, ref message); TranslateTeacherBDOToTeacherDTO(tbdo, teacher); return teacher; } }
public void TranslateGradeSectionBDOToGradeSection(GradeSectionBDO gs, GradeSection gsb) { RoomService rService = new RoomService(); Room room = new Room(); TeacherService tService = new TeacherService(); Teacher teacher = new Teacher(); string message = string.Empty; room = rService.GetRoom(gs.HomeRoomNumber); teacher = tService.GetTeacher(gs.HomeRoomTeacherId, ref message); gsb.Deactivated = gs.Deactivated; gsb.GradeLevel = gs.GradeLevel; gsb.GradeSectionCode = gs.GradeSectionCode; gsb.HomeRoom = room; gsb.HomeRoomNumber = gs.HomeRoomNumber; gsb.HomeRoomTeacherId = gs.HomeRoomTeacherId; gsb.HomeRoomTeacher = teacher; if (teacher.MiddleName == String.Empty) gsb.TeacherName = teacher.LastName + ", " + teacher.FirstName; else gsb.TeacherName = teacher.LastName + ", " + teacher.FirstName + " " + teacher.MiddleName.Substring(0, 1); gsb.Class = gs.Class; gsb.SY = gs.SY; gsb.Section = gs.Section; }
private void gvTeacher_SelectionChanged(object sender, EventArgs e) { int selectedIndex = -1; if (gvTeacher.CurrentRow != null) selectedIndex = gvTeacher.CurrentRow.Index; if (selectedIndex >= 0) { string tID = gvTeacher.Rows[selectedIndex].Cells["TeacherId"].Value.ToString(); List<Teacher> item = new List<Teacher>(); item = teacherList.FindAll(x => x.TeacherId.ToString() == tID); teacherSelected = new Teacher(); teacherSelected = (Teacher)item[0]; } }
private void frmAdvisersLoad_Load(object sender, EventArgs e) { IGradeSectionService gService = new GradeSectionService(); sy = GlobalClass.currentsy; string fname = GlobalClass.user.FirstName; string lname = GlobalClass.user.LastName; string mname = GlobalClass.user.MiddleName; teacher = new Teacher() { FirstName = fname }; teacher = gService.GetTeacher(lname, mname, fname); LoadGradeSections(); }
private void btnAddSchedule_Click(object sender, EventArgs e) { if (cmbGradeLevel.Text != string.Empty && cmbSection.Text != string.Empty && cmbTimeslot.Text != string.Empty && cmbSubject.Text != string.Empty && cmbTeacher.Text != string.Empty && cmbRoom.Text != string.Empty) { Timeslot t = new Timeslot(); t = timeslots.Find(x => x.TimeSlotCode == cmbTimeslot.SelectedValue.ToString()); GradeSection gs = new GradeSection(); gs = sections.Find(x => x.GradeSectionCode == sectioncode); Subject su = new Subject(); su = subjects.Find(x => x.SubjectCode == cmbSubject.SelectedValue.ToString()); Room rm = new Room(); rm = rooms.Find(x => x.RoomId == Int32.Parse(cmbRoom.SelectedValue.ToString())); Teacher tc = new Teacher(); tc = teachers.Find(x => x.TeacherId == cmbTeacher.SelectedValue.ToString()); SubjectAssignment sa = new SubjectAssignment(); sa.GradeLevel = cmbGradeLevel.SelectedValue.ToString() ; sa.TeacherName = cmbTeacher.Text; sa.SY = currentSY; sa.Subject = su; sa.SubjectCode = su.SubjectCode; sa.SubjectDescription = su.Description; sa.TimeslotInfo = t.TimeSlotInfo; sa.TimeSlotCode = t.TimeSlotCode; sa.Room = rm; sa.RoomId = rm.RoomId; sa.RoomCode = rm.RoomCode; sa.Teacher = tc; sa.TeacherId = tc.TeacherId; sa.Section = section; sa.GradeSection = gs; sa.GradeSectionCode = gs.GradeSectionCode; sa.Timeslot = t; sa.Timestart = t.TimeStart; sa.TimeEnd = t.TimeEnd; sa.Days = t.Days; sa.Deactivated = false; createdSchedule.Add(sa); schedules.Add(sa); cmbTimeslot.DataSource = null; availTimeSlot.RemoveAll(x => x.TimeSlotCode == t.TimeSlotCode); if (availTimeSlot.Count > 0) { cmbTimeslot.DataSource = availTimeSlot; cmbTimeslot.SelectedIndex = 0; cmbTimeslot.Refresh(); } else cmbTimeslot.Enabled = false; gvSchedule.DataSource = null; gvSchedule.DataSource = schedules.FindAll(x => x.GradeSectionCode == sectioncode); gvSchedule.Refresh(); // LoadSchedules(); } }
public void TranslateScheduleBDOToSchedule(SubjectAssignmentBDO sabdo, SubjectAssignment sched) { GradeSectionService gs = new GradeSectionService(); GradeSection g = new GradeSection(); gs.TranslateGradeSectionBDOToGradeSection(sabdo.GradeSection, g); sched.GradeSection = g; sched.Section = g.Section; sched.GradeLevel = g.GradeLevel; sched.Class = (int)g.Class; RoomService rs = new RoomService(); Room r = new Room(); rs.TranslateRoomBDOtoRoomDTO(sabdo.Room, r); sched.Room = r; sched.RoomCode = r.RoomCode; SubjectService ss = new SubjectService(); Subject s = new Subject(); ss.TranslateSubjectBDOToSubject(sabdo.Subject, s); sched.Subject = s; TeacherService ts = new TeacherService(); Teacher t = new Teacher(); ts.TranslateTeacherBDOToTeacherDTO(sabdo.Teacher, t); sched.Teacher = t; if (t.MiddleName == String.Empty) sched.TeacherName = t.LastName + ", " + t.FirstName; else sched.TeacherName = t.LastName + ", " + t.FirstName + " " + t.MiddleName.Substring(0, 1) + "."; TimeslotService times = new TimeslotService(); Timeslot time = new Timeslot(); times.TranslateTimeslotBDOToTimeslotDTo(sabdo.Timeslot, time); sched.Timeslot = time; sched.Timestart = time.TimeStart; sched.TimeEnd = time.TimeEnd; sched.Days = time.Days; sched.Deactivated = sabdo.Deactivated; sched.GradeSectionCode = sabdo.GradeSectionCode; sched.RoomId = sabdo.RoomId; sched.SubjectAssignmentsID = sabdo.SubjectAssignmentsID; sched.SubjectCode = sabdo.SubjectCode; sched.SY = sabdo.SY; sched.TeacherId = sabdo.TeacherId; sched.TimeSlotCode = sabdo.TimeSlotCode; sched.TimeslotInfo = time.Days + " " + time.TimeStart + "-" + time.TimeEnd; sched.SubjectInfo = sabdo.SubjectCode + " " + sched.Section + " " + sched.TimeslotInfo; sched.SubjectDescription = s.Description; }
private void Save() { string szGender = string.Empty; string szBloodType = string.Empty; bool acad = false; if (cmbGender.Text == "Female") szGender = "F"; if (cmbGender.Text == "Male") szGender = "M"; if (cmbBloodType.Text == "A") szBloodType = "A"; if (cmbBloodType.Text == "O") szBloodType = "O"; if (cmbBloodType.Text == "AB") szBloodType = "AB"; if (cmbBloodType.Text == "A") szBloodType = "A"; if (radioAcademic.Checked == true && radioNonAcad.Checked == false) acad = true; else if (radioAcademic.Checked == false && radioNonAcad.Checked == true) acad = false; else if (radioAcademic.Checked == false && radioNonAcad.Checked == false) acad = false; Boolean ret = false; string message = String.Empty; byte[] bImage = null; if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png); TeacherService teacherService = new TeacherService(); String fName = txtFirstName.Text; String mName = txtMiddleName.Text; String lName = txtLastName.Text; String cName = fName.Trim() + mName.Trim() + lName.Trim(); var teachers = teacherService.GetAllTeachers(); teacherCompare = new List<Teacher>(teachers); Teacher teacher = new Teacher() { TeacherId = txtTeacherID.Text, BloodType = szBloodType, CivilStatus = cmbCivilState.Text, DOB = dtBirth.Value, DateOfAppointment = dtAppointment.Value, EmailAddress = txtEmailAdd.Text, EmploymentStatus = txtEmploymentState.Text, DialectSpoken = txtDialect.Text, FirstName = txtFirstName.Text, MiddleName = txtMiddleName.Text, LastName = txtLastName.Text, Gender = szGender, HeightCm = int.Parse(txtHeight.Text), WeightKg = double.Parse(txtWeight.Text), MobileNo = txtCellphone.Text, PAMunicipality = txtPA_Municipality.Text, PAProvince = txtPA_Province.Text, PARegion = cmbPA_Region.SelectedValue.ToString(), PAStreetName = txtPA_StreetName.Text, POBMunicipality = txtPOB_Municipality.Text, POBProvince = txtPOB_Province.Text, PagIBIGNo = txtPagIbig.Text, PhilHealthNo = txtPhilHealth.Text, PreviousSchool = txtSchoolReassigned.Text, RAMunicipality = txtRes_Municipality.Text, RAProvince = txtRes_Province.Text, RARegion = cmbRes_Region.SelectedValue.ToString(), RAStreetName = txtRes_StreetName.Text, ResTelephoneNo = txtRes_TelNo.Text, SSSNum = txtSSS.Text, SpouseBusinessAdd = txtSpouse_BusinessAdd.Text, SpouseEmployerName = txtSpouse_Employer.Text, SpouseFirstName = txtSpouse_FirstName.Text, SpouseLastName = txtSpouse_LastName.Text, SpouseMiddleName = txtSpouse_MiddleName.Text, SpouseOccupation = txtSpouse_Occupation.Text, SpouseTelephoneNo = txtSpouse_Contact.Text, TIN = txtTIN.Text, Image = bImage, PERAA = txtPERAA.Text, Academic = acad, Salary = double.Parse(txtSalary.Text), Department = txtDepartment.Text, TeacherChildrens = teachChild, TeacherEducationalBackgrounds = educBack, TeacherEligibilities = teachElig, WorkExperiences = workExp, TrainingSeminars=trainSem, }; if (Op.Equals("edit")) { ret = teacherService.UpdateTeacher(ref teacher, ref message); ILogService logService = new LogService(); teacher.TeacherChildrens = null; teacher.TeacherEducationalBackgrounds = null; teacher.TeacherEligibilities = null; teacher.TrainingSeminars = null; teacher.WorkExperiences = null; Log("U", "Teachers", teacher); foreach (TeacherChildren tc in teachChild) Log("U", "TeacherChildren", tc); foreach (TeacherEducationalBackground teb in educBack) Log("U", "TeacherEducationalBackground", teb); foreach (TeacherEligibility te in teachElig) Log("U", "TeacherEligibilities", te); foreach (WorkExperience we in workExp) Log("U", "WorkExperiences", we); foreach (TrainingSeminar ts in trainSem) Log("U", "TrainingSeminars", ts); } else { foreach (Teacher tc in teacherCompare) { String compareString = tc.FirstName.Trim() + tc.MiddleName.Trim() + tc.LastName.Trim(); if (cName.Equals(compareString)) { MessageBox.Show("Teacher already exist!"); break; } else { ret = teacherService.CreateTeacher(ref teacher, ref message); Log("C", "Teachers", teacher); } } } // if (ret) MessageBox.Show("Saved Successfully"); //else // MessageBox.Show("Error Saving"); Close(); }
private void txtTeacherID_Leave(object sender, EventArgs e) { Teacher teach = new Teacher(); string msg = string.Empty; ITeacherService teacherService = new TeacherService(); if (txtTeacherID.Text == string.Empty) txtTeacherID.Text = szTeacherID; teach = teacherService.GetTeacher(txtTeacherID.Text, ref msg); if (teach.TeacherId != null) { MessageBox.Show("Teacher ID already exist!"); txtTeacherID.Text = szTeacherID; txtTeacherID.Focus(); return; } }
private void cmbSection_SelectedValueChanged(object sender, EventArgs e) { string msg = string.Empty; if (gradeSection != null) teach = gsService.GetTeacherDetail(gradeSection.HomeRoomTeacherId, ref msg); }
public bool UpdateTeacher(ref Teacher teacher, ref string message) { TeacherBDO tbdo = new TeacherBDO(); TranslateTeacherDTOToTeacherBDO(teacher, tbdo); return tLogic.UpdateTeacher(ref tbdo, ref message); }
public void TranslateTeacherBDOToTeacherDTO(TeacherBDO teacher, Teacher tb) { if (teacher.MiddleName.Length > 0) tb.TeacherName = teacher.LastName + ", " + teacher.FirstName + " " + teacher.MiddleName.Substring(0, 1) + "."; else tb.TeacherName = teacher.LastName + ", " + teacher.FirstName; tb.BloodType = teacher.BloodType; tb.CivilStatus = teacher.CivilStatus; tb.DateOfAppointment = (DateTime)teacher.DateOfAppointment; tb.Deactivated = teacher.Deactivated; tb.DialectSpoken = teacher.DialectSpoken; tb.DOB = (DateTime)teacher.DOB; tb.EmailAddress = teacher.EmailAddress; tb.EmploymentStatus = teacher.EmploymentStatus; tb.FirstName = teacher.FirstName; tb.Gender = teacher.Gender; tb.HeightCm = (int)teacher.HeightCm; tb.LastName = teacher.LastName; tb.MiddleName = teacher.MiddleName; tb.MobileNo = teacher.MobileNo; tb.PagIBIGNo = teacher.PagIBIGNo; tb.PAMunicipality = teacher.PAMunicipality; tb.PAProvince = teacher.PAProvince; tb.PARegion = teacher.PARegion; tb.PAStreetName = teacher.PAStreetName; tb.PhilHealthNo = teacher.PhilHealthNo; tb.POBMunicipality = teacher.POBMunicipality; tb.POBProvince = teacher.POBProvince; tb.PreviousSchool = teacher.PreviousSchool; tb.RAMunicipality = teacher.RAMunicipality; tb.RAProvince = teacher.RAProvince; tb.RARegion = teacher.RARegion; tb.RAStreetName = teacher.RAStreetName; tb.ResTelephoneNo = teacher.ResTelephoneNo; tb.SpouseBusinessAdd = teacher.SpouseBusinessAdd; tb.SpouseEmployerName = teacher.SpouseEmployerName; tb.SpouseFirstName = teacher.SpouseFirstName; tb.SpouseLastName = teacher.SpouseLastName; tb.SpouseMiddleName = teacher.SpouseMiddleName; tb.SpouseOccupation = teacher.SpouseOccupation; tb.SpouseTelephoneNo = teacher.SpouseTelephoneNo; tb.SSSNum = teacher.SSSNum; tb.TeacherId = teacher.TeacherId; tb.TIN = teacher.TIN; tb.WeightKg = (double)teacher.WeightKg; tb.Image = teacher.Image; tb.PERAA = teacher.PERAA; tb.Academic = teacher.Academic; tb.TeacherChildrens = ToChildrenDTO(teacher.TeacherChildrens); tb.TeacherEligibilities = ToEligibilityDTO(teacher.TeacherEligibilities); tb.TeacherEducationalBackgrounds = ToEducBacDTO(teacher.TeacherEducationalBackgrounds); tb.TrainingSeminars = ToTrainSemDTO(teacher.TrainingSeminars); tb.WorkExperiences = ToWorkExpDTO(teacher.WorkExperiences); tb.Academic = teacher.Academic; tb.Salary = teacher.Salary; tb.Department = teacher.Department; }
public List<Teacher> ToTeacherList(List<TeacherBDO> tc) { List<Teacher> tList = new List<Teacher>(); foreach (TeacherBDO t in tc) { Teacher to = new Teacher(); TranslateTeacherBDOToTeacherDTO(t, to); tList.Add(to); } return tList; }