Beispiel #1
0
 public int Save(IList<Model.DataBean> list)
 {
     int i = 0;
     object result;
     AccessHelper db = new AccessHelper();
     foreach (var item in list)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append("INSERT INTO SalesRecord ( ScZydBh, ScBh, ScDj, ScZl, JyTime, State,JyJlID ) ");
         sb.Append("values( '" + item.ZydBh + "','" + item.ShcBh + "','" + item.ShcDj + "','" + item.XSSL + "','" +
                   item.XSTime + "','0','" + item.JyJlID + "')");
         OleDbCommand cmd = db.GetSqlStringCommand(sb.ToString());
         result = db.ExecuteNonQuery(cmd); //.ExecuteNonQuery(cmd);
         i += result == null ? -1 : Convert.ToInt16(result);
     }
     return i;
 }
Beispiel #2
0
 public IList<Model.DataBean> GetDataList(string path = "")
 {
     IList<DataBean> list = new List<DataBean>();
     string sql = "select * from SalesRecord where State in(0,1)";
     AccessHelper db = new AccessHelper();
     OleDbCommand cmd = db.GetSqlStringCommand(sql);
     DataTable dt = db.ExecuteDataTable(cmd);
     foreach (DataRow VARIABLE in dt.Rows)
     {
         DataBean bena = new DataBean();
         bena.ID = UtiData.DBObjectToInt(VARIABLE["ID"]);
         bena.ShcBh = UtiData.DBObjectToString(VARIABLE["ScBh"]);
         bena.ShcDj = UtiData.DBObjectToString(VARIABLE["ScDj"]);
         bena.XSSL = UtiData.DBObjectToString(VARIABLE["ScZl"]);
         bena.XSTime = UtiData.DBObjectToDateTime(VARIABLE["JyTime"]);
         bena.ZydBh = UtiData.DBObjectToString(VARIABLE["ScZydBh"]);
         bena.JyJlID = UtiData.DBObjectToString(VARIABLE["JyJlID"]);
         list.Add(bena);
     }
     return list;
 }
Beispiel #3
0
 public int UpdateState(IList<DataBean> list )
 {
     object result;
     AccessHelper db = new AccessHelper();
     StringBuilder sb=new StringBuilder();
     foreach (var item in list)
     {
         sb.Append("," + item.ID + "");
     }
     StringBuilder sbs = new StringBuilder();
     sbs.Append("update SalesRecord set State=2 where ID in("+sb.ToString().Substring(1)+") ");
     OleDbCommand cmd = db.GetSqlStringCommand(sbs.ToString());
     result = db.ExecuteNonQuery(cmd);
     return result == null ? -1 : Convert.ToInt16(result);
 }