public static HRMemberEntity GetMemberByASPNETUserName(String userName) { HRMemberEntity member = null; MembershipUser user = GetASPNETUserByUserName(userName); if (user != null) { Guid userID = (Guid)user.ProviderUserKey; String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ASMemberAspnetUsersMapEntity.FLD_NAME_UserId, userID.ToString(), SQLMatchType.Equal); IList <ASMemberAspnetUsersMapEntity> aSMemberAspnetUsersMapEntityList = FCCASMemberAspnetUsersMap.GetFacadeCreate().GetIL(null, null, null, filterExpression, DatabaseOperationType.LoadWithFilterExpression); if (aSMemberAspnetUsersMapEntityList != null && aSMemberAspnetUsersMapEntityList.Count > 0) { filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, aSMemberAspnetUsersMapEntityList[0].MemberID.ToString(), SQLMatchType.Equal); IList <HRMemberEntity> memberEntityList = FCCHRMember.GetFacadeCreate().GetIL(null, null, null, filterExpression, DatabaseOperationType.LoadWithFilterExpression); if (memberEntityList != null && memberEntityList.Count > 0) { member = memberEntityList[0]; } } } return(member); }
public IList <HRMemberEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <HRMemberEntity> hRMemberEntityList = new List <HRMemberEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = HRMemberEntity.FLD_NAME_MemberID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; hRMemberEntityList = FCCHRMember.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (hRMemberEntityList != null && hRMemberEntityList.Count > 0) { totalRowCount = hRMemberEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(hRMemberEntityList ?? new List <HRMemberEntity>()); }
private void GetEmployeeNameAndCode() { HREmployeeEntity entity = FCCHREmployee.GetFacadeCreate().GetByID(_CurrentEmployeeEvaluatedID); HRMemberEntity ent = FCCHRMember.GetFacadeCreate().GetByID(entity.MemberID); txtEmployeeCode.Text = entity.EmployeeCode; txtEmployeeName.Text = ent.FirstName + " " + ent.MiddleName + " " + ent.LastName; }
private void SaveHRMemberEntity() { if (IsValid) { try { HRMemberEntity hRMemberEntity = BuildHRMemberEntity(); Int64 result = -1; if (hRMemberEntity.IsNew) { result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal); result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _MemberID = 0; _HRMemberEntity = new HRMemberEntity(); PrepareInitialView(); BindHRMemberList(); if (hRMemberEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Member Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Member Information has been updated successfully.", false); } } else { if (hRMemberEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
//public static String[] GetRolesForAssignToUserByMemberID(Int64 memberID) //{ // String[] roleList = null; // MembershipUser member = GetASPNETUserByMemberID(memberID); // String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberUserCreationRoleListEntity.FLD_NAME_MemberID, memberID.ToString(), SQLMatchType.Equal); // IList<ERMMemberUserCreationRoleListEntity> eRMMemberUserCreationRoleListEntityList = FCCERMMemberUserCreationRoleList.GetFacadeCreate().GetIL(null, null, String.Empty, filterExpression, DatabaseOperationType.LoadWithFilterExpression); // if (eRMMemberUserCreationRoleListEntityList != null && eRMMemberUserCreationRoleListEntityList.Count > 0) // { // roleList = new String[eRMMemberUserCreationRoleListEntityList.Count]; // for (int i = 0; i < eRMMemberUserCreationRoleListEntityList.Count; i++) // { // roleList[i] = eRMMemberUserCreationRoleListEntityList[i].RoleName; // } // } // return roleList; //} #endregion public static HRMemberEntity CreateMember(HRMemberEntity member) { Int64 memberID = FCCHRMember.GetFacadeCreate().Add(member, DatabaseOperationType.Add, TransactionRequired.No); if (memberID > 0) { member.MemberID = memberID; return(member); } return(null); }
protected void lvHRMember_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 MemberID; Int64.TryParse(e.CommandArgument.ToString(), out MemberID); if (MemberID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _MemberID = MemberID; PrepareEditView(); //cpeEditor.Collapsed = false; //cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, MemberID.ToString(), SQLMatchType.Equal); HRMemberEntity hRMemberEntity = new HRMemberEntity(); result = FCCHRMember.GetFacadeCreate().Delete(hRMemberEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _MemberID = 0; _HRMemberEntity = new HRMemberEntity(); PrepareInitialView(); BindHRMemberList(); MiscUtil.ShowMessage(lblMessage, "Member has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Member.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <HRMemberEntity> GetData() { IList <HRMemberEntity> hRMemberEntityList = new List <HRMemberEntity>(); try { hRMemberEntityList = FCCHRMember.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (hRMemberEntityList != null && hRMemberEntityList.Count > 0) { totalRowCount = hRMemberEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(hRMemberEntityList ?? new List <HRMemberEntity>()); }
protected void lvCMConsultant_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 ConsultantID; Int64.TryParse(e.CommandArgument.ToString(), out ConsultantID); if (ConsultantID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _ConsultantID = ConsultantID; _MemberID = CurrentCMConsultantEntity.MemberID.Value; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { CMConsultantEntity tempConsultant = FCCCMConsultant.GetFacadeCreate().GetByID(ConsultantID); #region Resource Delete Int64 resultOne = -1; String fe1_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, ConsultantID.ToString(), SQLMatchType.Equal); String fe2_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.CONSULTANT.ToString(), SQLMatchType.Equal); String fe_re = SqlExpressionBuilder.PrepareFilterExpression(fe1_re, SQLJoinType.AND, fe2_re); IList <ResourceEntity> resourceList = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_re, DatabaseOperationType.LoadWithFilterExpression); foreach (ResourceEntity ent in resourceList) { String fe_re_delete = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ent.ResourceID.ToString(), SQLMatchType.Equal); resultOne = FCCResource.GetFacadeCreate().Delete(ent, fe_re_delete, DatabaseOperationType.Delete, TransactionRequired.No); } #endregion #region Consultant Delete Int64 resultTwo = -1; if (resultOne == 0) { String fe_con_delete = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, ConsultantID.ToString(), SQLMatchType.Equal); CMConsultantEntity cMConsultantEntity = new CMConsultantEntity(); resultTwo = FCCCMConsultant.GetFacadeCreate().Delete(cMConsultantEntity, fe_con_delete, DatabaseOperationType.Delete, TransactionRequired.No); } #endregion #region Member Delete Int64 resultThree = -1; if (resultTwo == 0) { String fe_mem_delete = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, tempConsultant.MemberID.ToString(), SQLMatchType.Equal); HRMemberEntity hRMemberEntity = new HRMemberEntity(); resultThree = FCCHRMember.GetFacadeCreate().Delete(hRMemberEntity, fe_mem_delete, DatabaseOperationType.Delete, TransactionRequired.No); } #endregion if (resultOne == 0 && resultTwo == 0 && resultThree == 0) { _ConsultantID = 0; _CMConsultantEntity = new CMConsultantEntity(); _MemberID = 0; _HRMemberEntity = new HRMemberEntity(); PrepareInitialView(); BindCMConsultantList(); MiscUtil.ShowMessage(lblMessage, "Consultant has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Consultant.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private void SaveCMConsultantEntity() { if (IsValid) { try { #region Member HRMemberEntity hRMemberEntity = BuildHRMemberEntity(); Int64 result = -1; if (hRMemberEntity.IsNew) { result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal); result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } #endregion if (result > 0) { _MemberID = 0; _HRMemberEntity = new HRMemberEntity(); } if (result > 0) { CMConsultantEntity cMConsultantEntity = BuildCMConsultantEntity(); Int64 resultC = -1; if (cMConsultantEntity.IsNew) { cMConsultantEntity.MemberID = result; resultC = FCCCMConsultant.GetFacadeCreate().Add(cMConsultantEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, cMConsultantEntity.ConsultantID.ToString(), SQLMatchType.Equal); resultC = FCCCMConsultant.GetFacadeCreate().Update(cMConsultantEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (resultC > 0) { _ConsultantID = 0; _CMConsultantEntity = new CMConsultantEntity(); PrepareInitialView(); BindCMConsultantList(); if (cMConsultantEntity.IsNew) { ResourceEntity resourceEntity = new ResourceEntity(); resourceEntity.ReferenceID = resultC; // means new contractor id resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.CONSULTANT; FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No); } if (cMConsultantEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Consultant Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Consultant Information has been updated successfully.", false); } } else { if (cMConsultantEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Consultant Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Consultant Information.", false); } } } else { if (hRMemberEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void SaveHREmployeeEntity() { if (IsValid) { try { #region Member HRMemberEntity hRMemberEntity = BuildHRMemberEntity(); Int64 result = -1; if (hRMemberEntity.IsNew) { result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal); result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } #endregion if (result > 0) { _MemberID = 0; _HRMemberEntity = new HRMemberEntity(); } if (result > 0) { HREmployeeEntity hREmployeeEntity = BuildHREmployeeEntity(); Int64 resultC = -1; if (hREmployeeEntity.IsNew) { hREmployeeEntity.MemberID = result; resultC = FCCHREmployee.GetFacadeCreate().Add(hREmployeeEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEntity.FLD_NAME_EmployeeID, hREmployeeEntity.EmployeeID.ToString(), SQLMatchType.Equal); resultC = FCCHREmployee.GetFacadeCreate().Update(hREmployeeEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } #region Create Six Task For HR try { StringBuilder xmlStr = new StringBuilder(); Int64 employeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember); Int64 referenceID = 49; DateTime joinDate = (DateTime)hREmployeeEntity.JoinDate; String fe = "DepartmentID = " + MasterDataConstants.MDDepartment.HR_DEPARTMENTID + ""; IList <HREmployeeEntity> lst = FCCHREmployee.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); #region Delete Old Task String filter = "IssueIdentityCategoryID = " + MasterDataConstants.MDIssueIdentityCategory.HRMETTINGWITHEMPLOYEE + " and SupervisorEmployeeID = " + hREmployeeEntity.EmployeeID + ""; IList <OTIssueEntity> issueList = FCCOTIssue.GetFacadeCreate().GetIL(null, null, String.Empty, filter, DatabaseOperationType.LoadWithFilterExpression); if (issueList != null && issueList.Count > 0) { OTIssueEntity oTIssueEntity = new OTIssueEntity(); FCCOTIssue.GetFacadeCreate().Delete(oTIssueEntity, filter, DatabaseOperationType.Delete, TransactionRequired.No); } #endregion String title = "Employee Name: " + hRMemberEntity.FirstName + " " + hRMemberEntity.MiddleName + " " + hRMemberEntity.LastName + ", Code: " + hREmployeeEntity.EmployeeCode + " join Date: " + hREmployeeEntity.JoinDate + " has metting with you"; xmlStr.Append("<m>"); if (lst != null && lst.Count > 0) { foreach (HREmployeeEntity e in lst) { for (int i = 1; i <= 6; i++) { String subXmlStr = null; subXmlStr = subXmlStr + "<i><a>" + title + "</a><b>" + hREmployeeEntity.EmployeeID + "</b><c>" + e.EmployeeID + "</c><d>" + CurrentMember.MemberID + "</d><e>" + referenceID + "</e><f>" + joinDate.AddDays(i * 30) + "</f><g>" + joinDate.AddDays((i * 30) + 1) + "</g></i>"; xmlStr.Append(subXmlStr.ToString()); } } } xmlStr.Append("</m>"); FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.CreateSixTaskForHR); MiscUtil.ShowMessage(lblMessage, "Six Task has created for HR Successfully.", false); } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, "An Error Occoured.", true); } #endregion if (resultC > 0) { _EmployeeID = 0; _HREmployeeEntity = new HREmployeeEntity(); PrepareInitialView(); BindHREmployeeList(); if (hREmployeeEntity.IsNew) { ResourceEntity resourceEntity = new ResourceEntity(); resourceEntity.ReferenceID = resultC; // means new employee id resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.EMPLOYEE; FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No); } if (hREmployeeEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Employee Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Employee Information has been updated successfully.", false); } } else { if (hREmployeeEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Information.", false); } } } else { if (hRMemberEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void btnSendMailToGuest_Click(object sender, EventArgs e) { //Mail will implement here. #region Guest Invitation Mail CMNEventEntity cMNEventEntity = FCCCMNEvent.GetFacadeCreate().GetByID(OverviewEventID); String MailBody = String.Empty; String Subject = String.Empty; StringBuilder sb = new StringBuilder(); sb.Append("Dear Sir,"); sb.Append("<br/>"); sb.Append("This is a auto generated mail from the ERP."); sb.Append("<br/>"); sb.Append("An Event has created."); sb.Append("<br/>"); sb.Append("Dated : " + cMNEventEntity.ExpectedStartDate.ToString(UIConstants.SHORT_DATE_FORMAT)); sb.Append("<br/>"); sb.Append("-"); sb.Append("<br/>"); sb.Append("Thanks"); sb.Append("<br/>"); sb.Append("ERP System"); MailBody = sb.ToString(); Subject = "ERP, Event"; String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventID, OverviewEventID.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventInvitatedPersonTypeID, MasterDataConstants.EventInvitationPersonType.GUEST.ToString(), SQLMatchType.Equal); String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); IList <CMNEventInvitationInformationEntity> lstEventInvitationInformationEntity = FCCCMNEventInvitationInformation.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lstEventInvitationInformationEntity != null && lstEventInvitationInformationEntity.Count > 0) { String[] sendToMail = new String[10]; // Should change here. Int64 i = 0; foreach (CMNEventInvitationInformationEntity ent in lstEventInvitationInformationEntity) { HRMemberEntity hRMemberEntity = FCCHRMember.GetFacadeCreate().GetByID(ent.InitationGivenToMemberID); if (hRMemberEntity != null && hRMemberEntity.MemberID > 0) { switch (hRMemberEntity.MemberTypeID) { case MasterDataConstants.MemberType.HR_MEMBER: String fe_member = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEntity.FLD_NAME_MemberID, ent.InitationGivenToMemberID.ToString(), SQLMatchType.Equal); IList <HREmployeeEntity> lsthREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetIL(null, null, String.Empty, fe_member, DatabaseOperationType.LoadWithFilterExpression); if (lsthREmployeeEntity != null && lsthREmployeeEntity.Count > 0) { sendToMail[i++] = lsthREmployeeEntity[0].PrimaryEmail; } break; //Will Implement Later on... case MasterDataConstants.MemberType.CONSULATANT: break; //case MasterDataConstants.MemberType.CONSULATANT: // break; } } } MiscUtil.SendMail(sendToMail, Subject, MailBody); } #endregion }