示例#1
0
        async void getThongTinViPham(ViPham vipham)
        {
            string tenNguoiViPham = await new DansWebService().getDanName(vipham.nguoi_vi_pham);

            nguoiViPhamTxt.Text = tenNguoiViPham;

            if (vipham.noi_giam_giu_xe != 1)
            {
                DonCongAn doncongan = await new DonCongAnsWebServices().GetDonCongAnById(vipham.noi_giam_giu_xe);
                noiGiamGiuXeTxt.IsVisible = true;
                noiGiamGiuXeTxt.Text      = doncongan.ten_don_cong_an + " - " + doncongan.dia_chi;
            }

            nguoiXuPhatTxt.Text    = vipham.nguoi_xu_phat.ToString();
            xeViPhamTxt.Text       = vipham.xe_vi_pham;
            diaDiemViPhamTxt.Text  = vipham.dia_diem_vi_pham;
            tienPhatThemTxt.Text   = vipham.tien_phat_them.ToString();
            tongTienPhatTxt.Text   = vipham.tong_tien_phat.ToString();
            thoiGianViPhamTxt.Text = vipham.thoi_gian_vi_pham.ToString();
            thoiGianXuPhatTxt.Text = vipham.thoi_gian_xu_phat.ToString();

            if (vipham.flag_da_nop_phat == 1)
            {
                flagNopPhatTxt.Text = "Đã nộp phạt";
                btn.IsVisible       = false;
            }
            else
            {
                flagNopPhatTxt.Text = "Chưa nộp phạt";
            }
        }
示例#2
0
        public IHttpActionResult PutDonCongAn(int id, DonCongAn donCongAn)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != donCongAn.ma_don_cong_an)
            {
                return(BadRequest());
            }

            db.Entry(donCongAn).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DonCongAnExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
 async void getDonCongAnName(int noi_giam_giu_xe)
 {
     if (noi_giam_giu_xe != 1)
     {
         noiGiamGiuXeTxt.IsVisible = true;
         DonCongAn doncongan = await new DonCongAnsWebServices().GetDonCongAnById(noi_giam_giu_xe);
         noiGiamGiuXeTxt.Text = doncongan.ten_don_cong_an + " - " + doncongan.dia_chi;
     }
 }
示例#4
0
        public IHttpActionResult GetDonCongAn(int id)
        {
            DonCongAn donCongAn = db.DonCongAn.Find(id);

            if (donCongAn == null)
            {
                return(NotFound());
            }

            return(Ok(donCongAn));
        }
示例#5
0
        public IHttpActionResult PostDonCongAn(DonCongAn donCongAn)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DonCongAn.Add(donCongAn);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = donCongAn.ma_don_cong_an }, donCongAn));
        }
示例#6
0
        public IHttpActionResult DeleteDonCongAn(int id)
        {
            DonCongAn donCongAn = db.DonCongAn.Find(id);

            if (donCongAn == null)
            {
                return(NotFound());
            }

            db.DonCongAn.Remove(donCongAn);
            db.SaveChanges();

            return(Ok(donCongAn));
        }
示例#7
0
        public async Task <DonCongAn> GetDonCongAnById(int id)
        {
            DonCongAn dca = new DonCongAn();

            try
            {
                var client   = new HttpClient();
                var response = await client.GetAsync(uri + "/" + id);

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

                var result = JsonConvert.DeserializeObject <DonCongAn>(content);
                return(result);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("\tERROR {0}", ex.Message);
            }
            return(dca);
        }