public bool Update(NhatKyHoatDong nhatKyHoatDong)
        {
            try
            {
                string         query       = "SELECT * FROM NhatKyHoatDong";
                SqlDataAdapter dataAdapter = new SqlDataAdapter(query, connection);
                DataRow        row         = table.Rows.Find(nhatKyHoatDong.NhatKyHoatDongId);

                if (row != null)
                {
                    row["NguoiDungId"] = nhatKyHoatDong.NguoiDungId;
                    row["chucNang"]    = nhatKyHoatDong.ChucNang;
                    row["thaoTac"]     = nhatKyHoatDong.ThaoTac;
                    row["noiDung"]     = nhatKyHoatDong.NoiDung;
                    row["thoiGian"]    = nhatKyHoatDong.ThoiGian;
                }

                SqlCommandBuilder sqlCommandBuilder = new SqlCommandBuilder(dataAdapter);
                dataAdapter.Update(table);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public bool Insert(NhatKyHoatDong nhatKyHoatDong)
        {
            try
            {
                string         query       = "SELECT * FROM NhatKyHoatDong";
                SqlDataAdapter dataAdapter = new SqlDataAdapter(query, connection);
                table = GetData();
                DataRow row = table.NewRow();
                row["NguoiDungId"] = nhatKyHoatDong.NguoiDungId;
                row["chucNang"]    = nhatKyHoatDong.ChucNang;
                row["thaoTac"]     = nhatKyHoatDong.ThaoTac;
                row["noiDung"]     = nhatKyHoatDong.NoiDung;
                row["thoiGian"]    = nhatKyHoatDong.ThoiGian;
                table.Rows.Add(row);

                SqlCommandBuilder sqlCommandBuilder = new SqlCommandBuilder(dataAdapter);
                dataAdapter.Update(table);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (txtMaDanToc.Text != "")
            {
                if (MessageBox.Show("Bạn chắc chắn muốn xóa bản ghi này ?", "Đồng ý Ok-Cancel", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (bus_DanToc.Delete(int.Parse(txtMaDanToc.Text)))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Xóa thành công dân tộc " + txtMaDanToc.Text + " ra khỏi hệ thống";
                        nhatKy.ThaoTac     = "Xóa";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Dân tộc";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                        MessageBox.Show("Xóa dữ liệu thành công.", "Thông báo.");
                    }

                    else
                    {
                        MessageBox.Show("Xóa dữ liệu lỗi.", "Thông báo.");
                    }
                    reset();
                }
            }
            else
            {
                MessageBox.Show("Thao tác bị lỗi, vui lòng chọn đối tượng.", "Thông báo");
            }
        }
Ejemplo n.º 4
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (txtMSV.Text != "")
     {
         if (MessageBox.Show("Bạn chắc chắn muốn xóa bản ghi này ?", "Đồng ý Ok-Cancel", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (bus_KhenThuong.Delete(khenthuongID))
             {
                 //------------Ghi log
                 NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                 nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                 nhatKy.NoiDung     = "Xóa thành công khen thưởng " + txtTenKhenthuong.Text + " - MSV: " + txtMSV.Text + "/" + txtHoTen.Text;
                 nhatKy.ThaoTac     = "Xóa";
                 nhatKy.ThoiGian    = DateTime.Now;
                 nhatKy.ChucNang    = "Khen thưởng, kỷ luật";
                 Const.NhatKyHoatDong.Insert(nhatKy);
                 //-------------------
                 MessageBox.Show("Xóa thành công!");
                 reset();
             }
             else
             {
                 MessageBox.Show("Xóa thất bại!");
             }
         }
     }
     else
     {
         MessageBox.Show("Thao tác bị lỗi, vui lòng chọn đối tượng.", "Thông báo");
     }
 }
Ejemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenTinhThanh.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                errorProvider.SetError(txtTenTinhThanh, "Chưa điền tên.");
            }
            else
            {
                TinhThanh tinhthanh = new TinhThanh();

                if (chucnang == 1)
                {
                    tinhthanh.TenTinhThanh = txtTenTinhThanh.Text;
                    if (bUS_TinhThanh.Insert(tinhthanh))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công tỉnh thành " + txtTenTinhThanh.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Tỉnh thành";
                        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)
                {
                    tinhthanh.TinhThanhId  = int.Parse(txtMaTinhThanh.Text);
                    tinhthanh.TenTinhThanh = txtTenTinhThanh.Text;
                    if (bUS_TinhThanh.Update(tinhthanh))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công tỉnh thành " + txtTenTinhThanh.Text + " trong hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Tỉnh thành";
                        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();
            }
        }
Ejemplo n.º 6
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn muốn xóa hồ sơ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                try
                {
                    BUS_DoiTuong.Delete(Const.DoiTuongId);

                    //------------Ghi log
                    NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                    nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                    nhatKy.NoiDung     = "Xóa thành công hồ sơ của sinh viên/đối tượng " + ten_mvs;
                    nhatKy.ThaoTac     = "Xóa";
                    nhatKy.ThoiGian    = DateTime.Now;
                    nhatKy.ChucNang    = "Hồ sơ";
                    Const.NhatKyHoatDong.Insert(nhatKy);
                    //-------------------

                    UCHoSo_Load(sender, e);
                }
                catch
                {
                    MessageBox.Show("Hồ sơ này liên quan đến tác vụ khác đang hiện hữu, bạn cần xóa các dữ liệu liên quan trước.");
                }
            }
        }
Ejemplo n.º 7
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtMaVatTu.Text != "")
     {
         if (MessageBox.Show("Bạn chắc chắn muốn xóa bản ghi này ?", "Đồng ý Ok-Cancel", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (bUS_vattu.Delete(txtMaVatTu.Text))
             {
                 //------------Ghi log
                 NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                 nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                 nhatKy.NoiDung     = "Xóa thành công vật tư " + txtTenVatTu.Text + " ra khỏi hệ thống";
                 nhatKy.ThaoTac     = "Xóa";
                 nhatKy.ThoiGian    = DateTime.Now;
                 nhatKy.ChucNang    = "Vật tư";
                 Const.NhatKyHoatDong.Insert(nhatKy);
                 //-------------------
                 MessageBox.Show("Xóa thành công!");
                 reset();
             }
             else
             {
                 MessageBox.Show("Xóa thất bại!");
             }
         }
     }
     else
     {
         MessageBox.Show("Thao tác bị lỗi, vui lòng chọn đối tượng.", "Thông báo");
     }
 }
