using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using Models; namespace DAL { public class Country_FeeCostServcies { /// /// 查询所有 /// /// sql语句 /// 可变参数数组 /// 返回集合 List excuteSql(string sql, params SqlParameter[] param) { return ServiceBase.excuteSql(new Country_FeeCost(), "Country_FeeCost", sql, CommandType.Text, param); } /// /// 查询签证费用标准所有信息 /// /// 对象编号 /// 返回空或者单个对象信息 public List GetCountry_FeeCostAll() { //调用获取单个对象的方法 return excuteSql("select * from Country_FeeCost where Isdel=0 "); } /// /// 查询分页(团组表和签证表关联的数据) /// /// /// /// /// /// public List GetPageToAll(int pageIndex, out int sumPage, out int totalRecord, string Name,int[] ids) { string[] name = { "", "", "", "" }; if (!string.IsNullOrEmpty(Name)) { for (int i = 0; i < Name.Length; i++) { name[i] = Name.Substring(i, 1); } } string sqlwhere = "isDel = 0 and in ("+ids+ ") and (CCountryName like '%" + name[0] + "%')"; return PageBase.excutePageSql(new Country_FeeCost(), "Country_FeeCost", "Country_FeeCost", "*", "VisaId asc", sqlwhere, 5, pageIndex, out sumPage, out totalRecord); } /// /// 查询分页 /// /// /// /// /// /// public List GetPage(int pageIndex, out int sumPage, out int totalRecord, string Name) { string[] name = { "", "", "", "","","" }; if (!string.IsNullOrEmpty(Name)) { for (int i = 0; i < Name.Length; i++) { name[i] = Name.Substring(i, 1); } } string sqlwhere = "isDel = 0 and (VisaCountry like '%" + name[0] + "%')"; return PageBase.excutePageSql(new Country_FeeCost(), "Country_FeeCost", "Country_FeeCost", "* ", " VisaId asc", sqlwhere, 5, pageIndex, out sumPage, out totalRecord); } /// /// 获取单个对象 /// /// sql语句 /// 可变参数数组 /// 返回空或者单个对象 Country_FeeCost excuteType(string sql, params SqlParameter[] param) { //查询结果放入对象集合 List diList = excuteSql(sql, param); //判断集合是否为空 if (diList == null || diList.Count == 0) //返回null return null; //返回单个对象 return diList[0]; } /// /// 根据编号查询对象信息 /// /// 对象编号 /// 返回空或者单个对象信息 public List GetCountry_FeeCostByID(int diid) { //调用获取单个对象的方法 return excuteSql(@"select t2.* from DelegationInfo t1, Country_FeeCost t2, DelegationInfoOrFeeCost t3 where t1.id=t3.diid and t2.VisaId = t3.cfcid and t2.isdel=0 and t3.isdel=0 and t1.id=" + diid); } /// /// 根据国家名查询对象信息 /// /// 对象编号 /// 返回空或者单个对象信息 public Country_FeeCost GetCountry_FeeCostByCountry(string countryName) { //调用获取单个对象的方法 return excuteType("select * from Country_FeeCost where Isdel=0 and VisaCountry='" + countryName+"'"); } /// /// 根据编号查询对象信息 /// /// 对象编号 /// 返回空或者单个对象信息 public Country_FeeCost GetCountry_FeeCostByIDOne(int cid) { //调用获取单个对象的方法 return excuteType("select * from Country_FeeCost where Isdel=0 and VisaId=" + cid); } /// /// 修改这条签证的状态 /// /// /// /// /// public bool delCountry_FeeCost(int id, int userid, string datetime) { string sql = "update Country_FeeCost set Isdel=1, Oper=@Oper, OPDate=@OPDate where VisaId=@visaId"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@visaId",id), new SqlParameter("@OPDate",datetime), new SqlParameter("@Oper",userid) }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } ///修改签证信息 /// public bool UpdateCountry_FeeCost(Country_FeeCost cf) { string sql = "update Country_FeeCost set VisaContinent=@VisaContinent,VisaCountry=@VisaCountry,IsVisaExemption=@IsVisaExemption,IsVisaOnArrival=@IsVisaOnArrival,"+ "IsElectronicSignature=@IsElectronicSignature,VisaPrice=@VisaPrice,VisaPriceDesc=@VisaPriceDesc,VisaTime=@VisaTime,UrgentTime=@UrgentTime,UrgentPrice=@UrgentPrice,"+ "UrgentPriceDesc=@UrgentPriceDesc,VisaRemark=@VisaRemark,Oper=@Oper,OPDate=@OPDate,isDel=@isDel where VisaId=@VisaId"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@VisaId",cf.VisaId), new SqlParameter("@VisaContinent",cf.VisaContinent), new SqlParameter("@VisaCountry",cf.VisaCountry), new SqlParameter("@IsVisaExemption",cf.IsVisaExemption), new SqlParameter("@IsVisaOnArrival",cf.IsVisaOnArrival), new SqlParameter("@IsElectronicSignature",cf.IsElectronicSignature), new SqlParameter("@VisaPrice",cf.VisaPrice), new SqlParameter("@VisaPriceDesc",cf.VisaPriceDesc), new SqlParameter("@VisaTime",cf.VisaTime), new SqlParameter("@UrgentTime",cf.UrgentTime), new SqlParameter("@UrgentPrice",cf.UrgentPrice), new SqlParameter("@UrgentPriceDesc",cf.UrgentPriceDesc), new SqlParameter("@VisaRemark",cf.VisaRemark), new SqlParameter("@Oper",cf.Oper), new SqlParameter("@OPDate",cf.OPDate), new SqlParameter("@isDel",cf.isDel) }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } /// /// 更新签证表 /// /// /// public bool T0UpdateVisaFrom(Country_FeeCost cf) { string sql = "update Country_FeeCost set IsVisaExemption=@IsVisaExemption,IsVisaOnArrival=@IsVisaOnArrival,IsElectronicSignature=@IsElectronicSignature," + "VisaTime=@VisaTime,VisaType=@VisaType,Oper=@Oper,OPDate=@OPDate,isDel=@isDel where VisaId=@VisaId"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@VisaId",cf.VisaId), new SqlParameter("@IsVisaExemption",cf.IsVisaExemption), new SqlParameter("@IsVisaOnArrival",cf.IsVisaOnArrival), new SqlParameter("@IsElectronicSignature",cf.IsElectronicSignature), new SqlParameter("@VisaTime",cf.VisaTime), new SqlParameter("@VisaType",cf.VisaType), new SqlParameter("@Oper",cf.Oper), new SqlParameter("@OPDate",cf.OPDate), new SqlParameter("@isDel",cf.isDel) }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } /// /// 添加签证费用标准信息 /// /// /// public bool Add(Country_FeeCost cf) { string sql = "insert into Country_FeeCost values(@VisaContinent,@VisaCountry,@IsVisaExemption,@IsVisaOnArrival,@IsElectronicSignature,@VisaPrice,@VisaPriceDesc,@VisaType,"+ "@VisaTime,@IsUrgent,@UrgentTime,@UrgentPrice,@UrgentPriceDesc,@VisaAddress,@VisaRemark,@Oper,@OPDate,@isDel);SELECT @@IDENTITY"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@VisaContinent",cf.VisaContinent), new SqlParameter("@VisaCountry",cf.VisaCountry), new SqlParameter("@IsVisaExemption",cf.IsVisaExemption), new SqlParameter("@IsVisaOnArrival",cf.IsVisaOnArrival), new SqlParameter("@IsElectronicSignature",cf.IsElectronicSignature), new SqlParameter("@VisaPrice",cf.VisaPrice), new SqlParameter("@VisaPriceDesc",cf.VisaPriceDesc), new SqlParameter("@VisaType",cf.VisaType), new SqlParameter("@VisaTime",cf.VisaTime), new SqlParameter("@IsUrgent",cf.IsUrgent), new SqlParameter("@UrgentTime",cf.UrgentTime), new SqlParameter("@UrgentPrice",cf.UrgentPrice), new SqlParameter("@UrgentPriceDesc",cf.UrgentPriceDesc), new SqlParameter("@VisaAddress",cf.VisaAddress), new SqlParameter("@VisaRemark",cf.VisaRemark), new SqlParameter("@Oper",cf.Oper), new SqlParameter("@OPDate",cf.OPDate), new SqlParameter("@isDel",cf.isDel) }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } } }