using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; using Models; namespace DAL { public class ITIN_EmployeeInputService { List excuteSql(string sql, params SqlParameter[] param) { return ServiceBase.excuteSql(new ITIN_EmployeeInputInfo(), "AirTicketBlackCode", sql, CommandType.Text, param); } ITIN_EmployeeInputInfo excuteType(string sql, params SqlParameter[] param) { //查询结果放入对象集合 List hdList = excuteSql(sql, param); //判断集合是否为空 if (hdList == null || hdList.Count == 0) //返回null return null; //返回单个对象 return hdList[0]; } #region 数据添加相关函数 public bool Insert_ITINEmployeeInfo(ITIN_EmployeeInputInfo _info) { string sql = " Insert Into ITINEmployee Values(@Diid,@Days,@YDate,@Sort,@Content,@Operators,@OperatorsDate,@IsDel) "; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@Diid",_info.Diid), new SqlParameter("@Days",_info.Days), new SqlParameter("@YDate",_info.YDate), new SqlParameter("@Sort",_info.Sort), new SqlParameter("@Content",_info.Content), new SqlParameter("@Operators",_info.Operators), new SqlParameter("@OperatorsDate",_info.OperatorsDate), new SqlParameter("@IsDel",_info.IsDel), }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } #endregion #region 数据删除相关函数 public bool Delete_Single_ITIN(int id) { if (SqlHelper.ExecuteNonQuery("update ITINEmployee set Isdel=1 where Id=@Id", CommandType.Text, new SqlParameter("@Id", id)) > 0) return true; return false; } #endregion #region 数据修改相关函数 public bool Update_Single_ITIN(ITIN_EmployeeInputInfo _info) { string sql = "update ITINEmployee Set Diid=@Diid,Days=@Days,Sort=@Sort,YDate=@YDate,Content=@Content,Operators=@Operators,OperatorsDate=@OperatorsDate,IsDel=@IsDel where Id = @Id"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@Diid",_info.Diid), new SqlParameter("@Days",_info.Days), new SqlParameter("@YDate",_info.YDate), new SqlParameter("@Sort",_info.Sort), new SqlParameter("@Content",_info.Content), new SqlParameter("@Operators",_info.Operators), new SqlParameter("@OperatorsDate",_info.OperatorsDate), new SqlParameter("@IsDel",_info.IsDel), new SqlParameter("@Id",_info.Id), }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } #endregion #region 数据查询相关函数 public List Select_List_ITIN(int Diid) { return excuteSql("select * from ITINEmployee where Isdel=0 and Diid=" + Diid + " order by Days,Sort"); } public ITIN_EmployeeInputInfo Select_Single_ITIN(int id) { return excuteType("select * from ITINEmployee where Isdel=0 and Id=@id", new SqlParameter("@id", id)); } #endregion } }