private async void GetTicketDetails(string tick_id)
        {
            if (comfun.isConnected())
            {
                try
                {
                    var client = new HttpClient();
                    client.BaseAddress = new Uri(App.api_url);
                    var values = new Dictionary <string, string>();
                    values.Add("operation", "query");
                    values.Add("session_string", App.session_string);
                    // values.Add("query", "select * from tickets where tickets_id = " + tick_id);
                    values.Add("query", "select * from tickets where id = " + tick_id);
                    var content = new FormUrlEncodedContent(values);
                    HttpResponseMessage response = await client.PostAsync("/itcrm/webservices/", content);

                    var result = await response.Content.ReadAsStringAsync();

                    //await DisplayAlert("Ticket Detail", result.ToString(), "ok");
                    TicketResult ticketDetail = JsonConvert.DeserializeObject <TicketResult>(result);
                    var          detail       = ticketDetail.result[0];

                    lblTicketStatus.Text = detail.tickets_status;
                    // DisplayAlert("status", status, "ok");
                    lblTicketNumber.Text   = detail.tickets_id;
                    lblTicketSummary.Text  = detail.tickets_summary;
                    lblTicketFullName.Text = detail.tickets_full_name;
                    lblTicketEmail.Text    = detail.tickets_email_address;
                    lblTicketDevice.Text   = detail.tickets_device_id;
                    lblTicketDetail.Text   = detail.tickets_detail;
                    lblTicketSource.Text   = detail.tickets_source;
                    //lblTicketTopic.Text = detail.tickets_topic;
                    lblTicketDueDate.Text = detail.tickets_due_date;
                    lblTicketCreated.Text = detail.tickets_created;
                    // device_id = detail.tickets_device_id_id;
                    // DisplayAlert("device id", device_id, "ok");
                    activityIndicator.IsRunning = false;
                }
                catch (Exception ex)
                { }
            }
            else
            {
                await DisplayAlert("Connection", "Internet Connection Disabled", "Ok");
            }
        }
Пример #2
0
        private async void GetTickets()
        {
            if (comfun.isConnected())
            {
                try
                {
                    var client = new HttpClient();
                    client.BaseAddress = new Uri(App.api_url);
                    var values = new Dictionary <string, string>();
                    values.Add("operation", "query");
                    values.Add("session_string", App.session_string);
                    values.Add("query", "select * from tickets");
                    var content = new FormUrlEncodedContent(values);
                    HttpResponseMessage response = await client.PostAsync("/itcrm/webservices/", content);

                    var result = await response.Content.ReadAsStringAsync();

                    //await DisplayAlert("result!", result.ToString(), "ok");

                    TicketResult tickets_list = JsonConvert.DeserializeObject <TicketResult>(result);
                    ObservableCollection <SetTicketList> dt = new ObservableCollection <SetTicketList>();
                    //lvTicketList.ItemsSource = dt;
                    var lst = tickets_list.result;
                    try
                    {
                        for (int i = 0; i < lst.Length; i++)
                        {
                            try
                            {
                                //    await DisplayAlert("Error!", lst[i].tickets_id, "ok");
                                list.Add(lst[i].tickets_id);
                            }
                            catch (Exception e)
                            {
                                //   await DisplayAlert("Error!", e.Message, "ok");
                            }
                        }
                    }
                    catch { }
                    try
                    {
                        for (int i = 0; i <= lst.Length; i++)
                        {
                            try
                            {
                                dt.Add(new SetTicketList()
                                {
                                    ticket_id       = "#" + lst[i].tickets_device_id,
                                    color           = colors[count],
                                    summary         = lst[i].tickets_summary,
                                    device_name     = lst[i].tickets_device_id,
                                    detail          = Tickets.TruncateAtWord(lst[i].tickets_detail, 3),
                                    tickets_created = lst[i].tickets_created,
                                    icon            = frstWord(lst[i].tickets_detail) //"https://cloudschool.management/itcrm/media/images/tickets.png"
                                });
                            }

                            catch (Exception e)
                            {
                                //await DisplayAlert("Error!", e.Message, "ok");
                            }
                            if (count > 3)
                            {
                                count = 0;
                            }
                            count++;
                        }
                        aiDevices.IsRunning      = false;
                        lvTicketList.ItemsSource = dt;
                    }
                    catch { }
                    aiDevices.IsRunning = false;
                }
                catch { }
            }
            else
            {
                await DisplayAlert("Connection", "Internet Connection Disabled", "Ok");
            }
        }
Пример #3
0
        private async void GetTicketDetails(string tick_id)
        {
            if (comfun.isConnected())
            {
                try
                {
                    var client = new HttpClient();
                    client.BaseAddress = new Uri(App.api_url);
                    var values = new Dictionary <string, string>();
                    values.Add("operation", "query");
                    values.Add("session_string", App.session_string);
                    // values.Add("query", "select * from tickets where tickets_id = " + tick_id);
                    values.Add("query", "select * from tickets where id = " + tick_id);
                    var content = new FormUrlEncodedContent(values);
                    HttpResponseMessage response = await client.PostAsync("/itcrm/webservices/", content);

                    var result = await response.Content.ReadAsStringAsync();

                    //await DisplayAlert("Ticket Detail", result.ToString(), "ok");
                    TicketResult ticketDetail = JsonConvert.DeserializeObject <TicketResult>(result);

                    var detail = ticketDetail.result[0];
                    device_id = detail.tickets_device_id_id;

                    dt.Add(new TicketDetailLv()
                    {
                        title = "Name: ",
                        value = detail.tickets_full_name,
                    });
                    dt.Add(new TicketDetailLv()
                    {
                        title = "Email Address: ",
                        value = detail.tickets_email_address
                    });
                    dt.Add(new TicketDetailLv()
                    {
                        title = "Device Name: ",
                        value = detail.tickets_device_id
                    });
                    dt.Add(new TicketDetailLv()
                    {
                        title = "Summary: ",
                        value = detail.tickets_summary
                    });
                    dt.Add(new TicketDetailLv()
                    {
                        title = "Detail: ",
                        value = detail.tickets_detail
                    });
                    dt.Add(new TicketDetailLv()
                    {
                        title = "Source: ",
                        value = detail.tickets_source
                    });
                    dt.Add(new TicketDetailLv()
                    {
                        title = "Due Date: ",
                        value = detail.tickets_due_date
                    });
                    dt.Add(new TicketDetailLv()
                    {
                        title = "Created on: ",
                        value = detail.tickets_created
                    });
                    activityIndicator.IsRunning = false;
                }
                catch (Exception ex)
                { }
            }
            else
            {
                await DisplayAlert("Connection", "Internet Connection Disabled", "Ok");
            }
        }