123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using Models;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- namespace DAL
- {
- public class DeleOverViewServices
- {
- /// <summary>
- /// 查询所有数据
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<DeleOverView> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<DeleOverView>.excuteSql(new DeleOverView(), "DeleOverView", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- DeleOverView excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<DeleOverView> ctggdList = excuteSql(sql, param);
- //判断集合是否为空
- if (ctggdList == null || ctggdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return ctggdList[0];
- }
- //增Add
- public bool AddDeleOverView(DeleOverView Dov)
- {
- string sql = "insert into DeleOverView values(@Diid,@BaoPi,@GongWu,@JiPiao,@JiuDian,@DiJie,@Oper,@OpTime,@IsDel);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@BaoPi",Dov.BaoPi),
- new SqlParameter("@GongWu",Dov.GongWu),
- new SqlParameter("@JiPiao",Dov.JiPiao),
- new SqlParameter("@JiuDian",Dov.JiuDian),
- new SqlParameter("@DiJie",Dov.DiJie),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@OpTime",Dov.OpTime),
- new SqlParameter("@IsDel",Dov.IsDel)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- //删Delete
- public bool DelDeleOverView(int id)
- {
- if (SqlHelper.ExecuteNonQuery("update DeleOverView set IsDel = 1 where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- //改Update
- public bool EditDeleOverView(DeleOverView Dov)
- {
- string sql = "update DeleOverView set Diid=@Diid,BaoPi=@BaoPi,GongWu=@GongWu,JiPiao=@JiPiao,JiuDian=@JiuDian,DiJie=@DiJie,Oper=@Oper,OpTime=@OpTime,Isdel=@Isdel where Id = @Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@BaoPi",Dov.BaoPi),
- new SqlParameter("@GongWu",Dov.GongWu),
- new SqlParameter("@JiPiao",Dov.JiPiao),
- new SqlParameter("@JiuDian",Dov.JiuDian),
- new SqlParameter("@DiJie",Dov.DiJie),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@OpTime",Dov.OpTime),
- new SqlParameter("@IsDel",Dov.IsDel),
- new SqlParameter("@Id",Dov.Id)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- //查Select
- /// <summary>
- /// 根据团组ID查询数据
- /// </summary>
- /// <param name="Diid">根据团组ID</param>
- /// <returns>返回空或者单个对象信息</returns>
- public DeleOverView GetDeleOverViewByDIID(int Diid)
- {
- //调用获取单个对象的方法
- return excuteType("select * from DeleOverView where Diid = @Diid", new SqlParameter("@Diid", Diid));
- }
- }
- }
|