示例#1
0
        public static bool KiemTraGoiMon(string ma, int soLuong, int soLuongCu)
        {
            string query = "EXEC uspKiemTraGoiMon @ma,@soLuong,@soLuongCu";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@ma", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = ma
                },
                new SqlParameter("@soLuong", SqlDbType.Int)
                {
                    IsNullable = false, Value = soLuong
                },
                new SqlParameter("@soLuongCu", SqlDbType.Int)
                {
                    IsNullable = false, Value = soLuongCu
                },
            };
            int result = 0;

            try
            {
                result = (int)Dataprovider.ExcuteScalar(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(result == 0 ? false : true);
        }
示例#2
0
        public static int DemSanPham(string nhaCungCap, int loai, string ten)
        {
            string query = "EXEC uspDemSanPham  @nhaCungCap,@loai,@ten";
            //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
                },
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#3
0
        public static int DemHangHoa(int loai, int loaiChiTiet)
        {
            string query = "EXEC uspDemHangHoa @loai,@loaiChiTiet";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@loai", SqlDbType.Int)
                {
                    IsNullable = false, Value = loai
                },
                new SqlParameter("@loaiChiTiet", SqlDbType.Int)
                {
                    IsNullable = false, Value = loaiChiTiet
                },
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#4
0
        public static int DemPhongQuanLy(string maPhong, int loaiPhong)
        {
            string query = "EXEC uspDemPhongQuanLy @maPhong,@loaiPhong";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@maPhong", SqlDbType.VarChar)
                {
                    Value = maPhong
                },
                new SqlParameter("@loaiPhong", SqlDbType.Int)
                {
                    Value = loaiPhong
                },
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#5
0
        public static int DemKhuyenMai(string tenKhuyenMai, int loaiKhachHang)
        {
            string query = "EXEC uspDemKhuyenMai @tenKhuyenMai,@loaiKhachHang";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@tenKhuyenMai", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = tenKhuyenMai
                },
                new SqlParameter("@loaiKhachHang", SqlDbType.Int)
                {
                    IsNullable = false, Value = loaiKhachHang
                },
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#6
0
        public static bool KiemTraPhieuDatTiec(string maPhong, DateTime ngayNhanPhong, DateTime ngayGioKetThuc)
        {
            string query = "EXEC uspKiemTraDatPhong @maPhong,@ngayNhanPhong,@ngayGioKetThuc";

            //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("@ngayNhanPhong", SqlDbType.DateTime)
                {
                    Value = ngayNhanPhong
                },
                new SqlParameter("@ngayGioKetThuc", SqlDbType.DateTime)
                {
                    Value = ngayGioKetThuc
                }
            };
            int count = -1;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count > 0 ? false : true);
        }
示例#7
0
        public static bool KiemTraTonThietBi(string maThietBi, int soLuong, int soLuongCu)
        {
            string query = "EXEC uspKiemTraTon @maThietBi,@soLuong,@soLuongCu";


            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@maThietBi", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = maThietBi
                },
                new SqlParameter("@soLuong", SqlDbType.Int)
                {
                    IsNullable = false, Value = soLuong
                },
                new SqlParameter("@soLuongCu", SqlDbType.Int)
                {
                    IsNullable = false, Value = soLuongCu
                },
            };
            int num = 0;

            try
            {
                num = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
                return(false);
            }

            return(num > 0? true : false);
        }
