123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- 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 OfficialActivitiesService
- {
- List<OfficialActivities> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<OfficialActivities>.excuteSql(new OfficialActivities(), "OfficalActivities", sql, CommandType.Text, param);
- }
- OfficialActivities excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<OfficialActivities> hdList = excuteSql(sql, param);
- //判断集合是否为空
- if (hdList == null || hdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return hdList[0];
- }
- //增Add
- public bool Add(OfficialActivities Dov)
- {
- string sql = "insert into OfficialActivities values(@Diid,@Dovid,@Client,@Date,@Time,@Address,@Contact,@Job,@Tel,@Form,@Setting,@Dresscode,@Attendees,@IsNeedTrans,@Translators,@Language," +
- "@Trip,@Oper,@OpDate,@Isdel,@Type,@IsSubmitApproval,@IsPay);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@Dovid",Dov.Dovid),
- new SqlParameter("@Client",Dov.Client),
- new SqlParameter("@Date",Dov.Date),
- new SqlParameter("@Time",Dov.Time),
- new SqlParameter("@Address",Dov.Address),
- new SqlParameter("@Contact",Dov.Contact),
- new SqlParameter("@Job",Dov.Job),
- new SqlParameter("@Tel",Dov.Tel),
- new SqlParameter("@Form",Dov.Form),
- new SqlParameter("@Setting",Dov.Setting),
- new SqlParameter("@Dresscode",Dov.Dresscode),
- new SqlParameter("@Attendees",Dov.Attendees),
- new SqlParameter("@IsNeedTrans",Dov.IsNeedTrans),
- new SqlParameter("@Translators",Dov.Translators),
- new SqlParameter("@Language",Dov.Language),
- new SqlParameter("@Trip",Dov.Trip),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@OpDate",Dov.OpDate),
- new SqlParameter("@Isdel",Dov.Isdel),
- new SqlParameter("@Type",Dov.Type),
- new SqlParameter("@IsSubmitApproval",Dov.IsSubmitApproval),
- new SqlParameter("@IsPay",Dov.IsPay),
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- //改Update
- public bool Edit(OfficialActivities Dov)
- {
- string sql = "update OfficialActivities set Diid=@Diid,Dovid=@Dovid,Client=@Client,Date=@Date,Time=@Time,Address=@Address,Contact=@Contact,Job=@Job,"
- + "Tel=@Tel,Form=@Form,Setting=@Setting,Dresscode=@Dresscode,Attendees=@Attendees,IsNeedTrans=@IsNeedTrans,Translators=@Translators,Language=@Language,"
- + "Trip=@Trip,Oper=@Oper,OpDate=@OpDate,Isdel=@Isdel,Type=@Type,IsSubmitApproval=@IsSubmitApproval,IsPay=@IsPay where Id = @Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@Dovid",Dov.Dovid),
- new SqlParameter("@Client",Dov.Client),
- new SqlParameter("@Date",Dov.Date),
- new SqlParameter("@Time",Dov.Time),
- new SqlParameter("@Address",Dov.Address),
- new SqlParameter("@Contact",Dov.Contact),
- new SqlParameter("@Job",Dov.Job),
- new SqlParameter("@Tel",Dov.Tel),
- new SqlParameter("@Form",Dov.Form),
- new SqlParameter("@Setting",Dov.Setting),
- new SqlParameter("@Dresscode",Dov.Dresscode),
- new SqlParameter("@Attendees",Dov.Attendees),
- new SqlParameter("@IsNeedTrans",Dov.IsNeedTrans),
- new SqlParameter("@Translators",Dov.Translators),
- new SqlParameter("@Language",Dov.Language),
- new SqlParameter("@Trip",Dov.Trip),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@OpDate",Dov.OpDate),
- new SqlParameter("@Isdel",Dov.Isdel),
- new SqlParameter("@Id",Dov.Id),
- new SqlParameter("@Type",Dov.Type),
- new SqlParameter("@IsSubmitApproval",Dov.IsSubmitApproval),
- new SqlParameter("@IsPay",Dov.IsPay),
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- //删
- public bool delOA(int id)
- {
- if (SqlHelper.ExecuteNonQuery("update OfficialActivities set Isdel=1 where Id=@Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 根据团组ID查询多个信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public List<OfficialActivities> getByDiid(int diid)
- {
- return excuteSql("select * from OfficialActivities where Isdel=0 and Diid=@diid order by Date", new SqlParameter("@diid", diid));
- }
- /// <summary>
- /// 根据团组查询多个信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public List<OfficialActivities> getByDiidAndDate(int diid,string date)
- {
- return excuteSql("select * from OfficialActivities where Isdel=0 and Diid=@diid and IsSubmitApproval=0 and Date=@Date order by Date", new SqlParameter("@diid", diid), new SqlParameter("@Date", date));
- }
- /// <summary>
- /// 根据Id查单条信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public OfficialActivities getById(int id)
- {
- return excuteType("select * from OfficialActivities where Isdel=0 and Id=@id", new SqlParameter("@id", id));
- }
- /// <summary>
- /// 根据Id查单条信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public OfficialActivities getBySingleDiid(int diid)
- {
- return excuteType("select * from OfficialActivities where Isdel=0 and diid=@diid", new SqlParameter("@diid", diid));
- }
- /// <summary>
- /// 根据Id查单条信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public OfficialActivities getBySingleDiidAndCountry(int diid,string country)
- {
- return excuteType("select * from OfficialActivities where Isdel=0 and diid=" + diid + " and Client like '%" + country + "%'");
- }
- /// <summary>
- /// 雷怡 2021-08-30 10:20
- /// 查询所有
- /// </summary>
- /// <returns></returns>
- public List<OfficialActivities> getAll()
- {
- return excuteSql("select * from OfficialActivities where Isdel=0 order by Date desc");
- }
- }
- }
|