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 DeleProgressService { List excuteSql(string sql, params SqlParameter[] param) { return ServiceBase.excuteSql(new DeleProgress(), "DeleProgress", sql, CommandType.Text, param); } DeleProgress 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(DeleProgress Dov) { string sql = "insert into DeleProgress values(@Diid,@BP_GetReady,@BP_GetReadyTime,@BP_Work,@BP_WorkTime,@HZ_Work,@HZ_WorkTime," + "@QZ_Work,@QZ_WorkTime,@SQ_Work,@SQ_WorkTime,@CQ,@CQTime,@XQH,@XQHTime,@SJ,@SJTime,@OPer,@OPDate);SELECT @@IDENTITY"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@Diid",Dov.Diid), new SqlParameter("@BP_GetReady",Dov.BP_GetReady), new SqlParameter("@BP_GetReadyTime",Dov.BP_GetReadyTime), new SqlParameter("@BP_Work",Dov.BP_Work), new SqlParameter("@BP_WorkTime",Dov.BP_WorkTime), new SqlParameter("@HZ_Work",Dov.HZ_Work), new SqlParameter("@HZ_WorkTime",Dov.HZ_WorkTime), new SqlParameter("@QZ_Work",Dov.QZ_Work), new SqlParameter("@QZ_WorkTime",Dov.QZ_WorkTime), new SqlParameter("@SQ_Work",Dov.SQ_Work), new SqlParameter("@SQ_WorkTime",Dov.SQ_WorkTime), new SqlParameter("@CQ",Dov.CQ), new SqlParameter("@CQTime",Dov.CQTime), new SqlParameter("@XQH",Dov.XQH), new SqlParameter("@XQHTime",Dov.XQHTime), new SqlParameter("@SJ",Dov.SJ), new SqlParameter("@SJTime",Dov.SJTime), new SqlParameter("@OPer",Dov.OPer), new SqlParameter("@OPDate",Dov.OPDate) }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } //改Update public bool Edit(DeleProgress Dov) { string sql = "update DeleProgress set Diid=@Diid,BP_GetReady=@BP_GetReady,BP_GetReadyTime=@BP_GetReadyTime," + "BP_Work=@BP_Work,BP_WorkTime=@BP_WorkTime,HZ_Work=@HZ_Work,HZ_WorkTime=@HZ_WorkTime," + "QZ_Work=@QZ_Work,QZ_WorkTime=@QZ_WorkTime,SQ_Work=@SQ_Work,SQ_WorkTime=@SQ_WorkTime," + "CQ=@CQ,CQTime=@CQTime,XQH=@XQH,XQHTime=@XQHTime,SJ=@SJ,SJTime=@SJTime," + "OPer=@OPer,OPDate=@OPDate where Id = @Id"; SqlParameter[] parameter = new SqlParameter[]{ new SqlParameter("@Diid",Dov.Diid), new SqlParameter("@BP_GetReady",Dov.BP_GetReady), new SqlParameter("@BP_GetReadyTime",Dov.BP_GetReadyTime), new SqlParameter("@BP_Work",Dov.BP_Work), new SqlParameter("@BP_WorkTime",Dov.BP_WorkTime), new SqlParameter("@HZ_Work",Dov.HZ_Work), new SqlParameter("@HZ_WorkTime",Dov.HZ_WorkTime), new SqlParameter("@QZ_Work",Dov.QZ_Work), new SqlParameter("@QZ_WorkTime",Dov.QZ_WorkTime), new SqlParameter("@SQ_Work",Dov.SQ_Work), new SqlParameter("@SQ_WorkTime",Dov.SQ_WorkTime), new SqlParameter("@CQ",Dov.CQ), new SqlParameter("@CQTime",Dov.CQTime), new SqlParameter("@XQH",Dov.XQH), new SqlParameter("@XQHTime",Dov.XQHTime), new SqlParameter("@SJ",Dov.SJ), new SqlParameter("@SJTime",Dov.SJTime), new SqlParameter("@OPer",Dov.OPer), new SqlParameter("@OPDate",Dov.OPDate), new SqlParameter("@Id",Dov.Id) }; if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0) return true; return false; } public DeleProgress getByDiid(string Diid) { return excuteType("select * from DeleProgress where Diid =@Diid", new SqlParameter("@Diid", Diid)); } } }