Exemple #1
0
 public IList<HistoryEntity> GetAllHistoryByresource_id(int t_resource_id)
 {
     IList<HistoryEntity> t_Historys = new List<HistoryEntity>();
        OleDbDataReader sdr = null;
        using(sdr=OLEDBHelp.GetReader("select * from History where resource_id="+t_resource_id))
        {
       while(sdr.Read())
         {
             HistoryEntity t_History= new HistoryEntity();
             t_History.History_id=(int)sdr.GetValue(0);
             t_History.User_id=(int)sdr.GetValue(1);
             t_History.Resource_id=(int)sdr.GetValue(2);
             t_History.History_time=(DateTime)sdr.GetValue(3);
             t_Historys.Add(t_History);
         }
         sdr.Close();
     }
     return t_Historys;
 }
Exemple #2
0
 public int UpdateHistory(HistoryEntity t_History)
 {
     OleDbParameter[] p=new OleDbParameter[]{
     new OleDbParameter("@History_id",t_History.History_id),
     new OleDbParameter("@User_id",t_History.User_id),
     new OleDbParameter("@Resource_id",t_History.Resource_id),
     new OleDbParameter("@History_time",t_History.History_time)
     };
     int i=OLEDBHelp.GetExecute("update History set history_id=@History_id,history_time=@History_time where history_id=@History_id", p) ;
     return i;
 }
Exemple #3
0
 //插入操作
 public int InsertHistory(HistoryEntity t_History)
 {
     //定义插入数据的参数数组
       OleDbParameter[] p=new OleDbParameter[]{
       new OleDbParameter("@History_id",t_History.History_id),
       new OleDbParameter("@User_id",t_History.User_id),
       new OleDbParameter("@Resource_id",t_History.Resource_id),
       new OleDbParameter("@History_time",t_History.History_time)
        };
        int i=OLEDBHelp.GetExecute("insert into History values (@History_id,@User_id,@Resource_id,@History_time)", p) ;
        return i;
 }
Exemple #4
0
 public HistoryEntity SelectHistoryByID(int t_history_id)
 {
     HistoryEntity t_History= new HistoryEntity();
     OleDbDataReader sdr=null;
     using(sdr=OLEDBHelp.GetReader("select * from History where history_id="+t_history_id))
     {
         if(sdr.Read())
         {
             t_History.History_id=(int)sdr.GetValue(0);
             t_History.User_id=(int)sdr.GetValue(1);
             t_History.Resource_id=(int)sdr.GetValue(2);
             t_History.History_time=(DateTime)sdr.GetValue(3);
         }
     }
     sdr.Close();
     return t_History;
 }
Exemple #5
0
 public static int UpdateHistory(HistoryEntity t_History)
 {
     int i=-1;
     //定义插入数据的参数数组
     try
     {
         i=dal.UpdateHistory(t_History);
     }
     catch(Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return i;
 }