123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Models;
- using System.Data.SqlClient;
- using System.Data;
- namespace DAL
- {
- public class VisaProgressService
- {
- /// <summary>
- /// 查询所有数据
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<VisaProgress> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<VisaProgress>.excuteSql(new VisaProgress(), "VisaProgress", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- VisaProgress excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<VisaProgress> ctggdList = excuteSql(sql, param);
- //判断集合是否为空
- if (ctggdList == null || ctggdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return ctggdList[0];
- }
- //增Add
- public bool AddDeleQZ(VisaProgress Dov)
- {
- string sql = "insert into VisaProgress values(@Diid,@Country,@GetData,@GetDataTime,@GetPassport,@GetPassportTime,"
- + "@FillData,@FillDataTime,@SendVisa,@SendVisaTime,@SignOut,@SignOutTime,@SendBackPassport,@SendBackPassporTime,"
- + "@Receiver,@Oper,@Opdate,@IsDel);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@Country",Dov.Country),
- new SqlParameter("@GetData",Dov.GetData),
- new SqlParameter("@GetDataTime",Dov.GetDataTime),
- new SqlParameter("@GetPassport",Dov.GetPassport),
- new SqlParameter("@GetPassportTime",Dov.GetPassportTime),
- new SqlParameter("@FillData",Dov.FillData),
- new SqlParameter("@FillDataTime",Dov.FillDataTime),
- new SqlParameter("@SendVisa",Dov.SendVisa),
- new SqlParameter("@SendVisaTime",Dov.SendVisaTime),
- new SqlParameter("@SignOut",Dov.SignOut),
- new SqlParameter("@SignOutTime",Dov.SignOutTime),
- new SqlParameter("@SendBackPassport",Dov.SendBackPassport),
- new SqlParameter("@SendBackPassporTime",Dov.SendBackPassporTime),
- new SqlParameter("@Receiver",Dov.Receiver),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@Opdate",Dov.Opdate),
- new SqlParameter("@Isdel",Dov.Isdel)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- //删Delete
- public bool DelDeleQZ(int id)
- {
- if (SqlHelper.ExecuteNonQuery("update VisaProgress set IsDel = 1 where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- //改Update
- public bool EditDeleQZ(VisaProgress Dov)
- {
- string sql = "update VisaProgress set Diid=@Diid,Country=@Country,GetData=@GetData,GetDataTime=@GetDataTime,GetPassport=@GetPassport,"
- + "GetPassportTime=@GetPassportTime,FillData=@FillData,FillDataTime=@FillDataTime,SendVisa=@SendVisa,SendVisaTime=@SendVisaTime,"
- + "SignOut=@SignOut,SignOutTime=@SignOutTime,SendBackPassport=@SendBackPassport,SendBackPassporTime=@SendBackPassporTime,"
- + "Receiver=@Receiver,Oper=@Oper,Opdate=@Opdate,Isdel=@Isdel where Id = @Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@Country",Dov.Country),
- new SqlParameter("@GetData",Dov.GetData),
- new SqlParameter("@GetDataTime",Dov.GetDataTime),
- new SqlParameter("@GetPassport",Dov.GetPassport),
- new SqlParameter("@GetPassportTime",Dov.GetPassportTime),
- new SqlParameter("@FillData",Dov.FillData),
- new SqlParameter("@FillDataTime",Dov.FillDataTime),
- new SqlParameter("@SendVisa",Dov.SendVisa),
- new SqlParameter("@SendVisaTime",Dov.SendVisaTime),
- new SqlParameter("@SignOut",Dov.SignOut),
- new SqlParameter("@SignOutTime",Dov.SignOutTime),
- new SqlParameter("@SendBackPassport",Dov.SendBackPassport),
- new SqlParameter("@SendBackPassporTime",Dov.SendBackPassporTime),
- new SqlParameter("@Receiver",Dov.Receiver),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@Opdate",Dov.Opdate),
- 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 VisaProgress GetById(int Id)
- {
- //调用获取单个对象的方法
- return excuteType("select * from VisaProgress where IsDel=0 and Id=@Id", new SqlParameter("@Id", Id));
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="Diid">根据团组ID</param>
- /// <returns></returns>
- public List<VisaProgress> GetAllByDiid(int diid)
- {
- //调用获取单个对象的方法
- return excuteSql("select * from VisaProgress where IsDel=0 and Diid=@diid", new SqlParameter("@diid", diid));
- }
- List<Users> excuteUserSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<Users>.excuteSql(new Users(), "Users", sql, CommandType.Text, param);
- }
- public List<Users> GetByUser()
- {
- return excuteUserSql(" select * from Users where Post like '%酒店%' and IsDel=@isDel or Post like '%机票%' or Id=149", new SqlParameter("@isDel", 0));
- //return null;
- }
- }
- }
|