I am using iOS InAppPurchaseManager - iphone

with phonegap 1.5.0rc1 and XCode 4.3.
I can not upgrade my mac for the moment.
When I use plugins I do not have any answer, no alert and no message.
I try to do this :
function onDeviceReady() {
processdiv = document.getElementById('processdiv');
processdiv.innerHTML = "Loading...";
window.plugins.inAppPurchaseManager.onPurchased = function(transactionIdentifier, productId, transactionReceipt) {
console.log('purchased: ' + productId);
/* Give coins, enable subscriptions etc */
}
processdiv.innerHTML += "<br />onPurchased OK";
window.plugins.inAppPurchaseManager.onRestored = function(transactionIdentifier, productId, transactionReceipt) {
console.log('restored: ' + productId);
/* See the developer guide for details of what to do with this */
}
processdiv.innerHTML += "<br />onRestored OK";
window.plugins.inAppPurchaseManager.onFailed = function(errno, errtext) {
console.log('failed: ' + errtext);
}
processdiv.innerHTML += "<br />onFailed OK";
}
function requestProdData(prodStr) {
window.plugins.inAppPurchaseManager.requestProductData(prodStr, function(productId, title, description, price) {
console.log("productId: " + productId + " title: " + title + " description: " + description + " price: " + price);
showAlert("productId: " + productId + " title: " + title + " description: " + description + " price: " + price);
window.plugins.inAppPurchaseManager.makePurchase(productId, 1);
}, function(id) {
console.log("Invalid product id: " + id);
showAlert("par la ?? " + id);
}
);
processdiv.innerHTML = "ProductID: " + prodStr + "<br />";
}
Help
I try to add alert in different place of code to know what is the problem.
I had many products in a test app.
I search example to use this plugins. Thanks.