Ejemplo n.º 8
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtMSV.Text != "")
     {
         if (MessageBox.Show("Bạn chắc chắn muốn xóa bản ghi này ?", "Đồng ý Ok-Cancel", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             if (bUS_HopDong.Delete(HopDongid))
             {
                 //------------Ghi log
                 NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                 nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                 nhatKy.NoiDung     = "Xóa thành công hợp đồng của sinh viên/đối tượng có mã: " + txtMSV.Text + " - " + txtHoTen.Text;
                 nhatKy.ThaoTac     = "Xóa";
                 nhatKy.ThoiGian    = DateTime.Now;
                 nhatKy.ChucNang    = "Hợp đồng";
                 Const.NhatKyHoatDong.Insert(nhatKy);
                 //-------------------
                 MessageBox.Show("Xóa thành công!");
                 reset();
             }
             else
             {
                 MessageBox.Show("Xóa thất bại!");
             }
         }
     }
     else
     {
         MessageBox.Show("Thao tác bị lỗi, vui lòng chọn đối tượng.", "Thông báo");
     }
 }
        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            if (!IsEmptyInfor() && !IsCoincident())
            {
                try
                {
                    BUS_NguoiDung bUS_NguoiDung = new BUS_NguoiDung();
                    Const.CurrentUser.MatKhau = HashPassword(txtMatKhauNew.Text);
                    bUS_NguoiDung.Update(Const.CurrentUser);
                    MessageBox.Show("Đổi mật khâu thành công!");

                    //------------Ghi log
                    NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                    nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                    nhatKy.NoiDung     = "Đổi mật khẩu tài khoản " + Const.CurrentUser.TenDangNhap;
                    nhatKy.ThaoTac     = "";
                    nhatKy.ThoiGian    = DateTime.Now;
                    nhatKy.ChucNang    = "Đổi mật khẩu";
                    Const.NhatKyHoatDong.Insert(nhatKy);
                    //-------------------
                }
                catch
                {
                    MessageBox.Show("Có lỗi xảy ra!!!");
                    throw;
                }
            }
        }
Ejemplo n.º 10
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(dateCapPhat.Text);
            PhieuCapPhatVatTu phieuCapPhatVatTu = new PhieuCapPhatVatTu();

            phieuCapPhatVatTu.PhieuCapPhatVatTuId = int.Parse(id);
            phieuCapPhatVatTu.PhongId1            = cbPhong.SelectedValue.ToString();
            phieuCapPhatVatTu.NhanVienId          = int.Parse(cbNhanVien.SelectedValue.ToString());
            phieuCapPhatVatTu.NguoiDungId         = int.Parse(cbNguoiDung.SelectedValue.ToString());
            phieuCapPhatVatTu.NgayCapPhat         = DateTime.Parse(dateCapPhat.Text);
            phieuCapPhatVatTu.TenNguoiLap         = txtTenNguoiLap.Text;
            phieuCapPhatVatTu.GhiChu = txtGhiChu.Text;
            try
            {
                BUS_PhieuCapPhatVatTu.Update(phieuCapPhatVatTu);
                MessageBox.Show("Sửa thành công !");

                //------------Ghi log
                NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                nhatKy.NoiDung     = "Cập nhập thành công bản phiếu cấp phát vật tư cho phòng" + phieuCapPhatVatTu.PhongId1;
                nhatKy.ThaoTac     = "Cập nhập";
                nhatKy.ThoiGian    = DateTime.Now;
                nhatKy.ChucNang    = "Phiếu yêu cầu cấp phát vật tư";
                Const.NhatKyHoatDong.Insert(nhatKy);
                //-------------------

                this.Close();
            }
            catch
            {
                MessageBox.Show("Lỗi không sửa được mời kiểm tra lại !");
            }
        }
Ejemplo n.º 11
0
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (txtTenTonGiao.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                errorProvider1.SetError(txtTenTonGiao, "Chưa điền tên.");
            }
            else
            {
                TonGiao tongiao = new TonGiao();

                if (chucnang == 1)
                {
                    tongiao.TenTonGiao = txtTenTonGiao.Text;
                    if (bUS_TonGiao.Insert(tongiao))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công tôn giáo " + txtTenTonGiao.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Tôn giáo";
                        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)
                {
                    tongiao.TonnGiaoId = int.Parse(txtMaTonGiao.Text);
                    tongiao.TenTonGiao = txtTenTonGiao.Text;
                    if (bUS_TonGiao.Update(tongiao))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công tôn giáo " + txtTenTonGiao.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Tôn giáo";
                        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();
            }
        }
