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 EnterExitCostService { List excuteSql(string sql, params SqlParameter[] param) { return ServiceBase.excuteSql(new EnterExitCost(), "EnterExitCost", sql, CommandType.Text, param); } EnterExitCost excuteType(string sql, params SqlParameter[] param) { //查询结果放入对象集合 List hdList = excuteSql(sql, param); //判断集合是否为空 if (hdList == null || hdList.Count == 0) //返回null return null; //返回单个对象 return hdList[0]; } //增Add public bool Add(EnterExitCost Dov) { string sql = "insert into EnterExitCost values(@Diid,@InsidePay,@VisaPay,@VisaPayRemark,@SafePay,@YiMiao,@HeSuan,@ServiceFee,@Ticket,@OutsideJJ,@OutsaideGW,@AirJJ,@AirGW," + "@CityTranffic,@RateUSD,@RateJPY,@RateEUR,@RateGBP,@RateHKD,@OPer,@OPDate,@Isdel,@ChoiceOne,@ChoiceTwo,@ChoiceThree,@ChoiceFour,@ChoiceFive," + " @SumJJC,@SumGWC,@AirJJC_Checked,@AirGWC_Checked,@ChoiceSix);SELECT @@IDENTITY"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@Diid",Dov.Diid), new SqlParameter("@InsidePay",Dov.InsidePay), new SqlParameter("@VisaPay",Dov.VisaPay), new SqlParameter("@VisaPayRemark",Dov.VisaPayRemark), new SqlParameter("@SafePay",Dov.SafePay), new SqlParameter("@YiMiao",Dov.YiMiao), new SqlParameter("@HeSuan",Dov.HeSuan), new SqlParameter("@ServiceFee",Dov.ServiceFee), new SqlParameter("@Ticket",Dov.Ticket), new SqlParameter("@OutsideJJ",Dov.OutsideJJ), new SqlParameter("@OutsaideGW",Dov.OutsaideGW), new SqlParameter("@AirJJ",Dov.AirJJ), new SqlParameter("@AirGW",Dov.AirGW), new SqlParameter("@CityTranffic",Dov.CityTranffic), new SqlParameter("@RateUSD",Dov.RateUSD), new SqlParameter("@RateJPY",Dov.RateJPY), new SqlParameter("@RateEUR",Dov.RateEUR), new SqlParameter("@RateGBP",Dov.RateGBP), new SqlParameter("@RateHKD",Dov.RateHKD), new SqlParameter("@OPer",Dov.OPer), new SqlParameter("@OPDate",Dov.OPDate), new SqlParameter("@Isdel",Dov.Isdel), new SqlParameter("@ChoiceOne",Dov.ChoiceOne), new SqlParameter("@ChoiceTwo",Dov.ChoiceTwo), new SqlParameter("@ChoiceThree",Dov.ChoiceThree), new SqlParameter("@ChoiceFour",Dov.ChoiceFour), new SqlParameter("@ChoiceFive",Dov.ChoiceFive), new SqlParameter("@SumJJC",Dov.SumJJC), new SqlParameter("@SumGWC",Dov.SumGWC), new SqlParameter("@AirJJC_Checked",Dov.AirJJC_Checked), new SqlParameter("@AirGWC_Checked",Dov.AirGWC_Checked), new SqlParameter("@ChoiceSix",Dov.ChoiceSix) }; int obj = Convert.ToInt32(SqlHelper.ExecuteScalar(sql, CommandType.Text, parameter)); if (obj > 0) { return true; } return false; } //改Update public bool Edit(EnterExitCost Dov) { string sql = "update EnterExitCost set Diid=@Diid,InsidePay=@InsidePay,VisaPay=@VisaPay,VisaPayRemark=@VisaPayRemark,SafePay=@SafePay,YiMiao=@YiMiao,HeSuan=@HeSuan,ServiceFee=@ServiceFee,Ticket=@Ticket,OutsideJJ=@OutsideJJ,OutsaideGW=@OutsaideGW," + "AirJJ=@AirJJ,AirGW=@AirGW,CityTranffic=@CityTranffic,RateUSD=@RateUSD,RateJPY=@RateJPY,RateEUR=@RateEUR,RateHKD=@RateHKD," + "RateGBP=@RateGBP,OPer=@OPer,OPDate=@OPDate,Isdel=@Isdel,ChoiceOne=@ChoiceOne,ChoiceTwo=@ChoiceTwo,ChoiceThree=@ChoiceThree,ChoiceFour=@ChoiceFour,ChoiceFive=@ChoiceFive," + "SumJJC=@SumJJC,SumGWC=@SumGWC,AirJJC_Checked=@AirJJC_Checked,AirGWC_Checked=@AirGWC_Checked,ChoiceSix=@ChoiceSix where Id = @Id"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@Diid",Dov.Diid), new SqlParameter("@InsidePay",Dov.InsidePay), new SqlParameter("@VisaPay",Dov.VisaPay), new SqlParameter("@VisaPayRemark",Dov.VisaPayRemark), new SqlParameter("@SafePay",Dov.SafePay), new SqlParameter("@YiMiao",Dov.YiMiao), new SqlParameter("@HeSuan",Dov.HeSuan), new SqlParameter("@ServiceFee",Dov.ServiceFee), new SqlParameter("@Ticket",Dov.Ticket), new SqlParameter("@OutsideJJ",Dov.OutsideJJ), new SqlParameter("@OutsaideGW",Dov.OutsaideGW), new SqlParameter("@AirJJ",Dov.AirJJ), new SqlParameter("@AirGW",Dov.AirGW), new SqlParameter("@CityTranffic",Dov.CityTranffic), new SqlParameter("@RateUSD",Dov.RateUSD), new SqlParameter("@RateJPY",Dov.RateJPY), new SqlParameter("@RateEUR",Dov.RateEUR), new SqlParameter("@RateGBP",Dov.RateGBP), new SqlParameter("@RateHKD",Dov.RateHKD), new SqlParameter("@OPer",Dov.OPer), new SqlParameter("@OPDate",Dov.OPDate), new SqlParameter("@Isdel",Dov.Isdel), new SqlParameter("@ChoiceOne",Dov.ChoiceOne), new SqlParameter("@ChoiceTwo",Dov.ChoiceTwo), new SqlParameter("@ChoiceThree",Dov.ChoiceThree), new SqlParameter("@ChoiceFour",Dov.ChoiceFour), new SqlParameter("@ChoiceFive",Dov.ChoiceFive), new SqlParameter("@SumJJC",Dov.SumJJC), new SqlParameter("@SumGWC",Dov.SumGWC), new SqlParameter("@AirJJC_Checked",Dov.AirJJC_Checked), new SqlParameter("@AirGWC_Checked",Dov.AirGWC_Checked), new SqlParameter("@ChoiceSix",Dov.ChoiceSix), 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 EnterExitCost set Isdel=1 where Id= @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0) return true; return false; } public bool delbydiid(string diid) { if (SqlHelper.ExecuteNonQuery("update EnterExitCost set Isdel = 1 where diid = "+ diid, CommandType.Text) > 0) return true; return false; } public EnterExitCost getById(int id) { return excuteType("select * from EnterExitCost where Isdel=0 and diid=@id", new SqlParameter("@id", id)); } public EnterExitCost getByDiid(string Diid) { return excuteType("select * from EnterExitCost where Isdel=0 and Diid =@Diid", new SqlParameter("@Diid", Diid)); } } }