public void Them(HopDong themhd) { XmlNode HopDong = doc.CreateElement("HopDong"); XmlElement MaHopDong = doc.CreateElement("MaHopDong"); MaHopDong.InnerText = themhd.MaHopDong1.ToString(); HopDong.AppendChild(MaHopDong); XmlElement MSSV = doc.CreateElement("MSSV"); MSSV.InnerText = themhd.MSSV1.ToString(); HopDong.AppendChild(MSSV); XmlElement MaPhong = doc.CreateElement("MaPhong"); MaPhong.InnerText = themhd.MaPhong1.ToString(); HopDong.AppendChild(MaPhong); XmlElement NgayLap = doc.CreateElement("NgayLap"); NgayLap.InnerText = themhd.NgayLap1.ToString("yyyy-MM-dd"); HopDong.AppendChild(NgayLap); XmlElement NgayBatDau = doc.CreateElement("NgayBatDau"); NgayBatDau.InnerText = themhd.NgayBatDau1.ToString("yyyy-MM-dd"); HopDong.AppendChild(NgayBatDau); XmlElement NgayKetThuc = doc.CreateElement("NgayKetThuc"); NgayKetThuc.InnerText = themhd.NgayKetThuc1.ToString("yyyy-MM-dd"); HopDong.AppendChild(NgayKetThuc); root.AppendChild(HopDong); doc.Save(fileName); }
public void sua(HopDong suahd) { XmlNode suahopdong = root.SelectSingleNode("HopDong[MaHopDong='" + suahd.MaHopDong1 + "']"); if (suahd != null) { XmlNode suahopdongmoi = doc.CreateElement("suahopdongmoi"); XmlElement MaHopDong = doc.CreateElement("MaHopDong"); MaHopDong.InnerText = suahd.MaHopDong1.ToString(); suahopdongmoi.AppendChild(MaHopDong); XmlElement MSSV = doc.CreateElement("MSSV"); MSSV.InnerText = suahd.MSSV1.ToString(); suahopdongmoi.AppendChild(MSSV); XmlElement MaPhong = doc.CreateElement("MaPhong"); MaPhong.InnerText = suahd.MaPhong1.ToString(); suahopdongmoi.AppendChild(MaPhong); XmlElement NgayLap = doc.CreateElement("NgayLap"); NgayLap.InnerText = suahd.NgayLap1.ToString(); suahopdongmoi.AppendChild(NgayLap); XmlElement NgayBatDau = doc.CreateElement("NgayBatDau"); NgayBatDau.InnerText = suahd.NgayBatDau1.ToString(); suahopdongmoi.AppendChild(NgayBatDau); XmlElement NgayKetThuc = doc.CreateElement("NgayKetThuc"); NgayKetThuc.InnerText = suahd.NgayKetThuc1.ToString(); suahopdongmoi.AppendChild(NgayKetThuc); root.ReplaceChild(suahopdongmoi, suahopdong); doc.Save(fileName); } }
private void btnAdd_Click(object sender, EventArgs e) { try { HopDong hopDong = new HopDong(); hopDong.NgayTao = DateTime.Now; hopDong.HoTen = txtHoTen.Text; hopDong.ChucVu = txtChucVu.Text; hopDong.NgaySinh = dtpkNgaySinh.Value; hopDong.NgayCap = dtpkNgayCap.Value; hopDong.GioiTinh = cbxGioiTinh.Text == "Nam" ? false : true; hopDong.Cmtnd = txtCmtnd.Text; hopDong.NoiCap = txtNoiCap.Text; hopDong.SoNha = txtSoNha.Text; hopDong.Duong = txtDuong.Text; hopDong.To = txtTo.Text; hopDong.Quan = txtQuan.Text; hopDong.Phuong = txtPhuongXa.Text; hopDong.Tinh = txtTinh.Text; hopDong.MaSoThue = txtMaSoThue.Text; hopDong.NhanVien = Session.LoginAccount.TenTaiKhoan; hopDong.DienThoai = txtDienThoai.Text; hopDong.ChiTietHopDongs = chiTietHopDongs; db.HopDongs.Add(hopDong); db.SaveChanges(); MessageBox.Show("Đăng ký thành công!!"); } catch (Exception) { MessageBox.Show("Có lỗi xảy ra!!! Vui lòng kiểm tra lại !!!"); } }
//public HopDong TaoMoiHopDong(HopDongDTO hopDongDTO, int nguoiTiepNhan, bool isTaoMoi) //{ // HopDong hopDong = new HopDong(); // hopDong.CreatedAt = DateTime.Now; // hopDong.NguoiTiepNhan = nguoiTiepNhan; // hopDong.GhiChu = hopDongDTO.GhiChu; // hopDong.NgayHieuLucHD = hopDongDTO.NgayHieuLucHD; // hopDong.NgayKiHD = hopDongDTO.NgayKiHD; // hopDong.SchoolId = hopDongDTO.SchoolId; // hopDong.SoNam = hopDongDTO.SoNam; // hopDong.IsThanhToanBangTienMat = hopDongDTO.IsThanhToanBangTienMat; // hopDong.NgayThanhToan = hopDongDTO.NgayThanhToan; // if (isTaoMoi == false) // { // hopDong.IsTaoMoi = false; // hopDong.SoTien = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TienDuyTry"]) * hopDongDTO.SoNam; // } // else // { // hopDong.IsTaoMoi = true; // School school = schoolRepository.GetSchoolById(hopDong.SchoolId); // if (school.Ward.District.Type.Trim() == "Huyện") // { // hopDong.SoTien = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TienHuyenTL"]); // } // else // { // hopDong.SoTien = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TienQuanTL"]); // } // school.IsDaTaoMoi = true; // _db.Entry(school).State = EntityState.Modified; // //_db.SaveChanges(); // } // int checkNumThisYear = (DateTime.Now.Year % 100)*10000; // int maxSoHopdong = GetMaxSoHopDong(); // if (checkNumThisYear > maxSoHopdong) // { // hopDong.MaHopDong = checkNumThisYear + 1; // } // else // { // hopDong.MaHopDong = maxSoHopdong + 1; // } // _db.HopDongs.Add(hopDong); // _db.SaveChanges(); // return hopDong; //} public HopDong TaoMoiHopDongDuyTri(HopDongDTO hopDongDTO, int nguoiTiepNhan) { HopDong hopDong = new HopDong(); hopDong.CreatedAt = DateTime.Now; hopDong.NguoiTiepNhan = nguoiTiepNhan; hopDong.GhiChu = hopDongDTO.GhiChu; hopDong.NgayHieuLucHD = hopDongDTO.NgayHieuLucHD; hopDong.NgayKiHD = hopDongDTO.NgayKiHD; hopDong.SchoolId = hopDongDTO.SchoolId; hopDong.SoNam = hopDongDTO.SoNam; hopDong.IsThanhToanBangTienMat = hopDongDTO.IsThanhToanBangTienMat; hopDong.NgayThanhToan = hopDongDTO.NgayThanhToan; hopDong.IsTaoMoi = false; hopDong.SoTien = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TienDuyTry"]) * hopDongDTO.SoNam; int checkNumThisYear = (DateTime.Now.Year % 100) * 10000; int maxSoHopdong = GetMaxSoHopDong(); if (checkNumThisYear > maxSoHopdong) { hopDong.MaHopDong = checkNumThisYear + 1; } else { hopDong.MaHopDong = maxSoHopdong + 1; } _db.HopDongs.Add(hopDong); _db.SaveChanges(); return(hopDong); }
public ActionResult ThemDMHopDong(HopDong hd) { ViewBag.HD = db.ThanhViens.ToList().OrderBy(n => n.MaThanhVien); ViewBag.NCC = db.NhaCungCaps; var count = db.HopDongs.Count(n => n.SoHopDong == hd.SoHopDong); if (count == 0) { if (hd.NgayKy < hd.NgayKT) { db.HopDongs.Add(hd); db.SaveChanges(); Logging log = new Logging(); log.SaveLog(hd.SoHopDong + "-" + db.HanhDongs.Where(n => n.MaAction == 1).FirstOrDefault().TenAction, 1, int.Parse(Session["MaThanhVien"].ToString())); return(Redirect("../DanhMuc/XemDMHopDong")); } else { ViewBag.Message = 0; } } else { ViewBag.Message = 1; } return(View(hd)); }
public ActionResult DatXe(int maXe, int maNguoiDung, string hotenNguoiDatXe, string email, int SDT, string ghiChu, DateTime ngayThue, DateTime ngayTra, int soNgayThue, string diaChiNhanXe, int maPhuongThucThanhToan, int tongTien) { HopDong hopDong = new HopDong { maNguoiDung = maNguoiDung, hotenNguoiDatXe = hotenNguoiDatXe, email = email, SDT = SDT, ghiChu = ghiChu, diaChiNhanXe = diaChiNhanXe, maXe = maXe, soNgayThue = soNgayThue, ngayLapHopDong = DateTime.Now, ngayThue = ngayThue, ngayTra = ngayTra, daThanhToan = false, daDuyet = false, yeuCauHuyDon = false, TongTien = tongTien, maTinhTrangHopDong = 2, maPhuongThucThanhToan = maPhuongThucThanhToan }; database.HopDongs.Add(hopDong); var xe = database.Xes.Find(maXe); xe.maTinhTrangXe = 2; database.SaveChanges(); return(View(database.PhuongThucThanhToans.Where(s => s.maPhuongThucThanhToan == maPhuongThucThanhToan).FirstOrDefault())); }
private void Them() { if (KiemTraNull()) { MessageBox.Show("Vui lòng nhập đủ thông tin"); } else { PhongTroBAL ptbal = new PhongTroBAL(); if (ptbal.KTcoHopDong(lookUpEditPhong.EditValue.ToString())) { MessageBox.Show("Phòng hiện đang có người thuê"); } else { HopDong hd = new HopDong(); HopDongBAL hdbal = new HopDongBAL(); hd.MaHopDong = txtMaHopDong.Text; hd.MaPhong = lookUpEditPhong.EditValue.ToString(); hd.Coc = double.Parse(txtCoc.Text); hd.NgayThue = dtpThueTu.Value; hd.NgayTra = dtpThueDen.Value; if (hdbal.ThemHopDong(hd)) { MessageBox.Show("Thêm thành công"); LoadData(); } else { MessageBox.Show("Lỗi trùng mã hợp đồng"); } } } }
public ActionResult HopDongThueXe(int maXe, string tenXe, DateTime ngayThue, DateTime ngayTra, int soNgayThue, int tongTien, int donGia) { int count = database.HopDongs.Count(); if (Session["NguoiDung"] != null) { HopDong hopDong = new HopDong { tenXe = tenXe, maHopDong = count + 1, maXe = maXe, soNgayThue = soNgayThue, ngayLapHopDong = DateTime.Now, ngayThue = ngayThue, ngayTra = ngayTra, TongTien = tongTien, donGia = donGia, }; ViewData["myHopDong"] = hopDong; return(View()); } else { return(RedirectToAction("Index", "User")); } }
public HopDong LayThongTinKH(string cm) { HopDongDAL dal = new HopDongDAL(); HopDong hd = dal.LayThongTinKH(cm); return(hd); }
private void btThem_Click(object sender, EventArgs e) { HopDong hopdong = new HopDong(); hopdong.MaHD = txtSoDH.Text; hopdong.idXe = (int)cbbSoXe.SelectedValue; hopdong.idNV = (int)cbbMaNV.SelectedValue; hopdong.idKH = (int)cbbMaKH.SelectedValue; hopdong.NgayHD = DateTime.Parse(msktbNgayHD.Text.ToString()); hopdong.TienDat = txtTienDat.Text; hopdong.KhuyenMai = txtKhuyenMai.Text; hopdong.NoiDungHD = txtNoiDungHD.Text; hopdong.GiayToGiuLai = txtGiayTo.Text; if (HopDongController.AddHopDong(hopdong)) { XtraMessageBox.Show("Nhập thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("Nhập không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } CNPMEntities context = new CNPMEntities(); List <HopDong> lstHopDong = context.HopDongs.ToList(); BindGrid(lstHopDong); }
public async Task <ActionResult <HopDong> > PostHopDong(HopDong hopDong) { _context.HopDong.Add(hopDong); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHopDong", new { id = hopDong.IdhopDong }, hopDong)); }
public bool Insert(NhanVien nv, HopDong hd, ChiTietTT tt) { int result = DataProvider.Instance.ExecuteNonQuery("insert into NhanVien values ( @HoTen , @QueQuan , @NgaySinh , @email , @MaPB , @SDT , @CMT , @NgayBD , @MaLCB , @MaCV , @GT )", new object[] { nv.HoTen, nv.QueQuan, nv.NgaySinh, nv.email, nv.MaPB, nv.SDT, nv.CMT, nv.NgayBatDau, nv.MaLCB, nv.MaCV, nv.GT }); if (result <= 0) { return(false); } DataTable dt = DataProvider.Instance.ExecuteQuery("select top 1 MaNV from NhanVien order by MaNV DESC"); long a = 1, b; foreach (DataRow d in dt.Rows) { long.TryParse(d["MaNV"].ToString(), out a); } result = DataProvider.Instance.ExecuteNonQuery("EXEC ThemHD @MaNV , @MaLHD", new object[] { a, hd.MaLHD }); tt.MaNV = a; if (result <= 0) { return(false); } if (!UpdateTT(tt)) { return(false); } return(true); }
public string Remove(HopDong obj) { myData.HopDongs.Remove(obj); myData.SaveChanges(); return(null); }
public eHopDong LayHopDongTheoMaHDong(string mahdong)// Lấy 1 hợp dòng theo mã hợp đồng { HopDong hd = db.HopDongs.Where(s => s.MaHopDong.Trim() == mahdong).FirstOrDefault(); if (hd != null) { eHopDong t = new eHopDong(); t.MaKH = hd.MaKH; t.TenKH = hd.TenKH; t.DiaChi = hd.DiaChi; t.HanBH = DateTime.Parse(hd.HanBH.ToString()); t.HinhThucTT = hd.HinhThucTT; t.MaHopDong = hd.MaHopDong; t.NgayLap = DateTime.Parse(hd.NgayLap.ToString()); t.TenXe = hd.TenXe; t.TinhTrang = hd.TinhTrang; t.Gia = double.Parse(hd.Gia.ToString()); t.TenNV = hd.TenNV; return(t); } else { return(null); } }
public async Task <IActionResult> PutHopDong(int id, HopDong hopDong) { if (id != hopDong.IdhopDong) { return(BadRequest()); } _context.Entry(hopDong).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HopDongExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void btnXoa_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Bạn có chắc chắn muốn xóa", "Xác nhận!!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { try { HopDong hopDong = db.HopDongs.Find(int.Parse(lblMaHopDong.Text)); db.HopDongs.Remove(hopDong); db.SaveChanges(); MessageBox.Show("Xóa thành công"); LoadDtgv(); } catch (Exception) { MessageBox.Show("Có lỗi xảy ra!! Không thể xóa hợp đồng này!!"); } } else { //do nothing } }
public static List <QuanLyNhanVien> ToListNVPBDTOs(List <NhanVien> nhanViens, List <ChiTietNhanVien> chiTietNhanViens, List <PhongBan> phongBans, List <ChucVu> chucVus, List <NhanVienCongViec> nhanVienCongViecs, List <CongViec> congViecs, List <HopDong> hopDongs, List <Account> accounts, string id) { List <QuanLyNhanVien> listNVPB = new List <QuanLyNhanVien>(); foreach (NhanVien nhanVien in nhanViens) { //Tìm từng đứa một để chuyển qua DTO đưa lên cho người dùng xem if (nhanVien.TrangThai == 0 || nhanVien.PhongBanId != id) { continue; } ChiTietNhanVien chiTietNhanVien = chiTietNhanViens.Find(x => x.ChiTietNhanVienId == nhanVien.NhanVienId); PhongBan phongBan = phongBans.Find(x => x.PhongBanId == nhanVien.PhongBanId); ChucVu chucVu = chucVus.Find(x => x.ChucVuId == nhanVien.ChucVuId); //Tìm công việc hiện tại ứng với nhân viên NhanVienCongViec nhanVienCongViec = nhanVienCongViecs.Find(x => x.NhanVienId == nhanVien.NhanVienId && x.NgayKetThuc == null); CongViec congViec = null; if (nhanVienCongViec != null) { congViec = congViecs.Find(x => x.CongViecId == nhanVienCongViec.CongViecId); } //Tìm hợp đồng hiện tại ứng với nhân viên HopDong hopDong = hopDongs.Find(x => x.NhanVienId == nhanVien.NhanVienId && x.TrangThai == 1); Account account = accounts.Find(x => x.AccountId == nhanVien.NhanVienId); //Chuyển thành DTO listNVPB.Add(ToDTO(nhanVien, chiTietNhanVien, phongBan, chucVu, congViec, hopDong, account)); } return(listNVPB); }
private void btnChiTiet_Click(object sender, EventArgs e) { HopDong hopDong = db.HopDongs.Find(int.Parse(lblMaHopDong.Text)); Session.HopDong = hopDong; AppState.ManagerForm.Trigger(); }
public static Boolean CapNhatTrangThaiChoThanhToan() { var entity = new QuanLyThueXeEntities(); try { var hd = entity.HopDongs.Where(n => n.MaTrangThai == "1"); foreach (var item in hd) { var cthd = entity.CT_HopDongs.Where(n => n.SoHopDong == item.SoHopDong); foreach (var c in cthd) { if (c.NgayVe < DateTime.Now) { HopDong result = entity.HopDongs.SingleOrDefault(n => n.SoHopDong == c.SoHopDong); result.MaTrangThai = "3"; TrangThaiQueries.CapNhatTrangThaiPhuXeRanh(c.SoHopDong); TrangThaiQueries.CapNhatTrangThaiTaiXeRanh(c.SoHopDong); TrangThaiQueries.CapNhatTrangThaiXeRanh(c.SoHopDong); } } } entity.SaveChanges(); return(true); } catch (Exception ex) { entity.Dispose(); return(false); } }
public static QuanLyNhanVien ToDTO(this NhanVien nhanVien, ChiTietNhanVien chiTietNhanVien, PhongBan phongBan, ChucVu chucVu, CongViec congViec, HopDong hopDong, Account account) { if (account == null) { account = new Account(); } if (chiTietNhanVien == null) { chiTietNhanVien = new ChiTietNhanVien(); } if (phongBan == null) { phongBan = new PhongBan(); } if (chucVu == null) { chucVu = new ChucVu(); } if (congViec == null) { congViec = new CongViec(); } if (hopDong == null) { hopDong = new HopDong(); } return(new QuanLyNhanVien() { NhanVienId = nhanVien.NhanVienId, HoNhanVien = nhanVien.HoNhanVien, TenNhanVien = nhanVien.TenNhanVien, PhongBanId = phongBan.PhongBanId, TenPhongBan = phongBan.TenPhongBan, ChucVuId = chucVu.ChucVuId, TenChucVu = chucVu.TenChucVu, CongViecId = congViec.CongViecId, TenCongViec = congViec.TenCongViec, LuongCanBan = hopDong.LuongCanBan, NgaySinh = chiTietNhanVien.NgaySinh.ToString(), NoiSinh = chiTietNhanVien.NoiSinh, TrinhDoHocVan = chiTietNhanVien.TrinhDoHocVan, GioiTinh = chiTietNhanVien.GioiTinh, CMND = chiTietNhanVien.CMND, NgayCapCMND = chiTietNhanVien.NgayCapCMND.ToString(), DiaChi = chiTietNhanVien.DiaChi, SDT = chiTietNhanVien.SDT, Email = chiTietNhanVien.Email, HinhAnh = chiTietNhanVien.HinhAnh, TaiKhoan = account.TaiKhoan, Quyen = account.Quyen, MatKhau = account.MatKhau, }); }
/// <summary> /// Updates the HopDong /// </summary> /// <param name="HopDong">HopDong</param> public virtual void UpdateHopDong(HopDong _item) { if (_item == null) { throw new ArgumentNullException("HopDong"); } _hopdongRepository.Update(_item); }
private void btnThem_Click_1(object sender, EventArgs e) { HopDong Hd = new HopDong(txtTenHD.Text, HopDong._getSohopdong(Int16.Parse(cbSoThang.Text)), Int16.Parse(cbKhachhang.SelectedValue.ToString()), Int16.Parse(cbMaloaihang.SelectedValue.ToString()), dtpNgayHopDong.Value, Int16.Parse(cbSoThang.Text), dtpNgayHopDong.Value.AddMonths(Int16.Parse(cbSoThang.Text)), Int16.Parse(txtKhoiLuong.Text), txtNoiNhan.Text, txtNoiGiao.Text, txtmathang.Text, Int16.Parse(txtHaoHut.Text)); HopDong.themHD(); LoadDataGridView(); LoadInfo(); }
public HopDongReport(HopDong hopDong) { InitializeComponent(); this.hopDong = hopDong; PrintDetail(); PrintParam(); }
public ActionResult DeleteConfirmed(int id) { HopDong hopDong = db.HopDongs.Find(id); db.HopDongs.Remove(hopDong); db.SaveChanges(); return(RedirectToAction("Index")); }
private void btnExport_Click(object sender, EventArgs e) { HopDong hopDong = db.HopDongs.Find(int.Parse(lblMaHopDong.Text)); HopDongReport report = new HopDongReport(hopDong); ReportPrintTool printTool = new ReportPrintTool(report); printTool.ShowPreview(); }
public bool Delete(HopDong entity) { var model = _context.HopDongs.Find(entity.Id); _context.HopDongs.Remove(model); _context.SaveChanges(); return(true); }
public ChiTietHopDongUC(HopDong hopDong) { InitializeComponent(); this.hopDong = hopDong; LoadDtgv(); dtgv.DataSource = bds; ChangHeader(); }
public static bool AddHopDong(HopDong hopdong) { using (var _context = new CNPMEntities()) { _context.HopDongs.Add(hopdong); _context.SaveChanges(); return(true); } }
private void ThongTinHopDong(string cmnd) { HopDongBAL bal = new HopDongBAL(); HopDong hd = bal.LayThongTinKH(txtCMND.Text); txtMaPhong.Text = hd.MaPhong; txtKetThuc.Text = hd.NgayTra.ToString(); txtBatDau.Text = hd.NgayThue.ToString(); }
private void QuanLiDonHang_Load_1(object sender, EventArgs e) { cbLuaChon.Text = "All"; // dGKeHoach.DataSource = DonHang.hienthi(); dgHopDong.DataSource = HopDong.HienthiHD("0"); dGKeHoach.DataSource = DonHang.hienthi("Chờ"); dgHopDong.Font = new Font("", 12); dGKeHoach.Font = new Font("", 12); }