public void Save(ClsDataAccess Da) { foreach (string Header_Key in this.mObj_Base.pHeader_Key) { Int64 Inner_ID = (Int64)Methods.IsNull(this.mObj_Base.pDr[Header_Key], 0); this.mDr[Header_Key] = Inner_ID; } Da.SaveDataRow(this.mDr, this.mTableName); }
public void Save(ClsDataAccess Da) { DataRow[] ArrDr = this.mDt.Select("", "", DataViewRowState.CurrentRows); foreach (DataRow Dr in ArrDr) { if (Dr.RowState == DataRowState.Added || Dr.RowState == DataRowState.Modified) { foreach (string Header_Key in this.mObj_Base.pHeader_Key) { Int64 Inner_ID = (Int64)Methods.IsNull(this.mObj_Base.pDr[Header_Key], 0); Dr[Header_Key] = Inner_ID; } Da.SaveDataRow(Dr, this.mTableName); } } ArrDr = this.mDt.Select("", "", DataViewRowState.Deleted); foreach (DataRow Dr in ArrDr) { DataRow Nr = Dr.Table.NewRow(); foreach (DataColumn Dc in Dr.Table.Columns) { Nr[Dc.ColumnName] = Dr[Dc.ColumnName, DataRowVersion.Original]; } bool IsPKComplete = true; foreach (string Key in this.mList_Key) { if (Information.IsDBNull(Dr[Key])) { IsPKComplete = false; break; } } if (IsPKComplete) { Nr["IsDeleted"] = true; Da.SaveDataRow(Dr, this.mTableName); } } }
public virtual bool Save() { bool IsSave = false; ClsDataAccess Da = new ClsDataAccess(); try { Da.Connect(); Da.BeginTransaction(); Da.SaveDataRow(this.mHeader_Dr, this.mHeader_TableName); //[-] if (this.mBase_TableDetail != null) { foreach (ClsBaseTableDetail Inner_Obj in this.mBase_TableDetail) { Inner_Obj.Save(Da); } } //[-] if (this.mBase_RowDetail != null) { foreach (ClsBaseRowDetail Inner_Obj in this.mBase_RowDetail) { Inner_Obj.Save(Da); } } //[-] Da.CommitTransaction(); IsSave = true; } catch (Exception ex) { Da.RollbackTransaction(); throw ex; } finally { Da.Close(); } return(IsSave); }