Esempio n. 1
0
        public static DataTable Xemnl()
        {
            string query = "SELECT B.MANL AS MaNguyenLieu ,B.TENNL as TenNguyenLieu,A.MAMON AS Ma FROM TPMONAN A INNER JOIN NGUYENLIEU B ON A.MANL=B.MANL";


            return(Dataprovider.ExcuteQuery(query));
        }
Esempio n. 2
0
        public static List <LoaiHangHoa> XemLoaiMon(int loai)
        {
            string query = "EXEC uspXemLoaiHangHoa @loai";

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@loai", SqlDbType.Int)
                {
                    IsNullable = false, Value = loai
                }
            };
            List <LoaiHangHoa> list = null;

            try
            {
                DataTable table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new LoaiHangHoa()
                {
                    Ma  = x[0].ToString(),
                    Ten = x[1].ToString()
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }
Esempio n. 3
0
        public static List <GoiMonDataSource> XemChiTietHoaDon(string soHoaDon)
        {
            string query = "EXEC uspXemChiTietHoaDon @soHoaDon";

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@soHoaDon", SqlDbType.VarChar)
                {
                    Value = soHoaDon
                }
            };
            List <GoiMonDataSource> list = null;

            try
            {
                DataTable table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new GoiMonDataSource()
                {
                    Ma        = x[0].ToString(),
                    Ten       = x[1].ToString(),
                    Soluong   = x[2].ToString(),
                    Loai      = x[3].ToString(),
                    Gia       = x[4].ToString(),
                    Thanhtien = (int.Parse(x[2].ToString()) * int.Parse(x[4].ToString())).ToString()
                }
                                                                );
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }
Esempio n. 4
0
        public static DataTable XemHangHoa()
        {
            string query = "SELECT MAMON AS Ma,TENMON AS Ten FROM MONAN";


            return(Dataprovider.ExcuteQuery(query));
        }