Ejemplo n.º 12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenDanToc.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                errorProvider1.SetError(txtTenDanToc, "Chưa điền tên.");
            }

            else
            {
                DanToc dantoc = new DanToc();
                if (chucnang == 1)
                {
                    dantoc.TenDanToc = txtTenDanToc.Text;
                    if (bus_DanToc.Insert(dantoc))
                    {
                        MessageBox.Show("Thêm dữ liệu thành công.", "Thông báo.");
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "thêm thành công dân tộc " + txtMaDanToc.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Dân tộc";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                    }

                    else
                    {
                        MessageBox.Show("Thêm dữ liệu lỗi.", "Thông báo.");
                    }
                }

                if (chucnang == 2)
                {
                    dantoc.DanTocId  = int.Parse(txtMaDanToc.Text);
                    dantoc.TenDanToc = txtTenDanToc.Text;
                    if (bus_DanToc.Update(dantoc))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công dân tộc " + txtMaDanToc.Text + " trong hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Dân tộc";
                        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();
            }
        }
Ejemplo n.º 13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenLoaiDoiTuong.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                errorProvider1.SetError(txtTenLoaiDoiTuong, "Chưa điền tên.");
            }
            else
            {
                LoaiDoiTuong loaidoituong = new LoaiDoiTuong();

                if (chucnang == 1)
                {
                    loaidoituong.TenLoaiDoiTuong = txtTenLoaiDoiTuong.Text;
                    if (bUS_LoaiDoiTuong.Insert(loaidoituong))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công loại đối tượng " + txtTenLoaiDoiTuong.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Loại đối tượng";
                        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)
                {
                    loaidoituong.LoaiDoiTuongId  = int.Parse(txtMaLoaiDoiTuong.Text);
                    loaidoituong.TenLoaiDoiTuong = txtTenLoaiDoiTuong.Text;
                    if (bUS_LoaiDoiTuong.Update(loaidoituong))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công loại đối tượng " + txtTenLoaiDoiTuong.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Loại đối tượng";
                        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();
            }
        }
        private void btnCapNhap_Click(object sender, EventArgs e)
        {
            //Nếu không trùng và đầy đủ thông tin cần thiết thì add

            DoiTuong doiTuong = new DoiTuong();

            doiTuong.DoiTuongId = Const.DoiTuongId;
            doiTuong.HoDem      = txtHoDem.Text;
            doiTuong.Ten        = txtTen.Text;
            doiTuong.MaSinhVien = txtMaSinhVien.Text;
            doiTuong.NgaySinh   = (DateTime)dateNgaySinh.EditValue;

            bool gioiTinh = true;

            if (rdbNu.Checked)
            {
                gioiTinh = false;
            }
            doiTuong.GioiTinh = gioiTinh;
            doiTuong.NoiSinh  = txtNoiSinh.Text;
            doiTuong.HoKhau   = txtHoKhau.Text;
            doiTuong.QueQuan  = txtQueQuan.Text;
            doiTuong.Sdt      = txtSdt.Text;
            doiTuong.Email    = txtEmail.Text;


            doiTuong.LoaiDoiTuongId = (int)cbLoaiDoiTuong.SelectedValue;
            doiTuong.TonGiaoId      = (int)cbTonGiao.SelectedValue;
            doiTuong.LopId          = (int)cbLop.SelectedValue;
            doiTuong.DanTocId       = (int)cbDanToc.SelectedValue;
            doiTuong.TinhThanhId    = (int)cbTinhThanh.SelectedValue;
            doiTuong.QuocTichId     = (int)cbQuocTich.SelectedValue;

            doiTuong.Image  = (!string.IsNullOrEmpty(path)) ? support.converImgToByte(path) : tempPic;
            doiTuong.GhiChu = txtGhiChu.Text;

            BUS_DoiTuong.Update(doiTuong);

            //------------Ghi log
            NhatKyHoatDong nhatKy = new NhatKyHoatDong();

            nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
            nhatKy.NoiDung     = "Cập nhập thành công hồ sơ của sinh viên/đối tượng " + doiTuong.HoDem + " " + doiTuong.Ten + " - " + doiTuong.MaSinhVien;
            nhatKy.ThaoTac     = "Cập nhập";
            nhatKy.ThoiGian    = DateTime.Now;
            nhatKy.ChucNang    = "Hồ sơ";
            Const.NhatKyHoatDong.Insert(nhatKy);
            //-------------------

            MessageBox.Show("Cập nhập Thành Công!");
            this.Close();
        }
Ejemplo n.º 15
0
        private void btnThucHien_Click(object sender, EventArgs e)
        {
            BUS_PhanQuyen.UpdateDetail((DataTable)gridControl1.DataSource);

            //------------Ghi log
            NhatKyHoatDong nhatKy = new NhatKyHoatDong();

            nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
            nhatKy.NoiDung     = Const.CurrentUser.TenDangNhap + " cập nhập quyền cho " + Const.NguoiDungId;
            nhatKy.ThaoTac     = "Cập nhập";
            nhatKy.ThoiGian    = DateTime.Now;
            nhatKy.ChucNang    = "Nhật ký hoạt động";
            Const.NhatKyHoatDong.Insert(nhatKy);
            //-------------------
        }
Ejemplo n.º 16
0
        private void btnLogout_ItemClick(object sender, ItemClickEventArgs e)
        {
            ClearInfor();
            Login();

            //------------Ghi log
            NhatKyHoatDong nhatKy = new NhatKyHoatDong();

            nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
            nhatKy.NoiDung     = Const.CurrentUser.TenDangNhap + " đăng xuất ";
            nhatKy.ThaoTac     = "";
            nhatKy.ThoiGian    = DateTime.Now;
            nhatKy.ChucNang    = "Đăng xuất";
            Const.NhatKyHoatDong.Insert(nhatKy);
            //-------------------
        }
Ejemplo n.º 17
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có muốn xóa phiếu này hay không ? ", "Thông báo", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                if (BUS_PhieuCapPhatVatTu.Delete(int.Parse(temp)))
                {
                    //------------Ghi log
                    NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                    nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                    nhatKy.NoiDung     = "Xóa thành công bản phiếu cấp phát vật tư số " + temp;
                    nhatKy.ThaoTac     = "Xóa";
                    nhatKy.ThoiGian    = DateTime.Now;
                    nhatKy.ChucNang    = "Phiếu yêu cầu cấp phát vật tư";
                    Const.NhatKyHoatDong.Insert(nhatKy);
                    //-------------------

                    MessageBox.Show("Phiếu đã được xóa !");
                }
                MessageBox.Show("Không thể xóa phiếu này !");
            }
            gridControlPhieuCP.DataSource = BUS_PhieuCapPhatVatTu.GetDataNew();
        }
Ejemplo n.º 18
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            Login();
            if (Const.isLogin)
            {
                if (checkBoxGhiNho.Checked)
                {
                    Properties.Settings.Default.isCheckMemory = true;
                    Properties.Settings.Default.users         = txtUserName.Text;
                    Properties.Settings.Default.pass          = txtPassWord.Text;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    Properties.Settings.Default.isCheckMemory = false;
                    Properties.Settings.Default.users         = "";
                    Properties.Settings.Default.pass          = "";
                    Properties.Settings.Default.Save();
                }

                NhatKyHoatDong nhatKyHoatDong = new NhatKyHoatDong();
                nhatKyHoatDong.NguoiDungId = Const.CurrentUser.NguoiDungId;
                nhatKyHoatDong.NoiDung     = "Tài khoản: " + Const.CurrentUser.TenDangNhap + " đã đăng nhập";
                nhatKyHoatDong.ThaoTac     = "";
                nhatKyHoatDong.ThoiGian    = DateTime.Now;
                nhatKyHoatDong.ChucNang    = "Đăng nhập";



                Const.NhatKyHoatDong.Insert(nhatKyHoatDong);
                this.Close();
            }


            Reset();
        }
