12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- 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
- {
- /// <summary>
- /// 雷怡 2021-10-12 11:52
- /// 外部行程用户关联团组行程Diid表数据访问层
- /// </summary>
- public class TravelUsersAndDiidService
- {
- List<TravelUsersAndDiid> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<TravelUsersAndDiid>.excuteSql(new TravelUsersAndDiid(), "TravelUsersAndDiid", sql, CommandType.Text, param);
- }
- TravelUsersAndDiid excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<TravelUsersAndDiid> hdList = excuteSql(sql, param);
- TravelUsersAndDiid tuad = new TravelUsersAndDiid();
- //判断集合是否为空
- if (hdList == null || hdList.Count == 0)
- {
- return tuad;
- }
- //返回单个对象
- return hdList[0];
- }
- /// <summary>
- /// 雷怡 2021-10-14 15:55
- /// 增Add
- /// </summary>
- /// <param name="Dov"></param>
- /// <returns></returns>
- public bool Add(TravelUsersAndDiid tuad)
- {
- string sql = "insert into TravelUsersAndDiid values(@TravelUsersId,@Diid,@Oper,@OperDate,@Isdel);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@TravelUsersId",tuad.TravelUsersId),
- new SqlParameter("@Diid",tuad.Diid),
- new SqlParameter("@Oper",tuad.Oper),
- new SqlParameter("@OperDate",tuad.OperDate),
- new SqlParameter("@Isdel",tuad.Isdel)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 雷怡 2021-10-25 11:43
- /// 通过行程用户id 查询
- /// </summary>
- /// <param name="Dov"></param>
- /// <returns></returns>
- public List<TravelUsersAndDiid> GetByTravelUsersId(int TravelUsersId)
- {
- string sql = "select * from TravelUsersAndDiid where Isdel = 0 and TravelUsersId = " + TravelUsersId;
- return excuteSql(sql);
- }
- /// <summary>
- /// 雷怡 2021-10-14 15:55
- /// 删除 Del
- /// </summary>
- /// <param name="Dov"></param>
- /// <returns></returns>
- public bool Del(int id)
- {
- string sql = "update TravelUsersAndDiid set Isdel = 1 where Id ="+id;
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, null) > 0)
- return true;
- return false;
- }
-
- }
- }
|