本文整理汇总了C#中UpdateCommand.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# UpdateCommand.Execute方法的具体用法?C# UpdateCommand.Execute怎么用?C# UpdateCommand.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpdateCommand
的用法示例。
在下文中一共展示了UpdateCommand.Execute方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEntity_ShouldUpdateEntity
public void UpdateEntity_ShouldUpdateEntity()
{
// arrange
var obj = new Author { Uid = AuthorUid};
var storageObj = new Author { Uid = AuthorUid };
var stub = new FakeRepository(new Dictionary<Type, IEnumerable<IEntity>>
{
{typeof (Author), new[] {new Author {Uid = Guid.NewGuid()}, storageObj}}
});
var updateCommand = new UpdateCommand<Author>();
// act
obj.Name = "foo bar";
obj.About = "sooo some foor";
obj.Company = "rook";
obj.SemanticUid = "foo_bar_rook";
updateCommand.Entity = obj;
updateCommand.Execute(stub);
// assert
Assert.AreEqual(obj.Name, storageObj.Name);
Assert.AreEqual(obj.About, storageObj.About);
Assert.AreEqual(obj.Company, storageObj.Company);
Assert.AreEqual(obj.SemanticUid, storageObj.SemanticUid);
}
示例2: GetNext
public static decimal GetNext(Transaction pTransaction, string pIDFieldValue)
{
decimal lID;
// Inicializa operação
OperationResult lReturn = new OperationResult(QueryDictionaries.SequencesQD.TableName, QueryDictionaries.SequencesQD.TableName);
// Recupera Valor
SelectCommand lSelectNext;
string lSelectQuery = QueryDictionaries.SequencesQD.qSequencesMax;
lSelectQuery += String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesQD._SEQ_NAME.Name);
object lScalarReturn;
lSelectNext = new SelectCommand(lSelectQuery);
// Passagem dos Valores de Parametros para a Clausula WHERE [comando SELECT]
lSelectNext.Fields.Add(QueryDictionaries.SequencesQD._SEQ_NAME.Name, pIDFieldValue, ItemType.String);
// Recupera Valor do Select (Seq_Value)
lScalarReturn = lSelectNext.ReturnScalar(pTransaction);
if (lScalarReturn == null || lScalarReturn == DBNull.Value) lScalarReturn = 1;
lID = Convert.ToDecimal(lScalarReturn);
// Altera Valor da Sequence
UpdateCommand lUpdate;
lUpdate = new UpdateCommand(QueryDictionaries.SequencesQD.TableName);
// Identificação dos Campos a serem Alterados
lUpdate.Fields.Add(QueryDictionaries.SequencesQD._SEQ_VALUE.Name, lID, (ItemType) QueryDictionaries.SequencesQD._SEQ_VALUE.DBType);
string lUpdateQuery;
lUpdateQuery = String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesQD._SEQ_NAME.Name);
lUpdate.Condition = lUpdateQuery;
// Passagem dos Valores para a Condição Where do Update
lUpdate.Conditions.Add(QueryDictionaries.SequencesQD._SEQ_NAME.Name, pIDFieldValue);
// Execução do UPDATE
lUpdate.Execute(pTransaction);
// Retorna novo valor da chave [SEQUENCE VALUE]
return lID;
}
示例3: Update
public static OperationResult Update(
DataFieldCollection pValues,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(PLANOINTERNOQD.TableName, PLANOINTERNOQD.TableName);
ValidateUpdate(pValues, lReturn);
if (lReturn.IsValid)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lUpdate = new UpdateCommand(PLANOINTERNOQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de update");
foreach (DataField lField in pValues.Keys)
{
if ((lField.Name != PLANOINTERNOQD._PLANI_ID.Name))
lUpdate.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", PLANOINTERNOQD._PLANI_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(PLANOINTERNOQD._PLANI_ID.Name, pValues[PLANOINTERNOQD._PLANI_ID].DBToDecimal());
lReturn.Trace("Executando o Update");
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Update finalizado, executando commit");
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}
示例4: Update
public static OperationResult Update(
DataFieldCollection pValues,
List<DataFieldCollection> pListAtuaInc,
List<DataFieldCollection> pListAtuaUpd,
DataFieldCollection pValuesAtuaExcluir,
List<DataFieldCollection> pListPermissao,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(PessoaFuncaoQD.TableName, PessoaFuncaoQD.TableName);
ValidateUpdate(pValues, lReturn);
if (lReturn.IsValid)
{
try
{
lUpdate = new UpdateCommand(PessoaFuncaoQD.TableName);
foreach (DataField lField in pValues.Keys)
{
if ((lField.Name != PessoaFuncaoQD._PESF_ID.Name))
lUpdate.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", PessoaFuncaoQD._PESF_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(PessoaFuncaoQD._PESF_ID.Name, pValues[PessoaFuncaoQD._PESF_ID].DBToDecimal());
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
//Excluir atuação do núcleo alterado
if (pValuesAtuaExcluir.Count > 0)
{
lReturn = AtuacaoDo.UpdateInativo(pValuesAtuaExcluir, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
}
if (pListAtuaInc.Count > 0)
{
foreach (DataFieldCollection lFields in pListAtuaInc)
{
lReturn = AtuacaoDo.Insert(lFields, pTransaction, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
}
}
if (pListAtuaUpd.Count > 0)
{
foreach (DataFieldCollection lFields in pListAtuaUpd)
{
lReturn = AtuacaoDo.Update(lFields, pTransaction, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
}
}
if (pListPermissao.Count > 0)
{
foreach (DataFieldCollection lFields in pListPermissao)
{
lReturn = SecurityUsersDtDo.Insert(lFields, pTransaction, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
}
}
if (!lReturn.HasError)
{
pTransaction.Commit();
}
//.........这里部分代码省略.........
示例5: Exluir_ByNUC_ID
public static OperationResult Exluir_ByNUC_ID(
decimal pNUC_ID,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(NucleoxSecretariaQD.TableName, NucleoxSecretariaQD.TableName);
if (lReturn.IsValid)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lUpdate = new UpdateCommand(NucleoxSecretariaQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de update");
lUpdate.Fields.Add(NucleoxSecretariaQD._NUCSCT_STATUS.Name, "I", (ItemType)NucleoxSecretariaQD._NUCSCT_STATUS.DBType);
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", NucleoxSecretariaQD._NUC_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(NucleoxSecretariaQD._NUC_ID.Name, pNUC_ID);
lReturn.Trace("Executando o Update");
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Update finalizado, executando commit");
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}
示例6: ExcluirTodos
public static OperationResult ExcluirTodos(
DataFieldCollection pValues,
Transaction pTransactionAtivo,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
bool lLocalTransaction = (pTransactionAtivo == null);
if (lLocalTransaction)
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
else
pTransaction = pTransactionAtivo;
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(SituacaoFamiliarResideQD.TableName, SituacaoFamiliarResideQD.TableName);
ValidateUpdate(pValues, lReturn);
if (lReturn.IsValid)
{
try
{
lUpdate = new UpdateCommand(SituacaoFamiliarResideQD.TableName);
foreach (DataField lField in pValues.Keys)
{
if ((lField.Name != SituacaoFamiliarResideQD._STFAM_ID.Name))
lUpdate.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", SituacaoFamiliarResideQD._STFAM_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(SituacaoFamiliarResideQD._STFAM_ID.Name, pValues[SituacaoFamiliarResideQD._STFAM_ID].DBToDecimal());
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}
示例7: Update
public static OperationResult Update(
DataFieldCollection pValues,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(NucleoQD.TableName, NucleoQD.TableName);
ValidateUpdate(pValues, lReturn);
if (lReturn.IsValid)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
//16/10/2012 Ricardo Almeida - retirada da função, pois registro não pode ser excluido se estiver usuário cadastrado
//lReturn = NucleoxAreaAtuacaoDo.Exluir_ByNUC_ID(pValues[NucleoQD._NUC_ID].DBToDecimal(), pInfo);
//if (lReturn.HasError)
//{
// if (lLocalTransaction)
// pTransaction.Rollback();
// return lReturn;
//}
lReturn = NucleoxSecretariaDo.Exluir_ByNUC_ID(pValues[NucleoQD._NUC_ID].DBToDecimal(), pInfo);
if (!lReturn.HasError)
{
lUpdate = new UpdateCommand(NucleoQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de update");
foreach (DataField lField in pValues.Keys)
{
if ((lField.Name != NucleoQD._NUC_ID.Name))
lUpdate.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", NucleoQD._NUC_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(NucleoQD._NUC_ID.Name, pValues[NucleoQD._NUC_ID].DBToDecimal());
lReturn.Trace("Executando o Update");
lUpdate.Execute(pTransaction);
}
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Update finalizado, executando commit");
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}
示例8: Update
public static OperationResult Update(
DataFieldCollection pValues,
List<DataFieldCollection> pListValuesSFR,
DataFieldCollection pValuesSFRExcluir,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(SituacaoFamiliarQD.TableName, SituacaoFamiliarQD.TableName);
ValidateUpdate(pValues, lReturn);
if (lReturn.IsValid)
{
try
{
lUpdate = new UpdateCommand(SituacaoFamiliarQD.TableName);
foreach (DataField lField in pValues.Keys)
{
if ((lField.Name != SituacaoFamiliarQD._PES_ID.Name) && (lField.Name != SituacaoFamiliarQD._STFAM_ID.Name))
lUpdate.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", SituacaoFamiliarQD._PES_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(SituacaoFamiliarQD._PES_ID.Name, pValues[SituacaoFamiliarQD._PES_ID].DBToDecimal());
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (pListValuesSFR.Count > 0)
{
//1º Exclui todos os registros ja salvos
lReturn = SituacaoFamiliarResideDo.ExcluirTodos(pValuesSFRExcluir, pTransaction, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
//2º inclui os novos registros
foreach (DataFieldCollection lFields in pListValuesSFR)
{
lFields.Add(SituacaoFamiliarResideQD._STFAM_ID, pValues[SituacaoFamiliarQD._STFAM_ID].DBToDecimal());
lReturn = SituacaoFamiliarResideDo.Insert(lFields, pTransaction, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
}
}
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}
示例9: ChangePassword
public static string ChangePassword(decimal pSusr_Id, string pSusr_Login, string pSusr_Password_old, string pSusr_Password_new, ConnectionInfo pConnectionInfo)
{
bool lPasswordOK;
string lPassword;
string lResult = "";
OperationResult lReturn;
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pConnectionInfo));
// Validando a Senha Digitada.
lPassword = GetPassword(pSusr_Login, pConnectionInfo);
lPasswordOK = (lPassword == pSusr_Password_old) ? true : false;
if (!lPasswordOK)
lResult = "Senha Atual Incorreta";
// Verificando Transação
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
lReturn = new OperationResult(SystemUserQD.TableName, SystemUserQD.TableName);
if (lPasswordOK)
{
// Iniciando processo de update...
if (lReturn.IsValid)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("ExternalUser: Transação local, instanciando banco...");
}
lUpdate = new UpdateCommand(SystemUserQD.TableName);
lReturn.Trace("ExternalUser: Adicionando campos ao objeto de update");
lUpdate.Fields.Add(SystemUserQD._SUSR_PASSWORD.Name, APB.Framework.Encryption.Crypto.Encode(pSusr_Password_new), (ItemType)SystemUserQD._SUSR_PASSWORD.DBType);
string lSql = "";
//TODO: Condição where customizada
lSql = String.Format("WHERE {0} = >>{0}", SystemUserQD._SUSR_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(SystemUserQD._SUSR_ID.Name, pSusr_Id);
lReturn.Trace("ExternalUser: Executando o Update");
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("ExternalUser: Update finalizado, executando commit");
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
}
else
{
return "Senha atual incorreta";
}
if (lReturn.IsValid)
lResult = "";
else
lResult = lReturn.ToString();
return lResult;
}
示例10: UpdateInativo
public static OperationResult UpdateInativo(
DataFieldCollection pValues,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(AtuacaoQD.TableName, AtuacaoQD.TableName);
if (lReturn.IsValid)
{
try
{
lUpdate = new UpdateCommand(AtuacaoQD.TableName);
foreach (DataField lField in pValues.Keys)
{
if ((lField.Name != AtuacaoQD._PESF_ID.Name))
lUpdate.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", AtuacaoQD._PESF_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(AtuacaoQD._PESF_ID.Name, pValues[AtuacaoQD._PESF_ID].DBToDecimal());
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}
示例11: GetNext
public static decimal GetNext(ConnectionInfo pInfo, string pIDFieldValue)
{
Transaction lTransaction;
DataBase lDataBase;
lDataBase = Instance.CreateDatabase(pInfo);
lTransaction = new Transaction(lDataBase);
try
{
decimal lID;
// Inicializa operação
OperationResult lReturn = new OperationResult(QueryDictionaries.SequencesControlQD.TableName, QueryDictionaries.SequencesControlQD.TableName);
// Recupera Valor
SelectCommand lSelectNext;
string lSelectQuery = QueryDictionaries.SequencesControlQD.qSequencesControlMax;
lSelectQuery += String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesControlQD._CONTROLNAME.Name);
object lScalarReturn;
//APB.Framework.Math.Module11
lSelectNext = new SelectCommand(lSelectQuery);
// Passagem dos Valores de Parametros para a Clausula WHERE [comando SELECT]
lSelectNext.Fields.Add(QueryDictionaries.SequencesControlQD._CONTROLNAME.Name, pIDFieldValue, ItemType.String);
// Recupera Valor do Select (Seq_Value)
lScalarReturn = lSelectNext.ReturnScalar(lTransaction);
if (lScalarReturn == null || lScalarReturn == DBNull.Value) lScalarReturn = 1;
lID = Convert.ToDecimal(lScalarReturn);
// Altera Valor da Sequence
UpdateCommand lUpdate;
lUpdate = new UpdateCommand(QueryDictionaries.SequencesControlQD.TableName);
// Identificação dos Campos a serem Alterados
lUpdate.Fields.Add(QueryDictionaries.SequencesControlQD._CONTROLVALUE.Name, lID, (ItemType)QueryDictionaries.SequencesControlQD._CONTROLVALUE.DBType);
string lUpdateQuery;
lUpdateQuery = String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesControlQD._CONTROLNAME.Name);
lUpdate.Condition = lUpdateQuery;
// Passagem dos Valores para a Condição Where do Update
lUpdate.Conditions.Add(QueryDictionaries.SequencesControlQD._CONTROLNAME.Name, pIDFieldValue);
// Execução do UPDATE
lUpdate.Execute(lTransaction);
lTransaction.Commit();
// Retorna novo valor da chave [CONTROL VALUE]
return lID;
}
catch (Exception ex)
{
lTransaction.Rollback();
throw new UnknownException(ex);
}
}
示例12: Update
public static OperationResult Update(
DataFieldCollection pValues,
List<DataFieldCollection> pListItens,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (pTransaction != null);
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(RegistroMensalAtividadeQD.TableName, RegistroMensalAtividadeQD.TableName);
ValidateUpdate(pValues, lReturn);
if (lReturn.IsValid)
{
try
{
lUpdate = new UpdateCommand(RegistroMensalAtividadeQD.TableName);
foreach (DataField lField in pValues.Keys)
{
if ((lField.Name != RegistroMensalAtividadeQD._RMA_ID.Name))
lUpdate.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", RegistroMensalAtividadeQD._RMA_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(RegistroMensalAtividadeQD._RMA_ID.Name, pValues[RegistroMensalAtividadeQD._RMA_ID].DBToDecimal());
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (pValues[RegistroMensalAtividadeQD._RMA_STATUS].ToString() == "A")
{
//Atualiza
foreach (DataFieldCollection lFields in pListItens)
{
lReturn = ItensRegistroMensalAtividadeDo.Update(lFields, pTransaction, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
}
}
else
{
//Exclui todos os Itens
lReturn = ItensRegistroMensalAtividadeDo.ExcluirItensByRMA_ID(pValues[RegistroMensalAtividadeQD._RMA_ID].DBToDecimal(), pTransaction, pInfo);
if (lReturn.HasError)
{
pTransaction.Rollback();
return lReturn;
}
}
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}
示例13: ExcluirItensByRMA_ID
public static OperationResult ExcluirItensByRMA_ID(
decimal pRMA_ID,
Transaction lTransaction,
ConnectionInfo pInfo
)
{
Transaction pTransaction;
bool lLocalTransaction = (lTransaction != null);
if (lLocalTransaction)
pTransaction = new Transaction(Instance.CreateDatabase(pInfo));
else
pTransaction = lTransaction;
UpdateCommand lUpdate;
OperationResult lReturn = new OperationResult(ItensRegistroMensalAtividadeQD.TableName, ItensRegistroMensalAtividadeQD.TableName);
if (lReturn.IsValid)
{
try
{
lUpdate = new UpdateCommand(ItensRegistroMensalAtividadeQD.TableName);
lUpdate.Fields.Add(ItensRegistroMensalAtividadeQD._IRMA_STATUS.Name, "I", (ItemType)ItensRegistroMensalAtividadeQD._IRMA_STATUS.DBType);
string lSql = "";
lSql = String.Format("WHERE {0} = <<{0}", ItensRegistroMensalAtividadeQD._RMA_ID.Name);
lUpdate.Condition = lSql;
lUpdate.Conditions.Add(ItensRegistroMensalAtividadeQD._RMA_ID.Name, pRMA_ID);
lUpdate.Execute(pTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
pTransaction.Commit();
}
else
{
pTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
pTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
pTransaction.Rollback();
}
}
return lReturn;
}