Пример #1
0
 /// <summary>
 /// Xóa giáo viên ở bảng GiaoVien_KhoaDaoTao
 /// </summary>
 /// <param name="MaGV"></param>
 /// <param name="MaKhoaDaoTao"></param>
 public void DeleteGiaoVien(string MaGV, string MaKhoaDaoTao)
 {
     DAL.GiaoVien_KhoaDaoTao gvdt =
         dataContext.GiaoVien_KhoaDaoTaos.FirstOrDefault(t => t.MaGiaoVien == MaGV && t.MaKhoaHoc == MaKhoaDaoTao);
     dataContext.GiaoVien_KhoaDaoTaos.DeleteOnSubmit(gvdt);
     Save();
 }
Пример #2
0
 protected void btnOK_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DaoTaoController dtController = new DaoTaoController();
         foreach (var item in RowSelectionModel5.SelectedRows)
         {
             DAL.GiaoVien_KhoaDaoTao gv = new DAL.GiaoVien_KhoaDaoTao()
             {
                 CreatedBy   = CurrentUser.ID,
                 CreatedDate = DateTime.Now,
                 MaGiaoVien  = item.RecordID,
                 MaKhoaHoc   = hdfRecordID.Text
             };
             dtController.ThemGiaoVienVaoKhoaHoc(gv);
         }
         wdChonTuDanhSachGiaoVien.Hide();
         RM.RegisterClientScriptBlock("ds", "#{grp_GiaoVienDaoTaoStore}.reload();");
     }
     catch (Exception ex)
     {
         Dialog.ShowError("Lối xảy ra " + ex.Message);
     }
 }
Пример #3
0
 public void ThemGiaoVienVaoKhoaHoc(DAL.GiaoVien_KhoaDaoTao gvdt)
 {
     dataContext.GiaoVien_KhoaDaoTaos.InsertOnSubmit(gvdt);
     Save();
 }
Пример #4
0
    /// <summary>
    /// Nhân đôi khóa đào tạo
    /// </summary>
    /// <param name="OldID">Khóa đào tạo cũ</param>
    /// <param name="NewID">Khóa đào tạo mới</param>
    /// <param name="createdUserID">Người tạo</param>
    /// <param name="copyGiaoVien"></param>
    /// <param name="copyChiPhi"></param>
    /// <param name="copyNhanVienThamGiaDaoTao"></param>
    public void DuplicateRecord(string OldID, string NewID, int createdUserID, bool copyGiaoVien, bool copyChiPhi, bool copyNhanVienThamGiaDaoTao)
    {
        DAL.KEHOACH_DAOTAO old  = GetByID(OldID);
        DAL.KEHOACH_DAOTAO _new = new DAL.KEHOACH_DAOTAO()
        {
            TEN_KHOA_HOC            = old.TEN_KHOA_HOC,
            TRANG_THAI              = old.TRANG_THAI,
            TEN_DONVIPHUTRACHDAOTAO = old.TEN_DONVIPHUTRACHDAOTAO,
            MA_DONVIPHUTRACHDAOTAO  = old.MA_DONVIPHUTRACHDAOTAO,
            GHI_CHU               = old.GHI_CHU,
            NOIDUNG_DAOTAO        = old.NOIDUNG_DAOTAO,
            LYDO_DAOTAO           = old.LYDO_DAOTAO,
            DOITUONG_DAOTAO       = old.DOITUONG_DAOTAO,
            THOI_GIAN_DAOTAO      = old.THOI_GIAN_DAOTAO,
            SOLUONG_HOCVIEN       = old.SOLUONG_HOCVIEN,
            DIA_DIEM_DAOTAO       = old.DIA_DIEM_DAOTAO,
            BATDAU_DANGKY         = old.BATDAU_DANGKY,
            CreatedDate           = DateTime.Now,
            DEN_NGAY              = old.DEN_NGAY,
            HETHAN_DANGKY         = old.HETHAN_DANGKY,
            KINHPHI_CTY_HOTRO     = old.KINHPHI_CTY_HOTRO,
            KINHPHI_DUKIEN        = old.KINHPHI_DUKIEN,
            KINHPHI_NHANVIEN_DONG = old.KINHPHI_NHANVIEN_DONG,
            KINHPHI_THUCTE        = old.KINHPHI_THUCTE,
            MA              = NewID,
            MA_DONVI        = old.MA_DONVI,
            MA_CHUNGCHI     = old.MA_CHUNGCHI,
            MA_LYDODAOTAO   = old.MA_LYDODAOTAO,
            MUCDICH_KHOAHOC = old.MUCDICH_KHOAHOC,
            TU_NGAY         = old.TU_NGAY,
            CreatedBy       = createdUserID
        };
        dataContext.KEHOACH_DAOTAOs.InsertOnSubmit(_new);
        Save();

        if (copyGiaoVien)
        {
            var gvdt = dataContext.GiaoVien_KhoaDaoTaos.Where(t => t.MaKhoaHoc == OldID);
            foreach (var item in gvdt)
            {
                DAL.GiaoVien_KhoaDaoTao gv = new DAL.GiaoVien_KhoaDaoTao()
                {
                    CreatedBy   = createdUserID,
                    CreatedDate = DateTime.Now,
                    MaGiaoVien  = item.MaGiaoVien,
                    MaKhoaHoc   = NewID
                };
                dataContext.GiaoVien_KhoaDaoTaos.InsertOnSubmit(gv);
                Save();
            }
        }
        if (copyChiPhi)
        {
            var chiPhi = dataContext.DM_CacKhoanChiChoDaoTaos.Where(t => t.FR_KEY == OldID);
            foreach (var item in chiPhi)
            {
                DAL.DM_CacKhoanChiChoDaoTao cp = new DAL.DM_CacKhoanChiChoDaoTao()
                {
                    FR_KEY      = NewID,
                    CreatedBy   = createdUserID,
                    CreatedDate = DateTime.Now,
                    NguonChi    = item.NguonChi,
                    SoTien      = item.SoTien,
                    TenChiPhi   = item.TenChiPhi
                };
                dataContext.DM_CacKhoanChiChoDaoTaos.InsertOnSubmit(cp);
                Save();
            }
        }
        if (copyNhanVienThamGiaDaoTao)
        {
            var nv = dataContext.DM_NhanVienThamGiaDaoTaos.Where(t => t.MaKhoaDaoTao == OldID);
            foreach (var item in nv)
            {
                DAL.DM_NhanVienThamGiaDaoTao nhanVien = new DAL.DM_NhanVienThamGiaDaoTao()
                {
                    CreatedBy         = createdUserID,
                    CreatedDate       = DateTime.Now,
                    MaKhoaDaoTao      = NewID,
                    DaThamGia         = item.DaThamGia,
                    MaCanBo           = item.MaCanBo,
                    SoTienCongTyHoTro = item.SoTienCongTyHoTro,
                    SoTienNVDong      = item.SoTienNVDong
                };
                dataContext.DM_NhanVienThamGiaDaoTaos.InsertOnSubmit(nhanVien);
                Save();
            }
        }
    }