Exemplo n.º 1
0
        private int TimDanhSachHoSoBienDongTruoc(int _MaHoSo)
        {
            int    kq    = 0;
            string query = " select MaHoSo from tblBienDong Where MaHoSoMoi =" + _MaHoSo.ToString();

            try
            {
                kq = Convert.ToInt32(cls.ExecuteQueryScalar(query));
            }
            catch (Exception ex)
            {
            }
            return(kq);
        }
Exemplo n.º 2
0
        private void btnTaoHoSoMoi_Click(object sender, EventArgs e)
        {
            try
            {
                if (MaBienDong == 0)
                {
                    MessageBox.Show("Cần chọn biến động trước");
                    return;
                }
                if (phanquyen.KiemTraQuyen(clsStatic.Username, 15) == false)
                {
                    MessageBox.Show("Tài khoản không có quyền thực hiện thao tác này.");
                    return;
                }
                string query = " select Max(MaBienDong) from tblBienDong where MaHoSo =" + MaHoSo.ToString();
                if (MaBienDong == Convert.ToInt32(cls.ExecuteQueryScalar(query)))
                {
                    query = " Select MaHoSoMoi from tblBienDong where MaHoSo =" + MaHoSo.ToString() + " and MaBienDong =" + MaBienDong.ToString();
                    if (cls.ExecuteQueryScalar(query) != "")
                    {
                        MessageBox.Show("Đã tạo hồ sơ mới rồi, Sai sót gì ở đây?!");
                        return;
                    }


                    if (MessageBox.Show("-) Khi tạo hồ sơ mới, tất cả thông tin từ hồ sơ hiện tại của bạn sẽ được copy sang hồ sơ mới và bạn sẽ chỉnh lý biến động trên hồ sơ mới. \n  " +
                                        "-) Hồ sơ hiện tại của bạn sẽ bị lưu thành hồ sơ cũ và không còn được sử dụng!", "Tạo hồ sơ mới?!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        int exe = cls.ExecuteSP("spSaoChepHoSo", new string[] { "@MaHoSo", "@MaBienDong" }, new string[] { MaHoSo.ToString(), MaBienDong.ToString() });
                        if (exe == 0)
                        {
                            MessageBox.Show("Copy hồ sơ Error!");
                        }

                        this.MaHoSo = exe;
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Phải là biến động sau cùng, bạn mới có thể tạo hồ sơ mới!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }