Exemple #1
0
        public async Task <KhenThuong> Update(KhenThuong khenthuong)
        {
            return(await WithConnection(async c =>
            {
                KhenThuong obj = await c.GetAsync(khenthuong);

                if (obj == null)
                {
                    throw new Exception(string.Format("Update id {0} not exist", khenthuong.KhenThuongId.ToString()));
                }

                if (obj.CtrVersion != khenthuong.CtrVersion)
                {
                    throw new Exception(string.Format("Update id {0} have version confict"
                                                      , khenthuong.KhenThuongId.ToString()));
                }

                khenthuong.CtrVersion += 1;

                var result = await c.UpdateAsync(khenthuong);

                if (result != true)
                {
                    throw new Exception("Update Fail");
                }

                return khenthuong;
            }));
        }
Exemple #2
0
 public ActionResult Delete(int id, KhenThuong khenThuong)
 {
     khenThuong = database.KhenThuongs.Where(x => x.Idkt == id).FirstOrDefault();
     database.Remove(khenThuong);
     database.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemple #3
0
        public Boolean UpdateKhenThuong(string MaPB, string MaNV, string HoTen, long TienThuong, string MaKhenThuong, DateTime NgayKhenThuong, string LyDo)
        {
            DataProviderKhenThuong dp = new DataProviderKhenThuong();
            KhenThuong             bh = new KhenThuong(MaPB, MaNV, HoTen, TienThuong, MaKhenThuong, NgayKhenThuong, LyDo);

            return(dp.SuaKhenThuong(bh));
        }
Exemple #4
0
        public ActionResult DeleteConfirmed(string id)
        {
            KhenThuong khenThuong = db.KhenThuongs.Find(id);

            db.KhenThuongs.Remove(khenThuong);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "TenNV,DanhHieuKhenthuong,MaSoKhenThuong,TienThuong")] KhenThuong khenThuong)
 {
     if (ModelState.IsValid)
     {
         db.Entry(khenThuong).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(khenThuong));
 }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "makt,tenkt,madv,thanhtich")] KhenThuong khenThuong)
 {
     if (ModelState.IsValid)
     {
         db.Entry(khenThuong).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.madv = new SelectList(db.DoanViens, "madv", "tendv", khenThuong.madv);
     return(View(khenThuong));
 }
Exemple #7
0
        public ActionResult Create([Bind(Include = "TenNV,DanhHieuKhenthuong,MaSoKhenThuong,TienThuong")] KhenThuong khenThuong)
        {
            if (ModelState.IsValid)
            {
                db.KhenThuongs.Add(khenThuong);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(khenThuong));
        }
Exemple #8
0
 public frmKhenThuongAdd(KhenThuong obj = null)
 {
     InitializeComponent();
     _baseService = new BaseService <KhenThuong>();
     _obj         = obj;
     if (obj != null)
     {
         txtID.Text  = obj.ID.ToString();
         txtTen.Text = obj.Ten;
     }
 }
 public void Modify_1_KhenThuong(KhenThuong khenThuong)
 {
     DataProvider.Instance.ExecuteNonQuery("" +
                                           "update khenThuong " +
                                           $"set NgayHieuLuc = '{khenThuong.NgayHieuLuc.Month}/{khenThuong.NgayHieuLuc.Day}/{khenThuong.NgayHieuLuc.Year}', " +
                                           $"NgayHetHan = '{khenThuong.NgayHetHan.Month}/{khenThuong.NgayHetHan.Day}/{khenThuong.NgayHetHan.Year}', " +
                                           $"NoiDung = N'{khenThuong.NoiDung}', " +
                                           $"HinhThuc = N'{khenThuong.HinhThuc}', " +
                                           $"SoTien = {khenThuong.SoTien}, " +
                                           $"TrangThai = N'{khenThuong.TrangThai}' " +
                                           $"where SoQuyetDinh = {khenThuong.SoQuyetDinh}");
 }
Exemple #10
0
        public ActionResult Create([Bind(Include = "makt,tenkt,madv,thanhtich")] KhenThuong khenThuong)
        {
            if (ModelState.IsValid)
            {
                db.KhenThuongs.Add(khenThuong);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.madv = new SelectList(db.DoanViens, "madv", "tendv", khenThuong.madv);
            return(View(khenThuong));
        }
 public void Insert_1_KhenThuong(KhenThuong khenThuong)
 {
     DataProvider.Instance.ExecuteNonQuery("" +
                                           "insert into khenThuong(SoQuyetDinh,NgayHieuLuc,NgayHetHan,NoiDung,HinhThuc,SoTien,TrangThai)" +
                                           $"values( " +
                                           $"'{khenThuong.SoQuyetDinh}', " +
                                           $"'{khenThuong.NgayHieuLuc.Month}/{khenThuong.NgayHieuLuc.Day}/{khenThuong.NgayHieuLuc.Year}', " +
                                           $"'{khenThuong.NgayHetHan.Month}/{khenThuong.NgayHetHan.Day}/{khenThuong.NgayHetHan.Year}', " +
                                           $"N'{khenThuong.NoiDung}', " +
                                           $"N'{khenThuong.HinhThuc}', " +
                                           $"{khenThuong.SoTien}, " +
                                           $"N'{khenThuong.TrangThai}')");
 }
Exemple #12
0
        public async Task <KhenThuong> Insert(KhenThuong khenthuong)
        {
            return(await WithConnection(async c =>
            {
                await c.InsertAsync(khenthuong);

                if (khenthuong.KhenThuongId == 0)
                {
                    throw new Exception("Insert Fail");
                }

                return khenthuong;
            }));
        }
Exemple #13
0
        // GET: KhenThuong/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KhenThuong khenThuong = db.KhenThuongs.Find(id);

            if (khenThuong == null)
            {
                return(HttpNotFound());
            }
            return(View(khenThuong));
        }
Exemple #14
0
        public async Task <ActionResult> Create(KhenThuong khenThuong)
        {
            var model = new ViewModelDG();

            model.ListNhanVien       = database.NhanViens.ToArray();
            model.ListLoaikhenThuong = database.LoaiKhenThuongs.ToArray();
            if (ModelState.IsValid)
            {
                database.Add(khenThuong);
                await database.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Exemple #15
0
        // GET: KhenThuongs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KhenThuong khenThuong = db.KhenThuongs.Find(id);

            if (khenThuong == null)
            {
                return(HttpNotFound());
            }
            ViewBag.madv = new SelectList(db.DoanViens, "madv", "tendv", khenThuong.madv);
            return(View(khenThuong));
        }
Exemple #16
0
        // GET: KhenThuongs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KhenThuong khenThuong = db.KhenThuongs.Find(id);

            ViewBag.TenDV = db.DoanViens.Find(khenThuong.madv).tendv;
            if (khenThuong == null)
            {
                return(HttpNotFound());
            }
            return(View(khenThuong));
        }
Exemple #17
0
        public ActionResult khen(KhenThuong kt)
        {
            //var ct = db.ChiTietLuongs.Where(n => n.MaNhanVien == kt.MaNhanVien).FirstOrDefault();

            KhenThuong ad = new KhenThuong();

            ad.MaNhanVien  = kt.MaNhanVien;
            ad.ThangThuong = kt.ThangThuong;
            ad.TienThuong  = kt.TienThuong;
            ad.LyDo        = kt.LyDo;

            db.KhenThuongs.Add(ad);
            db.SaveChanges();
            return(Redirect("/admin/quan-ly-khen-thuong"));
        }
 private void dataGridKhenThuong_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     updateKhenThuong             = _khenThuongServices.GetKhenThuongById(Convert.ToInt32(dataGridKhenThuong.CurrentRow.Cells[0].Value.ToString()));
     txtMaNV.Text                 = updateKhenThuong.ThongTinNhanVIen.MaNV;
     txtTenNV.Text                = updateKhenThuong.ThongTinNhanVIen.hoTen;
     datetimeNgayKhenThuong.Value = updateKhenThuong.namKhenThuong;
     txtLoaiKhenThuong.Text       = updateKhenThuong.loaiKhenThuong;
     txtSoSoKhenThuong.Text       = updateKhenThuong.soSoKhenThuong;
     txtNguoiKyKhenThuong.Text    = updateKhenThuong.nguoiKhenThuong;
     txtThanhTichKhenThuong.Text  = updateKhenThuong.thanhTichKhenThuong;
     txtCapKhenThuong.Text        = updateKhenThuong.capKhenThuong;
     txtGhiChuKhenThuong.Text     = updateKhenThuong.ghiChu;
     txtMaNV.ReadOnly             = true;
     btnSua.Enabled               = true;
     bntThem.Enabled              = false;
 }
 private void btnSua_Click(object sender, EventArgs e)
 {
     if (updateKhenThuong != null)
     {
         try
         {
             updateKhenThuong.namKhenThuong       = datetimeNgayKhenThuong.Value;
             updateKhenThuong.loaiKhenThuong      = txtLoaiKhenThuong.Text;
             updateKhenThuong.soSoKhenThuong      = txtSoSoKhenThuong.Text;
             updateKhenThuong.nguoiKhenThuong     = txtNguoiKyKhenThuong.Text;
             updateKhenThuong.thanhTichKhenThuong = txtThanhTichKhenThuong.Text;
             updateKhenThuong.capKhenThuong       = txtCapKhenThuong.Text;
             updateKhenThuong.ghiChu = txtGhiChuKhenThuong.Text;
             if (_khenThuongServices.UpdateThongTinKhenThuong(updateKhenThuong))
             {
                 MessageBox.Show("Đã Chỉnh Sửa Thông Tin Khen Thưởng Thành Công!", "Thông Báo", MessageBoxButtons.OK);
                 ClearAllText(this);
                 bntThem.Enabled  = true;
                 btnSua.Enabled   = false;
                 updateKhenThuong = null;
                 InitGridView();
                 dataGridKhenThuong.Refresh();
                 txtMaNV.ReadOnly = false;
             }
             else
             {
                 MessageBox.Show("Vui Lòng Kiểm Tra Lại Thông Tin", "Lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             if (UserProfile.permission == 1)
             {
                 MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 MessageBox.Show("Đã Có Lỗi! Vui Lòng Kiểm Tra Thông Tin Đầu Vào!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Vui Lòng Kiểm Tra Lại Thông Tin", "Lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #20
0
        public async Task <IActionResult> Edit(int id, KhenThuong khenThuong)
        {
            var model = new ViewModelDG();

            model.ListNhanVien       = database.NhanViens.ToArray();
            model.ListLoaikhenThuong = database.LoaiKhenThuongs.ToArray();
            model.khenThuong         = database.KhenThuongs.Where(x => x.Idkt == id).FirstOrDefault();
            if (ModelState.IsValid)
            {
                model.khenThuong.Idnv     = khenThuong.Idnv;
                model.khenThuong.IdloaiKt = khenThuong.IdloaiKt;
                model.khenThuong.Ngay     = khenThuong.Ngay;

                database.Update(model.khenThuong);
                await database.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
        // Insert Khen thưởng
        private KhenThuong Insert_KT()
        {
            string maDV     = txt_KT_MaDV.Text;
            string lyDo     = rtxt_KT_Lydo.Text;
            string hinhThuc = txt_KT_Hinhthuc.Text;
            string capQD    = txt_KT_CapQD.Text;

            DateTime dt_TG = ConvertStringToDate(txt_KT_TG.Text);

            if (maDV == "" || lyDo == "" || hinhThuc == "" || capQD == "")
            {
                MessageBox.Show("Vui lòng nhập đầy đủ Thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            else
            {
                _khenThuong = new KhenThuong(maDV, dt_TG, lyDo, hinhThuc, capQD);
                return(_khenThuong);
            }
        }
        // Update Khen thưởng
        private void Update_KT(KhenThuong khenThuong)
        {
            txt_KT_MaDV.Text     = khenThuong.MaDV;
            rtxt_KT_Lydo.Text    = khenThuong.LyDo;
            txt_KT_Hinhthuc.Text = khenThuong.HinhThuc;
            txt_KT_CapQD.Text    = khenThuong.CapQD;

            txt_KT_TG.Text = khenThuong.ThoiGian.ToShortDateString();

            //if (maDV == "" || lyDo == "" || hinhThuc == "" || capQD == "")
            //{
            //    MessageBox.Show("Vui lòng nhập đầy đủ Thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return null;
            //}
            //else
            //{
            //    _khenThuong = new KhenThuong(maDV, dt_TG, lyDo, hinhThuc, capQD);
            //    return _khenThuong;
            //}
        }
Exemple #23
0
 private void InitKhenThuong(KhenThuong khenThuong)
 {
     if (khenThuong != null)
     {
         lblLoaiKhenThuong.Text = khenThuong.loaiKhenThuong;
         lblNamKhenThuong.Text  = khenThuong.namKhenThuong.ToString("yyyy");
         lblSoQDKhen.Text       = khenThuong.soSoKhenThuong;
         lblNguoiKhen.Text      = khenThuong.nguoiKhenThuong;
         lblThanhTichKhen.Text  = khenThuong.thanhTichKhenThuong;
         lblGhiChuKhen.Text     = khenThuong.ghiChu;
     }
     else
     {
         lblLoaiKhenThuong.Text = "Chưa Cập Nhật";
         lblNamKhenThuong.Text  = "Chưa Cập Nhật";
         lblSoQDKhen.Text       = "Chưa Cập Nhật";
         lblNguoiKhen.Text      = "Chưa Cập Nhật";
         lblThanhTichKhen.Text  = "Chưa Cập Nhật";
         lblGhiChuKhen.Text     = "Chưa Cập Nhật";
     }
 }
Exemple #24
0
        public async Task <KhenThuong> UpdatePartial(KhenThuong khenthuong, params string[] field)
        {
            var a = await WithConnection(async c =>
            {
                KhenThuong obj = await c.GetAsync(khenthuong);

                if (obj == null)
                {
                    throw new Exception(string.Format("Update id {0} not exist", khenthuong.KhenThuongId.ToString()));
                }

                if (obj.CtrVersion != khenthuong.CtrVersion)
                {
                    throw new Exception(string.Format("Update id {0} have version confict"
                                                      , khenthuong.KhenThuongId.ToString()));
                }

                khenthuong.CtrVersion += 1;
                var list = field.ToList();

                list.Add(nameof(khenthuong.CtrVersion));

                var partialUpdateMapping = OrmConfiguration
                                           .GetDefaultEntityMapping <KhenThuong>()
                                           .Clone()
                                           .UpdatePropertiesExcluding(prop => prop.IsExcludedFromUpdates = true,
                                                                      list.ToArray());

                var result = await c.UpdateAsync(khenthuong, statement => statement.WithEntityMappingOverride(partialUpdateMapping));

                if (result != true)
                {
                    throw new Exception("Update Fail");
                }

                return(khenthuong);
            });

            return(a);
        }
        private void bntThem_Click(object sender, EventArgs e)
        {
            try
            {
                KhenThuong khenThuong = new KhenThuong
                {
                    idNhanVien          = _nhanVienServices.GetEmpByMaNV(txtMaNV.Text.Trim()).idNhanVien,
                    namKhenThuong       = datetimeNgayKhenThuong.Value,
                    loaiKhenThuong      = txtLoaiKhenThuong.Text,
                    soSoKhenThuong      = txtSoSoKhenThuong.Text,
                    nguoiKhenThuong     = txtNguoiKyKhenThuong.Text,
                    thanhTichKhenThuong = txtThanhTichKhenThuong.Text,
                    capKhenThuong       = txtCapKhenThuong.Text,
                    ghiChu = txtGhiChuKhenThuong.Text
                };

                if (_khenThuongServices.AddThongTinKhenThuong(khenThuong))
                {
                    MessageBox.Show("Đã Thêm Thông Tin Khen Thưởng Thành Công!", "Thông Báo", MessageBoxButtons.OK);
                    ClearAllText(this);
                    InitGridView();
                    dataGridKhenThuong.Refresh();
                }
                else
                {
                    MessageBox.Show("Vui Lòng Kiểm Tra Lại Thông Tin", "Lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                if (UserProfile.permission == 1)
                {
                    MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Đã Có Lỗi! Vui Lòng Kiểm Tra Thông Tin Đầu Vào!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #26
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var x = gridView1.GetSelectedRows();

            if (x.Length > 1)
            {
                MessageBox.Show("Bạn chọn quá nhiều dòng", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (x.Length <= 0)
            {
                MessageBox.Show("Bạn chưa chọn dòng nào", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                int        IDObj      = int.Parse(gridView1.GetRowCellValue(x[0], "ID").ToString());
                KhenThuong KhenThuong = new KhenThuong();
                KhenThuong = _baseService.GetByID(IDObj);
                frmKhenThuongAdd frm = new frmKhenThuongAdd(KhenThuong);
                frm.Text = "Sửa Loại khen thưởng";
                frm.ShowDialog();
                getList();
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            switch (_itemValue)
            {
            case 0:
            {
                _thongTin = new ThongTin();

                _thongTin.MaDV        = txtMaDV.Text;
                _thongTin.HoTen       = txtHoten.Text;
                _thongTin.TenKhaiSinh = txtTenKS.Text;
                _thongTin.BiDanh      = txtBidanh.Text;
                _thongTin.GioiTinh    = txtGioitinh.Text;

                _thongTin.NgaySinh = convertStringToDate(txtNgaysinh.Text);
                _thongTin.QueQuan  = txtQuequan.Text;
                _thongTin.DiaChi   = rtxtDiachi.Text;
                _thongTin.SDT      = txtSDT.Text;

                _thongTin.Email   = txtEmail.Text;
                _thongTin.DanToc  = txtDantoc.Text;
                _thongTin.TonGiao = txtTongiao.Text;
                _thongTin.LinkAnh = _linkAnh;

                _frmUpdate = new frmUpdate(_thongTin, 0);
                _frmUpdate.Show();

                break;
            }

            case 1:
            {
                _themThongTin = new ThemThongTin();

                _themThongTin.MaDV          = txt_TTT_MaDV.Text;
                _themThongTin.NgayVaoDoan   = convertStringToDate(txt_TTT_NgayVD.Text);
                _themThongTin.NoiVaoDoan    = txt_TTT_MaDV.Text;
                _themThongTin.NgayVaoDangL1 = convertStringToDate(txt_TTT_NgayVDL1.Text);

                _themThongTin.NoiVaoDangL1     = txt_TTT_MaDV.Text;
                _themThongTin.NgayChinhThucL1  = convertStringToDate(txt_TTT_NgayCTL1.Text);
                _themThongTin.NoiCongNhanL1    = txt_TTT_MaDV.Text;
                _themThongTin.NguoiGioiThieuL1 = txt_TTT_MaDV.Text;

                _frmUpdate = new frmUpdate(_themThongTin, 1);
                _frmUpdate.Show();
                break;
            }

            case 2:
            {
                _trinhDo = new TrinhDo();

                _trinhDo.MaDV      = txt_TD_MaDV.Text;
                _trinhDo.TrinhDoPT = txt_TD_PT.Text;
                _trinhDo.ChuyenMon = txt_TD_Chuyenmon.Text;
                _trinhDo.HocVi     = txt_TD_Hocvi.Text;

                _trinhDo.DTHocVi  = convertStringToDate(txt_TD_CTHV.Text);
                _trinhDo.HocHam   = txt_TD_Hocham.Text;
                _trinhDo.DTHocham = convertStringToDate(txt_TD_CTHH.Text);
                _trinhDo.LyLuanCT = txt_TD_Lyluan.Text;

                _trinhDo.NgoaiNgu = rtxt_TD_NN.Text;

                _frmUpdate = new frmUpdate(_trinhDo, 2);
                _frmUpdate.Show();
                break;
            }

            case 3:
            {
                _quaTrinhCT = new QuaTrinhCongTac();

                _quaTrinhCT.MaDV     = txt_QT_MaDV.Text;
                _quaTrinhCT.MaPB     = txt_QT_MaPB.Text;
                _quaTrinhCT.PhongBan = txt_QT_TenPB.Text;
                _quaTrinhCT.BatDau   = convertStringToDate(txt_QT_Batdau.Text);

                _quaTrinhCT.KetThuc  = convertStringToDate(txt_QT_Ketthuc.Text);
                _quaTrinhCT.CongViec = txt_QT_Congviec.Text;
                _quaTrinhCT.DiaDiem  = txt_QT_Diadiem.Text;
                _quaTrinhCT.ChucVu   = txt_QT_Chucvu.Text;

                _frmUpdate = new frmUpdate(_quaTrinhCT, 3);
                _frmUpdate.Show();
                break;
            }

            case 4:
            {
                _daoTaoBD = new DaoTao_BoiDuong();

                _daoTaoBD.MaDV    = txt_DT_MaDV.Text;
                _daoTaoBD.BatDau  = convertStringToDate(txt_DT_BD.Text);
                _daoTaoBD.KetThuc = convertStringToDate(txt_DT_KT.Text);
                _daoTaoBD.TenLop  = txt_DT_Tenlop.Text;

                _daoTaoBD.HinhThuc = txt_DT_Hinhthuc.Text;
                _daoTaoBD.ChungChi = txt_DT_Chungchi.Text;

                _frmUpdate = new frmUpdate(_daoTaoBD, 4);
                _frmUpdate.Show();
                break;
            }

            case 5:
            {
                _diNuocNgoai = new DiNuocNgoai();

                _diNuocNgoai.MaDV    = txt_DNN_MaDV.Text;
                _diNuocNgoai.BatDau  = convertStringToDate(txt_DNN_BD.Text);
                _diNuocNgoai.KetThuc = convertStringToDate(txt_DNN_KT.Text);
                _diNuocNgoai.NoiDung = rtxt_DNN_ND.Text;
                _diNuocNgoai.DiaDiem = txt_DNN_DD.Text;

                _frmUpdate = new frmUpdate(_diNuocNgoai, 5);
                _frmUpdate.Show();
                break;
            }

            case 6:
            {
                _khenThuong = new KhenThuong();

                _khenThuong.MaDV     = txt_KT_MaDV.Text;
                _khenThuong.ThoiGian = convertStringToDate(txt_KT_TG.Text);
                _khenThuong.HinhThuc = txt_KT_Hinhthuc.Text;
                _khenThuong.CapQD    = txt_KT_CapQD.Text;
                _khenThuong.LyDo     = rtxt_KT_Lydo.Text;

                _frmUpdate = new frmUpdate(_khenThuong, 6);
                _frmUpdate.Show();
                break;
            }

            case 7:
            {
                _kyLuat = new KyLuat();

                _kyLuat.MaDV     = txt_KL_MaDV.Text;
                _kyLuat.ThoiGian = convertStringToDate(txt_KL_TG.Text);
                _kyLuat.HinhThuc = txt_KL_Hinhthuc.Text;
                _kyLuat.CapQD    = txt_KL_CapQD.Text;
                _kyLuat.LyDo     = rtxt_KL_Lydo.Text;

                _frmUpdate = new frmUpdate(_kyLuat, 7);
                _frmUpdate.Show();
                break;
            }

            case 8:
            {
                _giaDinh = new GiaDinh();

                _giaDinh.MaDV    = txt_GD_MaDV.Text;
                _giaDinh.QuanHe  = txt_GD_QH.Text;
                _giaDinh.HoTen   = txt_GD_Hoten.Text;
                _giaDinh.NamSinh = txt_GD_Namsinh.Text;
                _giaDinh.QueQuan = txt_GD_Quequan.Text;
                _giaDinh.DiaChi  = rtxt_GD_Diachi.Text;

                _frmUpdate = new frmUpdate(_giaDinh, 8);
                _frmUpdate.Show();
                break;
            }

            case 9:
            {
                _tuNhanXet = new TuNhanXet();

                _tuNhanXet.MaDV       = txt_TNX_MaDV.Text;
                _tuNhanXet.PhamChat   = txt_TNX_PC.Text;
                _tuNhanXet.DaoDuc     = txt_TNX_DD.Text;
                _tuNhanXet.NangLuc    = txt_TNX_NL.Text;
                _tuNhanXet.QuanHeQC   = txt_TNX_QHQC.Text;
                _tuNhanXet.KhuyetDiem = txt_TNX_KD.Text;

                _frmUpdate = new frmUpdate(_tuNhanXet, 9);
                _frmUpdate.Show();
                break;
            }
            }
        }
Exemple #28
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (txtMSV.Text == "" || txtHoTen.Text == "" || txtNoiDung.Text == "" || txtTenKhenthuong.Text == "")
            {
                if (txtHoTen.Text == "")
                {
                    MessageBox.Show("Không tìm thấy đối tượng.");
                }
                if (txtNoiDung.Text == "")
                {
                    errorProvider1.SetError(txtNoiDung, "Chưa điền nội dung.");
                }
                if (txtTenKhenthuong.Text == "")
                {
                    errorProvider1.SetError(txtTenKhenthuong, "Chưa điền tên.");
                }
            }

            else
            {
                KhenThuong khenthuong = new KhenThuong();

                if (chucnang == 1)
                {
                    khenthuong.DoiTuongId    = TempDoiTuongID;
                    khenthuong.TenKhenThuong = txtTenKhenthuong.Text;
                    khenthuong.NoiDung       = txtNoiDung.Text;
                    khenthuong.Ngay          = DateTime.Now;
                    khenthuong.GhiChu        = txtGhiChu.Text;


                    if (bus_KhenThuong.Insert(khenthuong))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công khen thưởng " + txtTenKhenthuong.Text + " - MSV: " + txtMSV.Text + "/" + txtHoTen.Text;
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Khen thưởng, kỷ luật";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                        MessageBox.Show("Thêm dữ liệu thành công.", "Thông báo.");
                    }
                    else
                    {
                        MessageBox.Show("Thêm dữ liệu lỗi.", "Thông báo.");
                    }
                }

                if (chucnang == 2)
                {
                    khenthuong.KhenThuongId  = khenthuongID;
                    khenthuong.DoiTuongId    = doituongID;
                    khenthuong.TenKhenThuong = txtTenKhenthuong.Text;
                    khenthuong.NoiDung       = txtNoiDung.Text;
                    khenthuong.Ngay          = dpkNgayThem.Value;
                    khenthuong.GhiChu        = txtGhiChu.Text;
                    if (bus_KhenThuong.Update(khenthuong))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhật thành công khen thưởng " + txtTenKhenthuong.Text + " - MSV: " + txtMSV.Text + "/" + txtHoTen.Text;
                        nhatKy.ThaoTac     = "Cập nhật";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Khen thưởng, kỷ luật";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                        MessageBox.Show("Cập nhật dữ liệu thành công.", "Thông báo.");
                    }
                    else
                    {
                        MessageBox.Show("cập nhật dữ liệu lỗi.", "Thông báo.");
                    }
                }
                reset();
            }
        }
 // KHEN THƯỞNG.
 public bool Insert_KhenThuong(KhenThuong khenThuong)
 {
     return(dal_Insert.Insert_KhenThuong(khenThuong));
 }
 // KHEN THƯỞNG.
 public bool Update_KhenThuong(KhenThuong khenThuong)
 {
     return(dal_Update.Update_KhenThuong(khenThuong));
 }