Esempio n. 5
0
        public static List <ThietBiDataSource> XemChiTietSuDungThietBi(string maSuDung)
        {
            string query = "EXEC uspXemChiTietSuDungThietBi @maSuDung";



            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@maSuDung", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = maSuDung
                },
            };
            List <ThietBiDataSource> list = null;

            try
            {
                list = Dataprovider.ExcuteQuery(query, parameters.ToArray()).AsEnumerable().ToList().ConvertAll(x =>
                                                                                                                new ThietBiDataSource()
                {
                    MaThietBi     = x[0].ToString(),
                    TenThietBi    = x[1].ToString(),
                    SoLuong       = x[3].ToString(),
                    DonGia        = x[2].ToString(),
                    TenNhaCungCap = x[4].ToString(),
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(list);
        }
Esempio n. 6
0
        public static List <HangHoaDataSource> XemChiTietPhieuNhapSanPham(string soPhieuDat)
        {
            string query = "EXEC uspXemChiTietPhieuNhapSanPham @soPhieuDat";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@soPhieuDat", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = soPhieuDat
                },
            };
            List <HangHoaDataSource> list = null;

            try
            {
                list = Dataprovider.ExcuteQuery(query, parameters.ToArray()).AsEnumerable().ToList().ConvertAll(x =>
                                                                                                                new HangHoaDataSource()
                {
                    Ma             = x[1].ToString(),
                    Ten            = x[2].ToString(),
                    Loai           = x[3].ToString(),
                    DonViTinh      = x[4].ToString(),
                    Gia            = x[5].ToString(),
                    Soluong        = x[6].ToString(),
                    Thanhtien      = x[7].ToString(),
                    MaLoaiHangHoa  = x[3].ToString(),
                    TenLoaiHangHoa = x[8].ToString(),
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(list);
        }
Esempio n. 7
0
        public static DataTable XemLichSuPhong(int pageNumber, int pageSize)
        {
            string query = "EXEC uspXemLichSuDatPhong @pageNumber,@pageSize";

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    Value = pageSize
                },
            };
            DataTable table = null;

            try
            {
                table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(table);
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static List <KhachHang> LoadHanhKhach()
        {
            string query = "select * from khachhang";

            DataTable table = Dataprovider.ExcuteQuery(query);

            //Chuyển Table thành List tên hành khách
            return(table.AsEnumerable().ToList().ConvertAll(x =>
                                                            new KhachHang()
            {
                Ten = x[0].ToString(), SoDT = x[1].ToString(), Address = x[2].ToString(), Ma = x[2].ToString()
            }));
        }
Esempio n. 9
0
        public static List <HangHoa> XemSanPham(string nhaCungCap, int loai, int pageNumber, int pageSize)
        {
            string query = "EXEC uspXemSanPham @nhaCungCap,@loai,'',@pageNumber,@pageSize";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@nhaCungCap", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = nhaCungCap
                },
                new SqlParameter("@loai", SqlDbType.Int)
                {
                    IsNullable = false, Value = loai
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageSize
                },
            };
            List <HangHoa> list = new List <HangHoa>();

            try
            {
                DataTable table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new HangHoa()
                {
                    Ma          = x[0].ToString(),
                    Ten         = x[1].ToString(),
                    Loai        = loai.ToString(),
                    Gia         = uint.Parse(x[4].ToString()),
                    TenHinhAnh  = x[5].ToString(),
                    DonViTinh   = x[3].ToString(),
                    LoaiHangHoa = new LoaiHangHoa()
                    {
                        Ma = x[2].ToString(), Ten = x[6].ToString()
                    },
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }
Esempio n. 10
0
        public static DataTable LoadLoaiKH()
        {
            string    query = "EXEC usp_LoadLoaiKH";
            DataTable data  = new DataTable();

            try
            {
                data = Dataprovider.ExcuteQuery(query);
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(data);
        }
Esempio n. 11
0
        public static DataTable LayMaNCC()
        {
            DataTable data = new DataTable();

            try
            {
                string query = "EXEC usp_LoadNCC";
                data = Dataprovider.ExcuteQuery(query);
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(data);
        }
Esempio n. 12
0
        public static DataTable XemTonKho(DateTime ngayBatDau, DateTime ngayKetThuc)
        {
            string query = "EXEC uspXemTonKho @ngayBatDau,@ngayKetThuc";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@ngayBatDau", SqlDbType.DateTime)
                {
                    IsNullable = false, Value = ngayBatDau
                },
                new SqlParameter("@ngayKetThuc", SqlDbType.DateTime)
                {
                    IsNullable = false, Value = ngayKetThuc
                },
            };

            return(Dataprovider.ExcuteQuery(query, parameters.ToArray()));
        }
Esempio n. 13
0
        public static List <PhieuNhapHang> XemPhieuNhapHang(int loai, int pageNumber, int pageSize)
        {
            string query = "EXEC uspXemPhieuNhapThietBi @loai,@pageNumber,@pageSize";

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@loai", SqlDbType.Int)
                {
                    IsNullable = false, Value = loai
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageSize
                }
            };
            DataTable            table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            List <PhieuNhapHang> list  = null;


            try
            {
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new PhieuNhapHang()
                {
                    SoPhieu       = x[0].ToString(),
                    MaNhanVien    = x[1].ToString(),
                    NgayDat       = x[2].ToString(),
                    NgayGiao      = x[3].ToString(),
                    ThanhTien     = uint.Parse(x[4].ToString()),
                    NguoiGiao     = x[5].ToString(),
                    TenNhanVien   = x[6].ToString(),
                    SoDienThoai   = x[7].ToString(),
                    TenNhaCungCap = x[8].ToString(),
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            //Chuyển Table thành List tên hành khách
            return(list);
        }
Esempio n. 14
0
        public static List <ThietBi> XemThietBi(string tenThietBi, string maNhaCungCap, int pageNumber, int pageSize)
        {
            string query = "EXEC usp_LoadThietBi @tenThietBi,@maNhaCungCap,@pageNumber,@pageSize";

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@tenThietBi", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = tenThietBi
                },
                new SqlParameter("@maNhaCungCap", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = maNhaCungCap
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageSize
                },
            };
            DataTable      data = new DataTable();
            List <ThietBi> list = null;

            try
            {
                list = Dataprovider.ExcuteQuery(query, parameters.ToArray()).AsEnumerable().ToList().ConvertAll(x =>
                                                                                                                new ThietBi()
                {
                    Ma            = x[5].ToString(),
                    Ten           = x[0].ToString(),
                    DonGia        = x[2].ToString(),
                    DVT           = x[1].ToString(),
                    MaNCC         = x[4].ToString(),
                    TenNhaCungCap = x[3].ToString(),
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(list);
        }
Esempio n. 15
0
        public static DataTable XemLoaiPhong()
        {
            string query = "SELECT * FROM LOAIPHONG";


            DataTable table = null;

            try
            {
                table = Dataprovider.ExcuteQuery(query);
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(table);
        }
Esempio n. 16
0
        public static List <PhieuDatTiec> XemPhieuDatCho(string maPhong, int pageNumber, int pageSize)
        {
            string query = "EXEC uspXemPhieuDatCho @maPhong,@pageNumber,@pageSize";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@maPhong", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = maPhong
                },
                new SqlParameter("@pageNumber", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = pageSize
                }
            };
            List <PhieuDatTiec> list = new List <PhieuDatTiec>();

            try
            {
                DataTable table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new PhieuDatTiec()
                {
                    SoHD        = x[0].ToString(),
                    Phong       = x[1].ToString(),
                    TenKH       = x[2].ToString(),
                    SoDienThoai = x[3].ToString(),
                    NgayDat     = x[4].ToString(),
                    NgayNhan    = x[5].ToString(),
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }
Esempio n. 17
0
        public static List <KhuyenMai> XemKhuyenMai(string tenKhuyenMai, int loaiKhachHang, int pageNumber, int pageSize)
        {
            string query = "EXEC uspXemKhuyenMai @tenKhuyenMai,@loaiKhachHang,@pageNumber,@pageSize";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@tenKhuyenMai", SqlDbType.NVarChar)
                {
                    Value = tenKhuyenMai
                },
                new SqlParameter("@loaiKhachHang", SqlDbType.Int)
                {
                    Value = loaiKhachHang
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    Value = pageSize
                }
            };
            List <KhuyenMai> list = new List <KhuyenMai>();

            try
            {
                DataTable table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new KhuyenMai()
                {
                    MaKhuyenMai  = x[0].ToString(),
                    TenKhuyenMai = x[1].ToString(),
                    NgayBatDau   = (DateTime)x[2],
                    NgayKetThuc  = (DateTime)x[3],
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }
Esempio n. 18
0
        public static List <Phong> XemPhong(int trangThai, int pageSize, int pageNumber)
        {
            string query = "EXEC uspTraCuuPhong @trangThai,@pageSize,@pageNumber";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@trangThai", SqlDbType.Int)
                {
                    Value = trangThai
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    Value = pageSize
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    Value = pageNumber
                }
            };
            List <Phong> list = new List <Phong>();

            try
            {
                DataTable table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new Phong()
                {
                    Ten          = x[0].ToString(),
                    TenLoai      = x[1].ToString(),
                    Gia          = uint.Parse(x[2].ToString()),
                    TinhTrang    = int.Parse(x[3].ToString()),
                    GetKhachHang = new KhachHang()
                    {
                        Ma = x[4].ToString(), Ten = x[5].ToString(), SoDT = x[6].ToString()
                    }
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }
Esempio n. 19
0
        public static string TaoHoaDon()
        {
            string    query = "select macuoi,soma,tiento from taoma where id=3";
            DataTable table = Dataprovider.ExcuteQuery(query);
            DataRow   row   = table.Rows[0];

            int    maCuoi = int.Parse(row["macuoi"].ToString()) + 1;
            int    soMa   = int.Parse(row["soma"].ToString());
            string tienTo = row["tiento"].ToString();
            string maMoi  = tienTo + maCuoi.ToString().PadLeft(soMa, '0');

            query = "update taoma set macuoi=macuoi+1 where id=3";
            int num = Dataprovider.ExcuteNonQuery(query);

            if (num == 0)
            {
                maMoi = "";
            }
            return(maMoi);
        }
Esempio n. 20
0
        //public static void Nhap

        public static List <KhachHang> LoadCustomerWithType(string type)
        {
            string query = "EXEC usp_LoadHanhKhach @type";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@type", SqlDbType.NVarChar)
                {
                    IsNullable = true, Value = type ?? (Object)DBNull.Value
                },
            };
            DataTable table = Dataprovider.ExcuteQuery(query);


            //Chuyển Table thành List tên hành khách
            return(table.AsEnumerable().ToList().ConvertAll(x =>
                                                            new KhachHang()
            {
                Ten = x[0].ToString(), SoDT = x[1].ToString(), Address = x[2].ToString(), Ma = x[2].ToString()
            }));
        }
Esempio n. 21
0
        public static DataTable XemSanPhamTable(string nhaCungCap, int loai, string ten, int pageNumber, int pageSize)
        {
            string query = "EXEC uspXemSanPham @nhaCungCap,@loai,@ten,@pageNumber,@pageSize";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@nhaCungCap", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = nhaCungCap
                },
                new SqlParameter("@loai", SqlDbType.Int)
                {
                    IsNullable = false, Value = loai
                },
                new SqlParameter("@ten", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = ten
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageSize
                },
            };
            DataTable table = null;

            try
            {
                table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(table);
        }
Esempio n. 22
0
        /// <summary>
        /// Xem danh sách nguyên liệu
        /// </summary>
        /// <param name="maNhaCungCap">mã nhà cung cấp</param>
        /// <param name="loaiNL">loại nguyên liệu</param>
        /// <param name="isXemToiThieu">nếu true thì ta xem các nguyên liệu đạt ngưỡng tối thiểu</param>
        /// <returns></returns>
        public static DataTable XemNguyenLieu(string tenNguyenLieu, string maNhaCungCap, bool isXemToiThieu)
        {
            string query = "EXEC uspXemNguyenLieu @tenNguyenLieu,@maNhaCungCap,@isXemToiThieu";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@tenNguyenLieu", SqlDbType.NVarChar)
                {
                    IsNullable = true, Value = tenNguyenLieu
                },
                new SqlParameter("@maNhaCungCap", SqlDbType.VarChar)
                {
                    IsNullable = true, Value = maNhaCungCap
                },
                new SqlParameter("@isXemToiThieu", SqlDbType.Bit)
                {
                    IsNullable = true, Value = isXemToiThieu
                },
            };

            return(Dataprovider.ExcuteQuery(query, parameters.ToArray()));
        }
Esempio n. 23
0
        public static bool DangNhap()
        {
            int                 row        = 0;
            string              username   = User.UserName;
            string              password   = User.Password;
            string              query      = "EXEC usp_DangNhap @username,@password";
            DataTable           data       = new DataTable();
            List <SqlParameter> parameters = new List <SqlParameter>
            {
                new SqlParameter("@username", System.Data.SqlDbType.VarChar)
                {
                    IsNullable = false, Value = username
                },
                new  SqlParameter("@password", System.Data.SqlDbType.VarChar)
                {
                    IsNullable = false, Value = password
                },
            };

            try
            {
                data = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            if (data.Rows.Count > 0)
            {
                User.NhanVien       = new NhanVien();
                User.NhanVien.HoTen = data.Rows[0].ItemArray[0].ToString();
                User.UserName       = data.Rows[0].ItemArray[1].ToString();
                User.Password       = data.Rows[0].ItemArray[2].ToString();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 24
0
        public static DataTable XemChiTietPhieuNhapThietBiTable(string soPhieuDat)
        {
            string query = "EXEC uspXemChiTietPhieuNhapThietBi @soPhieuDat";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@soPhieuDat", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = soPhieuDat
                },
            };
            DataTable table = null;

            try
            {
                table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(table);
        }
Esempio n. 25
0
        public static DataTable XemThietBiSuDung(string tenThietBi, string maNhaCungCap, int pageNumber, int pageSize, List <string> exceptList)
        {
            string query                   = "EXEC uspXemThietBiExcepList @tenThietBi,@maNhaCungCap,@danhSachLoaiTru,@pageNumber,@pageSize";
            string danhSachLoaiTru         = exceptList == null ? "" : String.Join("|", exceptList);
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@tenThietBi", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = tenThietBi
                },
                new SqlParameter("@maNhaCungCap", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = maNhaCungCap
                },
                new SqlParameter("@danhSachLoaiTru", SqlDbType.VarChar)
                {
                    IsNullable = true, Value = danhSachLoaiTru
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageSize
                },
            };
            DataTable data = new DataTable();

            try
            {
                data = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(data);
        }
Esempio n. 26
0
        public static PhieuNhapHang LapPhieuNhap(string nhaCungCap, string maNhanVien)
        {
            string query = "EXEC uspLapPhieuNhapSanPham @nhaCungCap,@maNhanVien";

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@nhaCungCap", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = nhaCungCap
                },
                new SqlParameter("@maNhanVien", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = maNhanVien
                },
            };
            DataRow       result        = null;
            PhieuNhapHang phieuNhapHang = null;

            try
            {
                result        = Dataprovider.ExcuteQuery(query, parameters.ToArray()).Rows[0];
                phieuNhapHang = new PhieuNhapHang()
                {
                    SoPhieu       = result[0].ToString(),
                    MaNhanVien    = result[1].ToString(),
                    TenNhanVien   = result[2].ToString(),
                    SoDienThoai   = result[3].ToString(),
                    NgayDat       = result[4].ToString(),
                    MaNhaCungCap  = result[5].ToString(),
                    TenNhaCungCap = result[6].ToString(),
                };
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(phieuNhapHang);
        }
Esempio n. 27
0
        public static List <Phong> XemChuyenPhong(string soHoaDon, int pageSize, int pageNumber)
        {
            string query = "EXEC uspXemChuyenPhong @thoiGianDat,@pageSize,@pageNumber";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@trangThai", SqlDbType.VarChar)
                {
                    Value = soHoaDon
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    Value = pageSize
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    Value = pageNumber
                }
            };
            List <Phong> list = new List <Phong>();

            try
            {
                DataTable table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                new Phong()
                {
                    Ten     = x[0].ToString(),
                    TenLoai = x[1].ToString(),
                    Gia     = uint.Parse(x[2].ToString()),
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }
Esempio n. 28
0
        public static DataTable XemLoaiKhachHang(List <int> danhSachLoaiTru)
        {
            string query = "EXEC uspXemLoaiKhachHang @danhSachLoaiTru";
            string danhSachLoaiKhachHang   = String.Join("|", danhSachLoaiTru);
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@danhSachLoaiTru", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = danhSachLoaiKhachHang
                },
            };
            DataTable data = new DataTable();

            try
            {
                data = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(data);
        }
Esempio n. 29
0
        public static DataTable XemSuDungThietBi(string lyDo, string tenThietBi, int pageNumber, int pageSize)
        {
            string query = "EXEC uspXemSuDungThietBi @lyDo,@tenThietBi,@pageNumber,@pageSize";



            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@lyDo", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = lyDo
                },
                new SqlParameter("@tenThietBi", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = tenThietBi
                },
                new SqlParameter("@pageNumber", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageNumber
                },
                new SqlParameter("@pageSize", SqlDbType.Int)
                {
                    IsNullable = false, Value = pageSize
                },
            };
            DataTable data = null;

            try
            {
                data = Dataprovider.ExcuteQuery(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(data);
        }
Esempio n. 30
0
        public static List <LoaiKhachHang> XemChiTiet(int maKhuyenMai, List <int> listMaLoaiKhachHang)
        {
            string query = "EXEC uspXemDanhSachLoaiKhachHangKM @maKhuyenMai,@danhSachLoaiKhachHang";
            string danhSachLoaiKhachHang = listMaLoaiKhachHang == null ? "" : String.Join("|", listMaLoaiKhachHang);

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@maKhuyenMai", SqlDbType.Int)
                {
                    Value = maKhuyenMai
                },
                new SqlParameter("@danhSachLoaiKhachHang", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = danhSachLoaiKhachHang
                },
            };
            List <LoaiKhachHang> list  = null;
            DataTable            table = null;

            try
            {
                table = Dataprovider.ExcuteQuery(query, parameters.ToArray());
                list  = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                 new LoaiKhachHang()
                {
                    MaLoaiKH  = int.Parse(x[0].ToString()),
                    MucKM     = float.Parse(x[2].ToString()),
                    TenLoaiKH = x[1].ToString(),
                });
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }

            return(list);
        }