Ejemplo n.º 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtMSV.Text == "" || txtHoTen.Text == "" || txtNoiDung.Text == "" || txtTenHopDong.Text == "" || txtThoiHanTheoNam.Text == "" || txtThoiHanTheoThang.Text == "")
            {
                if (txtHoTen.Text == "")
                {
                    MessageBox.Show("Không tìm thấy đối tượng.");
                    if (txtMSV.Text == "")
                    {
                        errorProvider1.SetError(txtMSV, "Chưa điền MSV.");
                    }
                }
                if (txtNoiDung.Text == "")
                {
                    errorProvider1.SetError(txtNoiDung, "Chưa điền nội dung.");
                }
                if (txtTenHopDong.Text == "")
                {
                    errorProvider1.SetError(txtTenHopDong, "Chưa điền tên.");
                }
                if (txtThoiHanTheoNam.Text == "")
                {
                    errorProvider1.SetError(txtThoiHanTheoNam, "Chưa điền nội dung.");
                }
                if (txtThoiHanTheoThang.Text == "")
                {
                    errorProvider1.SetError(txtThoiHanTheoThang, "Chưa điền nội dung.");
                }
            }

            else
            {
                HopDong hopdong = new HopDong();

                if (chucnang == 1)
                {
                    hopdong.DoiTuongId       = TempDoiTuongID;
                    hopdong.TenHopDong       = txtTenHopDong.Text;
                    hopdong.NoiDung          = txtNoiDung.Text;
                    hopdong.TuNgay           = (DateTime)dpkTuNgay.Value;
                    hopdong.DenNgay          = (DateTime)dpkDenNgay.Value;
                    hopdong.ThoiHanTheoNam   = int.Parse(txtThoiHanTheoNam.Text);
                    hopdong.ThoiHanTheoThang = int.Parse(txtThoiHanTheoThang.Text);

                    if (bUS_HopDong.Insert(hopdong))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công hợp đồng của sinh viên/đối tượng có mã: " + txtMSV.Text + " - " + txtHoTen.Text + " thời hạn từ " + hopdong.TuNgay + " đến " + hopdong.DenNgay;
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Hợp đồng";
                        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)
                {
                    hopdong.HopDongId        = HopDongid;
                    hopdong.DoiTuongId       = doituongID;
                    hopdong.TenHopDong       = txtTenHopDong.Text;
                    hopdong.NoiDung          = txtNoiDung.Text;
                    hopdong.TuNgay           = dpkTuNgay.Value;
                    hopdong.DenNgay          = dpkDenNgay.Value;
                    hopdong.ThoiHanTheoNam   = int.Parse(txtThoiHanTheoNam.Text);
                    hopdong.ThoiHanTheoThang = int.Parse(txtThoiHanTheoThang.Text);
                    if (bUS_HopDong.Update(hopdong))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công hợp đồng của sinh viên/đối tượng có mã: " + txtMSV.Text + " - " + txtHoTen.Text + " thời hạn từ " + hopdong.TuNgay + " đến " + hopdong.DenNgay;
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Hợp đồng";
                        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();
            }
        }
Ejemplo n.º 20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtMSV.Text == "" || txtHoTen.Text == "" || txtNoiDung.Text == "" || txtTenKyLuat.Text == "")
            {
                if (txtHoTen.Text == "")
                {
                    MessageBox.Show("Không tìm thấy đối tượng.");
                }
                if (txtTenKyLuat.Text == "")
                {
                    errorProvider1.SetError(txtTenKyLuat, "Chưa điền tên.");
                }
                if (txtNoiDung.Text == "")
                {
                    errorProvider1.SetError(txtNoiDung, "Chưa điền nội dung.");
                }
            }

            else
            {
                KyLuat Kyluat = new KyLuat();

                if (chucnang == 1)
                {
                    Kyluat.DoiTuongId = TempDoiTuongID;
                    Kyluat.TenKyLuat  = txtTenKyLuat.Text;
                    Kyluat.NoiDung    = txtNoiDung.Text;
                    Kyluat.Ngay       = DateTime.Now;
                    Kyluat.GhiChu     = txtGhiChu.Text;


                    if (bus_KyLuat.Insert(Kyluat))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công bản kỷ luật " + txtTenKyLuat.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)
                {
                    Kyluat.KyLuatId   = KyLuatID;
                    Kyluat.DoiTuongId = doituongID;
                    Kyluat.TenKyLuat  = txtTenKyLuat.Text;
                    Kyluat.NoiDung    = txtNoiDung.Text;
                    Kyluat.Ngay       = dpkNgayThem.Value;
                    Kyluat.GhiChu     = txtGhiChu.Text;
                    if (bus_KyLuat.Update(Kyluat))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhật thành công bản kỷ luật " + txtTenKyLuat.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();
            }
        }
Ejemplo n.º 21
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenVatTu.Text == "" || txtMaVatTu.Text == "" || txtSoLuong.Text == "" || txtMoTa.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                if (txtMaVatTu.Text == "")
                {
                    errorProvider1.SetError(txtMaVatTu, "Chưa điền mã.");
                }
                if (txtTenVatTu.Text == "")
                {
                    errorProvider1.SetError(txtTenVatTu, "Chưa điền tên.");
                }
                if (txtSoLuong.Text == "")
                {
                    errorProvider1.SetError(txtSoLuong, "Chưa điền số lượng.");
                }
                if (txtMoTa.Text == "")
                {
                    errorProvider1.SetError(txtMoTa, "Chưa điền mô tả.");
                }
            }
            else
            {
                VatTu vattu = new VatTu();

                if (chucnang == 1)
                {
                    if (checkma() == true)
                    {
                        MessageBox.Show("Mã vật tư đã tồn tại.", "Thông Báo");
                        errorProvider1.SetError(txtMaVatTu, "Mã vật tư đã tồn tại.");
                    }
                    else
                    {
                        vattu.VatTuId  = txtMaVatTu.Text;
                        vattu.TenVatTu = txtTenVatTu.Text;
                        vattu.SoLuong  = int.Parse(txtSoLuong.Text);
                        vattu.MoTa     = txtMoTa.Text;
                        vattu.GhiChu   = txtGhiChu.Text;
                        if (bUS_vattu.Insert(vattu))
                        {
                            //------------Ghi log
                            NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                            nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                            nhatKy.NoiDung     = "Thêm thành công vật tư " + txtTenVatTu.Text + " vào hệ thống";
                            nhatKy.ThaoTac     = "Tạo";
                            nhatKy.ThoiGian    = DateTime.Now;
                            nhatKy.ChucNang    = "Vật 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.");
                        }
                        reset();
                    }
                }

                if (chucnang == 2)
                {
                    vattu.VatTuId  = txtMaVatTu.Text;
                    vattu.TenVatTu = txtTenVatTu.Text;
                    vattu.SoLuong  = int.Parse(txtSoLuong.Text);
                    vattu.MoTa     = txtMoTa.Text;
                    vattu.GhiChu   = txtGhiChu.Text;
                    if (bUS_vattu.Update(vattu))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công vật tư " + txtTenVatTu.Text + " trong hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Vật 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();
                }
            }
        }
