public PostNote(MatterDTO matter, IPostingComplete listener)
     : base(UITableViewStyle.Grouped, null)
 {
     this.matter = matter;
     this.listener = listener;
     selectedDate = DateTime.Now;
     GetTariffCodes (0);
     BuildInterface ();
 }
 public PostFee(IPostingComplete listener, MatterDetail matterDetail, MatterDTO matter, bool isUnbillable)
     : base(UITableViewStyle.Grouped, null)
 {
     this.matter = matter;
     this.matterDetail = matterDetail;
     this.isUnbillable = isUnbillable;
     this.listener = listener;
     BuildInterface ();
     GetTariffCodes (100, DataUtil.TARIFF_CODE_TYPE_FEES);
 }
        void DataDownloaded(IAsyncResult result)
        {
            isBusy = false;
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            end = DateTime.Now;
            var request = result.AsyncState as HttpWebRequest;
            WebServiceResponseDTO dto;
            try {
                HttpWebResponse response = (HttpWebResponse)request.EndGetResponse (result);
                Stream receiveStream = response.GetResponseStream ();
                StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8);
                string resp = readStream.ReadToEnd ();
                Console.WriteLine ("## ASYNCResponse stream received.\n" + resp);
                response.Close ();
                readStream.Close ();
                dto = (WebServiceResponseDTO)JsonConvert.DeserializeObject (resp, typeof(WebServiceResponseDTO)
                );
                if (dto != null) {
                    matter = dto.matter;
                    Tools.SendElapsedTime (start, end, dto.activityID);
                }

                InvokeOnMainThread (delegate {
                    isBusy = false;
                    try {
                        if (dto.responseCode > 0) {
                            new UIAlertView ("Matter Details", dto.responseMessage, null, "OK").Show ();
                            return;
                        } else {
                            matter = dto.matter;
                            BuildInterface ();
                            enableButtons ();
                        }
                    } catch (Exception e) {
                        Console.WriteLine ("### IGNORED: " + e.Message);
                        //ignore -
                    }
                }
                );

            } catch (Exception ex) {
                Console.WriteLine ("shit " + ex.ToString ());
                InvokeOnMainThread (delegate {
                    isBusy = false;
                    new UIAlertView ("Network Error", "Problem communicating with server, \n\nCheck your network connections and try again later", null, "Close"
                    ).Show ();

                }
                );
            }
        }