public Object OffLineGetTrainersList([FromBody] OffLineGetTrainerInput Trainer) { DataTable dt_Trainer = new DataTable(); string sJSONResponse = ""; DataSet dt_Packageresposne = new DataSet(); OffLineGetTraineroutput topt = new OffLineGetTraineroutput(); List <OffLineTrainerObjects> TrainerObjects = new List <OffLineTrainerObjects>(); try { dt_Trainer = getdata(string.Format("select distinct HRE.EmployeeCode as TrainerCode,HRE.EmployeeName as TrainerName from HREmployee HRE,TrainerSlotSpecializationMapping OLTSM where OLTSM.TrainerCode=HRE.EmployeeCode and OLTSM.IsDeleted=0", "")); OffLineTrainerObjects OTO = new OffLineTrainerObjects { previousTrainers = OffLinePerviousTrainerDetailsObject(Trainer.MobileNo), trainersList = OffLineTrainerListObject(Trainer.MobileNo, Trainer.BranchCode) }; TrainerObjects.Add(OTO); topt.status = "success"; topt.value = TrainerObjects; sJSONResponse = JsonConvert.SerializeObject(topt); } catch (Exception ec) { topt.status = "success"; sJSONResponse = JsonConvert.SerializeObject(topt); } return(sJSONResponse); }
public Object GetTrainersListBranchwise([FromBody] OffLineGetTrainerInput Trainer) { TrainerlistOutput daOP = new TrainerlistOutput(); DataSet SelectedSlots = new DataSet(); string sJSONResponse = ""; DataTable dt_Trainers = new DataTable(); List <TrainerlistResponse> dalots = new List <TrainerlistResponse>(); try { dt_Trainers = getdata(string.Format("select distinct HRE.EmployeeCode as TrainerCode,HRE.EmployeeName as TrainerName,HRES.GradeName as PackageName,HRE.PhotoURL from HREmployee HRE,CMSSlotWiseAllocation CMSSWA,EmployeeBranches EB,HREmpSpecialists HRES where HRES.EmployeeCode=HRE.EmployeeCode and HRES.EmployeeCode=CMSSWA.TrainerCode and CMSSWA.TrainerCode=HRE.EmployeeCode and CMSSWA.IsDeleted=0 and CMSSWA.IsActive=1 and EB.EmployeeCode=HRE.EmployeeCode and HRE.EmployeeCode!=100001 and CMSSWA.BranchCode=EB.BranchCode and EB.BranchCode='{0}' ", Trainer.BranchCode)); for (int i = 0; i < dt_Trainers.Rows.Count; i++) { TrainerlistResponse SlotsDetails = new TrainerlistResponse { trainerCode = dt_Trainers.Rows[i]["TrainerCode"].ToString(), trainerName = dt_Trainers.Rows[i]["TrainerName"].ToString(), packageName = dt_Trainers.Rows[i]["PackageName"].ToString(), imageUrl = dt_Trainers.Rows[i]["PhotoURL"].ToString() }; dalots.Add(SlotsDetails); } daOP.status = "success"; daOP.value = dalots; sJSONResponse = JsonConvert.SerializeObject(daOP); } catch (Exception ec) { daOP.status = "fail"; sJSONResponse = JsonConvert.SerializeObject(daOP); } return(sJSONResponse); }