← Back to team overview

dhis-mobile-devs team mailing list archive

[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 165: upload lost to follow up events

 

------------------------------------------------------------
revno: 165
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: lwuit-tracking
timestamp: Thu 2013-10-10 11:37:14 +0700
message:
  upload lost to follow up events
modified:
  src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java
  src/org/hisp/dhis/mobile/model/LostEvent.java
  src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java


--
lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking
https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking

Your team DHIS mobile developers is subscribed to branch lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking/+edit-subscription
=== modified file 'src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java'
--- src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java	2013-10-09 03:09:25 +0000
+++ src/org/hisp/dhis/mobile/connection/task/SendLostToFollowUpTask.java	2013-10-10 04:37:14 +0000
@@ -32,8 +32,12 @@
 import org.hisp.dhis.mobile.connection.ConnectionManager;
 import org.hisp.dhis.mobile.midlet.NameBasedMIDlet;
 import org.hisp.dhis.mobile.model.LostEvent;
+import org.hisp.dhis.mobile.model.Notification;
+import org.hisp.dhis.mobile.ui.Text;
 import org.hisp.dhis.mobile.util.SerializationUtil;
 
+import com.jcraft.jzlib.ZInputStream;
+
 /**
  * @author Nguyen Kim Lai
  *
@@ -53,10 +57,23 @@
     
     public void run()
     {
-        DataInputStream inputStream = null;
+        DataInputStream tempinputStream = null;
         try
         {
-            inputStream = this.upload( SerializationUtil.serialize( lostEvent ) );
+            tempinputStream = this.upload( SerializationUtil.serialize( lostEvent ) );
+            DataInputStream inputStream = new DataInputStream( new ZInputStream( tempinputStream ) );
+            Notification notification = new Notification();
+            notification.deSerialize( inputStream );
+
+            if( notification.getMessage().equalsIgnoreCase( Text.SUCCESS() ) )
+            {
+                nameBasedMIDlet.getAlertBoxView( "Upload Successfully", Text.SUCCESS() ).showView();
+            }
+            else
+            {
+                nameBasedMIDlet.getAlertBoxView( "Upload Failed", Text.ERROR() ).showView();
+            }
+            nameBasedMIDlet.getLostToFollowUpView().getMainForm().show();
         }
         catch( IOException e )
         {

=== modified file 'src/org/hisp/dhis/mobile/model/LostEvent.java'
--- src/org/hisp/dhis/mobile/model/LostEvent.java	2013-10-09 03:09:25 +0000
+++ src/org/hisp/dhis/mobile/model/LostEvent.java	2013-10-10 04:37:14 +0000
@@ -35,7 +35,7 @@
  *
  * @version LostEvent.java 2:21:32 PM Oct 7, 2013 $
  */
-public class LostEvent extends Model implements DataStreamSerializable 
+public class LostEvent extends Model
 {   
     private String dueDate;
     

=== modified file 'src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java'
--- src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java	2013-10-09 03:09:25 +0000
+++ src/org/hisp/dhis/mobile/view/LostToFollowUpDetailView.java	2013-10-10 04:37:14 +0000
@@ -99,8 +99,19 @@
                 lostEvent.setComment( txtComment.getText() );
                 lostEvent.setSMS( txtSMS.getText() );
                 
+                nameBasedMIDlet.getWaitingView().showView();
                 ConnectionManager.setUrl( nameBasedMIDlet.getCurrentOrgUnit().getHandleLostToFollowUpUrl() );
                 ConnectionManager.sendLostToFollowUp( lostEvent );
+                
+                backCommand = null;
+                sendCommand = null;
+                lostEvent = null;
+                txtDueDate = null; 
+                txtComment = null;
+                txtSMS = null;
+                cbxStatus = null;
+                lblWrongDOB = null;
+                mainForm = null;
             }
         }
         else