}//---------------------------- //this function will get person details public CommonExchange.Person GetPersonDetails(CommonExchange.SysAccess userInfo, String personSysId, String startUp) { CommonExchange.Person personInfo = new CommonExchange.Person(); using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { personInfo = remClient.SelectBySysIDPersonInformation(userInfo, personSysId); if (!String.IsNullOrEmpty(personInfo.BirthDate)) { DateTime bDate = DateTime.Parse(personInfo.BirthDate); if (DateTime.Compare(bDate, DateTime.MinValue) == 0) { personInfo.BirthDate = String.Empty; } } if (!String.IsNullOrEmpty(personInfo.MarriageDate)) { DateTime mDate = DateTime.Parse(personInfo.MarriageDate); if (DateTime.Compare(mDate, DateTime.MinValue) == 0) { personInfo.MarriageDate = String.Empty; } } } personInfo.FilePath = this.GetPersonImagePath(userInfo, personSysId, personInfo.PersonImagesFolder(startUp)); return(personInfo); }//---------------------
//this procedure will insert update personal information public void InsertUpdatePersonInformation(CommonExchange.SysAccess userInfo, ref CommonExchange.Person personInfo) { using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { remClient.InsertUpdatePersonInformation(userInfo, ref personInfo); } }//--------------------------
//this procedure will Initialized the class private void InitializedClass(CommonExchange.SysAccess userInfo) { //get server date time using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); } }//-------------------------
}//------------------------- #endregion #region Programmers Defined Functions public void InitializeClass(CommonExchange.SysAccess userInfo) { //get the server Date and Time using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); } //--------------------- } //----------------------
public BaseServicesLogic(CommonExchange.SysAccess userInfo) { //get the server date and time and class dataset using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); _classDataSet = remClient.GetDataSetForBaseServices(userInfo); }//--------------------- }
}//------------------------- //this fucntion will determine if the person is already a student or employee public Boolean IsExistsSysIDPersonStudentEmployeeInformation(CommonExchange.SysAccess userInfo, String sysIdPerson, ref Boolean isEmployee) { Boolean value = false; using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { value = remClient.IsExistsSysIDPersonStudentEmployeeInformation(userInfo, sysIdPerson, ref isEmployee); } return(value); }//-------------------------
}//-------------------------- //this function gets the student image path public String GetPersonImagePath(CommonExchange.SysAccess userInfo, String personSysIdList, String imagePath) { RemoteClient.ProcStatic.DeleteDirectory(imagePath); //creates the directory DirectoryInfo dirInfo = new DirectoryInfo(imagePath); dirInfo.Create(); dirInfo.Attributes = FileAttributes.Hidden; DataTable imageTable; using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { imageTable = remClient.SelectPersonImagesPersonInformation(userInfo, personSysIdList); } using (DataTableReader tableReader = new DataTableReader(imageTable)) { if (tableReader.HasRows) { Int32 picColumn = 1; while (tableReader.Read()) { if (!tableReader.IsDBNull(picColumn)) { imagePath += tableReader["original_name"].ToString(); long len = tableReader.GetBytes(picColumn, 0, null, 0, 0); // Create a buffer to hold the bytes, and then // read the bytes from the DataTableReader. Byte[] buffer = new Byte[len]; tableReader.GetBytes(picColumn, 0, buffer, 0, (int)len); // Create a new Bitmap object, passing the array // of bytes to the constructor of a MemoryStream. using (Bitmap studentImage = new Bitmap(new MemoryStream(buffer))) { studentImage.Save(imagePath); } } } } else { imagePath = null; } tableReader.Close(); } return(imagePath); } //------------------------------
}//--------------------------- //this procedure will initialize class private void InitializeClass(CommonExchange.SysAccess userInfo) { //get the server date and time using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); }//--------------------- //get class Data Set using (RemoteClient.RemCntAccountingManager remClient = new RemoteClient.RemCntAccountingManager()) { _classDataSet = remClient.GetDataSetForAccounting(userInfo); } //-------------------- } //---------------------------
//this will initialize 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); } //---------------------- //gets the dataset for the course manager using (RemoteClient.RemCntMajorExamScheduleManager remClient = new RemoteClient.RemCntMajorExamScheduleManager()) { _classDataSet = remClient.GetDataSetForMajorExamSchedule(userInfo, _serverDateTime); } //----------------------- } //-------------------------------
//this procedure will initialize the class private void InitializeClass(CommonExchange.SysAccess userInfo) { //get the server date and time using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); }//--------------------- //the the dataset administrator manager using (RemoteClient.RemCntAdministratorManager remClient = new RemoteClient.RemCntAdministratorManager()) { _classDataSet = remClient.GetDataSetForAdministrator(userInfo); } //------------------ } //-------------------------
} //--------------------------- //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 procedure will initialized 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 dataset for scholarship manager using (RemoteClient.RemCntScholarshipManager remClient = new RemoteClient.RemCntScholarshipManager()) { _classDataSet = remClient.GetDataSetForScholarship(userInfo, _serverDateTime); } }//-------------------------
}//------------------------- #endregion #region Programmer-Defined Functions //this function will get searched person information public DataTable GetSearchPersonInformation(CommonExchange.SysAccess userInfo, String queryString, String lastName, String firstName, String personSysIdExcludedList, Boolean isNewQuery) { if (isNewQuery) { using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _personTable = remClient.SelectPersonInformation(userInfo, queryString, lastName, firstName, personSysIdExcludedList); } } DataTable newTable = new DataTable("PersonTable"); newTable.Columns.Add("person_name", System.Type.GetType("System.String")); newTable.Columns.Add("birthdate", System.Type.GetType("System.String")); newTable.Columns.Add("present_address", System.Type.GetType("System.String")); newTable.Columns.Add("present_phone_nos", System.Type.GetType("System.String")); newTable.Columns.Add("life_status_code_code_description", System.Type.GetType("System.String")); newTable.Columns.Add("gender_code_code_description", System.Type.GetType("System.String")); if (_personTable != null) { foreach (DataRow pRow in _personTable.Rows) { DataRow newRow = newTable.NewRow(); newRow["person_name"] = RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(pRow, "last_name", "first_name", "middle_name"); DateTime dValue = DateTime.Parse(_serverDateTime); if (DateTime.TryParse(RemoteServerLib.ProcStatic.DataRowConvert(pRow, "birthdate", ""), out dValue)) { newRow["birthdate"] = DateTime.Compare(dValue, DateTime.MinValue) == 0 ? String.Empty : dValue.ToLongDateString(); } newRow["present_address"] = RemoteServerLib.ProcStatic.DataRowConvert(pRow, "present_address", ""); newRow["present_phone_nos"] = RemoteServerLib.ProcStatic.DataRowConvert(pRow, "present_phone_nos", ""); newRow["life_status_code_code_description"] = RemoteServerLib.ProcStatic.DataRowConvert(pRow, "life_status_code_code_description", ""); newRow["gender_code_code_description"] = RemoteServerLib.ProcStatic.DataRowConvert(pRow, "gender_code_code_description", ""); newTable.Rows.Add(newRow); } } return(newTable); }//----------------------------
} //-------------------------------- //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); } //---------------------- //gets the dataset for the school year information using (RemoteClient.RemCntSchoolYearSemesterManager remClient = new RemoteClient.RemCntSchoolYearSemesterManager()) { _classDataSet = remClient.GetDataSetForSchoolYearSemeter(userInfo); } //----------------------- //gets the registrar standard using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _stdRegistrar = remClient.SelectRegistrarStandard(userInfo); } //------------------ } //-----------------------
//this procedure will initialize the class private void InitializeClass(CommonExchange.SysAccess userInfo) { //set data set using (RemoteClient.RemCntCampusAccessManager remClient = new RemoteClient.RemCntCampusAccessManager()) { _classDataSet = remClient.GetDataSetForCampusAccess(userInfo); } //set serverdate and time using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); } //initialize tables _campusAccessDetailsTable = new DataTable("CampusAccessTable"); _campusAccessDetailsTable.Columns.Add("sysid_person", System.Type.GetType("System.String")); _campusAccessDetailsTable.Columns.Add("access_date_time", System.Type.GetType("System.DateTime")); _campusAccessDetailsTable.Columns.Add("access_point_id", System.Type.GetType("System.String")); //------------------------------ }//-------------------------
}//------------------------------ //this function gets the student image path public void InitializePersonImages(CommonExchange.SysAccess userInfo, String personSysIdList, List <CommonExchange.Person> personInfoList, String startUp) { try { DataTable imageTable; using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { imageTable = remClient.SelectPersonImagesPersonInformation(userInfo, personSysIdList); } using (DataTableReader tableReader = new DataTableReader(imageTable)) { if (tableReader.HasRows) { Int32 picColumn = 1; while (tableReader.Read()) { CommonExchange.Person personInfo = new CommonExchange.Person(); String imagePath = String.Empty; foreach (CommonExchange.Person list in personInfoList) { if (String.Equals(tableReader["sysid_person"].ToString(), list.PersonSysId)) { personInfo = list; imagePath = personInfo.PersonImagesFolder(startUp); break; } } RemoteClient.ProcStatic.DeleteDirectory(imagePath); //creates the directory DirectoryInfo dirInfo = new DirectoryInfo(imagePath); dirInfo.Create(); dirInfo.Attributes = FileAttributes.Hidden; if (!tableReader.IsDBNull(picColumn)) { imagePath += tableReader["original_name"].ToString(); long len = tableReader.GetBytes(picColumn, 0, null, 0, 0); // Create a buffer to hold the bytes, and then // read the bytes from the DataTableReader. Byte[] buffer = new Byte[len]; tableReader.GetBytes(picColumn, 0, buffer, 0, (int)len); // Create a new Bitmap object, passing the array // of bytes to the constructor of a MemoryStream. using (Bitmap studentImage = new Bitmap(new MemoryStream(buffer))) { if (!File.Exists(imagePath)) { studentImage.Save(imagePath); } } } } } tableReader.Close(); } } catch// (Exception ex) { //DataTable imageTable; //using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) //{ // imageTable = remClient.SelectPersonImagesPersonInformation(userInfo, personSysIdList); //} //using (DataTableReader tableReader = new DataTableReader(imageTable)) //{ // if (tableReader.HasRows) // { // Int32 picColumn = 1; // while (tableReader.Read()) // { // CommonExchange.Person personInfo = new CommonExchange.Person(); // String imagePath = String.Empty; // foreach (CommonExchange.Person list in personInfoList) // { // if (String.Equals(tableReader["sysid_person"].ToString(), list.PersonSysId)) // { // personInfo = list; // imagePath = personInfo.PersonImagesFolder(startUp); // break; // } // } // if (!tableReader.IsDBNull(picColumn)) // { // imagePath += tableReader["original_name"].ToString(); // long len = tableReader.GetBytes(picColumn, 0, null, 0, 0); // // Create a buffer to hold the bytes, and then // // read the bytes from the DataTableReader. // Byte[] buffer = new Byte[len]; // tableReader.GetBytes(picColumn, 0, buffer, 0, (int)len); // // Create a new Bitmap object, passing the array // // of bytes to the constructor of a MemoryStream. // using (Bitmap studentImage = new Bitmap(new MemoryStream(buffer))) // { // if (!File.Exists(imagePath)) // { // studentImage.Save(imagePath); // } // } // } // } // } // tableReader.Close(); //} } }//------------------------------
}//-------------------------- //this procedure gets the student image path public void InitializePersonImages(CommonExchange.SysAccess userInfo, String personSysIdList, String startUpPath, ProgressBar pgbBase, Label lblBase) { try { DataTable imageTable = new DataTable("ImageTable"); using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { Int32 count = 0; String[] strSplit = personSysIdList.Split(','); String newPersonSysIdList = String.Empty; pgbBase.Maximum = strSplit.Length * 2; this.DeletePersonImagesDirectory(startUpPath); //creates the directory DirectoryInfo dirInfo = new DirectoryInfo(CommonExchange.SystemConfiguration.PersonImagesFolder(startUpPath)); dirInfo.Create(); dirInfo.Attributes = FileAttributes.Hidden; Int32 x = 0; foreach (String id in strSplit) { if (count <= 200) { newPersonSysIdList += id + ", "; strSplit[x] = String.Empty; pgbBase.PerformStep(); } else if (count > 200) { imageTable = remClient.SelectPersonImagesPersonInformation(userInfo, newPersonSysIdList); using (DataTableReader tableReader = new DataTableReader(imageTable)) { if (tableReader.HasRows) { Int32 picColumn = 1; while (tableReader.Read()) { if (!tableReader.IsDBNull(picColumn)) { String imagePath = CommonExchange.SystemConfiguration.PersonImagesFolder(startUpPath) + @"\"; imagePath += tableReader["original_name"].ToString(); long len = tableReader.GetBytes(picColumn, 0, null, 0, 0); // Create a buffer to hold the bytes, and then // read the bytes from the DataTableReader. Byte[] buffer = new Byte[len]; tableReader.GetBytes(picColumn, 0, buffer, 0, (int)len); // Create a new Bitmap object, passing the array // of bytes to the constructor of a MemoryStream. using (Bitmap studentImage = new Bitmap(new MemoryStream(buffer))) { if (!File.Exists(imagePath)) { studentImage.Save(imagePath); } } } pgbBase.PerformStep(); lblBase.Text = "Copying images..." + tableReader["original_name"].ToString(); lblBase.Refresh(); Application.DoEvents(); } } tableReader.Close(); } count = 0; newPersonSysIdList = String.Empty; imageTable.Rows.Clear(); Thread.Sleep(200); } //pgbBase.PerformStep(); count++; } if (!String.IsNullOrEmpty(newPersonSysIdList)) { imageTable = remClient.SelectPersonImagesPersonInformation(userInfo, newPersonSysIdList); using (DataTableReader tableReader = new DataTableReader(imageTable)) { if (tableReader.HasRows) { Int32 picColumn = 1; while (tableReader.Read()) { if (!tableReader.IsDBNull(picColumn)) { String imagePath = CommonExchange.SystemConfiguration.PersonImagesFolder(startUpPath) + @"\"; imagePath += tableReader["original_name"].ToString(); long len = tableReader.GetBytes(picColumn, 0, null, 0, 0); // Create a buffer to hold the bytes, and then // read the bytes from the DataTableReader. Byte[] buffer = new Byte[len]; tableReader.GetBytes(picColumn, 0, buffer, 0, (int)len); // Create a new Bitmap object, passing the array // of bytes to the constructor of a MemoryStream. using (Bitmap studentImage = new Bitmap(new MemoryStream(buffer))) { if (!File.Exists(imagePath)) { studentImage.Save(imagePath); } } } pgbBase.PerformStep(); lblBase.Text = "Coping images..." + tableReader["original_name"].ToString(); lblBase.Refresh(); Application.DoEvents(); } } tableReader.Close(); } //pgbBase.PerformStep(); } } } catch (Exception ex) { RemoteClient.ProcStatic.ShowErrorDialog(ex.Message, "Error"); //DataTable imageTable = new DataTable("ImageTable"); //using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) //{ // Int32 count = 0; // String[] strSplit = personSysIdList.Split(','); // String newPersonSysIdList = String.Empty; // Int32 x = 0; // foreach (String id in strSplit) // { // if (count <= 200) // { // newPersonSysIdList += id + ", "; // strSplit[x] = String.Empty; // pgbBase.PerformStep(); // } // else if (count > 200) // { // imageTable = remClient.SelectPersonImagesPersonInformation(userInfo, newPersonSysIdList); // using (DataTableReader tableReader = new DataTableReader(imageTable)) // { // if (tableReader.HasRows) // { // Int32 picColumn = 1; // while (tableReader.Read()) // { // if (!tableReader.IsDBNull(picColumn)) // { // String imagePath = CommonExchange.SystemConfiguration.PersonImagesFolder(startUpPath) + @"\"; // imagePath += tableReader["original_name"].ToString(); // long len = tableReader.GetBytes(picColumn, 0, null, 0, 0); // // Create a buffer to hold the bytes, and then // // read the bytes from the DataTableReader. // Byte[] buffer = new Byte[len]; // tableReader.GetBytes(picColumn, 0, buffer, 0, (int)len); // // Create a new Bitmap object, passing the array // // of bytes to the constructor of a MemoryStream. // using (Bitmap studentImage = new Bitmap(new MemoryStream(buffer))) // { // if (!File.Exists(imagePath)) // { // studentImage.Save(imagePath); // } // } // } // } // } // tableReader.Close(); // } // count = 0; // imageTable.Rows.Clear(); // pgbBase.PerformStep(); // Thread.Sleep(200); // } // count++; // x++; // } //} } }//------------------------------