123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- using Models;
- using System;
- using System.Collections.Generic;
- using System.Data.SqlClient;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DAL
- {
- public class grouopExceedService
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<grouopExceed> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<grouopExceed>.excuteSql(new grouopExceed(), "grouopExceed", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- grouopExceed excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<grouopExceed> gdpList = excuteSql(sql, param);
- //判断集合是否为空
- if (gdpList == null || gdpList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return gdpList[0];
- }
- public List<grouopExceed> GetgrouopExceed(int pageIndex, out int sumPage, out int totalRecord, string tourCode)
- {
- string sqlwhere = "IsDel = 0 and DIId = " + tourCode ;
- return PageBase<grouopExceed>.excutePageSql(new grouopExceed(), "grouopExceed", "grouopExceed", "*", "id desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
- }
- /// 增加
- /// </summary>
- /// <returns></returns>
- public bool AddGrouopExceed(grouopExceed gpd, out int id)
- {
- string sql = "insert into grouopExceed values(@DIID,@PriceName,@Price,@Currency,@FilePath,@Remark,@Operator,@OperatorDate,@PriceType,@coefficient,@PriceTypeDetail,@IsDel);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@DIId",gpd.DIID),
- new SqlParameter("@PriceName",gpd.PriceName),
- new SqlParameter("@Price",gpd.Price),
- new SqlParameter("@Currency",gpd.Currency),
- new SqlParameter("@FilePath",gpd.FilePath),
- new SqlParameter("@Remark",gpd.Remark),
- new SqlParameter("@Operator",gpd.Operators),
- new SqlParameter("@OperatorDate",gpd.OperatorsDate),
- new SqlParameter("@IsDel",gpd.IsDel),
- new SqlParameter("@PriceType",gpd.PriceType),
- new SqlParameter("@coefficient",gpd.coefficient),
- new SqlParameter("@PriceTypeDetail",gpd.PriceTypeDetail)
- };
- int obj = Convert.ToInt32(SqlHelper.ExecuteScalar(sql, CommandType.Text, parameter));
- if (obj > 0)
- {
- id = obj;
- return true;
- }
- id = 0;
- return false;
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <returns></returns>
- public bool DelGrouopExceed(int id)
- {
- string sql = "update grouopExceed set IsDel = 1 where Id = @Id";
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 根据编号查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者单个对象信息</returns>
- public grouopExceed GetGrouopExceed(int id)
- {
- //调用获取单个对象的方法
- return excuteType("select * from grouopExceed where Id = @id and isdel=0", new SqlParameter("@id", id));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <returns></returns>
- public bool EditGrouopExceed(grouopExceed gpd)
- {
- string sql = "update GrouopExceed set DIID = @DIID,PriceName = @PriceName,Price = @Price,Currency = @Currency,FilePath = @FilePath,Remark = @Remark ,Operators = @Operators,OperatorsDate = @OperatorsDate,PriceType = @PriceType,coefficient= @coefficient,PriceTypeDetail=@PriceTypeDetail where Id = @Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@DIId",gpd.DIID),
- new SqlParameter("@PriceName",gpd.PriceName),
- new SqlParameter("@Price",gpd.Price),
- new SqlParameter("@Currency",gpd.Currency),
- new SqlParameter("@FilePath",gpd.FilePath),
- new SqlParameter("@Remark",gpd.Remark),
- new SqlParameter("@Operators",gpd.Operators),
- new SqlParameter("@OperatorsDate",gpd.OperatorsDate),
- new SqlParameter("@Id",gpd.Id),
- new SqlParameter("@PriceType",gpd.PriceType),
- new SqlParameter("@coefficient",gpd.coefficient),
- new SqlParameter("@PriceTypeDetail",gpd.PriceTypeDetail)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- public DataTable GetGrouopExceedAllByDiid(int diid)
- {
- return SqlHelper.TransferProcedure("Exec_GetCreditCardPaymentAnd",CommandType.StoredProcedure , new SqlParameter("@DiiD", diid));
- }
-
- }
- }
|