コード例 #1
0
        //
        // Asynchronous HTTP request
        //
        public void getAsyncAppAndPlatform()
        {
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.GET_APP_PLATFORM_IDS;
            cr.appName = "GhostPractice Mobile";
            cr.platformName = "iPad";

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("Async JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            var request = (HttpWebRequest)WebRequest.Create (url);
            request.BeginGetResponse (PlatformDownloaded, request);
        }
コード例 #2
0
        public void getAsyncProvisionDevice()
        {
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            start = DateTime.Now;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.PROVISION_NEW_USER;
            cr.activationCode = activationCode.Value;
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.platformID = NSUserDefaults.StandardUserDefaults.IntForKey ("platformID");

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("Async JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            var request = (HttpWebRequest)WebRequest.Create (url);
            request.BeginGetResponse (ProvisioningDownloaded, request);
        }
コード例 #3
0
        // Asynchronous HTTP request
        //
        public static void SendElapsedTime(DateTime start, DateTime end, int activityID)
        {
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            try {
                cr.requestType = GhostRequestDTO.POST_DEVICE_ELAPSED_TIME;
                cr.activityID = activityID;
                cr.deviceElapsedSeconds = getElapsed (start, end);

                json = JsonConvert.SerializeObject (cr);
                Console.WriteLine ("SendElapsed JSON = " + json);
                encodedJSON = HttpUtility.UrlEncode (json);
                url = Tools.CONSOLE_URL + encodedJSON;

                var request = (HttpWebRequest)WebRequest.Create (url);
                request.BeginGetResponse (PlatformDownloaded, request);
            } catch (Exception e) {
                Console.WriteLine ("##SendElapsed Error: " + e.Message);
            }
        }
コード例 #4
0
        public void GetCalculatedFee(int duration, int tariffCodeID)
        {
            if (isBusy) {
                Console.WriteLine ("##GetCalculatedFee: comms are busy, slow down!");
                return;
            }
            isBusy = true;
            BuildInterface ();
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            start = DateTime.Now;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.CALCULATE_FEE;
            cr.matterID = matter.id;
            cr.duration = duration;
            cr.tariffCodeID = tariffCodeID;
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("Async JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            var request = (HttpWebRequest)WebRequest.Create (url);
            request.BeginGetResponse (FeeDownloaded, request);
        }
コード例 #5
0
        public void PostFeeToOffice(FeeDTO fee)
        {
            if (isBusy) {
                Console.WriteLine ("##PostFee: comms are busy, slow down!");
                return;
            }
            isBusy = true;
            BuildInterface ();
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            start = DateTime.Now;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;
            if (isTimeBased) {

            }
            if (isUnbillable) {
                cr.requestType = GhostRequestDTO.POST_UNBILLABLE_FEE;
            } else {
                cr.requestType = GhostRequestDTO.POST_FEE;
            }
            cr.fee = fee;
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("##PostFee JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            var request = (HttpWebRequest)WebRequest.Create (url);
            request.BeginGetResponse (PostComplete, request);
        }
コード例 #6
0
        public void GetTariffCodes(int duration, int tariffCodeType)
        {
            if (isBusy) {
                Console.WriteLine ("##GetTariffCodes: comms are busy, slow down!");
                return;
            }
            if (matter == null) {
                return;
            }
            isBusy = true;
            BuildInterface ();
            Console.WriteLine ("### tariff codes requested, duration: " + duration);
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            start = DateTime.Now;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.GET_TARIFF_CODES;
            cr.matterID = matter.id;
            cr.duration = duration;
            cr.tarrifCodeType = tariffCodeType;
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("&& GetTariffCodes JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            var request = (HttpWebRequest)WebRequest.Create (url);
            try {
                request.BeginGetResponse (DataDownloaded, request);
            } catch (Exception e) {
                Console.WriteLine ("Exception - " + e.Message);
                new UIAlertView (
                    "Error",
                    "Server Unavailable at this time.\nPlease try later.",
                    null,
                    "OK"
                ).Show ();
            }
        }
コード例 #7
0
        public void GetTariffCodes(int duration)
        {
            if (isBusy) {
                Console.WriteLine ("##GetTariffCodes: comms are busy, slow down!");
                return;
            }
            if (matter == null) {
                return;
            }

            isBusy = true;
            BuildInterface ();
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            start = DateTime.Now;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.GET_TARIFF_CODES;
            cr.matterID = matter.id;
            cr.duration = duration;
            cr.tarrifCodeType = DataUtil.TARIFF_CODE_TYPE_NOTES;
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("$$ GetTariffCodes JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            var request = (HttpWebRequest)WebRequest.Create (url);
            request.BeginGetResponse (DataDownloaded, request);
        }
コード例 #8
0
        public void sendAssignTaskRequest(TaskDTO task)
        {
            isBusy = true;
            start = DateTime.Now;
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.ASSIGN_TASK;
            cr.task = task;
            Console.WriteLine ("Task Description in getAsyncData: " + cr.task.taskDescription);
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("Async JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            try {
                var request = (HttpWebRequest)WebRequest.Create (url);
                request.BeginGetResponse (AssignTaskRequestCompleted, request);
            } catch (WebException e) {
                isBusy = false;
                Console.WriteLine ("Exception - " + e.Message);
                new UIAlertView ("Error", "Server Unavailable at this time.\nPlease try later.", null, "OK").Show ();
            }
        }
コード例 #9
0
        public void getAsyncReportData()
        {
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            isBusy = true;
            BuildInterface ();
            start = DateTime.Now;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.GET_REPORT;
            cr.reportType = reportType;
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");
            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("Async JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            var request = (HttpWebRequest)WebRequest.Create (url);
            request.BeginGetResponse (DataDownloaded, request);
        }
コード例 #10
0
        public void GetMatterDetails()
        {
            isBusy = true;
            disableButtons ();
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            start = DateTime.Now;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.GET_MATTER_DETAIL;
            cr.matterID = searchResult.matterID;
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");
            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("Async JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;
            var request = (HttpWebRequest)WebRequest.Create (url);
            request.BeginGetResponse (DataDownloaded, request);
        }
コード例 #11
0
        //
        // Asynchronous HTTP request
        //
        public void getAsyncData()
        {
            isBusy = true;
            start = DateTime.Now;
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            GhostRequestDTO cr = new GhostRequestDTO ();
            string json, encodedJSON, url;

            cr.requestType = GhostRequestDTO.FIND_MATTER;
            cr.searchString = SearchBar.Text;
            NSUserDefaults.StandardUserDefaults.SetString (cr.searchString, "search");
            cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID");
            cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID");
            cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID");
            cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID");

            json = JsonConvert.SerializeObject (cr);
            Console.WriteLine ("MatterFind JSON = " + json);
            encodedJSON = HttpUtility.UrlEncode (json);
            url = Tools.CONSOLE_URL + encodedJSON;

            try {
                var request = (HttpWebRequest)WebRequest.Create (url);
                request.BeginGetResponse (DataDownloaded, request);
            } catch (WebException e) {
                isBusy = false;
                Console.WriteLine ("Exception - " + e.Message);
                new UIAlertView ("Error", "Server Unavailable at this time.\nPlease try later.", null, "OK").Show ();
            }
        }