DelegationInfoService.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Models;
  6. using System.Data.SqlClient;
  7. using System.Data;
  8. namespace DAL
  9. {
  10. /// <summary>
  11. /// 团组信息数据访问类
  12. /// </summary>
  13. public class DelegationInfoService
  14. {
  15. /// <summary>
  16. /// 查询所有
  17. /// </summary>
  18. /// <param name="sql">sql语句</param>
  19. /// <param name="param">可变参数数组</param>
  20. /// <returns>返回集合</returns>
  21. List<DelegationInfo> excuteSql(string sql, params SqlParameter[] param)
  22. {
  23. return ServiceBase<DelegationInfo>.excuteSql(new DelegationInfo(), "DelegationInfo", sql, CommandType.Text, param);
  24. }
  25. /// <summary>
  26. /// 获取单个对象
  27. /// </summary>
  28. /// <param name="sql">sql语句</param>
  29. /// <param name="param">可变参数数组</param>
  30. /// <returns>返回空或者单个对象</returns>
  31. DelegationInfo excuteType(string sql, params SqlParameter[] param)
  32. {
  33. //查询结果放入对象集合
  34. List<DelegationInfo> diList = excuteSql(sql, param);
  35. //判断集合是否为空
  36. if (diList == null || diList.Count == 0)
  37. //返回null
  38. return null;
  39. //返回单个对象
  40. return diList[0];
  41. }
  42. /// <summary>
  43. /// 根据编号查询对象信息
  44. /// </summary>
  45. /// <param name="id">对象编号</param>
  46. /// <returns>返回空或者单个对象信息</returns>
  47. public DelegationInfo GetDelegationInfoByID(int id)
  48. {
  49. //调用获取单个对象的方法
  50. return excuteType("select * from DelegationInfo where Id = @id and isdel=0 order by id asc", new SqlParameter("@id", id));
  51. }
  52. /// <summary>
  53. /// 根据编号查询已删除团组信息
  54. /// 20210924 贾文滔
  55. /// </summary>
  56. /// <param name="id">对象编号</param>
  57. /// <returns>返回空或者单个对象信息</returns>
  58. public DelegationInfo GetRemoveDeleByID(int id)
  59. {
  60. //调用获取单个对象的方法
  61. return excuteType("select * from DelegationInfo where Id = @id and isdel=1 ", new SqlParameter("@id", id));
  62. }
  63. /// <summary>
  64. /// 根据团组名查询对象信息
  65. /// </summary>
  66. /// <param name="id">对象编号</param>
  67. /// <returns>返回空或者单个对象信息</returns>
  68. public DelegationInfo GetDelegationInfoByName(string name)
  69. {
  70. //调用获取单个对象的方法
  71. return excuteType("select * from DelegationInfo where Isdel=0 and TeamName ='" + name + "'");
  72. }
  73. /// <summary>
  74. /// 根据国家名查询对象信息
  75. /// </summary>
  76. /// <param name="id">对象编号</param>
  77. /// <returns>返回空或者单个对象信息</returns>
  78. public DelegationInfo GetDelegationInfoByCountryName(string name)
  79. {
  80. //调用获取单个对象的方法
  81. return excuteType("select * from DelegationInfo where Isdel=0 and Visitcountry ='" + name + "'");
  82. }
  83. /// <summary>
  84. /// 获取全部
  85. /// </summary>
  86. /// <returns></returns>
  87. public List<DelegationInfo> GetAll()
  88. {
  89. return excuteSql("select * from DelegationInfo Where IsDel = 0 order by Id desc");
  90. }
  91. /// <summary>
  92. /// 获取全部
  93. /// </summary>
  94. /// <returns></returns>
  95. public List<DelegationInfo> GetAllByTourCode()
  96. {
  97. return excuteSql("select * from DelegationInfo Where IsDel = 0 and TourCode is not null and IsState = 0 order by VisitStartDate desc");
  98. }
  99. /// <summary>
  100. /// 按团组名 查询信息
  101. /// </summary>
  102. /// <param name="TeamName"></param>
  103. /// <returns></returns>
  104. public DelegationInfo GetSingleByTeamName(string TeamName)
  105. {
  106. return excuteType("select * from DelegationInfo Where IsDel = 0 and TourCode is not null and TeamName like '%" + TeamName + "%' and IsState = 0 order by VisitStartDate desc");
  107. }
  108. /// <summary>
  109. /// 按团组名 查询多条信息
  110. /// </summary>
  111. /// <param name="TeamName"></param>
  112. /// <returns></returns>
  113. public List<DelegationInfo> GetByListTeamName(string TeamName)
  114. {
  115. return excuteSql("select * from DelegationInfo Where IsDel = 0 and TourCode is not null and TeamName like '%" + TeamName + "%' and IsState = 0 order by VisitStartDate desc");
  116. }
  117. /// <summary>
  118. /// 获取全部
  119. /// </summary>
  120. /// <returns></returns>
  121. public List<DelegationInfo> GetAllByTourCodeInId(string arrayId)
  122. {
  123. return excuteSql("select * from DelegationInfo Where IsDel = 0 and TourCode is not null and IsState = 0 and Id in (" + arrayId + ") order by VisitStartDate desc");
  124. }
  125. /// <summary>
  126. /// 根据条件查询条件获取 - 分页
  127. /// </summary>
  128. /// <param name="pageIndex"></param>
  129. /// <param name="sumPage"></param>
  130. /// <param name="totalRecord"></param>
  131. /// <param name="teamName"></param>
  132. /// <param name="startTime"></param>
  133. /// <param name="endTime"></param>
  134. /// <returns></returns>
  135. public List<DelegationInfo> GetAll(int pageIndex, out int sumPage, out int totalRecord, string teamName, string startTime, string endTime)
  136. {
  137. string sqlwhere = "TeamName like '%" + teamName + "%' and IsDel = 0";
  138. if (!string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime))
  139. sqlwhere += " and (VisitDate between '" + startTime + "' and '" + endTime + "')";
  140. return PageBase<DelegationInfo>.excutePageSql(new DelegationInfo(), "DelegationInfo", "DelegationInfo", "*", "jietuanTime desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
  141. }
  142. /// <summary>
  143. /// 根据条件查询条件获取 - 分页
  144. /// </summary>
  145. /// <param name="pageIndex"></param>
  146. /// <param name="sumPage"></param>
  147. /// <param name="totalRecord"></param>
  148. /// <param name="dataType"></param>
  149. /// <param name="name"></param>
  150. /// <returns></returns>
  151. public List<DelegationInfo> GetAll(int pageIndex, out int sumPage, out int totalRecord, string isState, string teamType, string teamName, string clientName, string clientUnit, string startTime, string endTime, string tourCode, string userId)
  152. {
  153. string sqlwhere = "TeamName like '%" + teamName + "%' and ClientName like '%" + clientName + "%' and ClientUnit like '%" + clientUnit + "%' and IsSure = " + isState + " and IsDel = 0";
  154. if (teamType != "全部")
  155. sqlwhere += " and TeamDid = " + teamType;
  156. if (!string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime))
  157. sqlwhere += " and (VisitDate between '" + startTime + "' and '" + endTime + "')";
  158. if (!string.IsNullOrEmpty(userId))
  159. sqlwhere += " and JietuanOperator = " + userId;
  160. if (!string.IsNullOrEmpty(tourCode))
  161. sqlwhere += " and TourCode like '%" + tourCode + "%'";
  162. return PageBase<DelegationInfo>.excutePageSql(new DelegationInfo(), "DelegationInfo", "DelegationInfo", "*", "jietuanTime desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
  163. }
  164. /// <summary>
  165. /// 根据条件查询条件获取 - 分页
  166. /// </summary>
  167. /// <param name="pageIndex"></param>
  168. /// <param name="sumPage"></param>
  169. /// <param name="totalRecord"></param>
  170. /// <param name="dataType"></param>
  171. /// <param name="name"></param>
  172. /// <returns></returns>
  173. public List<DelegationInfo> GetAllByStatistics(int pageIndex, out int sumPage, out int totalRecord, string isState, string teamType, string teamName, string clientName, string clientUnit, string startTime, string endTime, string tourCode, string userId)
  174. {
  175. string sqlwhere = "(TourCode <> '' and TourCode is not null) and TeamName like '%" + teamName + "%' and ClientName like '%" + clientName + "%' and ClientUnit like '%" + clientUnit + "%' and IsSure = " + isState + " and IsDel = 0 ";
  176. if (teamType != "全部")
  177. sqlwhere += " and TeamDid = " + teamType;
  178. if (!string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime))
  179. sqlwhere += " and (VisitDate between '" + startTime + "' and '" + endTime + "')";
  180. if (!string.IsNullOrEmpty(userId))
  181. sqlwhere += " and JietuanOperator = " + userId;
  182. if (!string.IsNullOrEmpty(tourCode))
  183. sqlwhere += " and TourCode like '%" + tourCode + "%'";
  184. return PageBase<DelegationInfo>.excutePageSql(new DelegationInfo(), "DelegationInfo", "DelegationInfo", "*", "VisitDate desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
  185. }
  186. /// <summary>
  187. /// 获取对象
  188. /// </summary>
  189. /// <returns></returns>
  190. public DelegationInfo GetDelegationInfo(string clientName, string clientUnit, string teamName, int teamDid, string visitDate)
  191. {
  192. string sql = "select * from DelegationInfo Where IsDel = 0 and ClientName = @ClientName and ClientUnit = @ClientUnit and TeamName = @TeamName and TeamDid = @TeamDid and VisitDate = @VisitDate";
  193. SqlParameter[] parameter = new SqlParameter[]{
  194. new SqlParameter("@ClientName",clientName),
  195. new SqlParameter("@ClientUnit",clientUnit),
  196. new SqlParameter("@TeamName",teamName),
  197. new SqlParameter("@TeamDid",teamDid),
  198. new SqlParameter("@VisitDate",visitDate)
  199. };
  200. return excuteType(sql, parameter);
  201. }
  202. /// <summary>
  203. /// 新增
  204. /// </summary>
  205. /// <param name="sdt">对象</param>
  206. public bool AddDelegationInfo(DelegationInfo di, out int id)
  207. {
  208. string sql = "insert into DelegationInfo"
  209. + "(SalesQuoteNo,SalesDate,ClientName,ClientUnit,TeamName,TeamDid,VisitDate,VisitCountry,"
  210. + "VisitPurpose,VisitDays,VisitPNumber,SpecialNeeds,OtherNeeds,Remark,IsState,JietuanOperator,JietuanTime,IsDel,BudgetCost,TellPhone,"
  211. + "TeamLev,HotelComplain,OPComplain,VisaComplain,OAComplain,AirComplain,Director,TontractTime,PaymentMoney,PayDay,CGRWSPBMMC,CGRWSPWH,ZZSCBMMC,ZZSCSPWH,WeChat,OpRoyaltyLv,OpRoyaltyRemark) "
  212. + "values("
  213. + "@SalesQuoteNo,@SalesDate,@ClientName,@ClientUnit,@TeamName,@TeamDid,@VisitDate,@VisitCountry,"
  214. + "@VisitPurpose,@VisitDays,@VisitPNumber,@SpecialNeeds,@OtherNeeds,@Remark,@IsState,@JietuanOperator,@JietuanTime,@IsDel,@BudgetCost,@TellPhone,"
  215. + "@TeamLev,@HotelComplain,@OPComplain,@VisaComplain,@OAComplain,@AirComplain,@Director,@TontractTime,@PaymentMoney,@PayDay,@CGRWSPBMMC,@CGRWSPWH,@ZZSCBMMC,@ZZSCSPWH,@WeChat,@OpRoyaltyLv,@OpRoyaltyRemark);SELECT @@IDENTITY";
  216. SqlParameter[] parameter = new SqlParameter[]{
  217. new SqlParameter("@SalesQuoteNo",di.SalesQuoteNo),
  218. new SqlParameter("@SalesDate",di.SalesDate),
  219. new SqlParameter("@ClientName",di.ClientName),
  220. new SqlParameter("@ClientUnit",di.ClientUnit),
  221. new SqlParameter("@TeamName",di.TeamName),
  222. new SqlParameter("@TeamDid",di.TeamDid),
  223. new SqlParameter("@VisitDate",di.VisitDate),
  224. new SqlParameter("@VisitCountry",di.VisitCountry),
  225. new SqlParameter("@VisitPurpose",di.VisitPurpose),
  226. new SqlParameter("@VisitDays",di.VisitDays),
  227. new SqlParameter("@VisitPNumber",di.VisitPNumber),
  228. new SqlParameter("@SpecialNeeds",di.SpecialNeeds),
  229. new SqlParameter("@OtherNeeds",di.OtherNeeds),
  230. new SqlParameter("@Remark",di.Remark),
  231. new SqlParameter("@IsState",di.IsState),
  232. new SqlParameter("@JietuanOperator",di.JietuanOperator),
  233. new SqlParameter("@JietuanTime",di.JietuanTime),
  234. new SqlParameter("@IsDel",di.IsDel),
  235. new SqlParameter("@BudgetCost",di.BudgetCost),
  236. new SqlParameter("@TellPhone",di.TellPhone),
  237. new SqlParameter("@TeamLev",di.TeamLev),
  238. new SqlParameter("@HotelComplain",di.HotelComplain),
  239. new SqlParameter("@OPComplain",di.OPComplain),
  240. new SqlParameter("@VisaComplain",di.VisaComplain),
  241. new SqlParameter("@OAComplain",di.OAComplain),
  242. new SqlParameter("@AirComplain",di.AirComplain),
  243. new SqlParameter("@Director",di.Director),
  244. new SqlParameter("@TontractTime",di.TontractTime),
  245. new SqlParameter("@PaymentMoney",di.PaymentMoney),
  246. new SqlParameter("@PayDay",di.PayDay),
  247. //@CGRWSPBMMC,@CGRWSPWH,@ZZSCBMMC,@ZZSCSPWH
  248. new SqlParameter("@CGRWSPBMMC",di.CGRWSPBMMC),
  249. new SqlParameter("@CGRWSPWH",di.CGRWSPWH),
  250. new SqlParameter("@ZZSCBMMC",di.ZZSCBMMC),
  251. new SqlParameter("@ZZSCSPWH",di.ZZSCSPWH),
  252. new SqlParameter("@WeChat",di.WeChat),
  253. new SqlParameter("@OpRoyaltyLv",di.OpRoyaltyLv),
  254. new SqlParameter("@OpRoyaltyRemark",di.OpRoyaltyRemark)
  255. };
  256. int obj = Convert.ToInt32(SqlHelper.ExecuteScalar(sql, CommandType.Text, parameter));
  257. if (obj > 0)
  258. {
  259. id = obj;
  260. return true;
  261. }
  262. else
  263. {
  264. id = 0;
  265. return false;
  266. }
  267. //if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  268. // return true;
  269. //return false;
  270. }
  271. /// <summary>
  272. /// 编辑
  273. /// </summary>
  274. /// <param name="sdt"></param>
  275. /// <returns></returns>
  276. public bool EditDelegationInfo(DelegationInfo di)
  277. {
  278. string sql = "update DelegationInfo set "
  279. + "ClientName = @ClientName,ClientUnit = @ClientUnit,TeamName = @TeamName,TeamDid = @TeamDid,"
  280. + "VisitDate = @VisitDate,VisitStartDate = @VisitStartDate,VisitEndDate = @VisitEndDate,VisitCountry = @VisitCountry,"
  281. + "VisitPurpose = @VisitPurpose,VisitDays = @VisitDays,VisitPNumber = @VisitPNumber,SpecialNeeds = @SpecialNeeds,OtherNeeds = @OtherNeeds,"
  282. + "Remark = @Remark,JietuanOperator = @JietuanOperator,JietuanTime = @JietuanTime,BudgetCost = @BudgetCost,TellPhone = @TellPhone,"
  283. + "TeamLev = @TeamLev,HotelComplain = @HotelComplain,OPComplain = @OPComplain,VisaComplain = @VisaComplain,OAComplain = @OAComplain,AirComplain = @AirComplain,"
  284. + "Director = @Director,TontractTime = @TontractTime,PaymentMoney = @PaymentMoney,PayDay=@PayDay,CGRWSPBMMC=@CGRWSPBMMC,CGRWSPWH=@CGRWSPWH,ZZSCBMMC=@ZZSCBMMC," +
  285. "ZZSCSPWH=@ZZSCSPWH,WeChat=@WeChat,OpRoyaltyLv=@OpRoyaltyLv,OpRoyaltyRemark=@OpRoyaltyRemark where Id = @Id";
  286. SqlParameter[] parameter = new SqlParameter[] {
  287. new SqlParameter("@ClientName",di.ClientName),
  288. new SqlParameter("@ClientUnit",di.ClientUnit),
  289. new SqlParameter("@TeamName",di.TeamName),
  290. new SqlParameter("@TeamDid",di.TeamDid),
  291. new SqlParameter("@VisitDate",di.VisitDate),
  292. new SqlParameter("@VisitStartDate",di.VisitStartDate),
  293. new SqlParameter("@VisitEndDate",di.VisitEndDate),
  294. new SqlParameter("@VisitCountry",di.VisitCountry),
  295. new SqlParameter("@VisitPurpose",di.VisitPurpose),
  296. new SqlParameter("@VisitDays",di.VisitDays),
  297. new SqlParameter("@VisitPNumber",di.VisitPNumber),
  298. new SqlParameter("@SpecialNeeds",di.SpecialNeeds),
  299. new SqlParameter("@OtherNeeds",di.OtherNeeds),
  300. new SqlParameter("@Remark",di.Remark),
  301. new SqlParameter("@JietuanOperator",di.JietuanOperator),
  302. new SqlParameter("@JietuanTime",di.JietuanTime),
  303. new SqlParameter("@BudgetCost",di.BudgetCost),
  304. new SqlParameter("@Id",di.Id),
  305. new SqlParameter("@TellPhone",di.TellPhone),
  306. new SqlParameter("@TeamLev",di.TeamLev),
  307. new SqlParameter("@HotelComplain",di.HotelComplain),
  308. new SqlParameter("@OPComplain",di.OPComplain),
  309. new SqlParameter("@VisaComplain",di.VisaComplain),
  310. new SqlParameter("@OAComplain",di.OAComplain),
  311. new SqlParameter("@AirComplain",di.AirComplain),
  312. new SqlParameter("@Director",di.Director),
  313. new SqlParameter("@TontractTime",di.TontractTime),
  314. new SqlParameter("@PaymentMoney",di.PaymentMoney),
  315. new SqlParameter("@PayDay",di.PayDay),
  316. //@CGRWSPBMMC,@CGRWSPWH,@ZZSCBMMC,@ZZSCSPWH
  317. new SqlParameter("@CGRWSPBMMC",di.CGRWSPBMMC),
  318. new SqlParameter("@CGRWSPWH",di.CGRWSPWH),
  319. new SqlParameter("@ZZSCBMMC",di.ZZSCBMMC),
  320. new SqlParameter("@ZZSCSPWH",di.ZZSCSPWH),
  321. new SqlParameter("@WeChat",di.WeChat),
  322. new SqlParameter("@OpRoyaltyLv",di.OpRoyaltyLv),
  323. new SqlParameter("@OpRoyaltyRemark",di.OpRoyaltyRemark)
  324. };
  325. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  326. return true;
  327. return false;
  328. }
  329. /// <summary>
  330. /// 编辑
  331. /// </summary>
  332. /// <param name="sdt"></param>
  333. /// <returns></returns>
  334. public bool EditDelegationInfoOperations(DelegationInfo di)
  335. {
  336. string sql = "update DelegationInfo set TourCode = @TourCode,VisitDate = @VisitDate,VisitStartDate = @VisitStartDate,"
  337. +"VisitEndDate = @VisitEndDate,VisitPurpose = @VisitPurpose,VisitDays = @VisitDays,ClientNeeds = @ClientNeeds,Remark = @Remark,"
  338. +"GroupsOperator = @GroupsOperator,GroupsTime = @GroupsTime,BudgetCost = @BudgetCost where Id = @Id";
  339. SqlParameter[] parameter = new SqlParameter[] {
  340. new SqlParameter("@TourCode",di.TourCode),
  341. new SqlParameter("@VisitDate",di.VisitDate),
  342. new SqlParameter("@VisitStartDate",di.VisitStartDate),
  343. new SqlParameter("@VisitEndDate",di.VisitEndDate),
  344. new SqlParameter("@VisitDays",di.VisitDays),
  345. new SqlParameter("@VisitPurpose",di.VisitPurpose),
  346. new SqlParameter("@ClientNeeds",di.ClientNeeds),
  347. new SqlParameter("@Remark",di.Remark),
  348. new SqlParameter("@GroupsOperator",di.GroupsOperator),
  349. new SqlParameter("@GroupsTime",di.GroupsTime),
  350. new SqlParameter("@BudgetCost",di.BudgetCost),
  351. new SqlParameter("@Id",di.Id)
  352. };
  353. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  354. return true;
  355. return false;
  356. }
  357. /// <summary>
  358. /// 删除
  359. /// </summary>
  360. /// <param name="id"></param>
  361. /// <returns></returns>
  362. public bool DelDelegationInfo(int id)
  363. {
  364. if (SqlHelper.ExecuteNonQuery("update DelegationInfo set IsDel = 1 where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  365. return true;
  366. return false;
  367. }
  368. /// <summary>
  369. /// 更改状态
  370. /// </summary>
  371. /// <param name="id"></param>
  372. /// <returns></returns>
  373. public bool UpdateDelegationInfoState(int id)
  374. {
  375. if (SqlHelper.ExecuteNonQuery("update DelegationInfo set IsState = 1 where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  376. return true;
  377. return false;
  378. }
  379. /// <summary>
  380. /// LiuChengYi 2014/4/16
  381. /// 用于出访国家的数据统计
  382. /// </summary>
  383. /// <returns></returns>
  384. public DataTable ReportDelegationInfo()
  385. {
  386. return SqlHelper.TransferProcedure("DelegationsToVisitStatisticsList", CommandType.StoredProcedure);
  387. }
  388. /// <summary>
  389. /// 更改是否操作完成状态
  390. /// </summary>
  391. /// <param name="diid"></param>
  392. /// <returns></returns>
  393. public bool EditDelegationInfoAsSure(int id)
  394. {
  395. if (SqlHelper.ExecuteNonQuery("update DelegationInfo set IsSure = 1,SureTime='" + DateTime.Now + "' where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  396. return true;
  397. return false;
  398. }
  399. /// <summary>
  400. /// LiuChengYi 2014/4/16
  401. /// 用于出访国家的数据统计
  402. /// </summary>
  403. /// <returns></returns>
  404. public DataTable ReportDelegationInfo(string year)
  405. {
  406. SqlParameter[] pars =
  407. {
  408. new SqlParameter("@year",year)
  409. };
  410. return SqlHelper.TransferProcedure("DelegationsToVisitStatisticsList", CommandType.StoredProcedure, pars);
  411. }
  412. public List<DelegationInfo> getByName(string name)
  413. {
  414. return excuteSql("select * from DelegationInfo where Isdel=0 and TeamName like '%" + name + "%' order by Id");
  415. }
  416. /// <summary>
  417. /// 根据年份查询 出访团组
  418. /// </summary>
  419. /// <param name="year">年份</param>
  420. /// <returns></returns>
  421. public List<DelegationInfo> getByVisitDate(string year)
  422. {
  423. return excuteSql("select * from DelegationInfo where Isdel=0 and VisitDate like '" + year + "%' order by VisitDate");
  424. }
  425. /// <summary>
  426. /// 贾文滔 2021-06-23
  427. /// 根据指定时间段查询团组
  428. /// </summary>
  429. /// <param name="startDate"></param>
  430. /// <param name="endDate"></param>
  431. /// <returns></returns>
  432. public List<DelegationInfo> GetByTime(string startDate, string endDate)
  433. {
  434. //IsSure=1 and
  435. return excuteSql("select * from DelegationInfo where Isdel=0 and (VisitEndDate between '" + startDate + "' and '" + endDate + "') order by VisitEndDate");
  436. }
  437. /// <summary>
  438. /// 雷怡 2021-07-26 15:58
  439. /// 根据团组号查询团组
  440. /// </summary>
  441. /// <param name="startDate"></param>
  442. /// <param name="endDate"></param>
  443. /// <returns></returns>
  444. public DelegationInfo GetByTourCode(string TourCode)
  445. {
  446. return excuteType("select * from DelegationInfo where Isdel=0 and TourCode='" + TourCode + "'");
  447. }
  448. /// <summary>
  449. /// 根据条件查询条件获取 - 分页
  450. /// </summary>
  451. /// <param name="pageIndex"></param>
  452. /// <param name="sumPage"></param>
  453. /// <param name="totalRecord"></param>
  454. /// <param name="dataType"></param>
  455. /// <param name="name"></param>
  456. /// <returns></returns>
  457. public List<DelegationInfo> GetAirInfo(int pageIndex, out int sumPage, out int totalRecord, string country)
  458. {
  459. string sqlwhere = "(TourCode <> '' and TourCode is not null) and IsDel = 0 ";
  460. if (!string.IsNullOrEmpty(country) && !string.IsNullOrEmpty(country))
  461. sqlwhere += " and (VisitCountry like '%" + country + "%')";
  462. return PageBase<DelegationInfo>.excutePageSql(new DelegationInfo(), "DelegationInfo", "DelegationInfo", "*", "VisitDate desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
  463. }
  464. /// <summary>
  465. /// 雷怡 2021-08-03 15:20
  466. /// 根据时间段查询 出访团组数量
  467. /// </summary>
  468. /// <param name="startTime">开始时间</param>
  469. /// <param name="endTime">结束时间</param>
  470. /// <param name="typeId">
  471. /// 0:团组(38(政府团) 39(企业团) 40(散客团))
  472. /// 1:活动(102(未知) 248(非团组) 302(公关传媒部) 691(会务活动))
  473. /// </param>
  474. /// <returns></returns>
  475. public int GetMonthGroupNumber(string startTime, string endTime, int typeId)
  476. {
  477. string sql = "select * from DelegationInfo where Isdel = 0 ";
  478. if (typeId == 0)
  479. {
  480. sql += " and TeamDid in(38,39,40)";
  481. }
  482. else if (typeId == 1)
  483. {
  484. sql += " and TeamDid in(102,248,302,691)";
  485. }
  486. sql += " and VisitStartDate between '" + startTime + "' and '" + endTime + "'";
  487. return excuteSql(sql).Count;
  488. }
  489. /// <summary>
  490. /// 雷怡 2021-08-03 15:20
  491. /// 查询至今未完成的团 数量
  492. /// <returns></returns>
  493. public int GetUncollected()
  494. {
  495. string sql = "select * from DelegationInfo where isdel = 0 and IsSure = 0";
  496. return excuteSql(sql).Count;
  497. }
  498. }
  499. }