/// /// 插入一个GHSF_NOTEMANAGE实体到数据库。 /// /// 将要插入的实体 public int InsertEntity(DataSetGHSF_NOTEMANAGE entity) { CheckData(entity); int iRtn = 0; bool isExistTrans = db.IsInTransaction(); if (!isExistTrans) { db.BeginTrans(); } try { foreach (DataRow row in entity.Tables["GHSF_GHSF_NOTEMANAGE"].Rows) { int j = db.exeSql(new SS_GHSF_NOTEMANAGE_InsertGHSF_GHSF_NOTEMANAGE(), row); iRtn = iRtn + j; } if (!isExistTrans) { db.CommitTrans(); } return(iRtn); } catch (Exception e) { if (!isExistTrans) { db.RollbackTrans(); } throw e; } }
///////////// #endregion //// 2006-09-11 public DataSetGHSF_NOTEMANAGE GetDataSet(SqlClass sC, string sTableName) { DataSetGHSF_NOTEMANAGE ds = new DataSetGHSF_NOTEMANAGE(); db.FillDataSet(sC, ds, sTableName); return(ds); }
} // Data_SelectByIDGHSF_GHSF_NOTEMANAGE #endregion #region Data_GHSF_NOTEMANAGE_SelectAll /// /// 对于SelectAll的类的实现(数据库操作)。 /// public DataSetGHSF_NOTEMANAGE Data_GHSF_NOTEMANAGE_SelectAll(string sTj) { DataSetGHSF_NOTEMANAGE ds = new DataSetGHSF_NOTEMANAGE(); SS_GHSF_NOTEMANAGE_SelectAll ss = new SS_GHSF_NOTEMANAGE_SelectAll(); ss.SqlString = ss.SqlString.Replace("1=1", sTj); db.FillDataSet(ss, ds, "GHSF_GHSF_NOTEMANAGE"); return(ds); } // Data_SelectAll
//wuqb modify 2007-03-27 //强名DataSet #region Data_GHSF_NOTEMANAGE_SelectByIDGHSF_GHSF_NOTEMANAGE /// /// 对于SelectByIDGHSF_GHSF_NOTEMANAGE的类的实现(数据库操作)。 /// public DataSetGHSF_NOTEMANAGE Data_GHSF_NOTEMANAGE_SelectByIDGHSF_GHSF_NOTEMANAGE(System.String VNOTEMANAGEID) { DataSetGHSF_NOTEMANAGE ds = new DataSetGHSF_NOTEMANAGE(); SS_GHSF_NOTEMANAGE_SelectByIDGHSF_GHSF_NOTEMANAGE ss = new SS_GHSF_NOTEMANAGE_SelectByIDGHSF_GHSF_NOTEMANAGE(); ss.VNOTEMANAGEID = VNOTEMANAGEID; db.FillDataSet(ss, ds, "GHSF_GHSF_NOTEMANAGE"); return(ds); } // Data_SelectByIDGHSF_GHSF_NOTEMANAGE
/// /// 检查给定的实体是否有给定状态的更改,如果有把更改的行提交到数据库。 /// /// 要检验的实体 /// 要检查更改的状态 /// 2006-05-21 public int CommitChanges(DataSetGHSF_NOTEMANAGE entity, DataRowState drs, ArrayList alUpdateColumn, ArrayList alUpdateControl) { db.SetUpdateControl(alUpdateControl); db.SetUpdateColumn(alUpdateColumn); int iRet = CommitChanges(entity, drs); db.SetUpdateControl(null); db.SetUpdateColumn(null); return(iRet); }
/// /// 按照GHSF_NOTEMANAGE实体的主表的主键查询数据。 /// /// 主键的值 public DataSetGHSF_NOTEMANAGE FindByPrimaryKey(object KeyValue) { DataSetGHSF_NOTEMANAGE entity = new DataSetGHSF_NOTEMANAGE(); SS_GHSF_NOTEMANAGE_SelectByIDGHSF_GHSF_NOTEMANAGE ss = new SS_GHSF_NOTEMANAGE_SelectByIDGHSF_GHSF_NOTEMANAGE(); ss.Params[0].Value = KeyValue; db.FillDataSet(ss, entity, "GHSF_GHSF_NOTEMANAGE"); return(entity); }
///////////////// public int CommitChanges(DataSetGHSF_NOTEMANAGE entity, DataRowState drs) { int iRtn = 0; if (!entity.HasChanges(drs)) { return(iRtn); } CheckData(entity); bool isExistTrans = db.IsInTransaction(); if (!isExistTrans) { db.BeginTrans(); } try { if (drs == DataRowState.Deleted) { iRtn += DeleteEntity(entity.GetChangesEntity(drs)); } else if (drs == DataRowState.Modified) { iRtn += UpdateEntity(entity.GetChangesEntity(drs)); } else if (drs == DataRowState.Added) { iRtn += InsertEntity(entity.GetChangesEntity(drs)); } if (!isExistTrans) { db.CommitTrans(); } return(iRtn); } catch (Exception e) { if (isExistTrans) { db.RollbackTrans(); } throw e; } }
/// /// 检查给定的实体是否有更改,如果有把更改的行提交到数据库。 /// /// 要检验的实体 public int CommitChanges(DataSetGHSF_NOTEMANAGE entity) { int iRtn = 0; if (!entity.HasChanges()) { return(iRtn); } CheckData(entity); bool isExistTrans = db.IsInTransaction(); if (!isExistTrans) { db.BeginTrans(); } try { //CommitChanges(entity, DataRowState.Deleted); //CommitChanges(entity, DataRowState.Modified); //CommitChanges(entity, DataRowState.Added); ////////// 2006-05-21 iRtn += CommitChanges(entity, DataRowState.Deleted, null, null); iRtn += CommitChanges(entity, DataRowState.Modified, alUpdateColumn, alUpdateControl); iRtn += CommitChanges(entity, DataRowState.Added, null, null); ///////////// if (!isExistTrans) { db.CommitTrans(); } return(iRtn); } catch (Exception e) { if (isExistTrans) { db.RollbackTrans(); } throw e; } }
/// /// 校验数据输入的有效性。 /// /// 要检验的实体 protected void CheckData(DataSetGHSF_NOTEMANAGE entity) { //在这里可以加入操作之前所需要对实体检验的代码 }
/// 2006-05-21 /// public int CommitChanges(DataSetGHSF_NOTEMANAGE entity, ArrayList alUpdateColumn, ArrayList alUpdateControl) { this.alUpdateColumn = alUpdateColumn; this.alUpdateControl = alUpdateControl; return(CommitChanges(entity)); }