//[Route("api/JSearch/GetJobs")] public HttpResponseMessage GetJobbySearch([FromUri] String PLocation, [FromUri] String PKeySkill, [FromUri] String PQualification, [FromUri] String PJobCategory, [FromUri] String PMinExp, [FromUri] String PMaxExp, [FromUri] String PJobCode, [FromUri] String PSourceType) { #region R&D Work //{Location:"CTYGSP0510000001",KeySkill:"accounts",Qualification:"%",JobCategory:"%",MinExp:"0",MaxExp:"31",JobCode:"%",SourceType:"PERM"} //dynamic item1 = Newtonsoft.Json.JsonConvert.DeserializeObject(Params); //var lst = Newtonsoft.Json.JsonConvert.DeserializeObject(Params); //List<dynamic> lstitem = new List<dynamic>(); //lstitem.Add(item1); ////var bb = from item in lst select item; ////foreach(var aa in lst) ////{ ////} #endregion R&D Work JSParams JParam = new JSParams() { Location = PLocation, KeySkill = PKeySkill, Qualification = PQualification, JobCategory = PJobCategory, MinExp = PMinExp, MaxExp = PMaxExp, JobCode = PJobCode, SourceType = PSourceType }; List <dynamic> lstJob = GetParamDetails(JParam); ResponseClass objresponse = new ResponseClass() { ResponseCode = lstJob.Count > 0 ? 001 : -101, ResponseData = lstJob, ResponseStatus = lstJob.Count > 0 ? "Success" : "Failed" }; var jsonformat = new System.Net.Http.Formatting.JsonMediaTypeFormatter(); HttpResponseMessage response = new HttpResponseMessage(); response.Content = new ObjectContent(objresponse.GetType(), objresponse, jsonformat); response.StatusCode = lstJob.Count > 0 ? HttpStatusCode.OK : HttpStatusCode.NotFound; return(response); }
public List <dynamic> GetParamDetails(JSParams objparams) { //RMSJSSelectJobDetailsSearchforApp //TRJOBSEARCHforApp int?ReturnStatus = 0; System.Data.DataTable dtd = new System.Data.DataTable(); DatabaseTransaction objDB = new DatabaseTransaction(); string strProc = string.Empty; List <KeyValuePair <object, object> > lstJobs = new List <KeyValuePair <object, object> >(); lstJobs.Add(new KeyValuePair <object, object>("@SelectedCity", objparams.Location)); lstJobs.Add(new KeyValuePair <object, object>("@SelectedSKILL", objparams.KeySkill)); lstJobs.Add(new KeyValuePair <object, object>("@SelectedQualification", objparams.Qualification)); lstJobs.Add(new KeyValuePair <object, object>("@Selectedfunction", objparams.JobCategory)); lstJobs.Add(new KeyValuePair <object, object>("@SelectedMINEXP", objparams.MinExp)); lstJobs.Add(new KeyValuePair <object, object>("@SelectedMAXEXP", objparams.MaxExp)); lstJobs.Add(new KeyValuePair <object, object>("@JobCode", objparams.JobCode)); switch (objparams.SourceType.ToUpper()) { case "PERM": dtd = null; objDB.AddConnectionName = "RMSLocal"; dtd = objDB.SqlGetData("RMSJSSelectJobDetailsSearchforApp", ref lstJobs, ExecType.Dynamic, ReturnDBOperation.DataTable, ref ReturnStatus); break; case "TEMP": dtd = null; objDB.AddConnectionName = "TSSRMS"; dtd = objDB.SqlGetData("TRJOBSEARCHforApp", ref lstJobs, ExecType.Dynamic, ReturnDBOperation.DataTable, ref ReturnStatus); break; case "ALL": dtd = null; DataSet dsPerm = new DataSet(); DataSet dsTemp = new DataSet(); objDB.AddConnectionName = "RMSLocal"; dsPerm = objDB.SqlGetData("RMSJSSelectJobDetailsSearchforApp", ref lstJobs, ExecType.Dynamic, ReturnDBOperation.DataSet, ref ReturnStatus); objDB.AddConnectionName = "TSSRMS"; dsTemp = objDB.SqlGetData("TRJOBSEARCHforApp", ref lstJobs, ExecType.Dynamic, ReturnDBOperation.DataSet, ref ReturnStatus); if (dsPerm != null && dsPerm.Tables.Count > 0 && dsPerm.Tables[0].Rows.Count > 0) { if (dsTemp != null && dsTemp.Tables.Count > 0 && dsTemp.Tables[0].Rows.Count > 0) { dsPerm.Merge(dsTemp.Tables[0]); } dtd = dsPerm.Tables[0]; } if (dsPerm == null && dsTemp != null && dsTemp.Tables.Count > 0 && dsTemp.Tables[0].Rows.Count > 0) { dtd = dsTemp.Tables[0]; } break; } var dtlist = new List <dynamic>(); if (dtd != null && dtd.Rows.Count > 0) { dtlist = new CommonMethods().DatatableToList(dtd); } return(dtlist); }