Do not foget to add plugins inAppPurchaseManager in you plugins Cordova.plist :(

Related

Splitting a string Value into chunks of a certain size

public static void SplittingStringIntoChunksCounts(string InputValue)
{
int ChunkSize = 5;
InputValue = "TestingManualTestingAutomTesting";
Dictionary<string, int> dictValue = new Dictionary<string, int>();
for (int i = 0; i < InputValue.Length; i += chunkSize)
{
if (i + chunkSize <= InputValue.Length)
{
Console.WriteLine(InputValue.Substring(i, chunkSize));
string tempValue = InputValue.Substring(i, chunkSize);
if (dictValue.ContainsKey(tempValue))
//if (!dictValue.ContainsKey(tempValue))
{
dictValue[tempValue]++;
//dictValue[tempValue] = 0;
}
else { dictValue[tempValue] = 1; }
// dictValue[tempValue]++;
}
}
foreach (var item in dictValue)
{
Console.WriteLine("Input User== " + " " + item.Key + " " + "Number of Time" + " " + item.Value);
}
}
foreach (var item in dictValue)
{
Console.WriteLine("Input User== " + " " + item.Key + " " + "Number of Time" + " " + item.Value);
}

Windows Service not receiving API response when request takes more than 5 mins to process

We have implented a queuing mechanism with windows service which sends API requests in sequential manner. When the API request take more than 5 mins to process, windonws service not taking the subsequent items.
With the log we observed that, windows service not receiving response from API. But when we debug the same things are working fine.
Do we know whether API not giving response back to windows service or something is going on?
Below is the code piece for this issue:
private void ProcessQueueRequestsByEnvironment(EnvironmentTypes environmentType)
{
try
{
var queueRequests = new DbHelper().GetQueueRequestsByEnvironment(environmentType);
if (queueRequests != null && queueRequests.Count > 0)
{
foreach (var queueRequest in queueRequests)
{
LoggingHelper.WriteToFile("======Request Starting - " + environmentType.ToString() + "====== QueueId: " + queueRequest.QueueId + " AnalysisId: " + queueRequest.AnalysisId + " at " + DateTime.Now);
ApiServiceHelper.SendAnalysisRequestToProcess(queueRequest, environmentType);
LoggingHelper.WriteToFile("======Request Completed - " + environmentType.ToString() + "====== QueueId: " + queueRequest.QueueId + " AnalysisId: " + queueRequest.AnalysisId + " at " + DateTime.Now);
}
}
}
catch (Exception ex)
{
if (!ex.Message.Contains("Could not find stored procedure 'SP_GetQueueRequestsToProcess'"))
{
EmailHelper.SendErrorEmailNotification(ex, "QueueProcessingService::ProcessQueueRequestsByEnvironment");
}
LoggingHelper.WriteToFile("======Error occurred while processing " + environmentType.ToString() + " requests at ======" + DateTime.Now + Environment.NewLine + ex.Message + ex.StackTrace);
}
}
....................
public class ApiServiceHelper
{
public static bool SendAnalysisRequestToProcess(QueueItemModel queueItem, EnvironmentTypes environmentType)
{
try
{
using (var client = new HttpClient())
{
client.Timeout = Timeout.InfiniteTimeSpan; // Infinite request timeout
string apiUrl = ConfigurationManager.AppSettings["ProductionApiUrl"];
if (environmentType == EnvironmentTypes.STAGING)
{
apiUrl = ConfigurationManager.AppSettings["StagingApiUrl"];
}
client.BaseAddress = new Uri(apiUrl);
client.DefaultRequestHeaders.Add("ServiceRequestKey", ConfigurationManager.AppSettings["ServiceRequestKey"]);
using (StringContent content = new StringContent(JsonConvert.SerializeObject(queueItem), Encoding.UTF8, "application/json"))
{
//HTTP POST
var result = client.PostAsync(apiUrl, content).Result;
bool objResult = JsonConvert.DeserializeObject<bool>(result.Content.ReadAsStringAsync().Result);
return objResult;
}
}
}
catch (Exception ex)
{
LoggingHelper.WriteToFile("======Error occurred while processing the request====== QueueId: " + queueItem.QueueId + " AnalysisId: " + queueItem.AnalysisId + " at " + DateTime.Now + Environment.NewLine + ex.Message + ex.StackTrace);
EmailHelper.SendErrorEmailNotification(ex, "ApiServiceHelper::SendAnalysisRequestToProcess");
return false;
}
}

createNativeQuery - return Page

I have the following custom implementation of my repository.
public final EntityManager entityManager;
public ImputacionRepositoryImpl(EntityManager entityManager) {
this.entityManager = entityManager;
}
#Override
public List<ImputacionData> imputacionesList() {
Query q = entityManager.createNativeQuery("SELECT " + "empleado.id as empleadoId,"
+ "MAX(imputacion.dia) as dia," + "imputacion.id as id " + "FROM rrhh.empleado empleado "
+ "JOIN rrhh.imputacion imputacion ON imputacion.empleado = empleado.id "
+ "WHERE empleado.id NOT IN (SELECT empleado.id " + "FROM rrhh.empleado empleado "
+ "LEFT JOIN rrhh.imputacion imputacion ON imputacion.empleado = empleado.id " + "WHERE "
+ "(imputacion.dia >= '2017-06-01' AND imputacion.dia <= '2017-10-31') "
+ "GROUP BY empleado.id,imputacion.empleado, imputacion.id) " + "AND true=true "
+ "GROUP BY empleado.id,imputacion.empleado, imputacion.id ORDER BY imputacion.dia DESC");
List<ImputacionData> imputaciones = q.getResultList();
return imputaciones;
}
And I need that instead of returning a List<ImputacionData>, return Page<ImputacionData>, but I do not know if it is possible, and how to do it.
So you can use page implementation in Spring, in Your case it's may look like:
#Override
public Page<ImputacionData> imputacionesList() {
Query q = entityManager.createNativeQuery("SELECT " + "empleado.id as empleadoId,"
+ "MAX(imputacion.dia) as dia," + "imputacion.id as id " + "FROM rrhh.empleado empleado "
+ "JOIN rrhh.imputacion imputacion ON imputacion.empleado = empleado.id "
+ "WHERE empleado.id NOT IN (SELECT empleado.id " + "FROM rrhh.empleado empleado "
+ "LEFT JOIN rrhh.imputacion imputacion ON imputacion.empleado = empleado.id " + "WHERE "
+ "(imputacion.dia >= '2017-06-01' AND imputacion.dia <= '2017-10-31') "
+ "GROUP BY empleado.id,imputacion.empleado, imputacion.id) " + "AND true=true "
+ "GROUP BY empleado.id,imputacion.empleado, imputacion.id ORDER BY imputacion.dia DESC");
Page<ImputacionData> page = new PageImpl<>(q.getResultList());
return page;
}

How to solve a TabLayout inside a Fragment which includes four Tabs created by one Fragment with newInstance() using RecyclerView

I implement an Activity which contains a NavigationView with includes several fragments. The first Fragment of the NavigationView contains a RecyclerView with a TabLayout, so that I can swipe between the different lists. Because I've got always the same list(UI) with different values, I decided to implement only one Fragment with a newInstance().
My problem now is that the list does not update properly when I jump from Tab1 to Tab2 or if I change a list item and come back to the list. Can somebody help me? I can't figure it out ...
swipe from Tab1 to Tab2
This is my fragment which contains the RecyclerView:
public class HinweiseFragment extends Fragment {
private static final String TAG = "HinweiseFragment";
private TabLayout mTabLayout;
private ViewPager mViewPager;
private HinweiseTabAdapter adapter;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
((MainActivity) getActivity()).getSupportActionBar().setTitle("Hinweise");
((MainActivity) getActivity()).showFloatingActionButton();
View rootView = inflater.inflate(R.layout.fragment_hinweise, null);
mTabLayout = (TabLayout) rootView.findViewById(R.id.tablayout_hinweise);
mTabLayout.addTab(mTabLayout.newTab().setText("BESAMUNG"));
mTabLayout.addTab(mTabLayout.newTab().setText("NICHT BESAMEN"));
mTabLayout.addTab(mTabLayout.newTab().setText("VERDACHT"));
mTabLayout.addTab(mTabLayout.newTab().setText("ALLE"));
mTabLayout.setTabGravity(mTabLayout.GRAVITY_FILL);
mViewPager = (ViewPager) rootView.findViewById(R.id.viewpager_hinweise);
adapter = new HinweiseTabAdapter(getChildFragmentManager(), mTabLayout.getTabCount(), getContext());
mViewPager.setAdapter(adapter);
mViewPager.setOffscreenPageLimit(3);
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));
mTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
#Override
public void onTabSelected(TabLayout.Tab tab) {
mViewPager.setCurrentItem(tab.getPosition(), true);
adapter.refreshFragment(tab.getPosition());
}
#Override
public void onTabUnselected(TabLayout.Tab tab) {
}
#Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
return rootView;
}
}
This is my TabAdapter:
public class HinweiseTabAdapter extends FragmentPagerAdapter {
HinweiseListFragment tab_besamung, tab_nicht, tab_verdacht, tab_alle;
String[] tabHostTitle = {"BESAMUNG", "NICHT BESAMEN", "VERDACHT", "ALLE"};
int mNumOfTabs;
private final Context mContext;
public HinweiseTabAdapter(FragmentManager fm, int NumOfTabs, Context context) {
super(fm);
this.mNumOfTabs = NumOfTabs;
this.mContext = context;
}
#Override
public Fragment getItem(int position) {
switch (position) {
case 0:
tab_besamung = HinweiseListFragment.newInstance(0, "BESAMUNG");
return tab_besamung;
case 1:
tab_nicht = HinweiseListFragment.newInstance(1, "NICHT BESAMEN");
return tab_nicht;
case 2:
tab_verdacht = HinweiseListFragment.newInstance(2, "VERDACHT");
return tab_verdacht;
case 3:
tab_alle = HinweiseListFragment.newInstance(3, "ALLE");
return tab_alle;
default:
return null;
}
}
public void refreshFragment(int position) {
switch (position) {
case 0:
tab_besamung.update();
break;
case 1:
tab_nicht.update();
break;
case 2:
tab_verdacht.update();
break;
case 3:
tab_alle.update();
break;
}
}
#Override
public int getItemPosition(Object object) {
int position = getItemPosition(object);
if (position >= 0) {
return position;
} else {
return POSITION_NONE;
}
}
#Override
public int getCount() {
return mNumOfTabs;
}
#Override
public CharSequence getPageTitle(int position) {
return tabHostTitle[position];
}
}
and this is my Fragment which contains the List:
public static HinweiseListFragment newInstance(int page, String title) {
HinweiseListFragment fragment = new HinweiseListFragment();
Bundle args = new Bundle();
args.putInt(PASSED_PAGE, page);
args.putString(PASSED_TITLE, title);
fragment.setArguments(args);
return fragment;
}
#Override
public void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (args != null) {
tabCount = args.getInt(PASSED_PAGE);
tabName = args.getString(PASSED_TITLE);
}
}
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_hinweise_list, container, false);
list_hinweise = new ArrayList<>();
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.rv_listHinweise);
mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeHinweise);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
#Override
public void onRefresh() {
mSwipeRefreshLayout.post(new Runnable() {
#Override
public void run() {
mSwipeRefreshLayout.setRefreshing(true);
refreshContent();
}
});
}
});
db = new DataBase(getActivity());
userHitKdr();
List<String> tab_ = db.getAll("SELECT * from tab_info where user_tab ='" + userdb + "' ");
if (tab_.size() != 2) {
db.updateSql("delete from tab_info where user_tab='" + userdb + "' ");
db.updateSql("insert into tab_info (activity_tab,tab_select,user_tab) values ('home','0','" + userdb + "'),('aufgabe','0','" + userdb + "'); ");
} else {
}
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mHinweiseAdapter = new HinweiseAdapter(getActivity(), getHinweise());
mRecyclerView.setAdapter(mHinweiseAdapter);
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
#Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
Intent detailView = new Intent(getActivity(), HinweiseDetail.class);
String[] tierarr = new String[tier_id.size()];
tier_id.toArray(tierarr);
String[] hinarr = new String[hin_id.size()];
hin_id.toArray(hinarr);
detailView.putExtra("detailart", "ovalert");
detailView.putExtra("idTier", tier_id.get(position));
detailView.putExtra("idDetail", hin_id.get(position));
int ipos = position;
Integer integerConverter = new Integer(ipos);
String s = integerConverter.toString();
detailView.putExtra("pos", s);
detailView.putExtra("arrIdTier", tierarr);
detailView.putExtra("arrIdHin", hinarr);
detailView.putExtra("userDetail", userdb);
detailView.putExtra("hitDetail", hitdb);
startActivity(detailView);
}
});
return rootView;
}
#Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
if(list_hinweise != null) {
update();
}
}
}
public String checkTab(int tab) {
tabCount = tab;
//tabName = name;
if (tabCount == 0) {
auswahl = " animalReproductionIndication.off='0' and (animalReproductionIndication.indicationCertainty ='IN' or animalReproductionIndication.indicationCertainty ='ID' or animalReproductionIndication.indicationCertainty ='' ) and ";
db.updateSql("update tab_info set tab_select='" + tabCount + "' where activity_tab='home' and user_tab='" + userdb + "' ");
if (list_hinweise != null) {
list_hinweise.clear();
if (mHinweiseAdapter != null) {
mHinweiseAdapter.notifyDataSetChanged();
}
}
}
if (tabCount == 1) {
auswahl = " animalReproductionIndication.off='0' and (animalReproductionIndication.indicationCertainty ='NI' or animalReproductionIndication.indicationCertainty ='HO') and ";
db.updateSql("update tab_info set tab_select='" + tabCount + "' where activity_tab='home' and user_tab='" + userdb + "' ");
if (list_hinweise != null) {
list_hinweise.clear();
if (mHinweiseAdapter != null) {
mHinweiseAdapter.notifyDataSetChanged();
}
}
}
if (tabCount == 2) {
auswahl = " animalReproductionIndication.off='0' and animalReproductionIndication.indicationCertainty ='SU' and ";
db.updateSql("update tab_info set tab_select='" + tabCount + "' where activity_tab='home' and user_tab='" + userdb + "' ");
if (list_hinweise != null) {
list_hinweise.clear();
if (mHinweiseAdapter != null) {
mHinweiseAdapter.notifyDataSetChanged();
}
}
}
if (tabCount == 3) {
auswahl = " animalReproductionIndication.off='0' and (animalReproductionIndication.indicationCertainty ='IN' or animalReproductionIndication.indicationCertainty ='NI' or animalReproductionIndication.indicationCertainty ='SU' or animalReproductionIndication.indicationCertainty ='ID' or animalReproductionIndication.indicationCertainty ='HO') and ";
db.updateSql("update tab_info set tab_select='" + tabCount + "' where activity_tab='home' and user_tab='" + userdb + "' ");
if (list_hinweise != null) {
list_hinweise.clear();
if (mHinweiseAdapter != null) {
mHinweiseAdapter.notifyDataSetChanged();
}
}
}
return auswahl;
}
public void update(){
tabCount = getArguments() != null ? getArguments().getInt(PASSED_PAGE) : 0;
tabName = getArguments() != null ? getArguments().getString(PASSED_TITLE) : "BESAMUNG";
list_hinweise.clear();
mHinweiseAdapter = new HinweiseAdapter(getActivity(), getHinweise());
mRecyclerView.setAdapter(mHinweiseAdapter);
}
public void refreshContent() {
importIndication();
tabCount = getArguments() != null ? getArguments().getInt(PASSED_PAGE) : 0;
tabName = getArguments() != null ? getArguments().getString(PASSED_TITLE) : "BESAMUNG";
list_hinweise.clear();
mHinweiseAdapter = new HinweiseAdapter(getActivity(), getHinweise());
mRecyclerView.setAdapter(mHinweiseAdapter);
// stopping swipe refresh
mSwipeRefreshLayout.setRefreshing(false);
}
private List<ListHinweise> getHinweise() {
checkTab(tabCount);
tm = new DateTime();
rg = new DateRegex();
tt = new DateTime();
try {
db.checkAndCopyDatabase();
db.openDatabase();
} catch (SQLiteException e) {
e.printStackTrace();
}
String sqlSortName = "select nameCode from sortieren where art='1' and (disable='0' or disable='1') and user='" + userdb + "' group by nameCode ";
String sqlSortDisable = "select disable from sortieren where art='1' and (disable='0' or disable='1') and user='" + userdb + "' group by nameCode ";
List<String> listSortName = db.getAll(sqlSortName);
List<String> listSortDisable = db.getAll(sqlSortDisable);
String sortSql = "";
for (int s1 = 0; s1 < listSortName.size(); s1++) {
System.out.println("Sort: " + listSortDisable.get(s1));
if (s1 == listSortName.size() - 1) {
String orderby = " desc ";
if (listSortDisable.get(s1).equals("0"))
orderby = " asc ";
if (listSortName.get(s1).equals("indicationDateTime"))
sortSql = sortSql + " animalReproductionIndication." + listSortName.get(s1) + " " + orderby;
else if (listSortName.get(s1).equals("farmersAnimalNr"))
sortSql = sortSql + " cast(OVALERTAPP." + listSortName.get(s1) + " as integer) " + orderby;
else
sortSql = sortSql + " OVALERTAPP." + listSortName.get(s1) + " " + orderby;
} else {
String orderby = " desc ,";
if (listSortDisable.get(s1).equals("0"))
orderby = " asc ,";
if (listSortName.get(s1).equals("indicationDateTime"))
sortSql = sortSql + " animalReproductionIndication." + listSortName.get(s1) + " " + orderby;
else if (listSortName.get(s1).equals("farmersAnimalNr"))
sortSql = sortSql + " cast(OVALERTAPP." + listSortName.get(s1) + " as integer) " + orderby;
else
sortSql = sortSql + " OVALERTAPP." + listSortName.get(s1) + " " + orderby;
}
}
String sxc = sortSql;
sxc = sxc.trim();
if (!sxc.equals(""))
sortSql = " order by " + sortSql;
System.out.println("Sort: " + sortSql);
try {
sql = " FROM OVALERTAPP, animalReproductionIndication WHERE " + sql_user_hit + " OVALERTAPP.AnimalNumber= animalReproductionIndication.AnimalNumber and " + auswahl + "1 " + sortSql;
String prio = db.getSelect("select nameCode from primaeridentifikation where user='" + userdb + "' and art='1' and disable='1' ");
List<String> einstellung_name = db.getAll("SELECT name from einstellungen where user ='" + userdb + "' and seite='1' and disable='1' ");
List<String> einstellung_nameCode = db.getAll("SELECT nameCode from einstellungen where user ='" + userdb + "' and seite='1' and disable='1' ");
String xxInhalt = " ";
for (int xx = 0; xx < einstellung_name.size(); xx++) {
String namexx = einstellung_name.get(xx);
for (int yy = 0; yy < namexx_.length; yy++) {
namexx = namexx.replace(namexx_[yy], Abkxx_[yy]);
}
xxInhalt = xxInhalt + "' " + namexx + ": ' || OVALERTAPP." + einstellung_nameCode.get(xx) + " ||";
}
xxInhalt = " || '<br>' || " + xxInhalt + " ''";
xxInhalt = xxInhalt.replace("OVALERTAPP.participantAnimal", "OVALERTAPP.participantAnimalNr");
if (einstellung_name.size() < 1) {
xxInhalt = " ";
}
tier_id = db.getAll("SELECT OVALERTAPP.id " + sql);
hin_id = db.getAll("SELECT animalReproductionIndication.id " + sql);
hin_besamt = db.getAll("SELECT animalReproductionIndication.indicationCertainty " + sql);
hin_blaue = db.getAll("select animalReproductionIndication.showType " + sql);
hin_time = db.getAll("select animalReproductionIndication.indicationDateTime " + sql); //gesehen
if (prio.equals("")) {
String sql_ = " SELECT OVALERTAPP.AnimalNumber || ' I.H: ' || '--' || ' T I.B: ' || OVALERTAPP.lastInseminationDate || ' T LT: ' || OVALERTAPP.calvingDate || ' T '|| reproductionStatus " + xxInhalt + " " + sql; // time
sql_ = sql_.replace("OVALERTAPP.aktivseit", "animalReproductionIndication.indicationDateTime");
hin_info = db.getAll(sql_);
// hin_info = db.getAll(" SELECT OVALERTAPP.AnimalNumber || ' I.H: ' || '--' || ' T I.B: ' || OVALERTAPP.lastInseminationDate || ' T LT: ' || OVALERTAPP.calvingDate || ' T '|| reproductionStatus " + xxInhalt + " " + sql); // time
System.out.println(" SELECT OVALERTAPP.AnimalNumber || ' I.H: ' || '--' || ' T I.B: ' || OVALERTAPP.lastInseminationDate || ' T LT: ' || OVALERTAPP.calvingDate || ' T '|| reproductionStatus " + xxInhalt + " " + sql); // time
} else {
//hin_info = db.getAll(" SELECT OVALERTAPP." + prio + " || ' I.H: ' || '--' || ' T I.B: ' || OVALERTAPP.lastInseminationDate || ' T LT: ' || OVALERTAPP.calvingDate || ' T '|| reproductionStatus " + xxInhalt + " " + sql); // time
String sql_ = " SELECT OVALERTAPP." + prio + " || ' I.H: ' || '--' || ' T I.B: ' || OVALERTAPP.lastInseminationDate || ' T LT: ' || OVALERTAPP.calvingDate || ' T '|| reproductionStatus " + xxInhalt + " " + sql; // time
sql_ = sql_.replace("OVALERTAPP.aktivseit", "animalReproductionIndication.indicationDateTime");
hin_info = db.getAll(sql_);
System.out.println(" SELECT OVALERTAPP." + prio + " || ' I.H: ' || '--' || ' T I.B: ' || OVALERTAPP.lastInseminationDate || ' T LT: ' || OVALERTAPP.calvingDate || ' T '|| reproductionStatus " + xxInhalt + " " + sql); // time
}
for (int i = 0; i < hin_besamt.size(); i++) {
String timehin = db.getSelect("SELECT indicationDateTime FROM animalReproductionIndication where animalReproductionIndication.id=" + hin_id.get(i));
String animalhin = db.getSelect("SELECT animalNumber FROM animalReproductionIndication where animalReproductionIndication.id=" + hin_id.get(i));
// List<String> maxList=db.getAll("SELECT indicationDateTime FROM animalReproductionIndication where user='"+userdb+"' and animalNumber='"+animalhin+"' and indicationDateTime!='"+timehin+"' and indicationExpirationDateTime !='' order by indicationDateTime desc ");
String timehin_date = timehin + " ";
List<String> maxList = db.getAll("SELECT indicationDateTimeHin FROM animalReproductionIndicationHinweise where userHin='" + userdb + "' and animalNumberHin='" + animalhin + "' and indicationDateTimeHin!='" + timehin + "' and (indicationDateTimeHin not LIKE '" + timehin_date.substring(0, 8) + "%') and indicationDateTimeHin < '" + timehin + "' order by indicationDateTimeHin desc ");
String hin = "";
if (maxList.size() > 0) {
hin = maxList.get(0);
System.out.println("hin++++" + hin + " neue: " + timehin);
}
//hin=tm.getDayToDay(hin,"yyyyMMddkkmmss");
hin = tm.getDayMinusDayDate(hin, timehin);
String line = statusUmbenennen(hin_info.get(i));
System.out.println("line: " + line);
String info_ = statusUmbenennen(hin_info.get(i));
System.out.println("line1: " + line);
info_ = info_.replace("--", hin);
System.out.println("line2: " + info_);
System.out.println(info_);
String[] anfang = {"I Kalb: ", "I Bes: ", "n Kalb: ", "I Bru: ", " Trocken: "};
String[] end = {"", "", "", "", ""};
String[] anfang1 = {"I.H: ", "I.B: ", "LT: "};
String[] end1 = {"", "", ""};
try {
info_ = lineYMDTag(info_, anfang1, end1);
System.out.println("line3: " + info_);
} catch (ParseException e) {
e.printStackTrace();
}
String[] anfangx = {"Aktiv seit: "};
String[] endx = {""};
try {
info_ = lineYMDHMS(info_, anfangx, endx);
} catch (ParseException e) {
e.printStackTrace();
}
try {
info_ = lineYMD(info_, anfang, end);
System.out.println("line4: " + info_);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println("info_: " + info_);
ListHinweise item = new ListHinweise();
item.setHinId(tier_id.get(i));
item.setHinId(hin_id.get(i));
item.setHinBlaue(hin_blaue.get(i));
item.setHinInfo(info_);
item.setHinBesamt(hin_besamt.get(i));
System.out.println(hin_time.get(i) + "_xmmx_" + tt.getHourDiffStartToNow(hin_time.get(i), "yyyyMMddkkmmss"));
item.setHinTime(String.valueOf(tt.getHourDiffStartToNow(hin_time.get(i), "yyyyMMddkkmmss")));
list_hinweise.add(item);
db.close();
}
} catch (SQLiteException e) {
e.printStackTrace();
}
return list_hinweise;
}
I have already tried to update the list with onResume or setUserVisibleHint but without success. My refreshContent() method works fine, but I want to update the list automatically and not manually. If I took the onResume() method the Items will be refreshed but then my Tab1 contains the values from Tab1 and Tab2.

ASP.net Retrieving data from database always failing with ajax

Got this jquery code am using to retrieve data from database through ADO.net:
$(document).ready(getBooks);
function getBooks() {
$.ajax({
type: "POST",
url: "main.aspx/getBooks",
data: "{}",
datatype: "json",
contenttype: "application/json; charset=utf-8",
success: function (data) {
var TableContent = "<table>" +
"<tr>" +
"<td>ISBN</td>" +
"<td>Book Title</td>" +
"<td>Public Year</td>" +
"<td>Category</td>" +
"</tr>";
for (var i = 0; i < data.d.length; i++) {
TableContent += "<tr>" +
"<td>" + data.d[i].ISBN + "</td>" +
"<td>" + data.d[i].BOOK_TITLE + "</td>" +
"<td>" + data.d[i].PUBLICATION_YEAR + "</td>" +
"<td>" + data.d[i].CATEGORY_TYPE + "</td>" +
"</tr>";
}
TableContent += "</table>";
$("#UpdatePanel").html(TableContent);
},
error: $("#UpdatePanel").html("Error")
});
}
C# code looks like this:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static List<Book> getBooks()
{
List<Book> allBooks = new List<Book>();
using (LibraryEntities le = new LibraryEntities())
{
allBooks = le.Books.ToList();
}
return allBooks;
}
My issue is that am always getting nothing and after i added:
error: $("#UpdatePanel").html("Error")
Am only getting "Error" in UpdatePanel element, i am an AJAX Newbie, need your help guys.