private String ManageExportID(int PrimaryKey, String tableName, String refTable) { try { if (String.IsNullOrEmpty(refTable)) { refTable = tableName; } if (module == null) { module = new X_AD_ModuleInfo(GetCtx(), _AD_ModuleInfo_ID, null); } //String exportid = module.GetPrefix() + PrimaryKey; //export id to be picked from msequence table int expID = MSequence.GetNextExportID(GetCtx().GetAD_Client_ID(), tableName, null); if (expID == -1) { throw new InvalidConstraintException("ExportID -1 for TableName: " + tableName); } String exportid = module.GetPrefix() + expID; String _updateSql = "Update " + refTable + " SET Export_ID = " + DB.TO_STRING(exportid) + " WHERE " + tableName + "_ID = " + PrimaryKey; int result = DB.ExecuteQuery(_updateSql); return(exportid); } catch (Exception ex) { throw ex; return(""); } }
private String ManageExportID(int PrimaryKey, String tableName, String refTable) { try { if (String.IsNullOrEmpty(refTable)) { refTable = tableName; } if (module == null) { module = new X_AD_ModuleInfo(GetCtx(), _AD_ModuleInfo_ID, null); } //String exportid = module.GetPrefix() + PrimaryKey; //export id to be picked from msequence table String exportid = module.GetPrefix() + MSequence.GetNextExportID(GetCtx().GetAD_Client_ID(), tableName, null); String _updateSql = "Update " + refTable + " SET Export_ID = " + DB.TO_STRING(exportid) + " WHERE " + tableName + "_ID = " + PrimaryKey; int result = DB.ExecuteQuery(_updateSql); return(exportid); } catch { return(""); } }
private String ManageExportID(int recordID, int AD_Colone_ID, String tableName, int _table_ID) { try { //if (String.IsNullOrEmpty(refTable)) // refTable = tableName; if (module == null) { module = new X_AD_ModuleInfo(GetCtx(), _AD_ModuleInfo_ID, null); } //String exportid = module.GetPrefix() + PrimaryKey; //export id to be picked from msequence table int expID = MSequence.GetNextExportID(GetCtx().GetAD_Client_ID(), tableName, null); if (expID == -1) { throw new InvalidConstraintException("ExportID -1 for TableName: " + tableName); } String exportid = module.GetPrefix() + expID; string[] ds = GetParentColumns(_table_ID); //String _updateSql = "Update " + tableName + " SET Export_ID = " + DB.TO_STRING(exportid) + " WHERE " + tableName + "_ID = " + recordID; String _updateSql = "Update " + tableName + " SET Export_ID = " + DB.TO_STRING(exportid) + " WHERE "; // _updateSql += ds.Tables[0].Rows[0]["ColumnName"].ToString() + " =" + recordID; _updateSql += ds[0] + " =" + recordID; if (ds.Length > 1) { //_updateSql += " and " + ds.Tables[0].Rows[1]["ColumnName"].ToString() + " =" + AD_Colone_ID; _updateSql += " and " + ds[1] + " =" + AD_Colone_ID; } int result = DB.ExecuteQuery(_updateSql); return(exportid); } catch (Exception ex) { throw ex; return(""); } }