示例#8
0
        public static int DemSuDungThietBi(string lyDo, string tenThietBi)
        {
            string query = "EXEC uspDemSuDungThietBi @lyDo,@tenThietBi";

            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@lyDo", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = lyDo
                },
                new SqlParameter("@tenThietBi", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = tenThietBi
                },
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#9
0
        public static int DemThietBi(string tenThietBi, string maNhaCungCap)
        {
            string query = "EXEC uspDemThietBi @tenThietBi,@maNhaCungCap";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@tenThietBi", SqlDbType.NVarChar)
                {
                    IsNullable = true, Value = tenThietBi
                },
                new SqlParameter("@maNhaCungCap", SqlDbType.VarChar)
                {
                    IsNullable = true, Value = maNhaCungCap
                }
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#10
0
        public static int DemThietBiSuDung(string tenThietBi, string maNhaCungCap, List <string> exceptList)
        {
            string query                   = "EXEC uspDemThietBiExcepList @tenThietBi,@maNhaCungCap,@danhSachLoaiTru";
            string danhSachLoaiTru         = exceptList == null?"": String.Join("|", exceptList);
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@tenThietBi", SqlDbType.NVarChar)
                {
                    IsNullable = true, Value = tenThietBi
                },
                new SqlParameter("@maNhaCungCap", SqlDbType.VarChar)
                {
                    IsNullable = true, Value = maNhaCungCap
                },
                new SqlParameter("@danhSachLoaiTru", SqlDbType.VarChar)
                {
                    IsNullable = true, Value = danhSachLoaiTru
                }
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="khachHang"></param>
        /// <param name="maPhong"></param>
        /// <param name="maNV"></param>
        /// <param name="ngayNhanPhong"></param>
        /// <param name="thoiGianDat"></param>
        /// <returns></returns>
        public static string GhiNhanDatTiec(KhachHang khachHang, string maPhong, string maNV, DateTime ngayNhanPhong, DateTime ngayDat, DateTime ngayGioKetThuc)
        {
            string query  = "EXEC uspGhiNhanDatTiec @maPhong,@tenKhachHang,@soDienThoai,@maNV,@ngayNhanPhong,@ngayDat,@ngayGioKetThuc";
            string result = "";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@maPhong", SqlDbType.VarChar)
                {
                    Value = maPhong
                },
                new SqlParameter("@tenKhachHang", SqlDbType.NVarChar)
                {
                    Value = khachHang.Ten
                },
                new SqlParameter("@soDienThoai", SqlDbType.VarChar)
                {
                    Value = khachHang.SoDT
                },
                new SqlParameter("@maNV", SqlDbType.VarChar)
                {
                    Value = maNV
                },
                new SqlParameter("@ngayNhanPhong", SqlDbType.DateTime)
                {
                    Value = ngayNhanPhong
                },
                new SqlParameter("@ngayDat", SqlDbType.DateTime)
                {
                    Value = ngayDat
                },
                new SqlParameter("@ngayGioKetThuc", SqlDbType.DateTime)
                {
                    Value = ngayGioKetThuc
                }
            };

            try
            {
                result = Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString();
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
                return(result);
            }
            return(result);
        }
示例#12
0
        public static int DemLichSuPhong()
        {
            string query = "EXEC uspDemLichSuDatPhong ";

            //truyền tham số vào câu truy vấn
            //List<SqlParameter> parameters = new List<SqlParameter>()
            //{
            //    new SqlParameter("@trangThai",SqlDbType.Int){IsNullable=false,Value=trangThai }

            //};
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#13
0
        public static int DemPhieuNhapHang(int loai)
        {
            string query = "EXEC uspDemPhieuNhapSanPham @loai";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@loai", SqlDbType.Int)
                {
                    IsNullable = false, Value = loai
                },
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#14
0
        public static bool KiemTraKhachHang(string ten, string soDienThoai)
        {
            string query = "select COUNT(*) from KHACHHANG where SDT=@soDienThoai AND TENKH=@tenKhachHang";
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@soDienThoai", SqlDbType.VarChar)
                {
                    Value = soDienThoai
                },
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count == 0? false : true);
        }
示例#15
0
        public static float LayGiamGia(string soHoaDon)
        {
            string query = "EXEC uspLayGiamGia @soHoaDon";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@soHoaDon", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = soHoaDon
                }
            };
            float count = 0;

            try
            {
                count = float.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="maPhong"></param>
        /// <returns></returns>
        public static int DemPhieuDatTiec(string maPhong)
        {
            string query = "EXEC uspDemPhieuDatCho @maPhong";

            //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
                }
            };
            int count = 0;

            try
            {
                count = int.Parse(Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(count);
        }
示例#17
0
        public static bool HoaDonDatTiec(string soHoaDon)
        {
            string query = "SELECT COUNT(*) FROM HOADON A INNER JOIN PHIEUDATPHONG B ON A.SOHD=B.SOHD WHERE A.SOHD = @soHoaDon";

            //truyền tham số vào câu truy vấn
            List <SqlParameter> parameters = new List <SqlParameter>()
            {
                new SqlParameter("@soHoaDon", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = soHoaDon
                }
            };
            int result = 0;

            try
            {
                result = (int)Dataprovider.ExcuteScalar(query, parameters.ToArray());
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(result == 0 ? false : true);
        }
示例#18
0
        public static string LayMaHoaDon(string maPhong)
        {
            string query = "EXEC uspLayHoaDon @maPhong";

            //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
                }
            };
            string result = "";

            try
            {
                result = Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString();
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(result);
        }
示例#19
0
        public static string LayMaHoaDonDatTiec(string maPhong, string tenKhachHang, string soDienThoai, DateTime ngayNhanPhong)
        {
            string query = "EXEC uspLayHoaDonDatTiec @maPhong,@tenKhachHang,@soDienThoai,@ngayNhanPhong";

            //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("@tenKhachHang", SqlDbType.NVarChar)
                {
                    IsNullable = false, Value = tenKhachHang
                },
                new SqlParameter("@soDienThoai", SqlDbType.VarChar)
                {
                    IsNullable = false, Value = soDienThoai
                },
                new SqlParameter("@ngayNhanPhong", SqlDbType.DateTime)
                {
                    IsNullable = false, Value = ngayNhanPhong
                }
            };
            string result = "";

            try
            {
                result = Dataprovider.ExcuteScalar(query, parameters.ToArray()).ToString();
            }
            catch (Exception ex)
            {
                Utility.Log(ex);
            }
            return(result);
        }