Ejemplo n.º 22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenLoi.Text == "" || txtHinhThucXuLy.Text == "" || txtNoiDung.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                if (txtTenLoi.Text == "")
                {
                    errorProvider1.SetError(txtTenLoi, "Chưa điền tên.");
                }
                if (txtNoiDung.Text == "")
                {
                    errorProvider1.SetError(txtNoiDung, "Chưa điền thông tin.");
                }
                if (txtHinhThucXuLy.Text == "")
                {
                    errorProvider1.SetError(txtHinhThucXuLy, "Chưa điền thông tin.");
                }
            }
            else
            {
                LoiViPham loivipham = new LoiViPham();

                if (chucnang == 1)
                {
                    loivipham.TenLoiViPham = txtTenLoi.Text;
                    loivipham.NoiDung      = txtNoiDung.Text;
                    loivipham.HinhThucXuLy = txtHinhThucXuLy.Text;
                    loivipham.GhiChu       = txtGhiChu.Text;
                    if (bUS_LoiViPham.Insert(loivipham))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công lỗi quy phạm " + txtTenLoi.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Lỗi vi phạm";
                        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)
                {
                    loivipham.LoiViPhamId  = int.Parse(txtMaLoi.Text);
                    loivipham.TenLoiViPham = txtTenLoi.Text;
                    loivipham.NoiDung      = txtNoiDung.Text;
                    loivipham.HinhThucXuLy = txtHinhThucXuLy.Text;
                    loivipham.GhiChu       = txtGhiChu.Text;
                    if (bUS_LoiViPham.Update(loivipham))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công lỗi quy phạm " + txtTenLoi.Text + " trong hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Lỗi vi phạm";
                        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();
            }
        }
Ejemplo n.º 23
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenNV.Text == "" || txtSDT.Text == "" || txtChucVu.Text == "" || txtEmail.Text == "" || txtdiachi.Text == "" || txtPhuTrach.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                if (txtTenNV.Text == "")
                {
                    errorProvider1.SetError(txtTenNV, "Chưa điền tên.");
                }
                if (txtChucVu.Text == "")
                {
                    errorProvider1.SetError(txtChucVu, "Chưa điền thông tin.");
                }
                if (txtSDT.Text == "")
                {
                    errorProvider1.SetError(txtSDT, "Chưa điền thông tin.");
                }
                if (txtEmail.Text == "")
                {
                    errorProvider1.SetError(txtEmail, "Chưa điền tên.");
                }
                if (txtdiachi.Text == "")
                {
                    errorProvider1.SetError(txtdiachi, "Chưa điền thông tin.");
                }
                if (txtPhuTrach.Text == "")
                {
                    errorProvider1.SetError(txtPhuTrach, "Chưa điền thông tin.");
                }
            }
            else
            {
                NhanVien nhanvien = new NhanVien();

                if (chucnang == 1)
                {
                    nhanvien.TenNhanVien = txtTenNV.Text;
                    nhanvien.ChucVu      = txtChucVu.Text;
                    nhanvien.Sdt         = txtSDT.Text;
                    nhanvien.PhuTrach    = txtPhuTrach.Text;
                    nhanvien.DiaChi      = txtdiachi.Text;
                    nhanvien.Email       = txtEmail.Text;
                    nhanvien.NgaySinh    = (DateTime)dpkNgaySinh.Value;
                    if (bUS_nhanvien.Insert(nhanvien))
                    {
                        MessageBox.Show("Thêm dữ liệu thành công.", "Thông báo.");

                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công nhân viên: " + txtTenNV.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Nhân viên";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                    }
                    else
                    {
                        MessageBox.Show("Thêm dữ liệu lỗi.", "Thông báo.");
                    }
                }

                if (chucnang == 2)
                {
                    nhanvien.NhanVienId  = int.Parse(txtMaNV.Text);
                    nhanvien.TenNhanVien = txtTenNV.Text;
                    nhanvien.ChucVu      = txtChucVu.Text;
                    nhanvien.Sdt         = txtSDT.Text;
                    nhanvien.PhuTrach    = txtPhuTrach.Text;
                    nhanvien.DiaChi      = txtdiachi.Text;
                    nhanvien.Email       = txtEmail.Text;
                    nhanvien.NgaySinh    = (DateTime)dpkNgaySinh.Value;
                    if (bUS_nhanvien.Update(nhanvien))
                    {
                        MessageBox.Show("Cập nhật dữ liệu thành công.", "Thông báo.");
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công nhân viên: " + txtTenNV.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Nhân viên";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                    }
                    else
                    {
                        MessageBox.Show("cập nhật dữ liệu lỗi.", "Thông báo.");
                    }
                }
                reset();
            }
        }
Ejemplo n.º 24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenDonVi.Text == "" || txtSDT.Text == "" || txtDiaChi.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                if (txtTenDonVi.Text == "")
                {
                    errorProvider1.SetError(txtTenDonVi, "Chưa điền tên.");
                }
                if (txtSDT.Text == "")
                {
                    errorProvider1.SetError(txtSDT, "Chưa điền sđt.");
                }
                if (txtDiaChi.Text == "")
                {
                    errorProvider1.SetError(txtDiaChi, "Chưa điền địa chỉ.");
                }
            }

            else
            {
                DonVi donvi = new DonVi();

                if (chucnang == 1)
                {
                    donvi.TenDonVi = txtTenDonVi.Text;
                    donvi.Sdt      = txtSDT.Text;
                    donvi.DiaChi   = txtDiaChi.Text;
                    donvi.GhiChu   = txtGhiChu.Text;
                    if (bus_donvi.Insert(donvi))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công đơn vị " + txtTenDonVi.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Đơn vị";
                        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)
                {
                    donvi.DonViId  = int.Parse(txtMaDonVi.Text);
                    donvi.TenDonVi = txtTenDonVi.Text;
                    donvi.Sdt      = txtSDT.Text;
                    donvi.DiaChi   = txtDiaChi.Text;
                    donvi.GhiChu   = txtGhiChu.Text;
                    if (bus_donvi.Update(donvi))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công đơn vị " + txtTenDonVi.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Đơn vị";
                        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();
            }
        }
