}//---------------------------- //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); }//---------------------
}//----------------------------- //####################################################END LINK LABEL lnkViewFullDetails EVENTS############################################### #endregion #region Programmer-Defined Void Procedures //this procedure will set Person Relationship controls private void SetPersonRelationshipControls(CommonExchange.Person personInfo) { _personRelationshipInfo.PersonInRelationshipWith.PersonSysId = personInfo.PersonSysId; _personRelationshipInfo.PersonInRelationshipWith.LastName = personInfo.LastName; _personRelationshipInfo.PersonInRelationshipWith.FirstName = personInfo.FirstName; _personRelationshipInfo.PersonInRelationshipWith.MiddleName = personInfo.MiddleName; _personRelationshipInfo.PersonInRelationshipWith.BirthDate = personInfo.BirthDate; _personRelationshipInfo.PersonInRelationshipWith.PresentAddress = personInfo.PresentAddress; _personRelationshipInfo.PersonInRelationshipWith.PresentPhoneNos = personInfo.PresentPhoneNos; _personRelationshipInfo.PersonInRelationshipWith.LifeStatusCode = personInfo.LifeStatusCode; _personRelationshipInfo.PersonInRelationshipWith.GenderCode = personInfo.GenderCode; _personRelationshipInfo.PersonInRelationshipWith.FilePath = personInfo.FilePath; this.lblPersonLastName.Text = personInfo.LastName; this.lblPersonFirstName.Text = personInfo.FirstName; this.lblPersonMiddleName.Text = personInfo.MiddleName; this.lblPresentAddress.Text = personInfo.PresentAddress; this.lblPresentPhoneNo.Text = personInfo.PresentPhoneNos; if (!String.IsNullOrEmpty(personInfo.FilePath) && File.Exists(personInfo.FilePath)) { this.pbxPerson.Image = Image.FromFile(personInfo.FilePath); } else { this.pbxPerson.Image = null; } }//-------------------------------
//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); } }//--------------------------
//####################################################CLASS PersonalInformation EVENTS############################################### //event is raised when the class is loaded protected virtual void ClassLoad(object sender, EventArgs e) { _baseServiceManager = new BaseServicesLogic(_userInfo); _personInfo = new CommonExchange.Person(); _baseServiceManager.InitializeCodeReferenceCombo(this.cboGender, CommonExchange.CodeEntityId.Gender); _baseServiceManager.InitializeCodeReferenceCombo(this.cboLifeStatus, CommonExchange.CodeEntityId.LifeStatus); _baseServiceManager.InitializeCodeReferenceCombo(this.cboMaritalStatus, CommonExchange.CodeEntityId.MaritalStatus); }//----------------------
}//------------------------ //####################################################END LINKLABEL lnkMarriageDate EVENTS############################################### //####################################################LINKLABEL lnkVerify EVENTS############################################### //event is raised when the control is clicked protected virtual void lnkVerifyLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { this.Cursor = Cursors.WaitCursor; DataTable resultTable = _baseServiceManager.GetSearchPersonInformation(_userInfo, String.Empty, _personInfo.LastName, _personInfo.FirstName, String.Empty, true); if (resultTable.Rows.Count > 0) { using (VerifyPersonExistenceList frmVerify = new VerifyPersonExistenceList(_userInfo, _baseServiceManager, RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(_personInfo.LastName, _personInfo.FirstName, _personInfo.MiddleName), resultTable, _isForStudentVerification, _isForPersonVerification, ref this.pbxPerson)) { frmVerify.ShowDialog(this); if (frmVerify.HasSelected) { _personInfo = _baseServiceManager.GetPersonDetails(_userInfo, _baseServiceManager.GetPersonSysId(frmVerify.RowIndex), Application.StartupPath); this.AssingControlsValue(); this.SetPersonInformationControls(true); } else if (frmVerify.IsVerified && _isForPersonVerification) { this.SetPersonInformationControls(true); } _hasSelectedPersonFromVerification = true; } } else { MessageBox.Show("The system has successfully verified that " + RemoteClient.ProcStatic.GetCompleteNameMiddleInitial( _personInfo.LastName, _personInfo.FirstName, _personInfo.MiddleName) + " does NOT currently exist on the database." + "\n\nClick OK to proceed.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); if (_isForPersonVerification) { this.SetPersonInformationControls(true); } } } catch (Exception ex) { RemoteClient.ProcStatic.ShowErrorDialog(ex.Message + "\n Error loading person verify module.", "Error Loading"); } finally { this.Cursor = Cursors.Arrow; } }//---------------------------
public PersonInformationCreateUpdate(CommonExchange.SysAccess userInfo, CommonExchange.Person personInfo) : base(userInfo) { this.InitializeComponent(); _userInfo = userInfo; _personInfo = _personInfoTemp = personInfo; _personInfo.ObjectState = DataRowState.Modified; this.btnClose.Click += new EventHandler(btnCloseClick); this.btnRecord.Click += new EventHandler(btnRecordClick); }
public PersonInformationCreate(CommonExchange.SysAccess userInfo, CommonExchange.Person personInfo, BaseServices.BaseServicesLogic baseServiceManager) : base(userInfo) { this.InitializeComponent(); _personInfo = personInfo; _baseServiceManager = baseServiceManager; this.FormClosing += new FormClosingEventHandler(ClassClosing); this.btnClose.Click += new EventHandler(btnCloseClick); this.btnRecord.Click += new EventHandler(btnRecordClick); }
public PersonInformationCreateUpdate(CommonExchange.SysAccess userInfo) : base(userInfo) { this.InitializeComponent(); _userInfo = userInfo; _baseServiceManager = new BaseServicesLogic(_userInfo); _personInfo = new CommonExchange.Person(); _personInfo.ObjectState = DataRowState.Added; this.btnClose.Click += new EventHandler(btnCloseClick); this.btnRecord.Click += new EventHandler(btnRecordClick); }
}//--------------------------------- //##################################END PICTUREBOX pbxRefresh EVENTS###################################################### //##################################LINKLABEL lnkCreatePerson EVENTS###################################################### //event is raised when the control is clicked private void lnkCreatePersonLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { using (PersonInformationCreate frmCreate = new PersonInformationCreate(_userInfo, _baseServiceManager)) { frmCreate.PersonArchiveVisible = false; frmCreate.ShowDialog(this); if (frmCreate.HasRecorded) { _hasRecorded = true; _personInfo = frmCreate.PersonInfo; this.Close(); } } }//-------------------------
}//--------------------------- //####################################################END LINKLABEL lnkVerify EVENTS############################################### //####################################################LINKLABEL lnkPersonArchive EVENTS############################################### //event is raised when the control is clicked protected virtual void lnkPersonArchiveLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { this.Cursor = Cursors.WaitCursor; using (PersonSearchOnTextBoxList frmSearch = new PersonSearchOnTextBoxList(_userInfo, _baseServiceManager, _isForStudentVerification, _isForNewUserVerification, this.pbxPerson)) { frmSearch.CreatePersonVisible = false; frmSearch.ShowDialog(this); if (frmSearch.HasSelected) { _rowIndex = frmSearch.RowIndex; _personInfo = _baseServiceManager.GetPersonDetails(_userInfo, _baseServiceManager.GetPersonSysId(frmSearch.RowIndex), Application.StartupPath); if (!_isForStudentVerification && !_isForNewUserVerification) { _empInfo = frmSearch.EmployeeInfo; } if (_isForNewUserVerification && !_isForStudentVerification) { _newUserInfo = frmSearch.NewUserInfo; } this.AssingControlsValue(); this.SetPersonInformationControls(true); _hasSelectedForPersonUpdate = true; } } } catch (Exception ex) { RemoteClient.ProcStatic.ShowErrorDialog(ex.Message, "Error Loading"); } finally { this.Cursor = Cursors.Arrow; } }//--------------------------
}//------------------------------ //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(); //} } }//------------------------------