public async Task <JsonResult> SearchWorkPlace(string value, decimal salary, int elmPage) { int?page = 1; if (elmPage == 0) { elmPage = 10; } int elmpage = elmPage; decimal pageCount = 0; Paging paging = new Paging(); paging.CurrentPage = (int)page; paging.ItemPage = elmpage; paging.Prev = page > 1; List <EmployeeInfoWorkPlace> places = new List <EmployeeInfoWorkPlace>(); EmployeeWorkPlace employeeWork = new EmployeeWorkPlace(); var currentdata = await employeeWork.EmployeeInfoWorks(dbContext); if (value != null) { var searchData = currentdata.Where(x => x.PositionName.Contains(value) || x.PositionName.StartsWith(value) || x.CompanyName.Contains(value) || x.CompanyName.StartsWith(value) || x.EmperiumName.Contains(value) || x.EmperiumName.StartsWith(value) || x.Name.Contains(value) || x.Name.StartsWith(value) || x.PlasierCode.Contains(value) || x.PlasierCode.StartsWith(value) || x.Salary == salary).ToList(); paging.TotalItems = searchData.Count(); pageCount = Math.Ceiling(searchData.Count() / (decimal)elmpage); paging.Next = page < pageCount; var datapaging = searchData.Skip((paging.CurrentPage - 1) * elmpage).Take(elmpage).ToList(); return(Json(new { pageCount = pageCount, currentPage = paging.CurrentPage, allData = searchData, nextElement = paging.Next, prevElement = paging.Prev, data = datapaging, message = 202 })); } paging.TotalItems = currentdata.Count(); pageCount = Math.Ceiling(currentdata.Count() / (decimal)elmpage); paging.Next = page < pageCount; var data = currentdata.Skip((paging.CurrentPage - 1) * elmpage).Take(elmpage).ToList(); return(Json(new { pageCount = pageCount, currentPage = paging.CurrentPage, allData = currentdata, nextElement = paging.Next, prevElement = paging.Prev, data = data, message = 202 })); }
public dynamic Fired(EmployeeWorkPlace employeeWorkPlace) { string query; switch (employeeWorkPlace.Type) { case 1: query = $"Delete from EmployeeStore where idEmployee='{employeeWorkPlace.IdEmployee}' AND idStore='{employeeWorkPlace.IdOffice}'"; SqlQuery(query); break; case 2: query = string.Format("Delete from EmployeeWareHouse where idEmployee = '{0}' AND idWareHouse = '{1}'", employeeWorkPlace.IdEmployee, employeeWorkPlace.IdOffice); SqlQuery(query); break; } return(Save()); }
public dynamic Hire(EmployeeWorkPlace employeeWorkPlace) { string query; switch (employeeWorkPlace.Type) { case 1: query = string.Format("Insert into EmployeeStore values ('{0}','{1}')", employeeWorkPlace.IdEmployee, employeeWorkPlace.IdOffice); SqlQuery(query); break; case 2: query = string.Format("Insert into EmployeeWareHouse values ('{0}','{1}')", employeeWorkPlace.IdEmployee, employeeWorkPlace.IdOffice); SqlQuery(query); break; } return(Save()); }
public IHttpActionResult FiredEmployee(EmployeeWorkPlace employeeWorkPlace) { return(Ok(_service.Fired(employeeWorkPlace)));; }
public IHttpActionResult HireEmployee(EmployeeWorkPlace hire) { return(Ok(_service.Hire(hire)));; }
public dynamic Fired(EmployeeWorkPlace EmployeeDtoWorkPlace) { throw new NotImplementedException(); }