1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 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 DelegationEnDataService
- {
- List<DelegationEnData> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<DelegationEnData>.excuteSql(new DelegationEnData(), "DelegationEnData", sql, CommandType.Text, param);
- }
- DelegationEnData excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<DelegationEnData> hdList = excuteSql(sql, param);
- //判断集合是否为空
- if (hdList == null || hdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return hdList[0];
- }
- //增Add
- public bool Add(DelegationEnData Dov)
- {
- string sql = "insert into DelegationEnData values(@Area,@Job,@JobEn,@DelegationSetting,@DelegationSettingEn,@Oper,@Opdate,@Isdel);SELECT @@IDENTITY";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Area",Dov.Area),
- new SqlParameter("@Job",Dov.Job),
- new SqlParameter("@JobEn",Dov.JobEn),
- new SqlParameter("@DelegationSetting",Dov.DelegationSetting),
- new SqlParameter("@DelegationSettingEn",Dov.DelegationSettingEn),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@Opdate",Dov.Opdate),
- new SqlParameter("@Isdel",Dov.Isdel)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- //改Update
- public bool Edit(DelegationEnData Dov)
- {
- string sql = "update DelegationEnData set Area=@Area,Job=@Job,JobEn=@JobEn,DelegationSetting=@DelegationSetting,"
- + "DelegationSettingEn=@DelegationSettingEn,Oper=@Oper,Opdate=@Opdate,Isdel=@Isdel where Id = @Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@Area",Dov.Area),
- new SqlParameter("@Job",Dov.Job),
- new SqlParameter("@JobEn",Dov.JobEn),
- new SqlParameter("@DelegationSetting",Dov.DelegationSetting),
- new SqlParameter("@DelegationSettingEn",Dov.DelegationSettingEn),
- new SqlParameter("@Oper",Dov.Oper),
- new SqlParameter("@Opdate",Dov.Opdate),
- new SqlParameter("@Isdel",Dov.Isdel),
- 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 DelegationEnData set Isdel=1 where Id=@Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 查找所有数据 - 分页
- /// </summary>
- /// <returns></returns>
- public List<DelegationEnData> GetAllAskData(int pageIndex, out int sumPage, out int totalRecord, string Area, string Job)
- {
- string sqlwhere = "IsDel = 0 and Area like '%" + Area + "%' and Job like '%" + Job + "%'";
- return PageBase<DelegationEnData>.excutePageSql(new DelegationEnData(), "DelegationEnData", "DelegationEnData", "*", "id asc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
- }
- public DelegationEnData getById(int id)
- {
- return excuteType("select * from DelegationEnData where Isdel=0 and Id=@id", new SqlParameter("@id", id));
- }
-
- }
- }
|