public static DataView NhaCungCap_getAll()
        {
            SqlConnection connection = SqlConnect.Connect();

            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand             = new SqlCommand("NhaCungCap_getAll", connection);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();

            da.Fill(dt);
            DataView dv = new DataView(dt);

            return(dv);
        }
Exemplo n.º 2
0
        public static DataSet getHangHoa()
        {
            SqlConnection conn    = SqlConnect.Connect();
            SqlCommand    command = new SqlCommand("SELECT MA_HANG,TEN_HANG FROM Danh_Muc_Hang_Hoa", conn);

            conn.Open();
            SqlDataAdapter da = new SqlDataAdapter(command);

            da.SelectCommand = command;
            DataSet dt = new DataSet();

            da.Fill(dt);
            conn.Close();
            return(dt);
        }
        public static DataTable loadHanghoa()
        {
            SqlConnection conn    = SqlConnect.Connect();
            SqlCommand    command = new SqlCommand("XEM_KHO", conn);

            command.CommandType = CommandType.StoredProcedure;
            conn.Open();
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = command;
            DataTable dt = new DataTable();

            da.Fill(dt);
            conn.Close();
            return(dt);
        }
        public static DataView chiTietPhieuNhap_find(int mapn)
        {
            SqlConnection connection = SqlConnect.Connect();

            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = new SqlCommand("chiTietPhieuNhap_find", connection);
            da.SelectCommand.Parameters.Add("@mapn", SqlDbType.Int);
            da.SelectCommand.Parameters["@mapn"].Value = mapn;
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();

            da.Fill(dt);
            DataView dv = new DataView(dt);

            return(dv);
        }
        public static void ThemKhachHang(KhachHang kh)
        {
            SqlConnection conn = SqlConnect.Connect();
            SqlCommand    cmd  = new SqlCommand("THEM_KH", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@TEN_KH", SqlDbType.NVarChar, 50);
            cmd.Parameters.Add("@DIA_CHI", SqlDbType.NVarChar, 50);
            cmd.Parameters.Add("@DIEN_THOAI", SqlDbType.NVarChar, 50);

            cmd.Parameters["@TEN_KH"].Value     = kh.Tenkh;
            cmd.Parameters["@DIA_CHI"].Value    = kh.Diachi;
            cmd.Parameters["@DIEN_THOAI"].Value = kh.Dienthoai;

            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
        }
        public static bool delete(int mapn)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("ChiTietPhieuNhap_delete", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@mapn", mapn));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 7
0
        public static bool insert(string tennuoc)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("NuocSX_insert", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@tenNuoc", tennuoc));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 8
0
        public static bool delete(string manuoc)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("NuocSX_delete", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@maNuoc", Int32.Parse(manuoc)));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static bool PhieuNhap_add(PhieuNhap phieuNhap)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("PhieuNhap_insert", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@ngayNhap", new SqlDateTime(phieuNhap.NgayNhap)));
            cmd.Parameters.Add(new SqlParameter("@maNCC", phieuNhap.MaNCC));
            cmd.Parameters.Add(new SqlParameter("@maKho", phieuNhap.MaKho));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static void SuaKho(KhoHang kh)
        {
            SqlConnection conn = SqlConnect.Connect();
            SqlCommand    cmd  = new SqlCommand("SUA_KHO", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@MA_KHO", SqlDbType.Int);
            cmd.Parameters.Add("@TEN_KHO", SqlDbType.NVarChar, 50);
            cmd.Parameters.Add("@DIA_CHI", SqlDbType.NVarChar, 50);
            cmd.Parameters.Add("@SDT", SqlDbType.NVarChar, 50);
            cmd.Parameters.Add("@TEN_THU_KHO", SqlDbType.NVarChar, 50);

            cmd.Parameters["@MA_KHO"].Value      = kh.Makho;
            cmd.Parameters["@TEN_KHO"].Value     = kh.Tenkho;
            cmd.Parameters["@DIA_CHI"].Value     = kh.Diachi;
            cmd.Parameters["@SDT"].Value         = kh.Dienthoai;
            cmd.Parameters["@TEN_THU_KHO"].Value = kh.Tenthukho;

            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
        }
        public static bool add(ChiTietPhieuXuat chiTiet)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("ChiTietPhieuXuat_add", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@maPX", chiTiet.MaPhieuXuat));
            cmd.Parameters.Add(new SqlParameter("@maHang", chiTiet.MaHang));
            cmd.Parameters.Add(new SqlParameter("@soLuong", chiTiet.SoLuong));
            cmd.Parameters.Add(new SqlParameter("@donGia", chiTiet.DonGia));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static bool insert(NhaCungCap ncc)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("NhaCungCap_insert", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@tenNhaCC", ncc.tenNhaCC));
            cmd.Parameters.Add(new SqlParameter("@diachi", ncc.diachi));
            cmd.Parameters.Add(new SqlParameter("@dienthoai", ncc.dienthoai));
            cmd.Parameters.Add(new SqlParameter("@maNuoc", ncc.maNuoc));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static bool insert(PhieuXuat phieuxuat)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("PhieuXuat_insert", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@ngayXuat", new SqlDateTime(phieuxuat.NgayXuat)));
            cmd.Parameters.Add(new SqlParameter("@lyDo", phieuxuat.LyDo));
            cmd.Parameters.Add(new SqlParameter("@maKho", phieuxuat.MaKho));
            cmd.Parameters.Add(new SqlParameter("@maKH", phieuxuat.MaKhachHang));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static bool insert(ChiTietPhieuNhap ctpn)
        {
            SqlConnection connection = SqlConnect.Connect();

            connection.Open();
            SqlCommand cmd = new SqlCommand("ChiTietPhieuNhap_insert", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@mapn", ctpn.MaPhieuNhap));
            cmd.Parameters.Add(new SqlParameter("@mahang", ctpn.MaHang));
            cmd.Parameters.Add(new SqlParameter("@slgia", ctpn.SlTheoChungTu));
            cmd.Parameters.Add(new SqlParameter("@slthuc", ctpn.SlThuc));
            cmd.Parameters.Add(new SqlParameter("@dongia", ctpn.DonGia));
            int msg = cmd.ExecuteNonQuery();

            if (msg > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }