Exemplo n.º 1
0
 public static string strMaNVOld, strHoOld, strTenOld; // gia tri ho ten luc moi tim, dung de so sanh khi nhap phong TH ng dung sua thong tin sau khi tim duoc cnvc
 // se duoc gan khi double click nv o gridview ds
 public ThoiBoNhiem()
 {
     InitializeComponent();
     oDonVi = new DonVi();
     oChucVu = new ChucVu();
     oThoiNhiem = new Business.HDQD.ThoiNhiem();
 }
Exemplo n.º 2
0
 public ThongTinBoNhiem()
 {
     InitializeComponent();
     oDonVi = new DonVi();
     oChucVu = new ChucVu();
     oChucDanh = new ChucDanh();
     oLoaiPhuCap = new Business.HDQD.LoaiPhuCap();
 }
Exemplo n.º 3
0
 public NVTheo_HocHam_HocVi_GioiTinh()
 {
     InitializeComponent();
     oDonVi            = new Business.DonVi();
     oBaoCao           = new Business.BaoCao();
     oChucDanh         = new ChucDanh();
     oVangBangChinhQuy = new VanBangChinhQuy();
 }
 public NVTheo_HocHam_HocVi_GioiTinh()
 {
     InitializeComponent();
     oDonVi = new Business.DonVi();
     oBaoCao = new Business.BaoCao();
     oChucDanh = new ChucDanh();
     oVangBangChinhQuy = new VanBangChinhQuy();
 }
Exemplo n.º 5
0
 public static string strMaNVOld, strHoOld, strTenOld; // gia tri ho ten luc moi tim, dung de so sanh khi nhap phong TH ng dung sua thong tin sau khi tim duoc cnvc
                                                         // se duoc gan khi double click nv o gridview ds
 public BoNhiem()
 {
     InitializeComponent();
     oDonVi = new DonVi();
     oChucVu = new ChucVu();
     oKiemNhiem = new Business.HDQD.KiemNhiem();
     oFTP = new Business.FTP();
 }
Exemplo n.º 6
0
        private void RefreshDataSource()
        {
            donvi = new DonVi();
            DataTable dt = donvi.GetDonViDetailList();

            if (dt != null)
            {
                PrepareDataSource(dt);
                EditDtgInterface();
            }
        }
Exemplo n.º 7
0
        public ThanhLapDonVi()
        {
            InitializeComponent();
            oDonvi      = new DonVi();
            dtDonVi     = new DataTable();
            dsDonVi_new = new List <DonVi>();

            oFTP   = new Business.FTP();
            oFile  = new Business.HDQD.QD_File();
            dtFile = new DataTable();
            Paths  = new List <KeyValuePair <string, bool?> >();
        }
Exemplo n.º 8
0
        public ThanhLapDonVi()
        {
            InitializeComponent();
            oDonvi = new DonVi();
            dtDonVi = new DataTable();
            dsDonVi_new = new List<DonVi>();

            oFTP = new Business.FTP();
            oFile = new Business.HDQD.QD_File();
            dtFile = new DataTable();
            Paths = new List<KeyValuePair<string, bool?>>();
        }
Exemplo n.º 9
0
        public static bool is_Tach_DV = false; //true = tach; false = gop

        //public M_A()
        //{
        //    InitializeComponent();
        //    oDonvi = new DonVi();
        //    oCNVC = new Business.CNVC.CNVC();
        //    dsDonVi_new = new List<DonVi>();
        //    dsCNVC = new List<string>();
        //    ds_tenCNVC = new List<string>();

        //    dtDonVi = new DataTable();
        //}

        public M_A(bool p_is_Tach_DV)
        {
            InitializeComponent();
            oDonvi      = new DonVi();
            oCNVC       = new Business.CNVC.CNVC();
            dsDonVi_new = new List <DonVi>();
            dsCNVC      = new List <string>();
            ds_tenCNVC  = new List <string>();

            dtDonVi = new DataTable();

            is_Tach_DV = p_is_Tach_DV;
        }
