public override void ViewDidLoad() { base.ViewDidLoad (); tableView.RowHeight = 60; btnEmail.Clicked += delegate { new UIAlertView ("eMail Broadcast", "Send eMail to list", null, "OK").Show (); }; btnSMS.Clicked += delegate { new UIAlertView ("SMS Broadcast", "Send SMS to list", null, "OK").Show (); }; UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; ConsoleRequest cr = new ConsoleRequest (); string json, encodedJSON, url, resp; ConsoleResponseDTO dto; try { if (companyID == 0) { cr.requestType = ConsoleRequest.PLATFORM_USERS_ALL; } else { cr.requestType = ConsoleRequest.PLATFORM_USERS_COMPANY; cr.companyID = companyID; } cr.platformID = platform.platformID; json = JsonConvert.SerializeObject (cr); encodedJSON = HttpUtility.UrlEncode (json); url = Tools.CONSOLE_URL + encodedJSON; resp = TalkToServer.getData (url); dto = (ConsoleResponseDTO)JsonConvert.DeserializeObject (resp, typeof(ConsoleResponseDTO)); if (dto.users.Count == 0) { btncount.Title = " Users: " + 0; //new UIAlertView ("No Data", "No users are provisioned on " + platform.platformName, null, "OK").Show (); } else { list = dto.users; btncount.Title = " Users: " + list.Count; tableView.Delegate = new TableViewDelegate (list, this); tableView.DataSource = new TableViewDataSource (list); tableView.ReloadData (); } } catch (System.Net.WebException ex) { Console.WriteLine ("Server unavailable: " + ex.Message); new UIAlertView ("Server Error", "Server not available", null, "OK").Show (); } catch (Exception ex) { Console.WriteLine ("Network unavailable: " + ex.Message); new UIAlertView ("Network Error", "Network not available", null, "OK").Show (); } UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }
private void getLogs() { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; ConsoleRequest cr = new ConsoleRequest (); string json, encodedJSON, url, resp; ConsoleResponseDTO dto; try { cr.requestType = ConsoleRequest.ACTIVITY_LOGS_BY_USER; cr.userID = user.userID; cr.fromDate = Tools.ConvertDateTimeToJavaMS (Tools.GetDate (Tools.NUMBER_OF_DAYS)); cr.toDate = Tools.ConvertDateTimeToJavaMS (DateTime.Now); json = JsonConvert.SerializeObject (cr); encodedJSON = HttpUtility.UrlEncode (json); url = Tools.CONSOLE_URL + encodedJSON; resp = TalkToServer.getData (url); dto = (ConsoleResponseDTO)JsonConvert.DeserializeObject (resp, typeof(ConsoleResponseDTO)); list = dto.activityLogs; if (list == null || dto.responseCode > 0) { list = new List<ActivityLogDTO> (); new UIAlertView ("Activity Logs", "No activity records were found", null, "OK").Show (); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; this.NavigationController.PopViewControllerAnimated(true); } else { btnLogs.Title = "Activities: " + list.Count.ToString (); tableView.Delegate = new TableViewDelegate (list, this); tableView.DataSource = new TableViewDataSource (list); tableView.ReloadData (); if (list.Count == 0) { new UIAlertView ("Activity Logs", "No activity records were found", null, "OK").Show (); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; this.NavigationController.PopViewControllerAnimated(true); } } } catch (System.Net.WebException ex) { Console.WriteLine ("Server unavailable: " + ex.Message); new UIAlertView ("Server Error", "Server not available", null, "OK").Show (); } catch (Exception ex) { Console.WriteLine ("Network unavailable: " + ex.Message); new UIAlertView ("Network Error", "Network not available", null, "OK").Show (); } UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }
private void getSummary() { ConsoleRequest cr = new ConsoleRequest (); string json, encodedJSON, url, resp; ConsoleResponseDTO dto; try { cr.requestType = ConsoleRequest.ACTIVITY_SUMMARY_USER; cr.fromDate = Tools.ConvertDateTimeToJavaMS (Tools.GetDate (Tools.NUMBER_OF_DAYS)); cr.toDate = Tools.ConvertDateTimeToJavaMS (DateTime.Now); cr.userID = user.userID; json = JsonConvert.SerializeObject (cr); encodedJSON = HttpUtility.UrlEncode (json); url = Tools.CONSOLE_URL + encodedJSON; resp = TalkToServer.getData (url); dto = (ConsoleResponseDTO)JsonConvert.DeserializeObject (resp, typeof(ConsoleResponseDTO)); List<SummaryDTO> sList = dto.summaries; //start summary view var cont = new SummaryController (sList); this.NavigationController.PushViewController (cont, true); } catch (System.Net.WebException ex) { Console.WriteLine ("Server unavailable: " + ex.Message); new UIAlertView ("Server Error", "Server not available", null, "OK").Show (); } catch (Exception ex) { Console.WriteLine ("Network unavailable: " + ex.Message); new UIAlertView ("Network Error", "Network not available", null, "OK").Show (); } }
private void doCompanySummary() { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; btnSummaryReport.Enabled = false; ConsoleRequest cr = new ConsoleRequest (); string json, encodedJSON, url, resp; ConsoleResponseDTO dto; try { cr.requestType = ConsoleRequest.ACTIVITY_SUMMARY_COMPANY; cr.fromDate = Tools.ConvertDateTimeToJavaMS (Tools.GetDate (Tools.NUMBER_OF_DAYS)); cr.toDate = Tools.ConvertDateTimeToJavaMS (DateTime.Now); cr.companyID = company.companyID; json = JsonConvert.SerializeObject (cr); encodedJSON = HttpUtility.UrlEncode (json); url = Tools.CONSOLE_URL + encodedJSON; resp = TalkToServer.getData (url); dto = (ConsoleResponseDTO)JsonConvert.DeserializeObject (resp, typeof(ConsoleResponseDTO)); List<SummaryDTO> sList = dto.summaries; var cont = new SummaryController (sList); this.NavigationController.PushViewController (cont, true); } catch (System.Net.WebException ex) { Console.WriteLine ("Server unavailable: " + ex.Message); new UIAlertView ("Server Error", "Server not available", null, "OK").Show (); } catch (Exception ex) { Console.WriteLine ("Network unavailable: " + ex.Message); new UIAlertView ("Network Error", "Network not available", null, "OK").Show (); } UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; btnSummaryReport.Enabled = true; }
private void doUserList() { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; ConsoleRequest cr = new ConsoleRequest (); string json, encodedJSON, url, resp; ConsoleResponseDTO dto; try { cr.requestType = ConsoleRequest.COMPANY_USER_LIST; cr.companyID = company.companyID; json = JsonConvert.SerializeObject (cr); encodedJSON = HttpUtility.UrlEncode (json); url = Tools.CONSOLE_URL + encodedJSON; resp = TalkToServer.getData (url); dto = (ConsoleResponseDTO)JsonConvert.DeserializeObject (resp, typeof(ConsoleResponseDTO)); list = dto.users; tableView.Delegate = new TableViewDelegate (list, this); tableView.DataSource = new TableViewDataSource (list); tableView.ReloadData (); btnCount.Title = "" + list.Count; } catch (System.Net.WebException ex) { Console.WriteLine ("Server unavailable: " + ex.Message); new UIAlertView ("Server Error", "Server not available", null, "OK").Show (); } catch (Exception ex) { Console.WriteLine ("Network unavailable: " + ex.Message); new UIAlertView ("Network Error", "Network not available", null, "OK").Show (); } UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }
private void doPlatformSummary() { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; btnActivityLogs.Enabled = false; ConsoleRequest cr = new ConsoleRequest (); string json, encodedJSON, url, resp; ConsoleResponseDTO dto; try { cr.requestType = ConsoleRequest.PLATFORM_SUMMARY_COMPANY; cr.appID = 1; cr.companyID = company.companyID; json = JsonConvert.SerializeObject (cr); encodedJSON = HttpUtility.UrlEncode (json); url = Tools.CONSOLE_URL + encodedJSON; resp = TalkToServer.getData (url); dto = (ConsoleResponseDTO)JsonConvert.DeserializeObject (resp, typeof(ConsoleResponseDTO)); List<PlatformSummaryDTO> sList = dto.platformSummaries; var contx = new PlatformController (sList, company.companyID); this.NavigationController.PushViewController (contx, true); } catch (System.Net.WebException ex) { Console.WriteLine ("Server unavailable: " + ex.Message); new UIAlertView ("Server Error", "Server not available", null, "OK").Show (); } catch (Exception ex) { Console.WriteLine ("Network unavailable: " + ex.Message); new UIAlertView ("Network Error", "Network not available", null, "OK").Show (); } UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; btnActivityLogs.Enabled = true; }