Example #1
0
        public QLNS_ChucVu_ChinhTri()
        {
            InitializeComponent();
            oChucVu_ChTri = new ChucVu_ChinhTri();

            //m_UC_Chinh_Tri = p_UC_Chinh_Tri;
        }
Example #2
0
        public QLNS_ChucVu_ChinhTri()
        {
            InitializeComponent();
            oChucVu_ChTri = new ChucVu_ChinhTri();

            //m_UC_Chinh_Tri = p_UC_Chinh_Tri;
        }
Example #3
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txt_Ten.Text))
            {
                oChucVu_ChTri     = new ChucVu_ChinhTri();
                oChucVu_ChTri.Ten = txt_Ten.Text.Trim();
                string loai_chinh_tri = comB_Loai.Text.Trim();
                switch (loai_chinh_tri)
                {
                case "Đoàn viên":
                    oChucVu_ChTri.LoaiChinhTri_ID = 1;
                    break;

                case "Đảng viên":
                    oChucVu_ChTri.LoaiChinhTri_ID = 2;
                    break;

                case "Dân quân tự vệ":
                    oChucVu_ChTri.LoaiChinhTri_ID = 3;
                    break;

                case "Công đoàn viên":
                    oChucVu_ChTri.LoaiChinhTri_ID = 4;
                    break;

                default:
                    break;
                }

                #region thao tac them

                if (bAddFlag)
                {
                    if (MessageBox.Show("Bạn thực sự muốn thêm chức vụ chính trị này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            if (oChucVu_ChTri.Add())
                            {
                                MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("Thao tác thêm thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }

                            QLNS.UCs.DanhMucThongTin.QLNS_ChinhTri.is_Modified_Ctri_CVu = true;
                            RefreshDataSource();
                            ResetInterface(true);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Thao tác thêm thất bại.\n" + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                #endregion
                #region thao tac sua
                else
                {
                    if (MessageBox.Show("Bạn thực sự muốn sửa chức vụ chính trị này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        oChucVu_ChTri.ID = Convert.ToInt16(dtgv_DSChucVuDonVi.CurrentRow.Cells["id"].Value.ToString());
                        try
                        {
                            if (oChucVu_ChTri.Update())
                            {
                                MessageBox.Show("Cập nhật thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("Thao tác sửa thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }

                            QLNS.UCs.DanhMucThongTin.QLNS_ChinhTri.is_Modified_Ctri_CVu = true;
                            RefreshDataSource();
                            ResetInterface(true);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Thao tác sửa thất bại.\n" + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                #endregion
            }
            else
            {
                MessageBox.Show("Tên chức vụ không được rỗng, xin vui lòng cung cấp đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        /// <summary>
        /// Refresh Data Source cho dtg sau moi lan thao tac
        /// </summary>
        private void RefreshDataSource()
        {
            Business.ChucVu_ChinhTri cv = new ChucVu_ChinhTri();
            dtChucVu_ChTri = cv.GetData();
            PrepareDataSource();

        }
Example #5
0
        private void btn_Luu_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txt_Ten.Text))
            {
                oChucVu_ChTri = new ChucVu_ChinhTri();
                oChucVu_ChTri.Ten = txt_Ten.Text.Trim();
                string loai_chinh_tri = comB_Loai.Text.Trim();
                switch (loai_chinh_tri)
                {
                    case "Đoàn viên":
                        oChucVu_ChTri.LoaiChinhTri_ID = 1;
                        break;
                    case "Đảng viên":
                        oChucVu_ChTri.LoaiChinhTri_ID = 2;
                        break;
                    case "Dân quân tự vệ":
                        oChucVu_ChTri.LoaiChinhTri_ID = 3;
                        break;
                    case "Công đoàn viên":
                        oChucVu_ChTri.LoaiChinhTri_ID = 4;
                        break;
                    default:
                        break;
                }

                #region thao tac them

                if (bAddFlag)
                {
                    if (MessageBox.Show("Bạn thực sự muốn thêm chức vụ chính trị này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        
                        try
                        {
                            if (oChucVu_ChTri.Add())
                            {
                                MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                                MessageBox.Show("Thao tác thêm thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);

                            QLNS.UCs.DanhMucThongTin.QLNS_ChinhTri.is_Modified_Ctri_CVu = true;
                            RefreshDataSource();
                            ResetInterface(true);

                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Thao tác thêm thất bại.\n" + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                #endregion
                #region thao tac sua
                else
                {
                    if (MessageBox.Show("Bạn thực sự muốn sửa chức vụ chính trị này ?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        oChucVu_ChTri.ID = Convert.ToInt16(dtgv_DSChucVuDonVi.CurrentRow.Cells["id"].Value.ToString());
                        try
                        {
                            if (oChucVu_ChTri.Update())
                            {
                                MessageBox.Show("Cập nhật thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                                MessageBox.Show("Thao tác sửa thất bại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);

                            QLNS.UCs.DanhMucThongTin.QLNS_ChinhTri.is_Modified_Ctri_CVu = true;
                            RefreshDataSource();
                            ResetInterface(true);

                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Thao tác sửa thất bại.\n" + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                    }

                }
                #endregion
            }
            else
                MessageBox.Show("Tên chức vụ không được rỗng, xin vui lòng cung cấp đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }