123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- 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 DeleClientNeedsService
- {
- List<DeleClientNeeds> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<DeleClientNeeds>.excuteSql(new DeleClientNeeds(), "DeleClientNeeds", sql, CommandType.Text, param);
- }
- DeleClientNeeds excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<DeleClientNeeds> hdList = excuteSql(sql, param);
- //判断集合是否为空
- if (hdList == null || hdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return hdList[0];
- }
- /// <summary>
- /// 根据ID查询
- /// </summary>
- /// <returns></returns>
- public DeleClientNeeds GetById(int id)
- {
- return excuteType("select * from DeleClientNeeds where Isdel=0 and Id=" + id);
- }
- public List<DeleClientNeeds> GetAll()
- {
- return excuteSql("select * from DeleClientNeeds where Isdel=0 ");
- }
- public DeleClientNeeds GetByDIId(int DIID)
- {
- return excuteType("select * from DeleClientNeeds where Isdel=0 and Diid=" + DIID);
- }
- //增Add
- public bool Add(DeleClientNeeds Dov)
- {
- string sql = "insert into DeleClientNeeds values(@Diid,@OffActPlace,@OffActLetter,@TransNeed,@TranLanguage,@TranScene,@VisaNeeds,"
- + "@Hobby,@CarNeeds,@GuideNeeds,@MealNeeds,@CheckInTime,@HotelLevel,@HotelPosition,@RoomNum,@NeedsRemark,@OPer,@OPdate,@Isdel);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@OffActPlace",Dov.OffActPlace),
- new SqlParameter("@OffActLetter",Dov.OffActLetter),
- new SqlParameter("@TransNeed",Dov.TransNeed),
- new SqlParameter("@TranLanguage",Dov.TranLanguage),
- new SqlParameter("@TranScene",Dov.TranScene),
- new SqlParameter("@VisaNeeds",Dov.VisaNeeds),
- new SqlParameter("@Hobby",Dov.Hobby),
- new SqlParameter("@CarNeeds",Dov.CarNeeds),
- new SqlParameter("@GuideNeeds",Dov.GuideNeeds),
- new SqlParameter("@MealNeeds",Dov.MealNeeds),
- new SqlParameter("@CheckInTime",Dov.CheckInTime),
- new SqlParameter("@HotelLevel",Dov.HotelLevel),
- new SqlParameter("@HotelPosition",Dov.HotelPosition),
- new SqlParameter("@RoomNum",Dov.RoomNum),
- new SqlParameter("@NeedsRemark",Dov.NeedsRemark),
- 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;
- }
- //改Update
- public bool Edit(DeleClientNeeds Dov)
- {
- string sql = "update DeleClientNeeds set Diid=@Diid,OffActPlace=@OffActPlace,TransNeed=@TransNeed,TranLanguage=@TranLanguage,TranScene=@TranScene,"
- + "OffActLetter=@OffActLetter,VisaNeeds=@VisaNeeds,Hobby=@Hobby,CarNeeds=@CarNeeds,"
- + "GuideNeeds=@GuideNeeds,MealNeeds=@MealNeeds,CheckInTime=@CheckInTime,HotelLevel=@HotelLevel,"
- + "HotelPosition=@HotelPosition,RoomNum=@RoomNum,NeedsRemark=@NeedsRemark,OPer=@OPer,OPdate=@OPdate,Isdel=@Isdel where Id = @Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Diid",Dov.Diid),
- new SqlParameter("@OffActPlace",Dov.OffActPlace),
- new SqlParameter("@OffActLetter",Dov.OffActLetter),
- new SqlParameter("@TransNeed",Dov.TransNeed),
- new SqlParameter("@TranLanguage",Dov.TranLanguage),
- new SqlParameter("@TranScene",Dov.TranScene),
- new SqlParameter("@VisaNeeds",Dov.VisaNeeds),
- new SqlParameter("@Hobby",Dov.Hobby),
- new SqlParameter("@CarNeeds",Dov.CarNeeds),
- new SqlParameter("@GuideNeeds",Dov.GuideNeeds),
- new SqlParameter("@MealNeeds",Dov.MealNeeds),
- new SqlParameter("@CheckInTime",Dov.CheckInTime),
- new SqlParameter("@HotelLevel",Dov.HotelLevel),
- new SqlParameter("@HotelPosition",Dov.HotelPosition),
- new SqlParameter("@RoomNum",Dov.RoomNum),
- new SqlParameter("@NeedsRemark",Dov.NeedsRemark),
- 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;
- }
- //删
- public bool delOA(int id)
- {
- if (SqlHelper.ExecuteNonQuery("update DeleClientNeeds set Isdel=1 where Id=@Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- public List<DeleClientNeeds> GetByNameAndPhone(string name, string Phone)
- {
- return excuteSql("select * from DeleClientNeeds where Isdel=0 and Name='" + name + "' and Phone='" + Phone + "'");
- }
- }
- }
|