⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buyeraccess.cs

📁 酒店管理系统,您酒店物业管理的好帮手
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Hotel.DAO;
using Hotel.Entity;

namespace Hotel.Operation
{
    public class BuyerAccess
    {
        GetDatabase objGetDatabase = null;
        //Buyer buyerEntity=null;
        DataSet ds = null;

        public BuyerAccess()
        {
            objGetDatabase = new GetDatabase();
        }
        //通得ID获得使用者信息
        public string GetBuyerInfo(int num)
        {
            string sql = "select BName from Buyer where BuyerID="+num;
            SqlDataReader dr=objGetDatabase.GetDataReader(sql);
            
            string name = "";
            if (dr.HasRows)
            {
                dr.Read();
                name = dr[0].ToString();
            }
            objGetDatabase.DrClose(dr);
            return name;

        }
        //获取最大的ID
        public int GetMaxBuyerID()
        {
            string sql = "select max(buyerID) from Buyer";
            int k = 0;
            SqlDataReader dr=objGetDatabase.GetDataReader(sql);
            dr.Read();
            if (dr.HasRows)
            {
                k =int.Parse( dr[0].ToString());
            }
            objGetDatabase.DrClose(dr);
            return k;
            
        }
        //通过证件号码搜客户信息
        public DataSet GetBuyerInfo(string num)
        {
            string sql = "select * from Buyer where BCarNum='" + num + "'";
            ds = objGetDatabase.GetDataSet(sql, "buyer");
            //objGetDatabase.DataClose();
            return ds;
        }
        
        //按姓名查找
        public DataSet GetBuyerDS(string name)
        {
            string sql = "select * from Buyer where BName='" + name + "'";
            ds = objGetDatabase.GetDataSet(sql, "buyer");
            objGetDatabase.DataClose();
            return ds;
        }
        //储存过程插入客户信息
        public int AddBuyerInfo(Buyer buyer)
        {
            SqlParameter []para={new SqlParameter("@BName", buyer.BName),
                new SqlParameter("@Birthday", buyer.Birthday),
                new SqlParameter("@certificateID", buyer.CertificateID),
                new SqlParameter("@BCarNum", buyer.BCarNum),
                new SqlParameter("@BSex", buyer.BSex),
                new SqlParameter("@Phone", buyer.Phone),
                new SqlParameter("@Company", buyer.Company),
                new SqlParameter("@NationalityID", buyer.NationalityID),
                new SqlParameter("@ProvinceID", buyer.ProvinceID),
                new SqlParameter("@Address", buyer.Address),
                new SqlParameter("@Remark", buyer.Remark),};
            int k= objGetDatabase.ExecuteProc("proc_Buyer",para);
            //objGetDatabase.DataClose();
            return k;
        }
        //所有宾客信息
        public DataSet GetAllBuyerInfo()
        {
            string sql = "select 顾客ID=BuyerID,姓名=BName,登记日期=birthday,证件类型=(select TypeName from Certificate where  certificateID=Buyer.certificateID),证件号码=BCarNum,性别=BSex from Buyer";
            ds = new DataSet();
            ds = objGetDatabase.GetDataSet(sql, "Buyer");
            return ds;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -