public bool ThemChuDuBi(string MaHoSo, string DanhXung, string HoTen, string NamSinh, string DiaChi, string DinhDanh, string SoDinhDanh, string NoiCap, string NgayCap, string QuocTich) { try { tblChuDuBi chumoi = new tblChuDuBi(); chumoi.DanhXung = DanhXung; chumoi.HoTen = HoTen; chumoi.NamSinh = NamSinh; chumoi.DiaChi = DiaChi; chumoi.DinhDanh = DinhDanh; chumoi.SoDinhDanh = SoDinhDanh; chumoi.NoiCap = NoiCap; chumoi.NgayCap = Convert.ToDateTime(NgayCap); chumoi.QuocTich = QuocTich; db.tblChuDuBis.Add(chumoi); db.SaveChanges(); tblChuHoSoDuBi chuhoso = new tblChuHoSoDuBi(); chuhoso.MaChu = chumoi.MaChu; chuhoso.MaHoSoKeKhai = Convert.ToInt32(MaHoSo); db.tblChuHoSoDuBis.Add(chuhoso); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
protected void grvChu_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { NhapThongTinChu_Visible(true); string _maChu = e.CommandArgument.ToString(); Session["ThaoTac"] = ThaoTac.DangSua; Session["MaChu"] = _maChu; using (DMCWebEntities db = new DMCWebEntities()) { long maChu = long.Parse(_maChu); var q = (from c in db.tblChuDuBis where c.MaChu == maChu select c).Single(); tblChuDuBi chu = (tblChuDuBi)q; lblMaChu.Text = "Mã chủ: " + _maChu.ToString(); txtHoTen.Text = chu.HoTen; drDanhXung.Text = chu.DanhXung; txtNamSinh.Text = chu.NamSinh; txtDiaChi.Text = chu.DiaChi; txtSoDinhDanh.Text = chu.SoDinhDanh; txtNoiCap.Text = chu.NoiCap; txtNgayCap.Text = chu.NgayCap.ToString(); txtDinhDanh.Text = chu.DinhDanh; } } }
public bool XoaChuDuBi(string MaChu) { try { long _maChu = long.Parse(MaChu); tblChuDuBi chucanxoa = db.tblChuDuBis.Single(c => c.MaChu == _maChu); db.tblChuDuBis.Remove(chucanxoa); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool XoaHoSoDuBi(string MaHoSoKeKhai) { try { long _maHoSo = long.Parse(MaHoSoKeKhai); //-- xoa trong bang chuhoso va chu du bi List <tblChuHoSoDuBi> dsChuHS_xoa = (from chs in db.tblChuHoSoDuBis where chs.MaHoSoKeKhai == _maHoSo select chs).ToList(); if (dsChuHS_xoa.Count > 0) { for (int i = 0; i < dsChuHS_xoa.Count; i++) { long ma = (long)dsChuHS_xoa[i].MaChu; tblChuDuBi Chu_xoa = db.tblChuDuBis.Single(n => n.MaChu == ma); db.tblChuDuBis.Remove(Chu_xoa); db.tblChuHoSoDuBis.Remove(dsChuHS_xoa[i]); } } //-- xoa trong bang nha o du bi var NhaO_xoa = from n in db.tblThongTinNhaODuBis where n.MaHoSoKeKhai == _maHoSo select n; db.tblThongTinNhaODuBis.RemoveRange(NhaO_xoa); //-- xoa trong bang thuadat du bi var ThuaDat_xoa = from td in db.tblThuaDatDuBis where td.MaHoSoKeKhai == _maHoSo select td; db.tblThuaDatDuBis.RemoveRange(ThuaDat_xoa); // -- xoa trong bang ho so ke khai du bi var HoSoKeKhai_xoa = (from h in db.tblHoSoKeKhaiDuBis where h.MaHoSoKeKhai == _maHoSo select h).SingleOrDefault(); db.tblHoSoKeKhaiDuBis.Remove(HoSoKeKhai_xoa); db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
protected void grvChu_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { NhapThongTinChu_Visible(true); string _maChu = e.CommandArgument.ToString(); Session["ThaoTac"] = ThaoTac.DangSua; Session["MaChu"] = _maChu; using (DMCWebEntities db = new DMCWebEntities()) { long maChu = long.Parse(_maChu); if (Session["LoaiHoSo"] == "DuBi") { tblChuDuBi chu = db.tblChuDuBis.SingleOrDefault(n => n.MaChu == maChu); lblMaChu.Text = _maChu.ToString(); txtHoTen.Text = chu.HoTen; drDanhXung.Text = chu.DanhXung; txtNamSinh.Text = chu.NamSinh; txtDiaChi.Text = chu.DiaChi; txtSoDinhDanh.Text = chu.SoDinhDanh; txtNoiCap.Text = chu.NoiCap; txtNgayCap.Text = chu.NgayCap.ToString(); txtDinhDanh.Text = chu.DinhDanh; } else if (Session["LoaiHoSo"] == "ChinhThuc") { tblChu chu = db.tblChus.SingleOrDefault(n => n.MaChu == maChu); lblMaChu.Text = "Mã chủ: " + _maChu.ToString(); txtHoTen.Text = chu.HoTen; drDanhXung.Text = chu.DanhXung; txtNamSinh.Text = chu.NamSinh; txtDiaChi.Text = chu.DiaChi; txtSoDinhDanh.Text = chu.SoDinhDanh; txtNoiCap.Text = chu.NoiCap; txtNgayCap.Text = chu.NgayCap.ToString(); txtDinhDanh.Text = chu.DinhDanh; } } } }
public bool SuaChuDuBi(string MaChu, string DanhXung, string HoTen, string NamSinh, string DiaChi, string DinhDanh, string SoDinhDanh, string NoiCap, string NgayCap, string QuocTich) { try { long _maChu = long.Parse(MaChu); tblChuDuBi chucansua = db.tblChuDuBis.Single(c => c.MaChu == _maChu); chucansua.DanhXung = DanhXung; chucansua.HoTen = HoTen; chucansua.NamSinh = NamSinh; chucansua.DiaChi = DiaChi; chucansua.DinhDanh = DinhDanh; chucansua.SoDinhDanh = SoDinhDanh; chucansua.NoiCap = NoiCap; chucansua.NgayCap = Convert.ToDateTime(NgayCap); chucansua.QuocTich = QuocTich; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool ChapNhanHoSo(string MaHoSoKeKhai) { try { long _maHS = long.Parse(MaHoSoKeKhai); tblHoSoKeKhaiDuBi HS = db.tblHoSoKeKhaiDuBis.Single(h => h.MaHoSoKeKhai == _maHS); //-- tao ho so moi tblHoSo HoSoMoi = new tblHoSo(); db.tblHoSoes.Add(HoSoMoi); //-- them vao bang ho so tblHoSoKeKhai HSKK = new tblHoSoKeKhai(); HSKK.KinhGuiCoQuanChucNang = HS.KinhGuiCoQuanChucNang; HSKK.NgayNhanHoSo = HS.NgayNhanHoSo; HSKK.NguoiNhanHoSo = HS.NguoiNhanHoSo; HSKK.SoTiepNhan = HS.SoTiepNhan; HSKK.Quyen = HS.Quyen; HSKK.NguoiVietDon = HS.NguoiVietDon; HSKK.DonViHanhChinh = HS.DonViHanhChinh; HSKK.GiayToKemTheo = HS.GiayToKemTheo; HSKK.NghiaVuTaiChinh = HS.NghiaVuTaiChinh; HSKK.DeNghiKhac = HS.DeNghiKhac; HSKK.SoDienThoaiLienHe = HS.SoDienThoaiLienHe; HSKK.DiaChiMail = HS.DiaChiMail; HSKK.MaLoaiDeNghi = HS.MaLoaiDeNghi; HSKK.MaHoSo = _maHS; db.tblHoSoKeKhais.Add(HSKK); //-- insert vao bang hosokekhaiduocchapnhan tblHoSoKeKhaiDuocChapNhan HSKKDCN = new tblHoSoKeKhaiDuocChapNhan(); HSKKDCN.MaHoSoKeKhai = HSKK.MaHoSoKeKhai; HSKKDCN.MaHoSoKeKhaiDuBi = HS.MaHoSoKeKhai; HSKKDCN.NgayThucHien = DateTime.Today; db.tblHoSoKeKhaiDuocChapNhans.Add(HSKKDCN); //-- insert vao bang hoso HoSoMoi.LoaiDoiTuong = HS.MaLoaiDoiTuong; HoSoMoi.DonViHanhChinh = HS.DonViHanhChinh; HoSoMoi.TrangThaiHoSoCapGCN = "1"; //HoSoMoi.TongSoThua se cap nhat o phan thua dat... //-- insert vao bang thuadat List <tblThuaDatDuBi> dsThuaDat = (from td in db.tblThuaDatDuBis where td.MaHoSoKeKhai == HS.MaHoSoKeKhai select td).ToList <tblThuaDatDuBi>(); if (dsThuaDat.Count > 0) { HoSoMoi.TongSoThua = dsThuaDat.Count; for (int i = 0; i < dsThuaDat.Count; i++) { tblThuaDat ThuaDaMoi = new tblThuaDat(); ThuaDaMoi.MaHoSo = dsThuaDat[i].MaHoSoKeKhai; ThuaDaMoi.ToBanDo = dsThuaDat[i].ToBanDo; ThuaDaMoi.SoThua = dsThuaDat[i].SoThua; ThuaDaMoi.DiaChi = dsThuaDat[i].DiaChi; ThuaDaMoi.DienTich = dsThuaDat[i].DienTich; ThuaDaMoi.SuDungChung = dsThuaDat[i].SuDungChung; ThuaDaMoi.SuDungRieng = dsThuaDat[i].SuDungRieng; ThuaDaMoi.MucDichSuDung = dsThuaDat[i].MucDichSuDung; ThuaDaMoi.ThoiHanSuDung = dsThuaDat[i].ThoiHanSuDung; ThuaDaMoi.NgayBatDauSuDung = dsThuaDat[i].NgayBatDauSuDung; ThuaDaMoi.LoaiNguonGocSuDung = dsThuaDat[i].LoaiNguonGocSuDung; ThuaDaMoi.CoHanCheSuDung = dsThuaDat[i].CoHanCheSuDung.ToString(); ThuaDaMoi.NoiDungHanCheSuDung = dsThuaDat[i].NoiDungHanCheSuDung; db.tblThuaDats.Add(ThuaDaMoi); } } //-- insert vao bang nhao List <tblThongTinNhaODuBi> dsNhaO = (from n in db.tblThongTinNhaODuBis where n.MaHoSoKeKhai == _maHS select n).ToList <tblThongTinNhaODuBi>(); if (dsNhaO.Count > 0) { for (int i = 0; i < dsNhaO.Count; i++) { tblThongTinNhaO NhaMoi = new tblThongTinNhaO(); NhaMoi.MaHoSo = dsNhaO[i].MaHoSoKeKhai; NhaMoi.LoaiNhaO = dsNhaO[i].LoaiNhaO; NhaMoi.DienTichXayDung = dsNhaO[i].DienTichXayDung; NhaMoi.DienTichSan = dsNhaO[i].DienTichSan; NhaMoi.SoHuuChung = dsNhaO[i].SoHuuChung; NhaMoi.SoHuuRieng = dsNhaO[i].SoHuuRieng; NhaMoi.KetCau = dsNhaO[i].KetCau; NhaMoi.SoTang = dsNhaO[i].SoTang; NhaMoi.CoHanCheThoiHanSoHuu = dsNhaO[i].CoHanCheThoiHanSoHuu; NhaMoi.ThoiHanSoHuu = dsNhaO[i].ThoiHanSoHuu; db.tblThongTinNhaOs.Add(NhaMoi); } } //-- insert vao bang chuhoso va bang chu List <tblChuHoSoDuBi> dsChuHS = (from chs in db.tblChuHoSoDuBis where chs.MaHoSoKeKhai == _maHS select chs).ToList <tblChuHoSoDuBi>(); if (dsChuHS.Count > 0) { for (int i = 0; i < dsChuHS.Count; i++) { tblChuHoSo ChuHS = new tblChuHoSo(); ChuHS.MaChu = dsChuHS[i].MaChu; ChuHS.MaHoSo = _maHS; db.tblChuHoSoes.Add(ChuHS); long ma = (long)dsChuHS[i].MaChu; tblChuDuBi chudubi = db.tblChuDuBis.Single(c => c.MaChu == ma); tblChu Chu = new tblChu(); Chu.DanhXung = chudubi.DanhXung; Chu.HoTen = chudubi.HoTen; Chu.NamSinh = chudubi.NamSinh; Chu.DiaChi = chudubi.DiaChi; Chu.DinhDanh = chudubi.DinhDanh; Chu.SoDinhDanh = chudubi.SoDinhDanh; Chu.NoiCap = chudubi.NoiCap; Chu.NgayCap = chudubi.NgayCap; Chu.QuocTich = chudubi.QuocTich; db.tblChus.Add(Chu); } } //LƯU LẠI LẦN 1 db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }