コード例 #1
0
        /// <summary>
        /// Delete Bảng
        /// </summary>
        public int Delete(Entities.KhachHang kh1)
        {
            int Trave = 0;

            try
            {
                kh  = new Constants.KhachHang();
                Sql = new Constants.Sql();
                string sql = Sql.DeleteKhachHang;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
                cmd.Parameters.Add(kh.KhachHangID, SqlDbType.Int).Value       = kh1.KhachHangID;
                Trave = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(Trave);
        }
コード例 #2
0
        public bool UpdateKH(Entities.KhachHang kh1)
        {
            bool Trave = false;

            try
            {
                Sql = new Constants.Sql();
                string sql = Sql.UpdateDuNoKH;
                conn = new Connection();
                kh   = new Constants.KhachHang();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
                cmd.Parameters.Add(kh.MaKH, SqlDbType.NVarChar, 20).Value     = kh1.MaKH;
                cmd.Parameters.Add(kh.DuNo, SqlDbType.Float).Value            = kh1.DuNo;
                int i = cmd.ExecuteNonQuery();
                if (i == 1)
                {
                    Trave = true;
                }
                else
                {
                    Trave = false;
                }
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(Trave);
        }
コード例 #3
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.KhachHang[] Select()
        {
            List <Entities.KhachHang> arr = null;

            try
            {
                kh  = new Constants.KhachHang();
                Sql = new Constants.Sql();
                string sql = Sql.SelectKhachHangsAll;
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr  = new List <Entities.KhachHang>();
                while (dr.Read())
                {
                    Entities.KhachHang khachhang = new Entities.KhachHang();
                    khachhang.KhachHangID = Convert.ToInt32(dr[kh.KhachHangID].ToString());
                    khachhang.MaKH        = dr[kh.MaKH].ToString();
                    khachhang.Ten         = dr[kh.Ten].ToString();
                    khachhang.DiaChi      = dr[kh.DiaChi].ToString();
                    khachhang.DienThoai   = dr[kh.DienThoai].ToString();
                    khachhang.Fax         = dr[kh.Fax].ToString();
                    khachhang.Email       = dr[kh.Email].ToString();
                    khachhang.MST         = dr[kh.MST].ToString();
                    khachhang.DuNo        = dr[kh.DuNo].ToString();
                    khachhang.HanMucTT    = dr[kh.HanMucTT].ToString();
                    khachhang.CongTy      = dr[kh.CongTy].ToString();
                    khachhang.NgaySinh    = Convert.ToDateTime(dr[kh.NgaySinh].ToString());
                    khachhang.MaVung      = Convert.ToInt32(dr[kh.MaVung].ToString());
                    khachhang.Mobi        = dr[kh.Mobi].ToString();
                    //khachhang.NgayThamGia = Convert.ToDateTime(dr[kh.Ngaythamgia].ToString());
                    //khachhang.GiaoDichCuoi = Convert.ToDateTime(dr[kh.Giaodichcuoi].ToString());
                    khachhang.NgungTheoDoi = Convert.ToBoolean(dr[kh.Ngungtheodoi].ToString());
                    khachhang.Website      = dr[kh.Website].ToString();
                    //khachhang.NgaySua = Convert.ToDateTime(dr[kh.Ngaysua].ToString());
                    khachhang.GhiChu  = dr[kh.GhiChu].ToString();
                    khachhang.Deleted = Convert.ToBoolean(dr[kh.Deleted].ToString());
                    arr.Add(khachhang);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }

            return(arr.ToArray());
        }
コード例 #4
0
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public KhachHang()
 {
     kh        = null;
     Sql       = null;
     conn      = null;
     cmd       = null;
     arr       = null;
     dr        = null;
     khachhang = null;
     cn        = null;
 }
コード例 #5
0
ファイル: KhachHang.cs プロジェクト: mrk29vn/vna-accounting
 /// <summary>
 /// khoi tao gia tri
 /// </summary>
 public KhachHang()
 {
     kh = null;
     Sql = null;
     conn = null;
     cmd = null;
     arr = null;
     dr = null;
     khachhang = null;
     cn = null;
 }
コード例 #6
0
        /// <summary>
        /// Insert Update Bảng
        /// </summary>
        public int InsertUpdate(Entities.KhachHang kh1)
        {
            int Trave = 0;

            try
            {
                Sql = new Constants.Sql();
                string sql = Sql.InsertUpdateKhachHang;
                conn = new Connection();
                kh   = new Constants.KhachHang();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value  = kh1.HanhDong;
                cmd.Parameters.Add(kh.KhachHangID, SqlDbType.Int).Value        = kh1.KhachHangID;
                cmd.Parameters.Add(kh.MaKH, SqlDbType.NVarChar, 20).Value      = kh1.MaKH;
                cmd.Parameters.Add(kh.Ten, SqlDbType.NVarChar, 200).Value      = kh1.Ten;
                cmd.Parameters.Add(kh.DiaChi, SqlDbType.NVarChar, 200).Value   = kh1.DiaChi;
                cmd.Parameters.Add(kh.DienThoai, SqlDbType.NVarChar, 20).Value = kh1.DienThoai;
                cmd.Parameters.Add(kh.Fax, SqlDbType.NVarChar, 20).Value       = kh1.Fax;
                cmd.Parameters.Add(kh.Email, SqlDbType.NVarChar, 50).Value     = kh1.Email;
                cmd.Parameters.Add(kh.MST, SqlDbType.NVarChar, 20).Value       = kh1.MST;
                cmd.Parameters.Add(kh.DuNo, SqlDbType.Float).Value             = kh1.DuNo;
                cmd.Parameters.Add(kh.HanMucTT, SqlDbType.Float).Value         = kh1.HanMucTT;
                cmd.Parameters.Add(kh.CongTy, SqlDbType.NVarChar, 200).Value   = kh1.CongTy;
                cmd.Parameters.Add(kh.NgaySinh, SqlDbType.DateTime).Value      = kh1.NgaySinh.ToShortDateString();
                cmd.Parameters.Add(kh.MaVung, SqlDbType.Int).Value             = kh1.MaVung;
                cmd.Parameters.Add(kh.Mobi, SqlDbType.NVarChar, 100).Value     = kh1.Mobi;
                //cmd.Parameters.Add(kh.Ngaythamgia, SqlDbType.DateTime).Value = kh1.NgayThamGia.ToShortDateString();
                //cmd.Parameters.Add(kh.Giaodichcuoi, SqlDbType.DateTime).Value = kh1.GiaoDichCuoi.ToShortDateString();
                cmd.Parameters.Add(kh.Ngungtheodoi, SqlDbType.Bit).Value      = kh1.NgungTheoDoi;
                cmd.Parameters.Add(kh.Website, SqlDbType.NVarChar, 200).Value = kh1.Website;
                //cmd.Parameters.Add(kh.Ngaysua, SqlDbType.DateTime).Value = kh1.NgaySua.ToShortDateString();
                cmd.Parameters.Add(kh.GhiChu, SqlDbType.NVarChar, 200).Value = kh1.GhiChu;
                cmd.Parameters.Add(kh.Deleted, SqlDbType.Bit).Value          = kh1.Deleted;
                Trave = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(Trave);
        }
コード例 #7
0
        /// <summary>
        /// GetKH
        /// </summary>
        /// <param name="maKH"></param>
        /// <returns></returns>
        public Entities.KhachHang GetKH(string maKH)
        {
            Entities.KhachHang retVal = null;
            try
            {
                Server_Client.Client cl = new Server_Client.Client();
                // gán TCPclient
                this.Client1 = cl.Connect(Luu.IP, Luu.Ports);
                // khởi tạo biến truyền vào với hàm khởi tạo
                Entities.KhachHang kh = new Entities.KhachHang("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.KhachHang[] kh1 = new Entities.KhachHang[1];
                Clientstrem = cl.SerializeObj(this.Client1, "KhachHang", kh);
                // đổ mảng đối tượng vào datagripview
                kh1 = (Entities.KhachHang[])cl.DeserializeHepper1(Clientstrem, kh1);
                foreach (Entities.KhachHang item in kh1)
                {
                    if (item.MaKH.Trim().ToUpper().Equals(maKH.Trim().ToUpper()))
                    {
                        retVal = item;
                        break;
                    }
                }
            }
            catch (Exception)
            {
                retVal = null;
            }

            return retVal;
        }
コード例 #8
0
        private void txtthegiamgia_KeyDown(object sender, KeyEventArgs e)
        {
            if (!string.IsNullOrEmpty(_str) && _str.Equals("Them"))
            {
                try
                {
                    if (e.KeyCode == Keys.Enter)
                    {
                        double tongTien = 0;
                        double giaTriThe = 0;
                        double giaTriTheGT = 0;
                        double khachPhaiTra = 0;
                        double khachTra = 0;
                        double duTra = 0;
                        string maThe = txtMaTheVip.Text.ToUpper();
                        txtMaTheVip.Text = maThe;
                        Entities.TheVip tv = LayGiaTriThe(maThe);
                        if (tv == null)
                        {
                            MessageBox.Show("Mã thẻ không tồn tại hoặc đã hết hạn sử dụng - Hãy kiểm tra lại", "Hệ thống cảnh báo");
                            txtMaTheVip.Text = string.Empty;
                            txtMaTheVip.Focus();
                            return;
                        }
                        else
                        {
                            loaithe = "TheVip";
                            txtGTTheVip.Text = new Common.Utilities().FormatMoney(double.Parse(tv.GiaTriConLai));
                            // lay khach hang theo maKH
                            Entities.KhachHang kh = new Entities.KhachHang();
                            kh = this.GetKH(tv.MaKhachHang);
                            // Gan thong tin cua KH
                            txtMakhachhang.Text = kh.MaKH.ToUpper();
                            lblTenKH.Text = kh.Ten;
                            txtkhachtra.Focus();
                            txtkhachtra.SelectAll();

                            if (!string.IsNullOrEmpty(txtTongtien.Text))
                                tongTien = double.Parse(txtTongtien.Text);

                            if (!string.IsNullOrEmpty(txtGTTheVip.Text))
                                giaTriThe = double.Parse(txtGTTheVip.Text);

                            if (!string.IsNullOrEmpty(txtGTTheGT.Text))
                                giaTriTheGT = double.Parse(txtGTTheGT.Text);

                            if (giaTriThe + giaTriTheGT > tongTien)
                            {
                                khachTra = 0;
                                duTra = 0;
                                khachPhaiTra = 0;
                            }
                            else
                            {
                                khachPhaiTra = tongTien - giaTriThe - giaTriTheGT;
                            }

                            txtkhachtra.Text = new Common.Utilities().FormatMoney(khachTra);
                            txtKhachPhaiTra.Text = new Common.Utilities().FormatMoney(khachPhaiTra);
                            txtkhachtra.Text = khachTra.ToString();
                            txtdutra.Text = duTra.ToString();
                        }
                    }
                }
                catch { }
            }
        }
コード例 #9
0
 private string LayTenKhachHang(string maKh)
 {
     try
     {
         cl = new Server_Client.Client();
         Client1 = cl.Connect(Luu.IP, Luu.Ports);
         Clientstrem = cl.SerializeObj(Client1, "KhachHang", new KhachHang("Select"));
         KhachHang[] khachhang = new KhachHang[1];
         khachhang = (KhachHang[])cl.DeserializeHepper1(Clientstrem, khachhang) ?? new KhachHang[0];
         foreach (KhachHang item in khachhang.Where(item => item.MaKH.ToUpper().Equals(maKh.ToUpper())))
             return item.Ten;
         return string.Empty;
     }
     catch { return string.Empty; }
 }
コード例 #10
0
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.KhachHang[] Select(string Cot, string Kieu, string Giatri)
        {
            Entities.KhachHang[] arrC = null;
            try
            {
                kh  = new Constants.KhachHang();
                Sql = new Constants.Sql();
                string sql = "";
                if (Kieu == "like")
                {
                    sql = "select * from KhachHang where " + Cot + " " + Kieu + " '%" + Giatri + "%'  and Deleted =0";
                }
                else
                {
                    sql = "select * from KhachHang where " + Cot + " " + Kieu + " '" + Giatri + "'  and Deleted =0";
                }
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);
                dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr  = new ArrayList();
                while (dr.Read())
                {
                    Entities.KhachHang khachhang = new Entities.KhachHang();
                    khachhang.KhachHangID  = Convert.ToInt32(dr[kh.KhachHangID].ToString());
                    khachhang.MaKH         = dr[kh.MaKH].ToString();
                    khachhang.Ten          = dr[kh.Ten].ToString();
                    khachhang.DiaChi       = dr[kh.DiaChi].ToString();
                    khachhang.DienThoai    = dr[kh.DienThoai].ToString();
                    khachhang.Fax          = dr[kh.Fax].ToString();
                    khachhang.Email        = dr[kh.Email].ToString();
                    khachhang.MST          = dr[kh.MST].ToString();
                    khachhang.DuNo         = dr[kh.DuNo].ToString();
                    khachhang.HanMucTT     = dr[kh.HanMucTT].ToString();
                    khachhang.CongTy       = dr[kh.CongTy].ToString();
                    khachhang.NgaySinh     = Convert.ToDateTime(dr[kh.NgaySinh].ToString());
                    khachhang.MaVung       = Convert.ToInt32(dr[kh.MaVung].ToString());
                    khachhang.Mobi         = dr[kh.Mobi].ToString();
                    khachhang.NgayThamGia  = Convert.ToDateTime(dr[kh.Ngaythamgia].ToString());
                    khachhang.GiaoDichCuoi = Convert.ToDateTime(dr[kh.Giaodichcuoi].ToString());
                    khachhang.NgungTheoDoi = Convert.ToBoolean(dr[kh.Ngungtheodoi].ToString());
                    khachhang.Website      = dr[kh.Website].ToString();
                    khachhang.NgaySua      = Convert.ToDateTime(dr[kh.Ngaysua].ToString());
                    khachhang.GhiChu       = dr[kh.GhiChu].ToString();
                    khachhang.Deleted      = Convert.ToBoolean(dr[kh.Deleted].ToString());
                    arr.Add(khachhang);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                arrC = new Entities.KhachHang[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.KhachHang)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
コード例 #11
0
ファイル: KhachHang.cs プロジェクト: mrk29vn/vna-accounting
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.KhachHang[] Select(string Cot, string Kieu, string Giatri)
        {
            Entities.KhachHang[] arrC = null;
            try
            {
                kh = new Constants.KhachHang();
                Sql = new Constants.Sql();
                string sql = "";
                if (Kieu == "like")
                    sql = "select * from KhachHang where " + Cot + " " + Kieu + " '%" + Giatri + "%'  and Deleted =0";
                else
                    sql = "select * from KhachHang where " + Cot + " " + Kieu + " '" + Giatri + "'  and Deleted =0";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    Entities.KhachHang khachhang = new Entities.KhachHang();
                    khachhang.KhachHangID = Convert.ToInt32(dr[kh.KhachHangID].ToString());
                    khachhang.MaKH = dr[kh.MaKH].ToString();
                    khachhang.Ten = dr[kh.Ten].ToString();
                    khachhang.DiaChi = dr[kh.DiaChi].ToString();
                    khachhang.DienThoai = dr[kh.DienThoai].ToString();
                    khachhang.Fax = dr[kh.Fax].ToString();
                    khachhang.Email = dr[kh.Email].ToString();
                    khachhang.MST = dr[kh.MST].ToString();
                    khachhang.DuNo = dr[kh.DuNo].ToString();
                    khachhang.HanMucTT = dr[kh.HanMucTT].ToString();
                    khachhang.CongTy = dr[kh.CongTy].ToString();
                    khachhang.NgaySinh = Convert.ToDateTime(dr[kh.NgaySinh].ToString());
                    khachhang.MaVung = Convert.ToInt32(dr[kh.MaVung].ToString());
                    khachhang.Mobi = dr[kh.Mobi].ToString();
                    khachhang.NgayThamGia = Convert.ToDateTime(dr[kh.Ngaythamgia].ToString());
                    khachhang.GiaoDichCuoi = Convert.ToDateTime(dr[kh.Giaodichcuoi].ToString());
                    khachhang.NgungTheoDoi = Convert.ToBoolean(dr[kh.Ngungtheodoi].ToString());
                    khachhang.Website = dr[kh.Website].ToString();
                    khachhang.NgaySua = Convert.ToDateTime(dr[kh.Ngaysua].ToString());
                    khachhang.GhiChu = dr[kh.GhiChu].ToString();
                    khachhang.Deleted = Convert.ToBoolean(dr[kh.Deleted].ToString());
                    arr.Add(khachhang);
                }
                int n = arr.Count;
                if (n == 0) { return null; }
                arrC = new Entities.KhachHang[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.KhachHang)arr[i];
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }
コード例 #12
0
ファイル: KhachHang.cs プロジェクト: mrk29vn/vna-accounting
        /// <summary>
        /// Select Bảng
        /// </summary>
        /// <returns></returns>
        public Entities.KhachHang[] Select()
        {
            List<Entities.KhachHang> arr = null;
            try
            {
                kh = new Constants.KhachHang();
                Sql = new Constants.Sql();
                string sql = Sql.SelectKhachHangsAll;
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new List<Entities.KhachHang>();
                while (dr.Read())
                {
                    Entities.KhachHang khachhang = new Entities.KhachHang();
                    khachhang.KhachHangID = Convert.ToInt32(dr[kh.KhachHangID].ToString());
                    khachhang.MaKH = dr[kh.MaKH].ToString();
                    khachhang.Ten = dr[kh.Ten].ToString();
                    khachhang.DiaChi = dr[kh.DiaChi].ToString();
                    khachhang.DienThoai = dr[kh.DienThoai].ToString();
                    khachhang.Fax = dr[kh.Fax].ToString();
                    khachhang.Email = dr[kh.Email].ToString();
                    khachhang.MST = dr[kh.MST].ToString();
                    khachhang.DuNo = dr[kh.DuNo].ToString();
                    khachhang.HanMucTT = dr[kh.HanMucTT].ToString();
                    khachhang.CongTy = dr[kh.CongTy].ToString();
                    khachhang.NgaySinh = Convert.ToDateTime(dr[kh.NgaySinh].ToString());
                    khachhang.MaVung = Convert.ToInt32(dr[kh.MaVung].ToString());
                    khachhang.Mobi = dr[kh.Mobi].ToString();
                    //khachhang.NgayThamGia = Convert.ToDateTime(dr[kh.Ngaythamgia].ToString());
                    //khachhang.GiaoDichCuoi = Convert.ToDateTime(dr[kh.Giaodichcuoi].ToString());
                    khachhang.NgungTheoDoi = Convert.ToBoolean(dr[kh.Ngungtheodoi].ToString());
                    khachhang.Website = dr[kh.Website].ToString();
                    //khachhang.NgaySua = Convert.ToDateTime(dr[kh.Ngaysua].ToString());
                    khachhang.GhiChu = dr[kh.GhiChu].ToString();
                    khachhang.Deleted = Convert.ToBoolean(dr[kh.Deleted].ToString());
                    arr.Add(khachhang);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return null;
                }
            }

            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }

            return arr.ToArray();
        }
コード例 #13
0
        /// <summary>
        /// Lay Thong tin cua khach hang .
        /// </summary>
        /// <param name="maKhachHang"></param>
        /// <returns></returns>
        private KhachHang GetThongTinKhachHang(string maKhachHang)
        {
            Entities.KhachHang khachHang = new Entities.KhachHang();
            try
            {

                cl = new Server_Client.Client();
                // gán TCPclient
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                // khởi tạo biến truyền vào với hàm khởi tạo
                khachHang = new Entities.KhachHang("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.KhachHang[] khArr = new Entities.KhachHang[1];
                clientstrem = cl.SerializeObj(this.client1, "KhachHang", khachHang);
                // đổ mảng đối tượng vào datagripview
                khArr = (Entities.KhachHang[])cl.DeserializeHepper1(clientstrem, khArr);
                foreach (Entities.KhachHang item in khArr)
                {
                    if (item.MaKH.Equals(maKhachHang))
                    {
                        khachHang = item;
                        break;
                    }
                }
            }
            catch (Exception)
            {
                khachHang = null;
            }
            return khachHang;
        }
コード例 #14
0
        public frmBaoCaorpt(string hanhDong)
        {
            try
            {
                InitializeComponent();
                switch (hanhDong)
                {
                    case "Test":
                        {
                            Entities.KhachHang[] kh1 = new Entities.KhachHang[0];
                            GUI.Report.rptBCCongNoKhachHang report = new GUI.Report.rptBCCongNoKhachHang();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Công Nợ Khách Hàng");
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }
                    case "KhachHang":
                        {
                            CongTy();
                            cl = new Server_Client.Client();
                            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                            Entities.KhachHang kh = new Entities.KhachHang("Select");
                            Entities.KhachHang[] kh1 = new Entities.KhachHang[1];
                            clientstrem = cl.SerializeObj(this.client1, "KhachHang", kh);
                            kh1 = (Entities.KhachHang[])cl.DeserializeHepper1(clientstrem, kh1);
                            if (kh1 == null)
                            {
                                MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
                                return;
                            }
                            GUI.Report.rptBCCongNoKhachHang report = new GUI.Report.rptBCCongNoKhachHang();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Công Nợ Khách Hàng");
                            report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }
                    case "ChiTietHangHoa":
                        {
                            CongTy();
                            cl = new Server_Client.Client();
                            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                            Entities.rptBCChiTietHangHoa kh = new Entities.rptBCChiTietHangHoa("Select");
                            Entities.rptBCChiTietHangHoa[] kh1 = new Entities.rptBCChiTietHangHoa[1];
                            clientstrem = cl.SerializeObj(this.client1, "BCChiTietHangHoa", kh);
                            kh1 = (Entities.rptBCChiTietHangHoa[])cl.DeserializeHepper1(clientstrem, kh1);
                            if (kh1 == null)
                            {
                                MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
                                return;
                            }
                            GUI.Report.rptBCChiTietHangHoa report = new GUI.Report.rptBCChiTietHangHoa();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Chi Tiết Hàng Hóa");
                            report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }
                    case "NCC":
                        {
                            CongTy();
                            cl = new Server_Client.Client();
                            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                            Entities.NhaCungCap kh = new Entities.NhaCungCap("Select");
                            Entities.NhaCungCap[] kh1 = new Entities.NhaCungCap[1];
                            clientstrem = cl.SerializeObj(this.client1, "NhaCungCap", kh);
                            kh1 = (Entities.NhaCungCap[])cl.DeserializeHepper1(clientstrem, kh1);
                            if (kh1 == null)
                            {
                                MessageBox.Show("Không có dữ liệu", "Hệ thống cảnh báo");
                                return;
                            }
                            GUI.Report.rptBCCongNoNCC report = new GUI.Report.rptBCCongNoNCC();
                            report.SetDataSource(kh1);
                            crvReport.ReportSource = report;
                            report.SetParameterValue("TenCongTy", CT.TenCongTy);
                            report.SetParameterValue("DiaChiCongTy", CT.DiaChi);
                            report.SetParameterValue("DienThoai", CT.SoDienThoai);
                            report.SetParameterValue("FaxCongTy", CT.Fax);
                            report.SetParameterValue("Web", CT.Website);
                            report.SetParameterValue("TenBaoCao", "Báo Cáo Công Nợ Nhà Cung Cấp");
                            report.SetParameterValue("NgayTao", new Common.Utilities().XuLy(2, DateServer.Date().ToShortDateString()));
                            report.SetParameterValue("MaNhanVien", Common.Utilities.User.TenNhanVien);
                            report.SetParameterValue("Email", CT.Email);
                            crvReport.Show();
                            break;
                        }

                    default: break;
                }
            }
            catch
            {
            }
        }