Exemplo n.º 1
0
        private async void TapGestureRecognizer_Tapped_Delete(object sender, EventArgs e)
        {
            TappedEventArgs tappedEventArgs = (TappedEventArgs)e;
            var             listCV          = LV.ItemsSource as List <CongViec>;
            CongViec        cv = listCV.Where(x => x.ID == (int)tappedEventArgs.Parameter).FirstOrDefault();

            CongViec _congviec = new CongViec();

            if (_congviec != null)
            {
                _congviec.ID     = cv.ID;
                _congviec.TT_XOA = cv.TT_XOA;
            }
            bool answer = await DisplayAlert("Thông báo", "Bạn có chắc chắn muốn xóa dữ liệu này?", "Yes", "No");

            Debug.WriteLine("Answer: " + answer);
            if (answer == true)
            {
                string     url    = "https://qlcv-api.conveyor.cloud/";
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(url + "api/DeleteCV");

                HttpResponseMessage response = await client.PostAsJsonAsync <CongViec>("DeleteCV", _congviec);

                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();
                }
                await DisplayAlert("Thông báo", "Bạn đã xóa dữ liệu thành công!", "OK");
            }
        }
Exemplo n.º 2
0
 private async void TapGestureRecognizer_Tapped_Edit(object sender, EventArgs e)
 {
     TappedEventArgs tappedEventArgs = (TappedEventArgs)e;
     var             listCV          = LV.ItemsSource as List <CongViec>;
     CongViec        cv = listCV.Where(x => x.ID == (int)tappedEventArgs.Parameter).FirstOrDefault();
     await Navigation.PushAsync(new EditCV(cv));
 }
Exemplo n.º 3
0
        public App()
        {
            InitializeComponent();

            MainPage    = new NavigationPage(new MainPage());
            HienThiDSCV = new NavigationPage(new HienThiDSCV());
            QuenMatKhau = new NavigationPage(new QuenMatKhau());
            ThemMoi     = new NavigationPage(new ThemMoi());
            CongViec cv = null;

            EditCV = new NavigationPage(new EditCV());
        }
Exemplo n.º 4
0
 public EditCV(CongViec cv = null)
 {
     _congviec.ID = null;
     InitializeComponent();
     if (cv != null)
     {
         _congviec.ID             = cv.ID;
         this.txtTenCongViec.Text = cv.TEN_CONG_VIEC;
         this.txtTenHT.Title      = cv.TEN;
         this.txtPLHĐ.Title       = cv.MA_HOP_DONG;
         this.DateStart.Date      = (DateTime)cv.NGAY_BAT_DAU;
         this.DateFinish.Date     = (DateTime)cv.NGAY_KET_THUC;
         this.txtChuTri.Title     = cv.FullName;
         this.txtKQ.Text          = Convert.ToString(cv.ID_KET_QUA_CV);
         this.txtGhiChu.Text      = cv.GHI_CHU;
         IDHT   = cv.ID_HE_THONG;
         IDPLHD = cv.ID_HOP_DONG;
         IDNGCT = cv.ID_NGUOI_CHU_TRI;
     }
 }
Exemplo n.º 5
0
 public ThemMoi(CongViec congviec)
 {
     InitializeComponent();
 }
Exemplo n.º 6
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            if (_congviec != null)
            {
                _congviec.TEN_CONG_VIEC    = txtTenCongViec.Text;
                _congviec.ID_HE_THONG      = IDHT;
                _congviec.ID_HOP_DONG      = IDPLHD;
                _congviec.ID_NGUOI_CHU_TRI = IDNGCT;
                _congviec.ID_KET_QUA_CV    = Convert.ToInt32(txtKQ.Text);
                _congviec.NGAY_BAT_DAU     = DateStart.Date;
                _congviec.NGAY_KET_THUC    = DateFinish.Date;
                _congviec.GHI_CHU          = txtGhiChu.Text;
            }
            else
            {
                _congviec = new CongViec();

                _congviec.TEN_CONG_VIEC    = txtTenCongViec.Text;
                _congviec.ID_HE_THONG      = IDHT;
                _congviec.ID_HOP_DONG      = IDPLHD;
                _congviec.ID_NGUOI_CHU_TRI = IDNGCT;
                _congviec.ID_KET_QUA_CV    = Convert.ToInt32(txtKQ.Text);
                _congviec.NGAY_BAT_DAU     = DateStart.Date;
                _congviec.NGAY_KET_THUC    = DateFinish.Date;
                _congviec.GHI_CHU          = txtGhiChu.Text;
            }
            if (string.IsNullOrEmpty(txtTenCongViec.Text))
            {
                await DisplayAlert("Thông báo", "Không được để trống tên công việc", "Ok");

                return;
            }
            if (IDHT == -1)
            {
                await DisplayAlert("Thông báo", "Không được để trống tên hệ thống", "Ok");

                return;
            }
            if (IDPLHD == -1)
            {
                await DisplayAlert("Thông báo", "Không được để trống phụ lục hợp đồng", "Ok");

                return;
            }
            if (IDNGCT == -1)
            {
                await DisplayAlert("Thông báo", "Không được để trống tên người chủ trì", "Ok");

                return;
            }
            if (string.IsNullOrEmpty(txtKQ.Text))
            {
                await DisplayAlert("Thông báo", "Không được để trống kết quả", "Ok");

                return;
            }
            if (Convert.ToInt32(txtKQ.Text) > 3)
            {
                await DisplayAlert("Thông báo", "Chỉ được nhập từ 1 đến 3", "OK");

                return;
            }
            bool answer = await DisplayAlert("Thông báo", "Bạn có chắc chắn muốn thêm dữ liệu mới?", "Yes", "No");

            Debug.WriteLine("Answer: " + answer);
            if (answer == true)
            {
                string     url    = "https://qlcv-api.conveyor.cloud/";
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(url + "api/AddNewCV");

                HttpResponseMessage response = await client.PostAsJsonAsync <CongViec>("AddNewCV", _congviec);

                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();
                    await DisplayAlert("Thông báo", "Bạn đã thêm dữ liệu mới thành công!", "OK");

                    await Navigation.PopAsync();
                }
            }
        }