Country_FeeCostServcies.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Data.SqlClient;
  5. using System.Linq;
  6. using System.Text;
  7. using Models;
  8. namespace DAL
  9. {
  10. public class Country_FeeCostServcies
  11. {
  12. /// <summary>
  13. /// 查询所有
  14. /// </summary>
  15. /// <param name="sql">sql语句</param>
  16. /// <param name="param">可变参数数组</param>
  17. /// <returns>返回集合</returns>
  18. List<Country_FeeCost> excuteSql(string sql, params SqlParameter[] param)
  19. {
  20. return ServiceBase<Country_FeeCost>.excuteSql(new Country_FeeCost(), "Country_FeeCost", sql, CommandType.Text, param);
  21. }
  22. /// <summary>
  23. /// 查询签证费用标准所有信息
  24. /// </summary>
  25. /// <param name="id">对象编号</param>
  26. /// <returns>返回空或者单个对象信息</returns>
  27. public List<Country_FeeCost> GetCountry_FeeCostAll()
  28. {
  29. //调用获取单个对象的方法
  30. return excuteSql("select * from Country_FeeCost where Isdel=0 ");
  31. }
  32. /// <summary>
  33. /// 查询分页(团组表和签证表关联的数据)
  34. /// </summary>
  35. /// <param name="pageIndex"></param>
  36. /// <param name="sumPage"></param>
  37. /// <param name="totalRecord"></param>
  38. /// <param name="Name"></param>
  39. /// <returns></returns>
  40. public List<Country_FeeCost> GetPageToAll(int pageIndex, out int sumPage, out int totalRecord, string Name,int[] ids)
  41. {
  42. string[] name = { "", "", "", "" };
  43. if (!string.IsNullOrEmpty(Name))
  44. {
  45. for (int i = 0; i < Name.Length; i++)
  46. {
  47. name[i] = Name.Substring(i, 1);
  48. }
  49. }
  50. string sqlwhere = "isDel = 0 and in ("+ids+ ") and (CCountryName like '%" + name[0] + "%')";
  51. return PageBase<Country_FeeCost>.excutePageSql(new Country_FeeCost(), "Country_FeeCost", "Country_FeeCost", "*", "VisaId asc", sqlwhere, 5, pageIndex, out sumPage, out totalRecord);
  52. }
  53. /// <summary>
  54. /// 查询分页
  55. /// </summary>
  56. /// <param name="pageIndex"></param>
  57. /// <param name="sumPage"></param>
  58. /// <param name="totalRecord"></param>
  59. /// <param name="Name"></param>
  60. /// <returns></returns>
  61. public List<Country_FeeCost> GetPage(int pageIndex, out int sumPage, out int totalRecord, string Name)
  62. {
  63. string[] name = { "", "", "", "","","" };
  64. if (!string.IsNullOrEmpty(Name))
  65. {
  66. for (int i = 0; i < Name.Length; i++)
  67. {
  68. name[i] = Name.Substring(i, 1);
  69. }
  70. }
  71. string sqlwhere = "isDel = 0 and (VisaCountry like '%" + name[0] + "%')";
  72. return PageBase<Country_FeeCost>.excutePageSql(new Country_FeeCost(), "Country_FeeCost", "Country_FeeCost", "* ", " VisaId asc", sqlwhere, 5, pageIndex, out sumPage, out totalRecord);
  73. }
  74. /// <summary>
  75. /// 获取单个对象
  76. /// </summary>
  77. /// <param name="sql">sql语句</param>
  78. /// <param name="param">可变参数数组</param>
  79. /// <returns>返回空或者单个对象</returns>
  80. Country_FeeCost excuteType(string sql, params SqlParameter[] param)
  81. {
  82. //查询结果放入对象集合
  83. List<Country_FeeCost> diList = excuteSql(sql, param);
  84. //判断集合是否为空
  85. if (diList == null || diList.Count == 0)
  86. //返回null
  87. return null;
  88. //返回单个对象
  89. return diList[0];
  90. }
  91. /// <summary>
  92. /// 根据编号查询对象信息
  93. /// </summary>
  94. /// <param name="id">对象编号</param>
  95. /// <returns>返回空或者单个对象信息</returns>
  96. public List<Country_FeeCost> GetCountry_FeeCostByID(int diid)
  97. {
  98. //调用获取单个对象的方法
  99. return excuteSql(@"select t2.* from DelegationInfo t1, Country_FeeCost t2, DelegationInfoOrFeeCost t3
  100. where t1.id=t3.diid and t2.VisaId = t3.cfcid and t2.isdel=0 and t3.isdel=0 and t1.id=" + diid);
  101. }
  102. /// <summary>
  103. /// 根据国家名查询对象信息
  104. /// </summary>
  105. /// <param name="id">对象编号</param>
  106. /// <returns>返回空或者单个对象信息</returns>
  107. public Country_FeeCost GetCountry_FeeCostByCountry(string countryName)
  108. {
  109. //调用获取单个对象的方法
  110. return excuteType("select * from Country_FeeCost where Isdel=0 and VisaCountry='" + countryName+"'");
  111. }
  112. /// <summary>
  113. /// 根据编号查询对象信息
  114. /// </summary>
  115. /// <param name="id">对象编号</param>
  116. /// <returns>返回空或者单个对象信息</returns>
  117. public Country_FeeCost GetCountry_FeeCostByIDOne(int cid)
  118. {
  119. //调用获取单个对象的方法
  120. return excuteType("select * from Country_FeeCost where Isdel=0 and VisaId=" + cid);
  121. }
  122. /// <summary>
  123. /// 修改这条签证的状态
  124. /// </summary>
  125. /// <param name="id"></param>
  126. /// <param name="userid"></param>
  127. /// <param name="datetime"></param>
  128. /// <returns></returns>
  129. public bool delCountry_FeeCost(int id, int userid, string datetime)
  130. {
  131. string sql = "update Country_FeeCost set Isdel=1, Oper=@Oper, OPDate=@OPDate where VisaId=@visaId";
  132. SqlParameter[] parameter = new SqlParameter[]{
  133. new SqlParameter("@visaId",id),
  134. new SqlParameter("@OPDate",datetime),
  135. new SqlParameter("@Oper",userid)
  136. };
  137. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  138. return true;
  139. return false;
  140. }
  141. ///修改签证信息
  142. ///
  143. public bool UpdateCountry_FeeCost(Country_FeeCost cf)
  144. {
  145. string sql = "update Country_FeeCost set VisaContinent=@VisaContinent,VisaCountry=@VisaCountry,IsVisaExemption=@IsVisaExemption,IsVisaOnArrival=@IsVisaOnArrival,"+
  146. "IsElectronicSignature=@IsElectronicSignature,VisaPrice=@VisaPrice,VisaPriceDesc=@VisaPriceDesc,VisaTime=@VisaTime,UrgentTime=@UrgentTime,UrgentPrice=@UrgentPrice,"+
  147. "UrgentPriceDesc=@UrgentPriceDesc,VisaRemark=@VisaRemark,Oper=@Oper,OPDate=@OPDate,isDel=@isDel where VisaId=@VisaId";
  148. SqlParameter[] parameter = new SqlParameter[]{
  149. new SqlParameter("@VisaId",cf.VisaId),
  150. new SqlParameter("@VisaContinent",cf.VisaContinent),
  151. new SqlParameter("@VisaCountry",cf.VisaCountry),
  152. new SqlParameter("@IsVisaExemption",cf.IsVisaExemption),
  153. new SqlParameter("@IsVisaOnArrival",cf.IsVisaOnArrival),
  154. new SqlParameter("@IsElectronicSignature",cf.IsElectronicSignature),
  155. new SqlParameter("@VisaPrice",cf.VisaPrice),
  156. new SqlParameter("@VisaPriceDesc",cf.VisaPriceDesc),
  157. new SqlParameter("@VisaTime",cf.VisaTime),
  158. new SqlParameter("@UrgentTime",cf.UrgentTime),
  159. new SqlParameter("@UrgentPrice",cf.UrgentPrice),
  160. new SqlParameter("@UrgentPriceDesc",cf.UrgentPriceDesc),
  161. new SqlParameter("@VisaRemark",cf.VisaRemark),
  162. new SqlParameter("@Oper",cf.Oper),
  163. new SqlParameter("@OPDate",cf.OPDate),
  164. new SqlParameter("@isDel",cf.isDel)
  165. };
  166. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  167. return true;
  168. return false;
  169. }
  170. /// <summary>
  171. /// 更新签证表
  172. /// </summary>
  173. /// <param name="cf"></param>
  174. /// <returns></returns>
  175. public bool T0UpdateVisaFrom(Country_FeeCost cf)
  176. {
  177. string sql = "update Country_FeeCost set IsVisaExemption=@IsVisaExemption,IsVisaOnArrival=@IsVisaOnArrival,IsElectronicSignature=@IsElectronicSignature," +
  178. "VisaTime=@VisaTime,VisaType=@VisaType,Oper=@Oper,OPDate=@OPDate,isDel=@isDel where VisaId=@VisaId";
  179. SqlParameter[] parameter = new SqlParameter[]{
  180. new SqlParameter("@VisaId",cf.VisaId),
  181. new SqlParameter("@IsVisaExemption",cf.IsVisaExemption),
  182. new SqlParameter("@IsVisaOnArrival",cf.IsVisaOnArrival),
  183. new SqlParameter("@IsElectronicSignature",cf.IsElectronicSignature),
  184. new SqlParameter("@VisaTime",cf.VisaTime),
  185. new SqlParameter("@VisaType",cf.VisaType),
  186. new SqlParameter("@Oper",cf.Oper),
  187. new SqlParameter("@OPDate",cf.OPDate),
  188. new SqlParameter("@isDel",cf.isDel)
  189. };
  190. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  191. return true;
  192. return false;
  193. }
  194. /// <summary>
  195. /// 添加签证费用标准信息
  196. /// </summary>
  197. /// <param name="Dov"></param>
  198. /// <returns></returns>
  199. public bool Add(Country_FeeCost cf)
  200. {
  201. string sql = "insert into Country_FeeCost values(@VisaContinent,@VisaCountry,@IsVisaExemption,@IsVisaOnArrival,@IsElectronicSignature,@VisaPrice,@VisaPriceDesc,@VisaType,"+
  202. "@VisaTime,@IsUrgent,@UrgentTime,@UrgentPrice,@UrgentPriceDesc,@VisaAddress,@VisaRemark,@Oper,@OPDate,@isDel);SELECT @@IDENTITY";
  203. SqlParameter[] parameter = new SqlParameter[]{
  204. new SqlParameter("@VisaContinent",cf.VisaContinent),
  205. new SqlParameter("@VisaCountry",cf.VisaCountry),
  206. new SqlParameter("@IsVisaExemption",cf.IsVisaExemption),
  207. new SqlParameter("@IsVisaOnArrival",cf.IsVisaOnArrival),
  208. new SqlParameter("@IsElectronicSignature",cf.IsElectronicSignature),
  209. new SqlParameter("@VisaPrice",cf.VisaPrice),
  210. new SqlParameter("@VisaPriceDesc",cf.VisaPriceDesc),
  211. new SqlParameter("@VisaType",cf.VisaType),
  212. new SqlParameter("@VisaTime",cf.VisaTime),
  213. new SqlParameter("@IsUrgent",cf.IsUrgent),
  214. new SqlParameter("@UrgentTime",cf.UrgentTime),
  215. new SqlParameter("@UrgentPrice",cf.UrgentPrice),
  216. new SqlParameter("@UrgentPriceDesc",cf.UrgentPriceDesc),
  217. new SqlParameter("@VisaAddress",cf.VisaAddress),
  218. new SqlParameter("@VisaRemark",cf.VisaRemark),
  219. new SqlParameter("@Oper",cf.Oper),
  220. new SqlParameter("@OPDate",cf.OPDate),
  221. new SqlParameter("@isDel",cf.isDel)
  222. };
  223. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  224. return true;
  225. return false;
  226. }
  227. }
  228. }