protected override List <DataService.Model.Employee> SelectEntities() { List <DataService.Model.Employee> result = base.SelectEntities(); EmployeeSearchCriteria searchCriteria = SearchCriteria as EmployeeSearchCriteria; if (searchCriteria != null) { result = base.SelectEntities() .Where(x => string.IsNullOrWhiteSpace(searchCriteria.Code) || x.Code.ToUpperInvariant() .Contains(searchCriteria.Code.ToUpperInvariant())).ToList() .Where(x => string.IsNullOrWhiteSpace(searchCriteria.Name) || x.Name.ToUpperInvariant() .Contains(searchCriteria.Name.ToUpperInvariant())).ToList() .Where(x => !searchCriteria.Active || x.Active).ToList() .Where(x => (!searchCriteria.CreatedFrom.HasValue || x.Created >= searchCriteria.CreatedFrom.Value) && (!searchCriteria.CreatedTo.HasValue || x.Created < searchCriteria.CreatedTo.Value.AddDays(1))).ToList() .Where(x => (!searchCriteria.LastModifyFrom.HasValue || x.LastModify >= searchCriteria.LastModifyFrom.Value) && (!searchCriteria.LastModifyTo.HasValue || x.LastModify < searchCriteria.LastModifyTo.Value.AddDays(1))).ToList() .Where(x => string.IsNullOrWhiteSpace(searchCriteria.UserModify) || x.UserModify.ToUpperInvariant() .Contains(searchCriteria.UserModify.ToUpperInvariant())).ToList(); } return(result); }
private ApplicationActionResult GetData() { _employeeID = GetIdFromUrl(); CheckPermissions(); _listSalaryDeductionsDto = PageMethodsHelper.InvokeWebAPI <SalaryDeductionsDto>( WebAPIVariables.salaryDeductions, "?SalaryDeductionsType=" + (int)SalaryDeductionsType.CompanyCar); Session[SessionVariables.gvDeductionsElements] = _listSalaryDeductionsDto; var esc = new EmployeeSearchCriteria() { EmployeeID = _employeeID }; _employeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>( WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)).FirstOrDefault(); _directSupervisorDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.employee, "?id=" + _employeeDto.DirectSupervisorID).FirstOrDefault(); _employeeMembershipDto = PageMethodsHelper.InvokeWebAPI <EmployeeMembershipDto>(WebAPIVariables.employeeMembership, "?id=" + _employeeID).FirstOrDefault(); if (_employeeDto == null || _employeeMembershipDto == null) { throw new ApplicationLayerException("NoData", ErrorNumbers.ApplicationsHRMyPortalGetData, SessionUser.Id); } var cph = (ContentPlaceHolder)Master.Master.FindControl("MainContent"); ((Image)cph.FindControl("btn_Image")).ImageUrl = @"~\Content\ThumbnailEmployee\" + _employeeID + ".png"; return(new ApplicationActionResult() { Success = true }); }
protected void gv_EmployeeList_PageIndexChanging(object sender, GridViewPageEventArgs e) { var esc = new EmployeeSearchCriteria() { FirstName = tb_FirstName.Text, LastName = tb_LastName.Text, Section = ddl_Section.SelectedItem.Value, OrganizationalUnit = ddl_OrganizationalUnit.SelectedItem.Value, OrganizationalCell = ddl_OrganizationalCell.SelectedItem.Value, EmployeeNumber = tb_EmployeeNumber.Text }; _listEmployeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)); if (_listEmployeeDto == null) { throw new ApplicationLayerException("NoData", ErrorNumbers.WUC_SearchEmployeesGv_EmployeeList_PageIndexChanging, _sessionUser.Id); } GridValueTranslate(); gv_EmployeeList.PageIndex = e.NewPageIndex; gv_EmployeeList.DataSource = _listEmployeeDto; gv_EmployeeList.DataBind(); up_SearchFor.Update(); }
protected void AddRow_Click(object sender, EventArgs e) { string id = (string)Session[SessionVariables.hf_EmployeeID]; Session[SessionVariables.hf_EmployeeID] = null; if (string.IsNullOrEmpty(id)) { return; } var esc = new EmployeeSearchCriteria() { EmployeeID = Convert.ToInt32(id) }; _directSupervisorDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>( WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)).FirstOrDefault(); if (_directSupervisorDto != null) { lbl_DirectSupervisor.Text = _directSupervisorDto.FirstName + " " + _directSupervisorDto.LastName; hf_DirectSupervisorId.Value = _directSupervisorDto.Id.ToString(); } else { lbl_DirectSupervisor.Text = Translate("Common", "Lack"); } up_SearchForss.Update(); }
protected void DataPortal_Fetch(EmployeeSearchCriteria criteria) { RaiseListChangedEvents = false; IsReadOnly = false; using (var ctx = new VacationManagerContext()) { IList <Persistence.Model.EmployeeEntity> employees; if (criteria == null) { employees = ctx.Employees .ToList(); } else { employees = ctx.Employees .Where(x => (x.Firstname == criteria.FirstName) || (x.LastName == criteria.LastName)) .ToList(); } foreach (var item in employees) { Add(DataPortal.Create <Employee>(item)); } } IsReadOnly = true; RaiseListChangedEvents = true; }
public List <EmployeeDto> FindEmployees(EmployeeSearchCriteria criteria) { string sql = @" SELECT e.Id as Id, e.FirstName as FirstName, e.LastName as LastName, e.EmployeeNumber as EmployeeNumber, e.PhoneNumber as PhoneNumber, e.MobilePhoneNumber as MobilePhoneNumber, e.Email as Email, e.Pesel as Pesel, oc.Name as OrganizationalCell, em.Position as Position, em.DirectSupervisor_id as DirectSupervisorID FROM B_Employee e Left JOIN B_EmployeeMembership em ON e.id = em.Employee_id LEFT JOIN B_OrganizationalUnit ou ON em.OrganizationalUnit_id = ou.id LEFT JOIN B_OrganizationalCell oc ON em.OrganizationalCell_id = oc.id "; sql = ApplyCriteria(sql, criteria); var list = SetCriteria(sql, criteria); return(list.ToList()); }
private ApplicationActionResult GetData() { _employeeID = GetIdFromUrl(); CheckPermissions(); var esc = new EmployeeSearchCriteria() { EmployeeID = _employeeID }; _employeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>( WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)).FirstOrDefault(); _directSupervisorDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.employee, "?id=" + _employeeDto.DirectSupervisorID).FirstOrDefault(); _employeeMembershipDto = PageMethodsHelper.InvokeWebAPI <EmployeeMembershipDto>(WebAPIVariables.employeeMembership, "?id=" + _employeeID).FirstOrDefault(); if (_employeeDto == null || _employeeMembershipDto == null) { throw new ApplicationLayerException("NoData", ErrorNumbers.ApplicationsHRStructureAndLocationGetData, SessionUser.Id); } _listSectionDto = PageMethodsHelper.InvokeWebAPI <DictionaryDto>(WebAPIVariables.sections); _listOrganizationalUnitDto = PageMethodsHelper.InvokeWebAPI <DictionaryDto>(WebAPIVariables.organizationalUnits); _listOrganizationalCellDto = PageMethodsHelper.InvokeWebAPI <DictionaryDto>(WebAPIVariables.organizationalCells); _listWorksDto = PageMethodsHelper.InvokeWebAPI <DictionaryDto>(WebAPIVariables.works); _listProductSectionDto = PageMethodsHelper.InvokeWebAPI <DictionaryDto>(WebAPIVariables.productSection); _listPlaceWhereCostsAriseDto = PageMethodsHelper.InvokeWebAPI <DictionaryDto>(WebAPIVariables.placeWhereCostsArise); _listSzpartaDto = PageMethodsHelper.InvokeWebAPI <DictionaryDto>(WebAPIVariables.szparta); _listStructureAndLocationDto = PageMethodsHelper.InvokeWebAPI <StructureAndLocationDto>( WebAPIVariables.structureAndLocation, "?employeeId=" + _employeeID); if (_listSectionDto == null || _listOrganizationalUnitDto == null || _listOrganizationalCellDto == null || _listWorksDto == null || _listProductSectionDto == null || _listPlaceWhereCostsAriseDto == null || _listSzpartaDto == null) { throw new ApplicationLayerException("NoData", ErrorNumbers.ApplicationsHRStructureAndLocationGetData, SessionUser.Id); } var cph = (ContentPlaceHolder)Master.Master.FindControl("MainContent"); var basic = @"~\Content\ThumbnailEmployee\"; var employeeImage = _employeeID + ".png"; var emptyImage = "empty.png"; var dataFile = Server.MapPath(basic) + employeeImage; if (File.Exists(dataFile)) { ((Image)cph.FindControl("btn_Image")).ImageUrl = basic + employeeImage; } else { ((Image)cph.FindControl("btn_Image")).ImageUrl = basic + emptyImage; } return(new ApplicationActionResult() { Success = true }); }
private ApplicationActionResult GetData() { CheckPermissions(); var esc = new EmployeeSearchCriteria() { EmployeeID = GetIdFromUrl() }; _employeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)).FirstOrDefault(); _employeeMembershipDto = PageMethodsHelper.InvokeWebAPI <EmployeeMembershipDto>(WebAPIVariables.employeeMembership, "?id=" + GetIdFromUrl()).FirstOrDefault(); esc = new EmployeeSearchCriteria() { EmployeeID = _employeeDto.DirectSupervisorID }; _listDirectReportsDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)); esc = new EmployeeSearchCriteria() { DirectSupervisorID = _employeeDto.Id }; _listReportsToDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)); var basic = @"~\Content\ThumbnailEmployee\"; var employeeImage = GetIdFromUrl() + ".png"; var emptyImage = "empty.png"; var dataFile = Server.MapPath(basic) + employeeImage; if (File.Exists(dataFile)) { btn_Image.ImageUrl = basic + employeeImage; } else { btn_Image.ImageUrl = basic + emptyImage; } if (_employeeDto == null || _employeeMembershipDto == null || _listDirectReportsDto == null || _listReportsToDto == null) { throw new ApplicationLayerException("NoData", ErrorNumbers.EmployeeGetData, SessionUser.Id); } SetGridView(gv_ReportsTo, _listDirectReportsDto); SetGridView(gv_DirectReports, _listReportsToDto); return(new ApplicationActionResult() { Success = true }); }
public async Task <List <MerchantIdentification_StoreName> > GetEmployeeByCriteria(List <MerchantIdentification_StoreName> lstAllMerchantStoreInformation) { TokenDetails objTokenDetails = new TokenDetails(); EmployeeSearchCriteria objReportSearchCriteria = new EmployeeSearchCriteria(); objReportSearchCriteria.searchCriteria = new EmpInputModel(); objReportSearchCriteria.searchCriteria = new EmpInputModel() { activeFilter = 1 }; string jsonString = JsonConvert.SerializeObject(objReportSearchCriteria); JObject objInputParameters = JObject.Parse(jsonString); List <EmployeeResultModel> lstEmployee = new List <EmployeeResultModel>(); foreach (var obj in lstAllMerchantStoreInformation) { using (HttpClient client = new HttpClient()) { objTokenDetails.SetHTTPClientObjectValues(client); HttpResponseMessage response = await objTokenDetails. ExecuteClientPostMethod("manageemployee/getallemployees", objInputParameters, client, Token.securityToken, obj.merchantIdentification); if (response.IsSuccessStatusCode) { objTokenDetails.SetRefreshToken(response); var objRes = await response.Content.ReadAsStringAsync(); JObject jsonRes = JObject.Parse(objRes); JToken jTokenUsers = jsonRes.FindTokens("users").FirstOrDefault(); foreach (JToken jobject in jTokenUsers.Children()) { EmployeeResultModel objEmployee = JsonConvert.DeserializeObject <EmployeeResultModel>(jobject.ToString()); lstEmployee.Add(objEmployee); } // add employees in lstEmployee object obj.lstEmployee = new List <EmployeeResultModel>(); obj.lstEmployee.AddRange(lstEmployee); } } } return(lstAllMerchantStoreInformation); }
protected void gv_EmployeeList_PageIndexChanging(object sender, GridViewPageEventArgs e) { var esc = new EmployeeSearchCriteria() { FirstName = tb_FirstName.Text, LastName = tb_LastName.Text, Position = tb_Position.Text, Section = ddl_Section.SelectedItem.Value, OrganizationalUnit = ddl_OrganizationalUnit.SelectedItem.Value, OrganizationalCell = ddl_OrganizationalCell.SelectedItem.Value, EmployeeNumber = tb_EmployeeNumber.Text }; _listEmployeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)); GridValueTranslate(); gv_EmployeeList.PageIndex = e.NewPageIndex; gv_EmployeeList.DataSource = _listEmployeeDto; gv_EmployeeList.DataBind(); }
protected void btn_SearchFor_Click(object sender, EventArgs e) { pnl_SearchResults.Visible = true; var esc = new EmployeeSearchCriteria() { FirstName = tb_FirstName.Text, LastName = tb_LastName.Text, Position = tb_Position.Text, Section = ddl_Section.SelectedItem.Value, OrganizationalUnit = ddl_OrganizationalUnit.SelectedItem.Value, OrganizationalCell = ddl_OrganizationalCell.SelectedItem.Value, EmployeeNumber = tb_EmployeeNumber.Text }; _listEmployeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)); GridValueTranslate(); gv_EmployeeList.DataSource = _listEmployeeDto; gv_EmployeeList.DataBind(); }
protected void AddRow_Click(object sender, EventArgs e) { string id = (string)Session[SessionVariables.hf_EmployeeID]; Session[SessionVariables.hf_EmployeeID] = null; if (string.IsNullOrEmpty(id)) { return; } var _listSalaryDeductionsDto = (List <SalaryDeductionsDto>)Session[SessionVariables.gvDeductionsElements]; var esc = new EmployeeSearchCriteria() { EmployeeID = Convert.ToInt32(id) }; _employeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>( WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)).FirstOrDefault(); var value = new SalaryDeductionsDto() { LastFirstName = _employeeDto.LastName + " " + _employeeDto.FirstName, EmployeeNumber = _employeeDto.EmployeeNumber, EmployeeId = Convert.ToInt32(id) }; _listSalaryDeductionsDto.Add(value); foreach (var item in _listSalaryDeductionsDto) { item.SetFromDateST(); item.SetToDateST(); } this.gv_Deductions.DataSource = _listSalaryDeductionsDto; this.gv_Deductions.DataBind(); }
protected void gv_DirectReports_PageIndexChanging(object sender, GridViewPageEventArgs e) { var esc = new EmployeeSearchCriteria() { EmployeeID = GetIdFromUrl() }; _employeeDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)).FirstOrDefault(); esc = new EmployeeSearchCriteria() { DirectSupervisorID = _employeeDto.Id }; _listDirectReportsDto = PageMethodsHelper.InvokeWebAPI <EmployeeDto>(WebAPIVariables.searchEmployee, PageMethodsHelper.ObjectToUrlParam(esc)); if (_listDirectReportsDto == null) { throw new ApplicationLayerException("NoData", ErrorNumbers.EmployeeGetData, SessionUser.Id); } gv_DirectReports.PageIndex = e.NewPageIndex; SetGridView(gv_DirectReports, _listDirectReportsDto); }
public Root <EmployeeDto> SearchEmployee([FromUri] EmployeeSearchCriteria employeeSearchCriteria) { return(new Root <EmployeeDto> { Items = _employeeFinder.FindEmployees(employeeSearchCriteria) }); }
private List <EmployeeDto> SetCriteria(string query, EmployeeSearchCriteria criteria) { var s = EntityManager.CurrentSession.CreateSQLQuery(query); if (criteria.EmployeeID > 0) { s.SetInt32("EmployeeID", criteria.EmployeeID); } if (criteria.DirectSupervisorID > 0) { s.SetInt32("DirectSupervisorID", criteria.DirectSupervisorID); } if (!string.IsNullOrEmpty(criteria.FirstName)) { s.SetString("FirstName", BuildLikeAttribute(criteria.FirstName)); } if (!string.IsNullOrEmpty(criteria.LastName)) { s.SetString("LastName", BuildLikeAttribute(criteria.LastName)); } if (!string.IsNullOrEmpty(criteria.Position)) { s.SetString("Position", BuildLikeAttribute(criteria.Position)); } if (!string.IsNullOrEmpty(criteria.PhoneNumber)) { s.SetString("PhoneNumber", BuildLikeAttribute(criteria.PhoneNumber)); } if (!string.IsNullOrEmpty(criteria.MobilePhoneNumber)) { s.SetString("MobilePhoneNumber", BuildLikeAttribute(criteria.MobilePhoneNumber)); } if (!string.IsNullOrEmpty(criteria.Email)) { s.SetString("Email", BuildLikeAttribute(criteria.Email)); } if (!string.IsNullOrEmpty(criteria.Section) && !criteria.Section.Equals("0")) { s.SetInt32("Section", Convert.ToInt32(criteria.Section)); } if (!string.IsNullOrEmpty(criteria.OrganizationalUnit) && !criteria.OrganizationalUnit.Equals("0")) { s.SetInt32("OrganizationalUnit", Convert.ToInt32(criteria.OrganizationalUnit)); } if (!string.IsNullOrEmpty(criteria.OrganizationalCell) && !criteria.OrganizationalCell.Equals("0")) { s.SetInt32("OrganizationalCell", Convert.ToInt32(criteria.OrganizationalCell)); } if (!string.IsNullOrEmpty(criteria.Room)) { s.SetString("Room", criteria.Room.Trim()); } if (!string.IsNullOrEmpty(criteria.EmployeeNumber)) { s.SetString("EmployeeNumber", criteria.EmployeeNumber.Trim()); } return(s .SetInt32("estatus", (int)EntityStatus.Active) .SetInt32("emstatus", (int)EntityStatus.Active) .SetResultTransformer(Transformers.AliasToBean <EmployeeDto>()) .List <EmployeeDto>() .ToList()); }
private string ApplyCriteria(string query, EmployeeSearchCriteria criteria) { // WHERE query = query + " Where e.status = :estatus "; query = query + " AND em.status = :emstatus "; if (criteria.EmployeeID > 0) { query = query + " AND e.Id = :EmployeeID "; } if (criteria.DirectSupervisorID > 0) { query = query + " AND em.DirectSupervisor_id = :DirectSupervisorID "; } if (!string.IsNullOrEmpty(criteria.FirstName)) { query = query + " AND e.FirstName LIKE :FirstName "; } if (!string.IsNullOrEmpty(criteria.LastName)) { query = query + " AND e.LastName LIKE :LastName "; } if (!string.IsNullOrEmpty(criteria.Position)) { query = query + " AND em.Position LIKE :Position "; } if (!string.IsNullOrEmpty(criteria.PhoneNumber)) { query = query + " AND e.PhoneNumber LIKE :PhoneNumber "; } if (!string.IsNullOrEmpty(criteria.MobilePhoneNumber)) { query = query + " AND e.MobilePhoneNumber LIKE :MobilePhoneNumber "; } if (!string.IsNullOrEmpty(criteria.Email)) { query = query + " AND e.Email LIKE :Email "; } if (!string.IsNullOrEmpty(criteria.Section) && !criteria.Section.Equals("0")) { query = query + " AND em.Section_id = :Section "; } if (!string.IsNullOrEmpty(criteria.OrganizationalUnit) && !criteria.OrganizationalUnit.Equals("0")) { query = query + " AND em.OrganizationalUnit_id = :OrganizationalUnit "; } if (!string.IsNullOrEmpty(criteria.OrganizationalCell) && !criteria.OrganizationalCell.Equals("0")) { query = query + " AND em.OrganizationalCell_id = :OrganizationalCell "; } if (!string.IsNullOrEmpty(criteria.Room)) { query = query + " AND em.Room = :Room "; } if (!string.IsNullOrEmpty(criteria.EmployeeNumber)) { query = query + " AND e.EmployeeNumber = :EmployeeNumber "; } // ORDER BY return(query); }