Exemplo n.º 10
0
        public static bool is_Tach_DV = false; //true = tach; false = gop
        
        //public M_A()
        //{
        //    InitializeComponent();
        //    oDonvi = new DonVi();
        //    oCNVC = new Business.CNVC.CNVC();
        //    dsDonVi_new = new List<DonVi>();
        //    dsCNVC = new List<string>();
        //    ds_tenCNVC = new List<string>();

        //    dtDonVi = new DataTable();
        //}

        public M_A(bool p_is_Tach_DV)
        {
            InitializeComponent();
            oDonvi = new DonVi();
            oCNVC = new Business.CNVC.CNVC();
            dsDonVi_new = new List<DonVi>();
            dsCNVC = new List<string>();
            ds_tenCNVC = new List<string>();

            dtDonVi = new DataTable();

            is_Tach_DV = p_is_Tach_DV;
        }
Exemplo n.º 11
0
        private void InitObject()
        {
            oDonVi    = new DonVi();
            oChucvu   = new ChucVu();
            oChucdanh = new ChucDanh();

            mList_don_vi_selected    = new List <int>();
            mList_chuc_vu_selected   = new List <int>();
            mList_chuc_danh_selected = new List <int>();

            m_Don_vi = new DataTable();

            PreapreDataSource();
        }
Exemplo n.º 12
0
        public DoiThongTinDV()
        {
            InitializeComponent();
            oDonVi = new DonVi();
            oChucVu = new ChucVu();
            oQuyetDinh = new Business.HDQD.QuyetDinh();
            dtDonVi = oDonVi.GetActiveDonVi();
            dtChucVu = oChucVu.GetList();
            oFTP = new Business.FTP();
            oFile = new Business.HDQD.QD_File();
            dtFile = new DataTable();
            Paths = new List<KeyValuePair<string, bool?>>();

            TLPTenColCount = tableLP_ThayDoiTen.ColumnCount;
            TLPCVColCount = tableLP_ThayDoiCV.ColumnCount;
            TLPCapBacColCount = tableLP_ThayDoiCapBac.ColumnCount;
        }
