} //------------------------------- //this procedure updates the employee information public void UpdateEmployeeInformation(CommonExchange.SysAccess userInfo, CommonExchange.Employee empInfo) { using (RemoteClient.RemCntEmployeeManager remClient = new RemoteClient.RemCntEmployeeManager()) { remClient.UpdateEmployeeInformation(userInfo, empInfo); } Int32 index = 0; foreach (DataRow empRow in _classDataSet.Tables["EmployeeInformationTable"].Rows) { if (String.Equals(empInfo.EmployeeSysId, empRow["sysid_employee"].ToString())) { DataRow editRow = _classDataSet.Tables["EmployeeInformationTable"].Rows[index]; editRow.BeginEdit(); editRow["employee_id"] = empInfo.EmployeeId; editRow["card_number"] = empInfo.CardNumber; editRow["last_name"] = empInfo.PersonInfo.LastName; editRow["first_name"] = empInfo.PersonInfo.FirstName; editRow["middle_name"] = empInfo.PersonInfo.MiddleName; editRow["type_no"] = empInfo.SalaryInfo.EmploymentTypeInfo.TypeNo; editRow["status_id"] = empInfo.SalaryInfo.EmployeeStatusInfo.StatusId; editRow.EndEdit(); break; } index++; } _classDataSet.Tables["EmployeeInformationTable"].AcceptChanges(); } //----------------------------------
} //--------------------------- //this function determines if the employee id already exist public Boolean IsExistsEmployeeIdEmployeeInformation(CommonExchange.SysAccess userInfo, String empId, String sysId) { Boolean isExist = false; using (RemoteClient.RemCntEmployeeManager remClient = new RemoteClient.RemCntEmployeeManager()) { isExist = remClient.IsExistsEmployeeIdEmployeeInformation(userInfo, empId, sysId); } return(isExist); } //----------------------------
} //--------------------------- //this procedure initializes the class private void InitializeClass(CommonExchange.SysAccess userInfo) { //gets the server date and time using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); } //---------------------- //get the dataset for employee information using (RemoteClient.RemCntEmployeeManager remClient = new RemoteClient.RemCntEmployeeManager()) { _classDataSet = remClient.GetDataSetForEmployeeInfo(userInfo); } //--------------------------------- } //--------------------------
}//------------------ //this function will get emplyee information by person system id public CommonExchange.Employee SelectBySysIDPersonEmployeeInformation(CommonExchange.SysAccess userInfo, String personSysId, String startUp) { CommonExchange.Employee employeeInfo = new CommonExchange.Employee(); using (RemoteClient.RemCntEmployeeManager remClient = new RemoteClient.RemCntEmployeeManager()) { employeeInfo = remClient.SelectBySysIDPersonEmployeeInformation(userInfo, personSysId); } employeeInfo.PersonInfo.FilePath = this.GetPersonImagePath(userInfo, employeeInfo.PersonInfo.PersonSysId, employeeInfo.PersonInfo.PersonImagesFolder(startUp)); return(employeeInfo); }//---------------------
} //------------------------------- //this function gets the employee information public CommonExchange.Employee GetDetailsEmployeeInformation(CommonExchange.SysAccess userInfo, String employeeIdPersonId, String startUpPath, Boolean searchByEmployeeId) { CommonExchange.Employee employeeInfo = new CommonExchange.Employee(); using (RemoteClient.RemCntEmployeeManager remClient = new RemoteClient.RemCntEmployeeManager()) { if (searchByEmployeeId) { employeeInfo = remClient.SelectByEmployeeIDEmployeeInformation(userInfo, employeeIdPersonId); } else { employeeInfo = remClient.SelectBySysIDPersonEmployeeInformation(userInfo, employeeIdPersonId); } if (!String.IsNullOrEmpty(employeeInfo.PersonInfo.BirthDate)) { DateTime bDate = DateTime.Parse(employeeInfo.PersonInfo.BirthDate); if (DateTime.Compare(bDate, DateTime.MinValue) == 0) { employeeInfo.PersonInfo.BirthDate = String.Empty; } } if (!String.IsNullOrEmpty(employeeInfo.PersonInfo.MarriageDate)) { DateTime mDate = DateTime.Parse(employeeInfo.PersonInfo.MarriageDate); if (DateTime.Compare(mDate, DateTime.MinValue) == 0) { employeeInfo.PersonInfo.MarriageDate = String.Empty; } } } employeeInfo.PersonInfo.FilePath = base.GetPersonImagePath(userInfo, employeeInfo.PersonInfo.PersonSysId, employeeInfo.PersonInfo.PersonImagesFolder(startUpPath)); return(employeeInfo); } //-----------------------
//this procedure inserts a new employee public void InsertEmployeeInformation(CommonExchange.SysAccess userInfo, CommonExchange.Employee empInfo) { using (RemoteClient.RemCntEmployeeManager remClient = new RemoteClient.RemCntEmployeeManager()) { remClient.InsertEmployeeInformation(userInfo, ref empInfo); } DataRow newRow = _classDataSet.Tables["EmployeeInformationTable"].NewRow(); newRow["sysid_employee"] = empInfo.EmployeeSysId; newRow["employee_id"] = empInfo.EmployeeId; newRow["card_number"] = empInfo.CardNumber; newRow["last_name"] = empInfo.PersonInfo.LastName; newRow["first_name"] = empInfo.PersonInfo.FirstName; newRow["middle_name"] = empInfo.PersonInfo.MiddleName; newRow["type_no"] = empInfo.SalaryInfo.EmploymentTypeInfo.TypeNo; newRow["status_id"] = empInfo.SalaryInfo.EmployeeStatusInfo.StatusId; _classDataSet.Tables["EmployeeInformationTable"].Rows.Add(newRow); _classDataSet.Tables["EmployeeInformationTable"].AcceptChanges(); } //-------------------------------