Пример #1
0
        public void hienthi()
        {
            Server_Client.Client cl = new Server_Client.Client();
            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            ntkkt        = new NhomTKKeToan("Select");
            clientstrem  = cl.SerializeObj(this.client1, "NhomTKKeToan", ntkkt);

            NhomTKKeToan[] pb1 = new NhomTKKeToan[1];
            pb1[0] = new NhomTKKeToan(1, "a", "a", "a", false);
            pb1    = (NhomTKKeToan[])cl.DeserializeHepper1(clientstrem, pb1);


            if (pb1 == null)
            {
                toolStripStatus_Sua.Enabled = false;
                toolStripStatus_Xoa.Enabled = false;
                Entities.NhomTKKeToan [] nhomtk = new NhomTKKeToan [0];
                NhomTKKT_Search          = nhomtk;
                dataGridView1.DataSource = nhomtk;
                FixDataGridView();
            }
            else
            {
                toolStripStatus_Sua.Enabled = true;
                toolStripStatus_Xoa.Enabled = true;
                NhomTKKT_Search             = pb1;
                dataGridView1.DataSource    = pb1;
                FixDataGridView();
            }
        }
Пример #2
0
        private void tsslThem_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                CheckConflictInsert();
                if (kt == "ok")
                {
                    Server_Client.Client cl = new Server_Client.Client();
                    this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                    NhomTKKeToan      ntk  = (NhomTKKeToan)cbbNhomTK.SelectedItem;
                    Entities.TKKeToan tkkt = new Entities.TKKeToan("Insert", 1, txtmatkkt.Text, txttentkkt.Text, ntk.MaNhomTKKeToan, txtghichu.Text, false, Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
                    clientstream = cl.SerializeObj(this.client1, "TKKeToan", tkkt);

                    int msg = 0;
                    msg = (int)cl.DeserializeHepper(clientstream, msg);
                    if (msg == 1)
                    {
                        txttentkkt.Text = "";
                        txtmatkkt.Text  = "";
                        txtghichu.Text  = "";
                        cbbNhomTK.Text  = "";
                        frmQuanLyTaiKhoanKeToan.KiemTra = "insert";
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Insert that bai");
                    }
                }
            }
        }
Пример #3
0
        private void toolStripStatus_Xoa_Click(object sender, EventArgs e)
        {
            if (!frmDangNhap.User.Administrator && !CheckQuyen(this.Name, 3))
            {
                MessageBox.Show("Bạn Không có quyền vào chức năng này.");
                return;
            }
            DialogResult dlgResult = MessageBox.Show("Bạn Có Chắc Chắn muốn Xóa không?", "Đồng ý?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlgResult == DialogResult.Yes)
            {
                try
                {
                    bool   ktdelete  = false;
                    int    idcurent  = int.Parse(dataGridView1.CurrentRow.Cells["NhomTKKeToanID"].Value.ToString());
                    string maCurrent = dataGridView1.CurrentRow.Cells["MaNhomTKKeToan"].Value.ToString();
                    hienthi();
                    for (int j = 0; j < NhomTKKT_Search.Length; j++)
                    {
                        if (NhomTKKT_Search[j].Delete == false)
                        {
                            if (NhomTKKT_Search[j].NhomTKKeToanID == idcurent)
                            {
                                ktdelete = true;
                                break;
                            }
                        }
                    }
                    if (ktdelete == true)
                    {
                        try
                        {
                            if (new Check().CheckReference("NhomTKKeToan", maCurrent))
                            {
                                Server_Client.Client cl = new Server_Client.Client();
                                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                                Entities.NhomTKKeToan nv = new NhomTKKeToan("Delete", idcurent, maCurrent, "", "", false, Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
                                clientstrem = cl.SerializeObj(this.client1, "NhomTKKeToan", nv);
                                //  MessageBox.Show("Xoa Thanh Cong...");
                            }
                            else
                            {
                                MessageBox.Show("Nhóm TK kế toán này hiện đang có giao dịch - Không thể xóa", "Hệ thống cảnh báo");
                            }
                        }
                        catch { }
                    }
                    hienthi();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Lỗi Hệ Thống- Liên Hệ nhà Quản Trị");
                }
            }
        }
Пример #4
0
        public void ShowCombobox()
        {
            Server_Client.Client cl = new Server_Client.Client();
            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            ntkkt        = new NhomTKKeToan("Select");
            clientstream = cl.SerializeObj(this.client1, "NhomTKKeToan", ntkkt);

            NhomTKKeToan[] tk = new NhomTKKeToan[1];
            tk[0] = new NhomTKKeToan(1, "a", "a", "a", false);
            tk    = (NhomTKKeToan[])cl.DeserializeHepper1(clientstream, tk);

            cbbNhomTK.DataSource    = tk;
            cbbNhomTK.DisplayMember = "TenNhomTKKeToan";
        }
Пример #5
0
        private void tsslSua_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                CheckConflictUpdate();
                if (kt == "ok")
                {
                    Server_Client.Client cl = new Server_Client.Client();
                    this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                    NhomTKKeToan      ntk   = (NhomTKKeToan)cbbNhomTK.SelectedItem;
                    Entities.TKKeToan tkkt1 = new Entities.TKKeToan("Update", Convert.ToInt32(txtID.Text), txtmatkkt.Text.Trim(), txttentkkt.Text.Trim(), ntk.MaNhomTKKeToan.Trim(), txtghichu.Text.Trim(), false, Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
                    clientstream = cl.SerializeObj(this.client1, "TKKeToan", tkkt1);

                    int msg = 0;
                    try
                    {
                        msg = (int)cl.DeserializeHepper(clientstream, msg);
                    }
                    catch { }
                    if (msg == 1)
                    {
                        //  MessageBox.Show("Update thanh cong ...");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Cập nhật thất bại!\r\nvui lòng kiểm tra lại đường truyền tới server hoặc tài khoản kế toán đang được sử dụng không thể sửa hoặc xóa!");
                    }
                    tentk  = txttentkkt.Text;
                    ghichu = txtghichu.Text;
                }
                else
                if (kt == "null")
                {
                    MessageBox.Show("Bản Ghi đã bị xóa trước khi cập nhật! Vui lòng thao tác lại !");
                    this.Close();
                }
            }
        }
Пример #6
0
        public void hienthi()
        {
            Server_Client.Client cl = new Server_Client.Client();
            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            ntkkt = new NhomTKKeToan("Select", 1, "a", "a", "a", false);
            clientstream = cl.SerializeObj(this.client1, "NhomTKKeToan", ntkkt);

            NhomTKKeToan[] tk1 = new NhomTKKeToan[1];
            tk1[0] = new NhomTKKeToan(1, "a", "a", "a", false);
            tk1 = (NhomTKKeToan[])cl.DeserializeHepper1(clientstream, tk1);

            foreach (NhomTKKeToan objtk in tk1)
            {
                if (objtk.MaNhomTKKeToan == maNhomTKKeToan)
                {
                    txtID.Text = objtk.NhomTKKeToanID.ToString();
                    txtmaNTKKT.Text = objtk.MaNhomTKKeToan;
                    txttenNTKKT.Text = objtk.TenNhomTKKeToan;
                    txtghichu.Text = objtk.GhiChu;
                }
            }
        }
Пример #7
0
        public void hienthi()
        {
            Server_Client.Client cl = new Server_Client.Client();
            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            ntkkt        = new NhomTKKeToan("Select", 1, "a", "a", "a", false);
            clientstream = cl.SerializeObj(this.client1, "NhomTKKeToan", ntkkt);

            NhomTKKeToan[] tk1 = new NhomTKKeToan[1];
            tk1[0] = new NhomTKKeToan(1, "a", "a", "a", false);
            tk1    = (NhomTKKeToan[])cl.DeserializeHepper1(clientstream, tk1);

            foreach (NhomTKKeToan objtk in tk1)
            {
                if (objtk.MaNhomTKKeToan == maNhomTKKeToan)
                {
                    txtID.Text       = objtk.NhomTKKeToanID.ToString();
                    txtmaNTKKT.Text  = objtk.MaNhomTKKeToan;
                    txttenNTKKT.Text = objtk.TenNhomTKKeToan;
                    txtghichu.Text   = objtk.GhiChu;
                }
            }
        }
Пример #8
0
        private void txtTimKiem_TextChanged(object sender, EventArgs e)
        {
            if (rdbTen.Checked == true)
            {
                if (NhomTKKT_Search == null)
                {
                    NhomTKKeToan[] pb = new NhomTKKeToan[0];
                    dataGridView1.DataSource = pb;
                    FixDataGridView();
                    toolStripStatus_Sua.Enabled = false;
                    toolStripStatus_Xoa.Enabled = false;
                }
                else
                if (NhomTKKT_Search != null)
                {
                    if (txtTimKiem.Text.Length == 0)
                    {
                        NhomTKKeToan[] pb = new NhomTKKeToan[0];
                        dataGridView1.DataSource = pb;
                        FixDataGridView();
                        toolStripStatus_Sua.Enabled = false;
                        toolStripStatus_Xoa.Enabled = false;
                    }
                    else
                    {
                        int TKKT1_search_count = 0;

                        for (int i = 0; i < NhomTKKT_Search.Length; i++)
                        {
                            int index = -1;
                            index = NhomTKKT_Search[i].TenNhomTKKeToan.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                TKKT1_search_count++;
                            }
                        }
                        NhomTKKeToan[] TKKT1_search = new NhomTKKeToan[TKKT1_search_count];
                        TKKT1_search_count = 0;

                        for (int i = 0; i < NhomTKKT_Search.Length; i++)
                        {
                            int index = -1;
                            index = NhomTKKT_Search[i].TenNhomTKKeToan.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                TKKT1_search[TKKT1_search_count] = NhomTKKT_Search[i];
                                TKKT1_search_count++;
                            }
                        }
                        if (TKKT1_search_count == 0)
                        {
                            toolStripStatus_Sua.Enabled = false;
                            toolStripStatus_Xoa.Enabled = false;
                        }
                        else
                        {
                            toolStripStatus_Sua.Enabled = true;
                            toolStripStatus_Xoa.Enabled = true;
                        }
                        dataGridView1.DataSource = TKKT1_search;
                        FixDataGridView();
                    }
                }
            }
            else
            if (rdbMa.Checked == true)
            {
                if (NhomTKKT_Search == null)
                {
                    NhomTKKeToan[] pb = new NhomTKKeToan[0];
                    dataGridView1.DataSource = pb;
                    FixDataGridView();
                    toolStripStatus_Sua.Enabled = false;
                    toolStripStatus_Xoa.Enabled = false;
                }
                else
                if (NhomTKKT_Search != null)
                {
                    if (txtTimKiem.Text.Length == 0)
                    {
                        NhomTKKeToan[] pb = new NhomTKKeToan[0];
                        dataGridView1.DataSource = pb;
                        FixDataGridView();
                        toolStripStatus_Sua.Enabled = false;
                        toolStripStatus_Xoa.Enabled = false;
                    }
                    else
                    {
                        int NV1_Search_count = 0;

                        for (int i = 0; i < NhomTKKT_Search.Length; i++)
                        {
                            int index = -1;
                            index = NhomTKKT_Search[i].MaNhomTKKeToan.ToLower().IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                NV1_Search_count++;
                            }
                        }
                        NhomTKKeToan[] NV1_search = new NhomTKKeToan[NV1_Search_count];
                        NV1_Search_count = 0;

                        for (int i = 0; i < NhomTKKT_Search.Length; i++)
                        {
                            int index = -1;
                            index = NhomTKKT_Search[i].MaNhomTKKeToan.IndexOf(txtTimKiem.Text.Trim().ToLower());
                            if (index >= 0)
                            {
                                NV1_search[NV1_Search_count] = NhomTKKT_Search[i];
                                NV1_Search_count++;
                            }
                        }
                        if (NV1_Search_count == 0)
                        {
                            toolStripStatus_Sua.Enabled = false;
                            toolStripStatus_Xoa.Enabled = false;
                        }
                        else
                        {
                            toolStripStatus_Sua.Enabled = true;
                            toolStripStatus_Xoa.Enabled = true;
                        }
                        dataGridView1.DataSource = NV1_search;
                        FixDataGridView();
                    }
                }
            }
        }