Exemplo n.º 13
0
        private void btn_LuuThongTin_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txt_TenDV.Text) && dTP_NgayHieuLuc.Checked)
            {
                if (bAddFlag)
                {
                    DonVi dv = new DonVi();
                    dv.TenDonVi = txt_TenDV.Text;
                    dv.TenDVVietTat = txt_TenDVTat.Text;
                    if (comb_DVTrucThuoc.Text != "")
                        dv.DVChaID = Convert.ToInt16(comb_DVTrucThuoc.SelectedValue);
                    else
                        dv.DVChaID = null;

                    dv.TuNgay = dTP_NgayHieuLuc.Value;
                    dv.GhiChu = rTB_GhiChu.Text;

                    int i = lstb_DSDV.Items.Count;
                    dsDonVi_new.Insert(i, dv);

                    lstb_DSDV.Items.Add(txt_TenDV.Text);
                }
                else
                {
                    DonVi dv = dsDonVi_new[lstb_DSDV.SelectedIndex];
                    dv.TenDonVi = txt_TenDV.Text.Trim();
                    dv.TenDVVietTat = txt_TenDVTat.Text;
                    dv.TuNgay = dTP_NgayHieuLuc.Value;
                    dv.GhiChu = rTB_GhiChu.Text;
                    if (comb_DVTrucThuoc.Text != "")
                        dv.DVChaID = Convert.ToInt16(comb_DVTrucThuoc.SelectedValue);
                    else
                        dv.DVChaID = null;

                    dsDonVi_new[lstb_DSDV.SelectedIndex] = dv;
                    lstb_DSDV.Items[lstb_DSDV.SelectedIndex] = dv.TenDonVi;
                }
                

                EnableControls(true);
            }
            else
            {
                MessageBox.Show("Tên đơn vị và ngày hiệu lực không được bỏ trống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 14
0
        public DoiThongTinDV()
        {
            InitializeComponent();
            oDonVi     = new DonVi();
            oChucVu    = new ChucVu();
            oQuyetDinh = new Business.HDQD.QuyetDinh();
            dtDonVi    = oDonVi.GetActiveDonVi();
            dtChucVu   = oChucVu.GetList();
            oFTP       = new Business.FTP();
            oFile      = new Business.HDQD.QD_File();
            dtFile     = new DataTable();
            Paths      = new List <KeyValuePair <string, bool?> >();

            TLPTenColCount    = tableLP_ThayDoiTen.ColumnCount;
            TLPCVColCount     = tableLP_ThayDoiCV.ColumnCount;
            TLPCapBacColCount = tableLP_ThayDoiCapBac.ColumnCount;
        }
Exemplo n.º 15
0
        private void InitObject()
        {
            oHopdong  = new Business.HDQD.CNVC_HopDong();
            oChucdanh = new ChucDanh();
            oChucvu   = new ChucVu();
            oDonvi    = new DonVi();
            oBacHeSo  = new Business.Luong.BacHeSo();
            dtBacHeSo = new DataTable();
            oLoaiPC   = new Business.HDQD.LoaiPhuCap();
            oFile     = new Business.CNVC.CNVC_File();
            dtLoaiPC  = new DataTable();
            dtPhuCap  = new DataTable();
            oFTP      = new Business.FTP();

            dtLoaiPC  = oLoaiPC.GetList_Cbo();
            dtDSDonVi = new DataTable();

            PreapreDataSource();
            Prepare_Data_BacHeSo();
            PrepareDataTablePhuCap();
            thongTinQuyetDinh1.dTP_NgayHieuLuc.ValueChanged += dTP_NgayHieuLuc_ValueChanged;
        }
Exemplo n.º 16
0
        private void InitObject(bool p_loadcbo_loaiqd)
        {
            oChucdanh     = new ChucDanh();
            oChucvu       = new ChucVu();
            oDonvi        = new DonVi();
            oLoaiPC       = new Business.HDQD.LoaiPhuCap();
            oQuyetDinh    = new Business.HDQD.QuyetDinh();
            oLoaiQD       = new Business.HDQD.LoaiQuyetDinh();
            ucDinhNghiaCT = new DinhNghiaCT();

            dtPhuCap = new DataTable();
            dtLoaiPC = new DataTable();

            dtLoaiPC = oLoaiPC.GetList_Cbo();
            PreapreDataSource();
            PrepareDataTablePhuCap();

            if (p_loadcbo_loaiqd)
            {
                LoadCbo_Loai_QD();
            }
        }
Exemplo n.º 17
0
 private void btn_Xoa_Click(object sender, EventArgs e)
 {
     if (dtgv_DSDonVi.CurrentRow != null)
     {
         if (MessageBox.Show("Bạn thực sự muốn xoá ngành này? TOÀN BỘ CÁC SINH VIÊN THUỘC NGÀNH NÀY SẼ BỊ XOÁ THEO.", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             //vanbang = ToDepartmentObject(dtg_DepartmentList.CurrentRow);
             donvi = new DonVi(Convert.ToInt16(dtgv_DSDonVi.CurrentRow.Cells[0].Value.ToString()));
             try
             {
                 donvi.Delete();
                 RefreshDataSource();
                 MessageBox.Show("Xoá thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     return;
 }
Exemplo n.º 18
0
        private void InitObject()
        {
            oHopdong     = new Business.HDQD.CNVC_HopDong();
            oLoaihopdong = new Business.HDQD.LoaiHopDong();
            oChucdanh    = new ChucDanh();
            oChucvu      = new ChucVu();
            oDonvi       = new DonVi();
            oFTP         = new Business.FTP();
            oFile        = new Business.CNVC.CNVC_File();
            oBacHeSo     = new Business.Luong.BacHeSo();
            dtBacHeSo    = new DataTable();

            oLoaiPC     = new Business.HDQD.LoaiPhuCap();
            dtPhuCap    = new DataTable();
            dtLoaiPC    = new DataTable();
            dtDonVi     = new DataTable();
            oCNVCPhuCap = new Business.HDQD.CNVC_PhuCap();

            dtLoaiPC = oLoaiPC.GetList_Cbo();

            PreapreDataSource();
            Prepare_Data_BacHeSo();
            PrepareDataTablePhuCap();
        }
Exemplo n.º 19
0
        private void listB_SangDV_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listB_SangDV.SelectedIndex != -1)
            {
                int index = listB_SangDV.SelectedIndex;
                DonVi dv = new DonVi();
                dv = dsDonVi_new[index];
                txt_TenDV.Text = dv.TenDonVi;
                txt_TenDVTat.Text = dv.TenDVVietTat;
                if (dv.DVChaID != null)
                    comb_DVTrucThuoc.SelectedValue = dv.DVChaID;
                else
                    comb_DVTrucThuoc.SelectedValue = 0;
                if (dv.TuNgay != null)
                    dTP_NgayHieuLuc.Value = dv.TuNgay.Value;
                else
                    dTP_NgayHieuLuc.Checked = false;
                rTB_GhiChu.Text = dv.GhiChu;

                string ho_ten_nv = ds_tenCNVC[index];
                string[] nv_arr = ho_ten_nv.Split(';');
                listB_DSNV.Items.Clear();
                foreach (string item in nv_arr)
                {
                    listB_DSNV.Items.Add(item);
                }
            }
        }
Exemplo n.º 20
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (txt_Ten.Text != "" && (txt_Ten.Text != comB_TrucThuoc.Text))
            {
                #region thao tac them
                if (AddFlag)
                {
                    if (MessageBox.Show("Bạn thực sự muốn thêm ngành này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        //Department = ToDepartmentObject();
                        int?   id           = null;
                        string tendvviettat = txt_TenVietTat.Text;
                        string tendv        = txt_Ten.Text;
                        string ghichu       = rTB_GhiChu.Text;

                        int?dvtructhuoc = null;
                        if (comB_TrucThuoc.SelectedValue.ToString() != "")
                        {
                            dvtructhuoc = Convert.ToInt16(comB_TrucThuoc.SelectedValue);
                        }



                        DateTime?tungay = null;
                        if (dTP_TuNgay.Checked == true)
                        {
                            tungay = dTP_TuNgay.Value;
                        }

                        DateTime?denngay = null;
                        if (dTP_DenNgay.Checked == true)
                        {
                            denngay = dTP_DenNgay.Value;
                        }

                        bool hoatdong = false;
                        if (cb_HoatDong.Checked == true)
                        {
                            hoatdong = true;
                        }

                        donvi = new DonVi(id, tendvviettat, tendv, dvtructhuoc, tungay, denngay, hoatdong, ghichu);
                        try
                        {
                            if (comb_LoaiDV.SelectedValue.ToString() != "")
                            {
                                donvi.loaidvid = Convert.ToInt16(comb_LoaiDV.SelectedValue);
                            }
                            else
                            {
                                donvi.loaidvid = null;
                            }

                            donvi.Add();
                            MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            ResetInterface(true);
                            RefreshDataSource();

                            return;
                        }
                        catch
                        {
                            MessageBox.Show("Thao tác thêm thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        }
                    }
                }
                #endregion
                #region thao tac sua
                else                // thao tac sua
                {
                    if (MessageBox.Show("Bạn thực sự muốn sửa đơn vị này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int?   id           = Convert.ToInt16(dtgv_DSDonVi.CurrentRow.Cells[0].Value.ToString());
                        string tendvviettat = txt_TenVietTat.Text;
                        string tendv        = txt_Ten.Text;
                        string ghichu       = rTB_GhiChu.Text;

                        int?dvtructhuoc = null;
                        if (comB_TrucThuoc.SelectedValue.ToString() != "")
                        {
                            dvtructhuoc = Convert.ToInt16(comB_TrucThuoc.SelectedValue);
                        }

                        DateTime?tungay = null;
                        if (dTP_TuNgay.Checked == true)
                        {
                            tungay = dTP_TuNgay.Value;
                        }

                        DateTime?denngay = null;
                        if (dTP_DenNgay.Checked == true)
                        {
                            denngay = dTP_DenNgay.Value;
                        }

                        bool hoatdong = false;
                        if (cb_HoatDong.Checked == true)
                        {
                            hoatdong = true;
                        }

                        donvi = new DonVi(id, tendvviettat, tendv, dvtructhuoc, tungay, denngay, hoatdong, ghichu);
                        if (id != dvtructhuoc)
                        {
                            try
                            {
                                if (comb_LoaiDV.SelectedValue.ToString() != "")
                                {
                                    donvi.loaidvid = Convert.ToInt16(comb_LoaiDV.SelectedValue);
                                }
                                else
                                {
                                    donvi.loaidvid = null;
                                }

                                donvi.Update();
                                MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                ResetInterface(true);
                                RefreshDataSource();

                                return;
                            }
                            catch
                            {
                                MessageBox.Show("Thao tác sửa thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Đơn vị cập nhật và đơn vị trực thuộc là một. Vui lòng chọn lại đơn vị trực thuộc khác!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                #endregion
            }
            else
            {
                MessageBox.Show("Tên đơn vị không được rỗng, xin vui lòng cung cấp tên ngành", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 21
0
        bool AddFlag;   // xac dinh thao tac add hay edit

        public QLNS_DonVi()
        {
            InitializeComponent();
            donvi      = new DonVi();
            oLoaiDonVi = new LoaiDonVi();
        }
Exemplo n.º 22
0
        private void btn_Nhap_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có muốn nhập quyết định này hay không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (VerifyData())
                {
                    bool bUploadInfoSuccess = false;

                    Business.HDQD.QuyetDinh quyetdinh = new Business.HDQD.QuyetDinh();
                    quyetdinh.Ma_Quyet_Dinh = thongTinQuyetDinh1.txt_MaQD.Text;
                    quyetdinh.Ten_Quyet_Dinh = thongTinQuyetDinh1.txt_TenQD.Text;
                    quyetdinh.Loai_QuyetDinh_ID = Convert.ToInt16(thongTinQuyetDinh1.comB_Loai.SelectedValue);
                    quyetdinh.Ngay_Ky = thongTinQuyetDinh1.dTP_NgayKy.Value;
                    quyetdinh.Ngay_Hieu_Luc = thongTinQuyetDinh1.dTP_NgayHieuLuc.Value;
                    if (thongTinQuyetDinh1.dTP_NgayHetHan.Checked == true)
                        quyetdinh.Ngay_Het_Han = thongTinQuyetDinh1.dTP_NgayHetHan.Value;
                    else
                        quyetdinh.Ngay_Het_Han = null;
                    quyetdinh.MoTa = thongTinQuyetDinh1.rTB_MoTa.Text;

                    try
                    {
                        int count = dsDonVi_new.Count;
                        string[] ten_don_vi_moi = new string[count];
                        string[] ten_dv_viet_tat = new string[count];
                        int[] dv_cha_id = new int[count];
                        DateTime[] tu_ngay = new DateTime[count];
                        string[] ghi_chu = new string[count];

                        for (int i = 0; i < dsDonVi_new.Count; i++)
                        {
                            DonVi dv = new DonVi();
                            dv = dsDonVi_new[i];

                            ten_don_vi_moi[i] = dv.TenDonVi;
                            ten_dv_viet_tat[i] = dv.TenDVVietTat;
                            if (dv.DVChaID != null)
                                dv_cha_id[i] = dv.DVChaID.Value;
                            else
                                dv_cha_id[i] = 0;
                            tu_ngay[i] = dv.TuNgay.Value;
                        }

                        quyetdinh.Add_ThanhLapDV(ten_don_vi_moi, ten_dv_viet_tat, dv_cha_id, ghi_chu, tu_ngay);
                        MessageBox.Show("Thành lập đơn vị thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        EnableControls(true);
                        bUploadInfoSuccess = true;
                        
                        if (Paths != null && Paths.Count > 0 && bUploadInfoSuccess)
                        {
                            UploadFile();
                        }
                        else
                        {
                            CleanUIData();
                        }

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Thành lập đơn vị không thành công.\r\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin của quyết định.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            
        }
Exemplo n.º 23
0
        private void InitObject(bool p_loadcbo_loaiqd)
        {
            oChucdanh = new ChucDanh();
            oChucvu = new ChucVu();
            oDonvi = new DonVi();
            oLoaiPC = new Business.HDQD.LoaiPhuCap();
            oQuyetDinh = new Business.HDQD.QuyetDinh();
            oLoaiQD = new Business.HDQD.LoaiQuyetDinh();
            ucDinhNghiaCT = new DinhNghiaCT();

            dtPhuCap = new DataTable();
            dtLoaiPC = new DataTable();

            dtLoaiPC = oLoaiPC.GetList_Cbo();
            PreapreDataSource();
            PrepareDataTablePhuCap();

            if (p_loadcbo_loaiqd)
            { LoadCbo_Loai_QD(); }

        }
Exemplo n.º 24
0
 private void btn_Xoa_Click(object sender, EventArgs e)
 {
     if (dtgv_DSDonVi.CurrentRow != null)
     {
         if (MessageBox.Show("Bạn thực sự muốn xoá ngành này? TOÀN BỘ CÁC SINH VIÊN THUỘC NGÀNH NÀY SẼ BỊ XOÁ THEO.", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             //vanbang = ToDepartmentObject(dtg_DepartmentList.CurrentRow);
             donvi = new DonVi(Convert.ToInt16(dtgv_DSDonVi.CurrentRow.Cells[0].Value.ToString()));
             try
             {
                 donvi.Delete();
                 RefreshDataSource();
                 MessageBox.Show("Xoá thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     return;
 }
Exemplo n.º 25
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (txt_Ten.Text != "" && (txt_Ten.Text != comB_TrucThuoc.Text))
            {
                #region thao tac them
                if (AddFlag)
                {
                    if (MessageBox.Show("Bạn thực sự muốn thêm ngành này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        //Department = ToDepartmentObject();
                        int? id = null;
                        string tendvviettat = txt_TenVietTat.Text;
                        string tendv = txt_Ten.Text;
                        string ghichu = rTB_GhiChu.Text;
                        
                        int? dvtructhuoc = null;
                        if (comB_TrucThuoc.SelectedValue.ToString() != "")
                        {
                            dvtructhuoc = Convert.ToInt16(comB_TrucThuoc.SelectedValue);
                        }

                        

                        DateTime? tungay = null;
                        if (dTP_TuNgay.Checked == true)
                            tungay = dTP_TuNgay.Value;

                        DateTime? denngay = null;
                        if (dTP_DenNgay.Checked == true)
                            denngay = dTP_DenNgay.Value;

                        bool hoatdong = false;
                        if (cb_HoatDong.Checked == true)
                            hoatdong = true;

                        donvi = new DonVi(id, tendvviettat, tendv, dvtructhuoc, tungay, denngay, hoatdong, ghichu);
                        try
                        {
                            if (comb_LoaiDV.SelectedValue.ToString() != "")
                            {
                                donvi.loaidvid = Convert.ToInt16(comb_LoaiDV.SelectedValue);
                            }
                            else
                            {
                                donvi.loaidvid = null;
                            }

                            donvi.Add();
                            MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            ResetInterface(true);
                            RefreshDataSource();

                            return;
                        }
                        catch
                        {
                            MessageBox.Show("Thao tác thêm thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        }

                    }

                }
                #endregion
                #region thao tac sua
                else                // thao tac sua
                {
                    if (MessageBox.Show("Bạn thực sự muốn sửa đơn vị này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int? id = Convert.ToInt16(dtgv_DSDonVi.CurrentRow.Cells[0].Value.ToString());
                        string tendvviettat = txt_TenVietTat.Text;
                        string tendv = txt_Ten.Text;
                        string ghichu = rTB_GhiChu.Text;

                        int? dvtructhuoc = null;
                        if (comB_TrucThuoc.SelectedValue.ToString() != "")
                        {
                            dvtructhuoc = Convert.ToInt16(comB_TrucThuoc.SelectedValue);
                        }

                        DateTime? tungay = null;
                        if (dTP_TuNgay.Checked == true)
                            tungay = dTP_TuNgay.Value;

                        DateTime? denngay = null;
                        if (dTP_DenNgay.Checked == true)
                            denngay = dTP_DenNgay.Value;

                        bool hoatdong = false;
                        if (cb_HoatDong.Checked == true)
                            hoatdong = true;

                        donvi = new DonVi(id, tendvviettat, tendv, dvtructhuoc, tungay, denngay, hoatdong, ghichu);
                        if (id != dvtructhuoc)
                        {
                            try
                            {
                                if (comb_LoaiDV.SelectedValue.ToString() != "")
                                {
                                    donvi.loaidvid = Convert.ToInt16(comb_LoaiDV.SelectedValue);
                                }
                                else
                                {
                                    donvi.loaidvid = null;
                                }

                                donvi.Update();
                                MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                ResetInterface(true);
                                RefreshDataSource();

                                return;
                            }
                            catch
                            {
                                MessageBox.Show("Thao tác sửa thất bại.", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                            }
                        }
                        else
                            MessageBox.Show("Đơn vị cập nhật và đơn vị trực thuộc là một. Vui lòng chọn lại đơn vị trực thuộc khác!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                #endregion
            }
            else
                MessageBox.Show("Tên đơn vị không được rỗng, xin vui lòng cung cấp tên ngành", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Exemplo n.º 26
0
        bool AddFlag;   // xac dinh thao tac add hay edit

        public QLNS_DonVi()
        {
            InitializeComponent();
            donvi = new DonVi();
            oLoaiDonVi = new LoaiDonVi();
        }
Exemplo n.º 27
0
 private void RefreshDataSource()
 {
     donvi = new DonVi();
     DataTable dt = donvi.GetDonViDetailList();
     if (dt != null)
     {
         PrepareDataSource(dt);
         EditDtgInterface();
     }
 }
Exemplo n.º 28
0
        private void lstb_DSDV_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstb_DSDV.SelectedIndex != -1)
            {
                int index = lstb_DSDV.SelectedIndex;
                DonVi dv = new DonVi();
                dv = dsDonVi_new[index];
                txt_TenDV.Text = dv.TenDonVi;
                txt_TenDVTat.Text = dv.TenDVVietTat;
                if (dv.DVChaID != null)
                    comb_DVTrucThuoc.SelectedValue = dv.DVChaID;
                else
                    comb_DVTrucThuoc.SelectedValue = 0;
                if (dv.TuNgay != null)
                {
                    dTP_NgayHieuLuc.Value = dv.TuNgay.Value;
                    dTP_NgayHieuLuc.Checked = false;
                }
                else
                    dTP_NgayHieuLuc.Checked = false;
                rTB_GhiChu.Text = dv.GhiChu;

            }
        }
Exemplo n.º 29
0
 public NVTheo_DV()
 {
     InitializeComponent();
     oDonVi  = new Business.DonVi();
     oBaoCao = new Business.BaoCao();
 }
Exemplo n.º 30
0
 public NVTheo_DV()
 {
     InitializeComponent();
     oDonVi = new Business.DonVi();
     oBaoCao = new Business.BaoCao();
 }
Exemplo n.º 31
0
        private void btn_LuuThongTin_Click(object sender, EventArgs e)
        {
            if (txt_TenDV.Text != null && dTP_NgayHieuLuc.Checked == true)
            {
                DonVi dv = new DonVi();
                dv.TenDonVi = txt_TenDV.Text;
                dv.TenDVVietTat = txt_TenDVTat.Text;
                if (comb_DVTrucThuoc.Text != "")
                    dv.DVChaID = Convert.ToInt16(comb_DVTrucThuoc.SelectedValue);
                else
                    dv.DVChaID = null;

                dv.TuNgay = dTP_NgayHieuLuc.Value;
                dv.GhiChu = rTB_GhiChu.Text;

                //Xử lý chuỗi mã nhân viên
                string ma_nv_arr = "";
                string ten_nv_arr = "";
                //foreach (string item in m_ma_nv)
                //{
                //    ma_nv_arr = ma_nv_arr + "'" + item + "', ";

                //}
                if (m_ma_nv != null && m_ma_nv.Length > 0)
                {
                    for (int y = 0; y < m_ma_nv.Length; y++)
                    {
                        ma_nv_arr = ma_nv_arr + "'" + m_ma_nv[y] + "', ";
                        ten_nv_arr = ten_nv_arr + m_ho_ten[y] + ";";
                    }

                    ma_nv_arr = ma_nv_arr.Remove(ma_nv_arr.Length - 2);
                    ten_nv_arr = ten_nv_arr.Remove(ten_nv_arr.Length - 1);
                }
                int i = listB_SangDV.Items.Count;
                dsDonVi_new.Insert(i, dv);
                dsCNVC.Insert(i, ma_nv_arr);
                ds_tenCNVC.Insert(i, ten_nv_arr);

                listB_SangDV.Items.Add(txt_TenDV.Text);

                EnableControls(true);
            }
            else
            {
                MessageBox.Show("Vui lòng nhập đầy đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 32
0
        private void btn_Nhap_Click(object sender, EventArgs e)
        {
            if (thongTinQuyetDinh1.txt_MaQD.Text != "")
            {
                Business.HDQD.QuyetDinh quyetdinh = new Business.HDQD.QuyetDinh();
                quyetdinh.Ma_Quyet_Dinh = thongTinQuyetDinh1.txt_MaQD.Text;
                quyetdinh.Ten_Quyet_Dinh = thongTinQuyetDinh1.txt_TenQD.Text;
                quyetdinh.Loai_QuyetDinh_ID = Convert.ToInt16(thongTinQuyetDinh1.comB_Loai.SelectedValue);
                quyetdinh.Ngay_Ky = thongTinQuyetDinh1.dTP_NgayKy.Value;
                quyetdinh.Ngay_Hieu_Luc = thongTinQuyetDinh1.dTP_NgayHieuLuc.Value;
                if (thongTinQuyetDinh1.dTP_NgayHetHan.Checked == true)
                    quyetdinh.Ngay_Het_Han = thongTinQuyetDinh1.dTP_NgayHetHan.Value;
                else
                    quyetdinh.Ngay_Het_Han = null;
                quyetdinh.MoTa = thongTinQuyetDinh1.rTB_MoTa.Text;

                if (is_Tach_DV == true) // tach don vi
                {
                    #region Tách đơn vị
                    try
                    {
                        int count = dsDonVi_new.Count;
                        string[] ten_don_vi_moi = new string[count];
                        string[] ten_dv_viet_tat = new string[count];
                        int[] dv_cha_id = new int[count];
                        string[] tu_ngay = new string[count];
                        string[] ghi_chu = new string[count];
                        string[] ma_nv = new string[count];

                        for (int i = 0; i < dsDonVi_new.Count; i++)
                        {
                            DonVi dv = new DonVi();
                            dv = dsDonVi_new[i];

                            ten_don_vi_moi[i] = dv.TenDonVi;
                            ten_dv_viet_tat[i] = dv.TenDVVietTat;
                            if (dv.DVChaID != null)
                                dv_cha_id[i] = dv.DVChaID.Value;
                            else
                                dv_cha_id[i] = 0;
                            tu_ngay[i] = dv.TuNgay.Value.ToString("d", CultureInfo.CreateSpecificCulture("vi-VN"));

                            ma_nv[i] = dsCNVC[i];

                        }

                        int[] tu_don_vi = new int[1];
                        ComboBox cbo_DonVi = (ComboBox)tableLP_ComboTuDV.Controls[0];
                        if (cbo_DonVi.Text != "")
                            tu_don_vi[0] = Convert.ToInt16(cbo_DonVi.SelectedValue);
                        else
                        {
                            MessageBox.Show("Vui lòng chọn một đơn vị.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        bool result = quyetdinh.MA_Tach_DonVi(tu_don_vi, ten_don_vi_moi, ten_dv_viet_tat, dv_cha_id, tu_ngay, ghi_chu, ma_nv);
                        if (result == true)
                            MessageBox.Show("Nhập quyết định tách đơn vị thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        else
                            MessageBox.Show("Nhập quyết định tách đơn vị không thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Nhập quyết định tách đơn vị không thành công.\r\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    #endregion
                }
                else // gộp đơn vị
                {
                    #region Gộp đơn vị
                    try
                    {
                        int[] tu_don_vi_id = new int[tableLP_ComboTuDV.RowCount];
                        for (int i = 0; i < tableLP_ComboTuDV.RowCount; i++)
                        {
                            tu_don_vi_id[i] = Convert.ToInt16(((ComboBox)tableLP_ComboTuDV.Controls[i * 2]).SelectedValue);
                        }

                        DonVi dv = new DonVi();
                        dv = dsDonVi_new[0];

                        string ten_dv_moi = dv.TenDonVi;
                        string ten_dv_viet_tat = dv.TenDVVietTat;
                        int? dv_cha_id = dv.DVChaID;
                        //if (comb_DVTrucThuoc.Text != "")
                        //    dv_cha_id = Convert.ToInt16(comb_DVTrucThuoc.SelectedValue);
                        string tu_ngay = dv.TuNgay.Value.ToString("d", CultureInfo.CreateSpecificCulture("vi-VN"));
                        string ghi_chu = dv.GhiChu;

                        bool result = quyetdinh.MA_Gop_DonVi(tu_don_vi_id, ten_dv_moi, ten_dv_viet_tat, dv_cha_id, tu_ngay, ghi_chu);
                        if (result == true)
                            MessageBox.Show("Nhập quyết định gộp đơn vị thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        else
                            MessageBox.Show("Nhập quyết định gộp đơn vị không thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Nhập quyết định gộp đơn vị không thành công.\r\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    #endregion

                }
            }
            else
                MessageBox.Show("Vui lòng nhập đầy đủ thông tin.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }