123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Models;
- namespace DAL
- {
- public class BackwardTable_VisaService
- {
- List<BackwardTable_Visa> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<BackwardTable_Visa>.excuteSql(new BackwardTable_Visa(), "BackwardTable_Visa", sql, CommandType.Text, param);
- }
- BackwardTable_Visa excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<BackwardTable_Visa> hdList = excuteSql(sql, param);
- //判断集合是否为空
- if (hdList == null || hdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return hdList[0];
- }
- /// <summary>
- /// 增加
- /// </summary>
- /// <param name="c"></param>
- public bool Add(BackwardTable_Visa btv)
- {
- string sql = "insert into BackwardTable_Visa values(@BT_Diid,@BT_VisaCountry,@BT_BusinessType,@BT_VisaType,@BT_VisaTime,@BT_Oper,@BT_OperDate,@BT_Isdel)";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@BT_Diid",btv.BT_Diid),
- new SqlParameter("@BT_VisaCountry",btv.BT_VisaCountry),
- new SqlParameter("@BT_BusinessType",btv.BT_BusinessType),
- new SqlParameter("@BT_VisaType",btv.BT_VisaType),
- new SqlParameter("@BT_VisaTime",btv.BT_VisaTime),
- new SqlParameter("@BT_Oper",btv.BT_Oper),
- new SqlParameter("@BT_OperDate",btv.BT_OperDate),
- new SqlParameter("@BT_Isdel",btv.BT_Isdel)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 改Update
- /// </summary>
- /// <param name="Dov"></param>
- /// <returns></returns>
- public bool Update(BackwardTable_Visa btv)
- {
- string sql = "update BackwardTable_Visa set BT_Diid=@BT_Diid,BT_VisaCountry=@BT_VisaCountry,BT_BusinessType=@BT_BusinessType,BT_VisaType=@BT_VisaType,BT_VisaTime=@BT_VisaTime," +
- "BT_Oper=@BT_Oper,BT_OperDate=@BT_OperDate,BT_Isdel=@BT_Isdel where BT_Id = @BT_Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@BT_Diid",btv.BT_Diid),
- new SqlParameter("@BT_VisaCountry",btv.BT_VisaCountry),
- new SqlParameter("@BT_BusinessType",btv.BT_BusinessType),
- new SqlParameter("@BT_VisaType",btv.BT_VisaType),
- new SqlParameter("@BT_VisaTime",btv.BT_VisaTime),
- new SqlParameter("@BT_Oper",btv.BT_Oper),
- new SqlParameter("@BT_OperDate",btv.BT_OperDate),
- new SqlParameter("@BT_Isdel",btv.BT_Isdel),
- new SqlParameter("@BT_Id",btv.BT_Id)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 根据ID查询
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public List<BackwardTable_Visa> GetByDiid(int diid)
- {
- //调用获取单个对象的方法
- string sql = "select * from BackwardTable_Visa where BT_Diid=@BT_Diid and BT_Isdel=0";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@BT_Diid", diid)
- };
- return excuteSql(sql, parameter);
- }
- public BackwardTable_Visa GetByDiidAndCountry(int diid, string country)
- {
- //调用获取单个对象的方法
- string sql = "select * from BackwardTable_Visa where BT_Diid=@BT_Diid and BT_VisaCountry=@BT_VisaCountry and BT_Isdel=0";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@BT_Diid", diid),
- new SqlParameter("@BT_VisaCountry", country)
- };
- return excuteType(sql, parameter);
- }
- }
- }
|