private async void GetJob_Clicked(object sender, EventArgs e)
        {
            var member_id = Application.Current.Properties["member_id"].ToString();

            string sContentType = "application/json";
            var    jsonData     = "{\"work_id\":\"" + work_id + "\",\"member_id\":\"" + member_id + "\"}";
            var    content      = new StringContent(jsonData.ToString(), Encoding.UTF8, sContentType);

            using (HttpResponseMessage response = await _client.PostAsync(Url2, content))
            {
                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    await DisplayAlert("Success", "รับงานเรียบร้อย", "ตกลง");

                    PopupNavigation.PopAsync(true);

                    var page = new EasyJob.MenuBar();
                    page.CurrentPage             = page.Children[0];
                    Application.Current.MainPage = new NavigationPage(page)
                    {
                        BarBackgroundColor = Color.FromHex("#031765"),
                        BarTextColor       = Color.White
                    };
                }
                else
                {
                    await DisplayAlert("Error", "เกิดข้อผิดพลาดบางอย่าง", "ตกลง");
                }
            }
        }
Example #2
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var    member_id  = Application.Current.Properties["member_id"].ToString();
            var    work_name  = Input_Work_name.Text;
            var    work_desc  = Input_Work_desc.Text;
            var    labor_cost = Input_cost.Text;
            var    tel        = Input_tel.Text;
            String myDate     = DateTime.Now.ToString();

            if (member_id != null && work_name != null && work_desc != null && labor_cost != null && tel != null && location_details != null && Latitude != 0.0 && Longitude != 0.0)
            {
                string sContentType = "application/json";
                var    jsonData     = "{\"member_id\":\"" + member_id + "\",\"work_name\":\"" + work_name + "\"," +
                                      "\"work_desc\":\"" + work_desc + "\"," +
                                      "\"tel\":\"" + tel + "\",\"labor_cost\":\"" + labor_cost + "\",\"duration\":\"" + duration_select + "\"," +
                                      "\"datetime\":\"" + myDate + "\",\"lat\":\"" + Latitude + "\"," +
                                      "\"long\":\"" + Longitude + "\",\"loc_name\":\"" + location_details + "\"}";
                var content = new StringContent(jsonData.ToString(), Encoding.UTF8, sContentType);

                using (HttpResponseMessage response = await _client.PostAsync(Url, content))
                {
                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        using (HttpContent contents = response.Content)
                        {
                            string mycontent = await contents.ReadAsStringAsync();

                            JObject add_work = JObject.Parse(mycontent);

                            Frame_main.IsVisible         = false;
                            animationSuccess.IsVisible   = true;
                            Frame_success.IsVisible      = true;
                            Frame_success_text.IsVisible = true;

                            await Task.Delay(2000);

                            PopupNavigation.PopAsync(true);

                            var page = new EasyJob.MenuBar();
                            page.CurrentPage             = page.Children[2];
                            Application.Current.MainPage = new NavigationPage(page)
                            {
                                BarBackgroundColor = Color.FromHex("#031765"),
                                BarTextColor       = Color.White
                            };
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", "เกิดข้อผิดพลาดกรุณาลองใหม่", "OK");
                    }
                }
            }
            else
            {
                await DisplayAlert("Error", "กรอกข้อมูลให้ครบ", "OK");
            }
        }
Example #3
0
        private void TapGestureRecognizer_Tapped_1(object sender, EventArgs e)
        {
            var page = new EasyJob.MenuBar();

            page.CurrentPage             = page.Children[2];
            Application.Current.MainPage = new NavigationPage(page)
            {
                BarBackgroundColor = Color.FromHex("#031765"),
                BarTextColor       = Color.White
            };
        }
Example #4
0
        private async void Button_Save(object sender, EventArgs e)
        {
            var names    = name.Text;
            var surnames = surname.Text;
            var tels     = tel.Text;

            if (names != null && surnames != null && tels != null)
            {
                var    member_ids   = Application.Current.Properties["member_id"].ToString();
                string sContentType = "application/json";
                var    jsonData     = "{\"member_id\":\"" + member_ids + "\",\"name\":\"" + names + "\",\"surname\":\"" + surnames + "\",\"tel\":\"" + tels + "\"}";
                var    content      = new StringContent(jsonData.ToString(), Encoding.UTF8, sContentType);

                using (HttpResponseMessage response = await _client.PostAsync(url, content))
                {
                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        Frame_main.IsVisible         = false;
                        animationSuccess.IsVisible   = true;
                        Frame_success.IsVisible      = true;
                        Frame_success_text.IsVisible = true;

                        await Task.Delay(2000);

                        PopupNavigation.PopAsync(true);

                        var page = new EasyJob.MenuBar();
                        page.CurrentPage             = page.Children[3];
                        Application.Current.MainPage = new NavigationPage(page)
                        {
                            BarBackgroundColor = Color.FromHex("#031765"),
                            BarTextColor       = Color.White
                        };
                    }
                    else
                    {
                        await DisplayAlert("เกิดข้อผิดพลาด", "Member id is null", "ตกลง");
                    }
                }
            }
            else
            {
                await DisplayAlert("เกิดข้อผิดพลาด", "กรอกข้อมูลให้ครบ", "ตกลง");
            }
        }