public IList<OperatingEntity> GetAllOperatingByoperating_type_id(int t_operating_type_id) { IList<OperatingEntity> t_Operatings = new List<OperatingEntity>(); OleDbDataReader sdr = null; using(sdr=OLEDBHelp.GetReader("select * from Operating where operating_type_id="+t_operating_type_id)) { while(sdr.Read()) { OperatingEntity t_Operating= new OperatingEntity(); t_Operating.Status_id=(int)sdr.GetValue(0); t_Operating.Resource_id=(int)sdr.GetValue(1); t_Operating.User_id=(int)sdr.GetValue(2); t_Operating.Operating_type_id=(int)sdr.GetValue(3); t_Operatings.Add(t_Operating); } sdr.Close(); } return t_Operatings; }
public int UpdateOperating(OperatingEntity t_Operating) { OleDbParameter[] p=new OleDbParameter[]{ new OleDbParameter("@Status_id",t_Operating.Status_id), new OleDbParameter("@Resource_id",t_Operating.Resource_id), new OleDbParameter("@User_id",t_Operating.User_id), new OleDbParameter("@Operating_type_id",t_Operating.Operating_type_id) }; int i=OLEDBHelp.GetExecute("update Operating set status_id=@Status_id where status_id=@Status_id", p) ; return i; }
//插入操作 public int InsertOperating(OperatingEntity t_Operating) { //定义插入数据的参数数组 OleDbParameter[] p=new OleDbParameter[]{ new OleDbParameter("@Status_id",t_Operating.Status_id), new OleDbParameter("@Resource_id",t_Operating.Resource_id), new OleDbParameter("@User_id",t_Operating.User_id), new OleDbParameter("@Operating_type_id",t_Operating.Operating_type_id) }; int i=OLEDBHelp.GetExecute("insert into Operating values (@Status_id,@Resource_id,@User_id,@Operating_type_id)", p) ; return i; }
public OperatingEntity SelectOperatingByID(int t_status_id) { OperatingEntity t_Operating= new OperatingEntity(); OleDbDataReader sdr=null; using(sdr=OLEDBHelp.GetReader("select * from Operating where status_id="+t_status_id)) { if(sdr.Read()) { t_Operating.Status_id=(int)sdr.GetValue(0); t_Operating.Resource_id=(int)sdr.GetValue(1); t_Operating.User_id=(int)sdr.GetValue(2); t_Operating.Operating_type_id=(int)sdr.GetValue(3); } } sdr.Close(); return t_Operating; }
public static int UpdateOperating(OperatingEntity t_Operating) { int i=-1; //定义插入数据的参数数组 try { i=dal.UpdateOperating(t_Operating); } catch(Exception ex) { throw new Exception(ex.Message); } return i; }