Ejemplo n.º 25
0
        public void Login()
        {
            try
            {
                data = bUS_NguoiDung.GetData();
                if (data != null && !string.IsNullOrEmpty(txtUserName.Text) && !string.IsNullOrEmpty(txtPassWord.Text))
                {
                    if (CheckUsername(txtUserName.Text))
                    {
                        if (CheckPass(HashPassword(txtPassWord.Text)))
                        {
                            //mở chức năng tương ứng với user
                            //MessageBox.Show(Const.CurrentUser.TenDangNhap + " đăng nhập thành công!");

                            if (Const.CurrentUser.TenDangNhap == "admin")
                            {
                                Const.isFullOp = true;
                                Const.isLogin  = true;
                                NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                                nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                                nhatKy.NoiDung     = "Tài khoản: admin đã đăng nhập";
                                nhatKy.ThaoTac     = "";
                                nhatKy.ThoiGian    = DateTime.Now;
                                nhatKy.ChucNang    = "Đăng nhập";



                                Const.NhatKyHoatDong.Insert(nhatKy);
                                return;
                            }

                            BUS_PhanQuyen bUS_PhanQuyen = new BUS_PhanQuyen();
                            data = bUS_PhanQuyen.GetDetailPhanQuyen(Const.CurrentUser.NguoiDungId);
                            for (int i = 0; i < data.Rows.Count; i++)
                            {
                                PhanQuyen quyen = new PhanQuyen();

                                quyen.TenNhomChucNang = data.Rows[i][1].ToString();
                                quyen.TenChucNang     = data.Rows[i][2].ToString();
                                quyen.ChucNangThem    = (bool)data.Rows[i][3];

                                quyen.ChucNangSua = (bool)data.Rows[i][4];
                                quyen.ChucNangXoa = (bool)data.Rows[i][5];
                                quyen.ChucNangDoc = (bool)data.Rows[i][6];
                                Const.PhanQuyens.Add(quyen);
                            }


                            Const.isLogin = true;

                            NhatKyHoatDong nhatKyHoatDong = new NhatKyHoatDong();
                            nhatKyHoatDong.NguoiDungId = Const.CurrentUser.NguoiDungId;
                            nhatKyHoatDong.NoiDung     = "Tài khoản: " + Const.CurrentUser.TenDangNhap + " đã đăng nhập";
                            nhatKyHoatDong.ThaoTac     = "";
                            nhatKyHoatDong.ThoiGian    = DateTime.Now;
                            nhatKyHoatDong.ChucNang    = "Đăng nhập";
                            Const.NhatKyHoatDong.Insert(nhatKyHoatDong);
                        }
                        else
                        {
                            MessageBox.Show(CheckPass(txtPassWord.Text).ToString());
                            errorProvider1.BlinkStyle = ErrorBlinkStyle.BlinkIfDifferentError;
                            errorProvider1.BlinkRate  = 500;
                            errorProvider1.SetError(txtPassWord, "Sai mật khâu người dùng!");
                            Const.isLogin = false;
                        }
                    }
                    else
                    {
                        errorProvider1.BlinkStyle = ErrorBlinkStyle.BlinkIfDifferentError;
                        errorProvider1.BlinkRate  = 500;
                        errorProvider1.SetError(txtUserName, "Sai tên tài khoản người dùng!");
                        Const.isLogin = false;
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Ejemplo n.º 26
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            if (txtTenDangNhap.Text == "" || txtMatKhau.Text == "" || txtDiaChi.Text == "" || txtHoTen.Text == "" || txtSDT.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                if (txtTenDangNhap.Text == "")
                {
                    errorProvider1.SetError(txtTenDangNhap, "Chưa điền tên đăng nhập.");
                }
                if (txtMatKhau.Text == "")
                {
                    errorProvider1.SetError(txtMatKhau, "Chưa điền mật khẩu.");
                }
                if (txtDiaChi.Text == "")
                {
                    errorProvider1.SetError(txtDiaChi, "Chưa điền địa chỉ.");
                }
                if (txtHoTen.Text == "")
                {
                    errorProvider1.SetError(txtHoTen, "Chưa điền tên.");
                }
                if (txtSDT.Text == "")
                {
                    errorProvider1.SetError(txtSDT, "Chưa điền sđt.");
                }
            }
            else
            {
                NguoiDung nguoidung = new NguoiDung();

                if (chucnang == 1)
                {
                    nguoidung.TenDangNhap = txtTenDangNhap.Text;
                    nguoidung.MatKhau     = txtMatKhau.Text;
                    nguoidung.TenDayDu    = txtHoTen.Text;
                    nguoidung.Sdt         = txtSDT.Text;
                    nguoidung.DiaChi      = txtDiaChi.Text;

                    if (BUS_NguoiDung.Insert(nguoidung))
                    {
                        MessageBox.Show("Thêm dữ liệu thành công.", "Thông báo.");

                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công user: "******" vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Người dùng";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                    }
                    else
                    {
                        MessageBox.Show("Thêm dữ liệu lỗi.", "Thông báo.");
                    }
                }

                if (chucnang == 2)
                {
                    nguoidung.NguoiDungId = int.Parse(txtNguoidungID.Text);
                    nguoidung.TenDangNhap = txtTenDangNhap.Text;
                    nguoidung.MatKhau     = txtMatKhau.Text;
                    nguoidung.TenDayDu    = txtHoTen.Text;
                    nguoidung.Sdt         = txtSDT.Text;
                    nguoidung.DiaChi      = txtDiaChi.Text;
                    if (BUS_NguoiDung.Update(nguoidung))
                    {
                        MessageBox.Show("Cập nhật dữ liệu thành công.", "Thông báo.");
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công user: "******" vào hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Người dùng";
                        Const.NhatKyHoatDong.Insert(nhatKy);
                        //-------------------
                    }
                    else
                    {
                        MessageBox.Show("cập nhật dữ liệu lỗi.", "Thông báo.");
                    }
                }
                reset();
            }
        }
Ejemplo n.º 27
0
        private void btnCapNhatCapPhat_Click(object sender, EventArgs e)
        {
            foreach (DataRow row in BUS_PhieuCapPhatVatTu.GetData().Rows)
            {
                if (cbPhong.SelectedValue.ToString() == row["PhongId"].ToString() && dateEdit1.Text == DateTime.Parse(row["ngayCapPhat"].ToString()).ToString("dd/MM/yyyy"))
                {
                    if (listViewCapPhat.Items.Count == 0)
                    {
                        MessageBox.Show("Chưa có vật tư cấp phát mời kiểm tra lại !", "Thông báo");
                        return;
                    }
                    else
                    {
                        for (int i = 0; i < listViewCapPhat.Items.Count; i++)
                        {
                            ChiTietPhieuCapPhatVatTu.ChiTietPhieuCapPhatVatTuId = BUS_ChiTietPhieuCapPhatVatTu.GetChiTietID(int.Parse(phieuID), listViewCapPhat.Items[i].SubItems[1].Text);
                            ChiTietPhieuCapPhatVatTu.PhieuCapPhatVatTuId        = int.Parse(row["PhieuCapPhatVatTuId"].ToString());
                            ChiTietPhieuCapPhatVatTu.VatTuId     = listViewCapPhat.Items[i].SubItems[1].Text;
                            ChiTietPhieuCapPhatVatTu.PhongId1    = cbPhong.SelectedValue.ToString();
                            ChiTietPhieuCapPhatVatTu.SoLuong     = int.Parse(listViewCapPhat.Items[i].SubItems[3].Text);
                            ChiTietPhieuCapPhatVatTu.DonViTinh   = listViewCapPhat.Items[i].SubItems[4].Text;
                            ChiTietPhieuCapPhatVatTu.TinhTrang   = listViewCapPhat.Items[i].SubItems[5].Text;
                            ChiTietPhieuCapPhatVatTu.DonGiaVatTu = decimal.Parse(listViewCapPhat.Items[i].SubItems[6].Text);
                            ChiTietPhieuCapPhatVatTu.ThanhTien   = decimal.Parse(listViewCapPhat.Items[i].SubItems[7].Text);
                            ChiTietPhieuCapPhatVatTu.GhiChu      = listViewCapPhat.Items[i].SubItems[8].Text;
                            if (BUS_ChiTietPhieuCapPhatVatTu.CheckVatTu(ChiTietPhieuCapPhatVatTu.PhieuCapPhatVatTuId, ChiTietPhieuCapPhatVatTu.VatTuId) == true)
                            {
                                BUS_ChiTietPhieuCapPhatVatTu.Update(ChiTietPhieuCapPhatVatTu);

                                //------------Ghi log
                                NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                                nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                                nhatKy.NoiDung     = "Cấp phát thành công vật tư: " + listViewCapPhat.Items[i].SubItems[1].Text + " - số lượng: " + ChiTietPhieuCapPhatVatTu.SoLuong + " cho phòng " + ChiTietPhieuCapPhatVatTu.PhongId1;
                                nhatKy.ThaoTac     = "Tạo";
                                nhatKy.ThoiGian    = DateTime.Now;
                                nhatKy.ChucNang    = "Cấp phát thiết bị vật tư";
                                Const.NhatKyHoatDong.Insert(nhatKy);
                                //-------------------
                            }
                            else
                            {
                                BUS_ChiTietPhieuCapPhatVatTu.Insert(ChiTietPhieuCapPhatVatTu);
                                //------------Ghi log
                                NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                                nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                                nhatKy.NoiDung     = "Cập nhập thành công vật tư: " + listViewCapPhat.Items[i].SubItems[1].Text + " - số lượng: " + ChiTietPhieuCapPhatVatTu.SoLuong + " cho phòng " + ChiTietPhieuCapPhatVatTu.PhongId1;
                                nhatKy.ThaoTac     = "Cập nhập";
                                nhatKy.ThoiGian    = DateTime.Now;
                                nhatKy.ChucNang    = "Cấp phát thiết bị vật tư";
                                Const.NhatKyHoatDong.Insert(nhatKy);
                                //-------------------
                            }
                        }
                        LoadVatTu(listViewVatTu);
                        LoadData();
                    }
                    MessageBox.Show("Đã cập nhật cấp phát !", "Thông báo");
                    return;
                }
            }
            MessageBox.Show("Chưa có phiếu cấp phát xin mời kiểm tra lại !", "Thông báo");
        }
Ejemplo n.º 28
0
        private void btnTaoHoSo_Click(object sender, EventArgs e)
        {
            //Nếu không trùng và đầy đủ thông tin cần thiết thì add
            if (!DuplicateCheck() && IsFullInfo())
            {
                DoiTuong doiTuong = new DoiTuong();
                doiTuong.HoDem      = txtHoDem.Text;
                doiTuong.Ten        = txtTen.Text;
                doiTuong.MaSinhVien = txtMaSinhVien.Text;
                doiTuong.NgaySinh   = (DateTime)dateNgaySinh.EditValue;

                bool gioiTinh = true;
                if (rdbNu.Checked)
                {
                    gioiTinh = false;
                }
                doiTuong.GioiTinh = gioiTinh;
                doiTuong.NoiSinh  = txtNoiSinh.Text;
                doiTuong.HoKhau   = txtHoKhau.Text;
                doiTuong.QueQuan  = txtQueQuan.Text;
                doiTuong.Sdt      = txtSdt.Text;
                doiTuong.Email    = txtEmail.Text;


                doiTuong.LoaiDoiTuongId = (int)cbLoaiDoiTuong.SelectedValue;
                doiTuong.TonGiaoId      = (int)cbTonGiao.SelectedValue;
                doiTuong.LopId          = (int)cbLop.SelectedValue;
                doiTuong.DanTocId       = (int)cbDanToc.SelectedValue;
                doiTuong.TinhThanhId    = (int)cbTinhThanh.SelectedValue;
                doiTuong.QuocTichId     = (int)cbQuocTich.SelectedValue;
                doiTuong.Image          = support.converImgToByte(path);
                doiTuong.GhiChu         = txtGhiChu.Text;
                BUS_DoiTuong.Insert(doiTuong);

                //------------Ghi log
                NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                nhatKy.NoiDung     = "Thêm thành công hồ sơ của sinh viên/đối tượng " + doiTuong.HoDem + " " + doiTuong.Ten + " - " + doiTuong.MaSinhVien;
                nhatKy.ThaoTac     = "Tạo";
                nhatKy.ThoiGian    = DateTime.Now;
                nhatKy.ChucNang    = "Hồ sơ";
                Const.NhatKyHoatDong.Insert(nhatKy);
                //-------------------

                MessageBox.Show("Thêm Thành Công!");

                this.Close();
            }
            else
            {
                if (DuplicateCheck())
                {
                    errorProvider1.SetError(txtMaSinhVien, "MSV đã tồn tại");
                }
                if (txtHoDem.Text == "")
                {
                    errorProvider1.SetError(txtHoDem, "Chưa điền tên");
                }
                if (txtTen.Text == "")
                {
                    errorProvider1.SetError(txtTen, "Chưa điền tên");
                }
                if (txtMaSinhVien.Text == "")
                {
                    errorProvider1.SetError(txtMaSinhVien, "Chưa điền msv");
                }
                if (dateNgaySinh.Text == "")
                {
                    errorProvider1.SetError(txtHoDem, "Chưa chọn ngày sinh");
                }
                if (txtNoiSinh.Text == "")
                {
                    errorProvider1.SetError(txtNoiSinh, "Chưa điền dữ liệu");
                }
                if (txtSdt.Text == "")
                {
                    errorProvider1.SetError(txtSdt, "Chưa điền dữ liệu");
                }
                if (txtEmail.Text == "")
                {
                    errorProvider1.SetError(txtEmail, "Chưa điền dữ liệu");
                }
                if (txtHoKhau.Text == "")
                {
                    errorProvider1.SetError(txtHoKhau, "Chưa điền dữ liệu");
                }
                if (txtQueQuan.Text == "")
                {
                    errorProvider1.SetError(txtQueQuan, "Chưa điền dữ liệu");
                }
            }
        }
Ejemplo n.º 29
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtTenLop.Text == "" || cbbDonvi.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                if (txtTenLop.Text == "")
                {
                    errorProvider1.SetError(txtTenLop, "Chưa điền tên.");
                }
                if (cbbDonvi.Text == "")
                {
                    errorProvider1.SetError(cbbDonvi, "Chưa chọn đơn vị.");
                }
            }
            else
            {
                Lop lop = new Lop();

                if (chucnang == 1)
                {
                    lop.TenLop  = txtTenLop.Text;
                    lop.DonViId = (int)cbbDonvi.SelectedValue;

                    if (bUS_Lop.Insert(lop))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Thêm thành công lớp " + txtTenLop.Text + " vào hệ thống";
                        nhatKy.ThaoTac     = "Tạo";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Lớp";
                        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)
                {
                    lop.LopId   = int.Parse(txtMaLop.Text);
                    lop.TenLop  = txtTenLop.Text;
                    lop.DonViId = int.Parse(cbbDonvi.SelectedValue.ToString());
                    if (bUS_Lop.Update(lop))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công lớp " + txtTenLop.Text + " trong hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Lớp";
                        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();
            }
        }
Ejemplo n.º 30
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (txtTenPhong.Text == "" || txtTang.Text == "" || txtMaPhong.Text == "" || txtGiaPhong.Text == "" || cbbLoaiPhong.Text == "" || cbbDayNha.Text == "")
            {
                MessageBox.Show("Dữ liệu nhập chưa đủ.");
                if (txtTenPhong.Text == "")
                {
                    errorProvider1.SetError(txtTenPhong, "Chưa điền tên.");
                }
                if (txtTang.Text == "")
                {
                    errorProvider1.SetError(txtTang, "");
                }
                if (txtMaPhong.Text == "")
                {
                    errorProvider1.SetError(txtMaPhong, "Chưa điền mã phòng");
                }
                if (txtGiaPhong.Text == "")
                {
                    errorProvider1.SetError(txtGiaPhong, "Chưa điền giá phòng.");
                }
                if (cbbDayNha.Text == "")
                {
                    errorProvider1.SetError(cbbDayNha, "Chưa chọn dãy nhà.");
                }
                if (cbbLoaiPhong.Text == "")
                {
                    errorProvider1.SetError(cbbLoaiPhong, "Chưa chọn loại phòng.");
                }
            }
            else
            {
                Phong phong = new Phong();

                if (chucnang == 1)
                {
                    if (checkma() == true)
                    {
                        MessageBox.Show("Mã vật tư đã tồn tại.", "Thông Báo");
                        errorProvider1.SetError(txtMaPhong, "Mã vật tư đã tồn tại.");
                    }
                    else
                    {
                        phong.PhongId     = txtMaPhong.Text;
                        phong.TenPhong    = txtTenPhong.Text;
                        phong.GiaPhong    = decimal.Parse(txtGiaPhong.Text);
                        phong.Tang        = int.Parse(txtTang.Text);
                        phong.DayNhaId    = int.Parse(cbbDayNha.SelectedValue.ToString());
                        phong.LoaiPhongId = int.Parse(cbbLoaiPhong.SelectedValue.ToString());
                        if (rdoNam.Checked)
                        {
                            phong.ThuocGioiTinh = true;
                        }
                        if (rdoNu.Checked)
                        {
                            phong.ThuocGioiTinh = false;
                        }
                        if (bUS_Phong.Insert(phong))
                        {
                            //------------Ghi log
                            NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                            nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                            nhatKy.NoiDung     = "Thềm thành công phòng " + txtMaPhong.Text + " vào hệ thống";
                            nhatKy.ThaoTac     = "Tạo";
                            nhatKy.ThoiGian    = DateTime.Now;
                            nhatKy.ChucNang    = "Phòng";
                            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.");
                        }
                        reset();
                    }
                }

                if (chucnang == 2)
                {
                    phong.PhongId     = txtMaPhong.Text;
                    phong.TenPhong    = txtTenPhong.Text;
                    phong.GiaPhong    = decimal.Parse(txtGiaPhong.Text);
                    phong.Tang        = int.Parse(txtTang.Text);
                    phong.DayNhaId    = int.Parse(cbbDayNha.SelectedValue.ToString());
                    phong.LoaiPhongId = int.Parse(cbbLoaiPhong.SelectedValue.ToString());
                    if (rdoNam.Checked)
                    {
                        phong.ThuocGioiTinh = true;
                    }
                    if (rdoNu.Checked)
                    {
                        phong.ThuocGioiTinh = false;
                    }
                    if (bUS_Phong.Update(phong))
                    {
                        //------------Ghi log
                        NhatKyHoatDong nhatKy = new NhatKyHoatDong();
                        nhatKy.NguoiDungId = Const.CurrentUser.NguoiDungId;
                        nhatKy.NoiDung     = "Cập nhập thành công phòng " + txtMaPhong.Text + " trong hệ thống";
                        nhatKy.ThaoTac     = "Cập nhập";
                        nhatKy.ThoiGian    = DateTime.Now;
                        nhatKy.ChucNang    = "Phòng";
                        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();
                }
            }
        }