123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- 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 DelegationInfoOrFeeCostServcies
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<DelegationInfoOrFeeCost> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<DelegationInfoOrFeeCost>.excuteSql(new DelegationInfoOrFeeCost(), "DelegationInfoOrFeeCost", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- DelegationInfoOrFeeCost excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<DelegationInfoOrFeeCost> diList = excuteSql(sql, param);
- //判断集合是否为空
- if (diList == null || diList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return diList[0];
- }
- /// <summary>
- /// 根据编号查询多条对象对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者多个对象信息</returns>
- public List<DelegationInfoOrFeeCost> GetDelegationInfoIdByIDAll(int diid)
- {
- //调用获取单个对象的方法
- return excuteSql("select * from DelegationInfoOrFeeCost where DIid=" + diid);
- }
- /// <summary>
- /// 根据编号查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者单个对象信息</returns>
- public DelegationInfoOrFeeCost GetDelegationInfoIdByID(int diid)
- {
- //调用获取单个对象的方法
- return excuteType("select * from DelegationInfoOrFeeCost where DIid="+diid);
- }
- /// <summary>
- /// 根据签证表id查询链接表id
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public DelegationInfoOrFeeCost getAllByCountryId(int cid)
- {
- return excuteType("select * from DelegationInfoOrFeeCost where isdel=0 and CFCid=@id", new SqlParameter("@id", cid));
- }
- /// <summary>
- /// 添加团组表和签证费用标准表的连表
- /// </summary>
- /// <param name="Dov"></param>
- /// <returns></returns>
- public bool Add(DelegationInfoOrFeeCost cf)
- {
- string sql = "insert into DelegationInfoOrFeeCost values(@DIid,@CFCid,@Oper,@OpdTime,@isdel);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@DIid",cf.DIid),
- new SqlParameter("@CFCid",cf.CFCid),
- new SqlParameter("@Oper",cf.Oper),
- new SqlParameter("@OpdTime",cf.OpdTime),
- new SqlParameter("@isdel",cf.isdel)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 修改这条签证的状态
- /// </summary>
- /// <param name="id">签证表 id</param>
- /// <param name="userid">操作人编号 </param>
- /// <param name="datetime">操作人操作时间</param>
- /// <returns></returns>
- public bool delDelegationInfoOrFeeCost(int id, int userid, string datetime)
- {
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@CId",id),
- new SqlParameter("@OPDate",datetime),
- new SqlParameter("@Oper",userid)
- };
- if (SqlHelper.ExecuteNonQuery("update DelegationInfoOrFeeCost set isdel=1,Oper=@Oper,OpdTime=@OPDate where DFCid=@CId", CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- }
- }
|