//###########################################CLASS IDENTIFICATIONSTUDENTUPDATE ClassLoad EVENTS##################################################### //event is raised when the class is loaded protected override void ClassLoad(object sender, EventArgs e) { _employeeInfo = new CommonExchange.Employee(); this.txtIdName.Text = _studentInfo.StudentId; this.txtName.Text = RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(_studentInfo.PersonInfo.LastName, _studentInfo.PersonInfo.FirstName, _studentInfo.PersonInfo.MiddleName); this.txtTypeName.Text = _studentInfo.CourseInfo.CourseTitle; this.txtAddressName.Text = _studentInfo.PersonInfo.PresentAddress; CommonExchange.PersonRelationship emrContact = _identificationManager.GetPersonEmergencyContact(_studentInfo.PersonInfo.PersonRelationshipList); this.txtEmerName.Text = RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(emrContact.PersonInRelationshipWith.LastName, emrContact.PersonInRelationshipWith.FirstName, emrContact.PersonInRelationshipWith.MiddleName); this.txtEmerAddress.Text = emrContact.PersonInRelationshipWith.PresentAddress; this.txtEmerPhone.Text = emrContact.PersonInRelationshipWith.PresentPhoneNos; this.txtRelationship.Text = emrContact.RelationshipTypeInfo.RelationshipDescription; this.txtCardNumber.Text = _studentInfo.CardNumber; if (!String.IsNullOrEmpty(_studentInfo.PersonInfo.FilePath)) { this.pbxPhoto.Image = Image.FromFile(_studentInfo.PersonInfo.FilePath); } }
}//------------------------- //this procedure will update person relationship information public void UpdatePersonRelationship(List <CommonExchange.PersonRelationship> personRelationshipList, CommonExchange.PersonRelationship personRelationshipInfo) { Int32 index = 0; if (personRelationshipInfo.IsEmergencyContact) { foreach (CommonExchange.PersonRelationship list in personRelationshipList) { if (list.RelationshipId != personRelationshipInfo.RelationshipId) { list.IsEmergencyContact = false; } } } foreach (CommonExchange.PersonRelationship list in personRelationshipList) { if (list.RelationshipId == personRelationshipInfo.RelationshipId) { personRelationshipList.RemoveAt(index); break; } index++; } personRelationshipList.Add(personRelationshipInfo); }//-------------------------
}//-------------------------- //this function will get person emergency contact public CommonExchange.PersonRelationship GetPersonEmergencyContact(List <CommonExchange.PersonRelationship> personRelationshipList) { CommonExchange.PersonRelationship personRelationshipInfo = new CommonExchange.PersonRelationship(); foreach (CommonExchange.PersonRelationship list in personRelationshipList) { if (list.IsEmergencyContact) { personRelationshipInfo = list; break; } } return(personRelationshipInfo); }//--------------------------
public PersonRelationshipUpdate(CommonExchange.SysAccess userInfo, BaseServicesLogic baseServiceManager, CommonExchange.PersonRelationship personRelationshipInfo, String personSysId) : base(userInfo, baseServiceManager, personSysId) { this.InitializeComponent(); _userInfo = userInfo; _baseServiceManager = baseServiceManager; _personRelationshipInfo = personRelationshipInfo; _personRelationshipInfoTemp = (CommonExchange.PersonRelationship)personRelationshipInfo.Clone(); this.FormClosing += new FormClosingEventHandler(ClassClosing); this.btnClose.Click += new EventHandler(btnCloseClick); this.btnUpdate.Click += new EventHandler(btnUpdateClick); this.btnDelete.Click += new EventHandler(btnDeleteClick); }
}//------------------------ //this fucntion will returns Employee Details public CommonExchange.Employee GetDetailsEmployeeInformation(CommonExchange.SysAccess userInfo, String studentEmployeeId, String startUp) { CommonExchange.Employee employeeInfo = new CommonExchange.Employee(); String strFilter = "student_employee_id = '" + studentEmployeeId + "'"; DataRow[] selectRow = _studentEmployeeTable.Select(strFilter, "student_employee_id ASC"); foreach (DataRow row in selectRow) { employeeInfo.EmployeeSysId = RemoteServerLib.ProcStatic.DataRowConvert(row, "sysid_student_employee", ""); employeeInfo.EmployeeId = RemoteServerLib.ProcStatic.DataRowConvert(row, "student_employee_id", ""); employeeInfo.CardNumber = RemoteServerLib.ProcStatic.DataRowConvert(row, "card_number", ""); employeeInfo.PersonInfo.LastName = RemoteServerLib.ProcStatic.DataRowConvert(row, "last_name", ""); employeeInfo.PersonInfo.FirstName = RemoteServerLib.ProcStatic.DataRowConvert(row, "first_name", ""); employeeInfo.PersonInfo.MiddleName = RemoteServerLib.ProcStatic.DataRowConvert(row, "middle_name", ""); employeeInfo.PersonInfo.PresentAddress = RemoteServerLib.ProcStatic.DataRowConvert(row, "present_address", ""); employeeInfo.SalaryInfo.DepartmentInfo.DepartmentName = RemoteServerLib.ProcStatic.DataRowConvert(row, "course_title_department_name", ""); employeeInfo.SalaryInfo.DepartmentInfo.Acronym = RemoteServerLib.ProcStatic.DataRowConvert(row, "acronym_employment_type", ""); employeeInfo.PersonInfo.PersonSysId = RemoteServerLib.ProcStatic.DataRowConvert(row, "sysid_person", ""); if (employeeInfo.PersonInfo.PersonRelationshipList.Count < 1) { CommonExchange.PersonRelationship personRelationshipInfo = new CommonExchange.PersonRelationship(); personRelationshipInfo.IsEmergencyContact = true; personRelationshipInfo.PersonInRelationshipWith.LastName = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_last_name", ""); personRelationshipInfo.PersonInRelationshipWith.FirstName = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_first_name", ""); personRelationshipInfo.PersonInRelationshipWith.MiddleName = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_middle_name", ""); personRelationshipInfo.PersonInRelationshipWith.PresentAddress = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_present_address", ""); personRelationshipInfo.PersonInRelationshipWith.PresentPhoneNos = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_present_phone_nos", ""); personRelationshipInfo.PersonInRelationshipWith.HomeAddress = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_home_address", ""); personRelationshipInfo.PersonInRelationshipWith.HomePhoneNos = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_home_phone_nos", ""); personRelationshipInfo.RelationshipTypeInfo.RelationshipDescription = RemoteServerLib.ProcStatic.DataRowConvert(row, "emer_relationship_description", ""); employeeInfo.PersonInfo.PersonRelationshipList.Add(personRelationshipInfo); } break; } employeeInfo.PersonInfo.FilePath = this.GetPersonImagePath(userInfo, employeeInfo.PersonInfo.PersonSysId, employeeInfo.PersonInfo.PersonImagesFolder(startUp)); return(employeeInfo); }//------------------------
}//------------------------- //this fucntion will get person relationship public CommonExchange.PersonRelationship GetDetailsPersonRelationship(CommonExchange.SysAccess userInfo, List <CommonExchange.PersonRelationship> personRelationshipList, String relationshipId, String startUp) { CommonExchange.PersonRelationship personRelationship = new CommonExchange.PersonRelationship(); foreach (CommonExchange.PersonRelationship list in personRelationshipList) { if (String.Equals(list.RelationshipId.ToString(), relationshipId)) { personRelationship = list; personRelationship.PersonInRelationshipWith.FilePath = this.GetPersonImagePath(userInfo, personRelationship.PersonInRelationshipWith.PersonSysId, personRelationship.PersonInRelationshipWith.PersonImagesFolder(startUp)); break; } } return(personRelationship); }//-----------------------------
}//-------------------------- //this procedure will Edit StudentEmployee Data Table private void EditStudentEmployeeDataTable(CommonExchange.Student studentInfo, CommonExchange.Employee employeeInfo, Boolean isStudent) { if (_studentEmployeeTable != null) { Int32 index = 0; foreach (DataRow studentRow in _studentEmployeeTable.Rows) { if (isStudent && String.Equals(studentInfo.StudentSysId, RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "sysid_student_employee", String.Empty))) { DataRow editRow = _studentEmployeeTable.Rows[index]; editRow.BeginEdit(); editRow["sysid_student_employee"] = studentInfo.StudentSysId; editRow["student_employee_id"] = studentInfo.StudentId; editRow["card_number"] = studentInfo.CardNumber; editRow["last_name"] = studentInfo.PersonInfo.LastName; editRow["first_name"] = studentInfo.PersonInfo.FirstName; editRow["middle_name"] = studentInfo.PersonInfo.MiddleName; editRow["present_address"] = studentInfo.PersonInfo.PresentAddress; editRow["course_title_department_name"] = studentInfo.CourseInfo.CourseTitle; editRow["acronym_employment_type"] = studentInfo.CourseInfo.Acronym; CommonExchange.PersonRelationship personRelationship = this.GetPersonEmergencyContact(studentInfo.PersonInfo.PersonRelationshipList); editRow["emer_last_name"] = personRelationship.PersonInRelationshipWith.LastName; editRow["emer_first_name"] = personRelationship.PersonInRelationshipWith.FirstName; editRow["emer_middle_name"] = personRelationship.PersonInRelationshipWith.MiddleName; editRow["emer_present_address"] = personRelationship.PersonInRelationshipWith.PresentAddress; editRow["emer_present_phone_nos"] = personRelationship.PersonInRelationshipWith.PresentPhoneNos; editRow["emer_relationship_description"] = personRelationship.RelationshipTypeInfo.RelationshipDescription; editRow["is_student"] = true; editRow.EndEdit(); break; } else if (!isStudent && String.Equals(employeeInfo.EmployeeSysId, RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "sysid_student_employee", String.Empty))) { DataRow editRow = _studentEmployeeTable.Rows[index]; editRow.BeginEdit(); editRow["sysid_student_employee"] = employeeInfo.EmployeeSysId; editRow["student_employee_id"] = employeeInfo.EmployeeId; editRow["card_number"] = employeeInfo.CardNumber; editRow["last_name"] = employeeInfo.PersonInfo.LastName; editRow["first_name"] = employeeInfo.PersonInfo.FirstName; editRow["middle_name"] = employeeInfo.PersonInfo.MiddleName; editRow["present_address"] = employeeInfo.PersonInfo.PresentAddress; editRow["course_title_department_name"] = employeeInfo.SalaryInfo.DepartmentInfo.DepartmentName; editRow["acronym_employment_type"] = employeeInfo.SalaryInfo.DepartmentInfo.Acronym; CommonExchange.PersonRelationship personRelationship = this.GetPersonEmergencyContact(employeeInfo.PersonInfo.PersonRelationshipList); editRow["emer_last_name"] = personRelationship.PersonInRelationshipWith.LastName; editRow["emer_first_name"] = personRelationship.PersonInRelationshipWith.FirstName; editRow["emer_middle_name"] = personRelationship.PersonInRelationshipWith.MiddleName; editRow["emer_present_address"] = personRelationship.PersonInRelationshipWith.PresentAddress; editRow["emer_present_phone_nos"] = personRelationship.PersonInRelationshipWith.PresentPhoneNos; editRow["emer_relationship_description"] = personRelationship.RelationshipTypeInfo.RelationshipDescription; editRow["is_student"] = false; editRow.EndEdit(); break; } index++; } _studentEmployeeTable.AcceptChanges(); } }//-----------------
//####################################################CLASS PersonRelationship EVENTS############################################### //event is raised when the class is loaded protected virtual void ClassLoad(object sender, EventArgs e) { _personRelationshipInfo = new CommonExchange.PersonRelationship(); _baseServiceManager.InitializePersonRelationshipTypeCombo(this.cboRelationshipType); }//--------------------------------