本文整理汇总了C#中InsertCommand.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# InsertCommand.Execute方法的具体用法?C# InsertCommand.Execute怎么用?C# InsertCommand.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InsertCommand
的用法示例。
在下文中一共展示了InsertCommand.Execute方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
public static OperationResult Insert(
DataFieldCollection pValuesPESF,
List<DataFieldCollection> pListValuesATUA,
DataFieldCollection pValuesSUSR,
List<DataFieldCollection> pListValuesPERMISSAO,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(PessoaFuncaoQD.TableName, PessoaFuncaoQD.TableName);
if (!lReturn.HasError)
{
try
{
lInsert = new InsertCommand(PessoaFuncaoQD.TableName);
foreach (DataField lField in pValuesPESF.Keys)
{
lInsert.Fields.Add(lField.Name, pValuesPESF[lField], (ItemType)lField.DBType);
}
decimal lSequencePESF_ID;
lSequencePESF_ID = DataBaseSequenceControl.GetNext(pInfo, "PESF_ID");
lInsert.Fields.Add(PessoaFuncaoQD._PESF_ID.Name, lSequencePESF_ID, (ItemType)PessoaFuncaoQD._PESF_ID.DBType);
lReturn.SequenceControl = lSequencePESF_ID;
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (pListValuesATUA.Count > 0)
{
foreach (DataFieldCollection lFields in pListValuesATUA)
{
lFields.Add(AtuacaoQD._PESF_ID, lSequencePESF_ID);
lReturn = AtuacaoDo.Insert(lFields, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
}
}
lReturn = SystemUserDo.Insert(pValuesSUSR, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
if (pListValuesPERMISSAO.Count > 0)
{
foreach (DataFieldCollection lFields in pListValuesPERMISSAO)
{
lFields.Add(SecurityUsersDtQD._SU_ID, lSequencePESF_ID);
lReturn = SecurityUsersDtDo.Insert(lFields, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
}
}
if (!lReturn.HasError)
{
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
//.........这里部分代码省略.........
示例2: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(PLANOINTERNOQD.TableName, PLANOINTERNOQD.TableName);
if (!lReturn.HasError)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lInsert = new InsertCommand(PLANOINTERNOQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de insert");
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "PLANI_ID");
lInsert.Fields.Add(PLANOINTERNOQD._PLANI_ID.Name, lSequence, (ItemType)PLANOINTERNOQD._PLANI_ID.DBType);
lReturn.Trace("Executando o Insert");
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Insert finalizado, executando commit");
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例3: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
List<DataFieldCollection> pListValuesSFR,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(SituacaoFamiliarQD.TableName, SituacaoFamiliarQD.TableName);
if (!lReturn.HasError)
{
try
{
lInsert = new InsertCommand(SituacaoFamiliarQD.TableName);
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "STFAM_ID");
lInsert.Fields.Add(SituacaoFamiliarQD._STFAM_ID.Name, lSequence, (ItemType)SituacaoFamiliarQD._STFAM_ID.DBType);
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (pListValuesSFR.Count > 0)
{
foreach (DataFieldCollection lFields in pListValuesSFR)
{
lFields.Add(SituacaoFamiliarResideQD._STFAM_ID, lSequence);
lReturn = SituacaoFamiliarResideDo.Insert(lFields, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
}
}
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.SequenceControl = lSequence;
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例4: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
Transaction pTransaction,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
bool lLocalTransaction = (pTransaction == null);
if (lLocalTransaction)
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
else
lTransaction = pTransaction;
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(PessoaDocumentoQD.TableName, PessoaDocumentoQD.TableName);
if (!lReturn.HasError)
{
try
{
lInsert = new InsertCommand(PessoaDocumentoQD.TableName);
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "PDOC_ID");
lInsert.Fields.Add(PessoaDocumentoQD._PDOC_ID.Name, lSequence, (ItemType)PessoaDocumentoQD._PDOC_ID.DBType);
lReturn.SequenceControl = lSequence;
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例5: Insert
public static OperationResult Insert(
DataFieldCollection pValuesPessoa,
DataFieldCollection pValuesPai,
DataFieldCollection pValuesMae,
DataFieldCollection pValuesRequerente,
DataFieldCollection pValuesPFamilia,
DataFieldCollection pValuesSituacaoEscolar,
DataFieldCollection pValuesEnderecoPai,
DataFieldCollection pValuesPessoaEnderecoPai,
DataFieldCollection pValuesEnderecoMae,
DataFieldCollection pValuesPessoaEnderecoMae,
DataFieldCollection pValuesEnderecoRequerente,
DataFieldCollection pValuesPessoaEnderecoRequerente,
DataFieldCollection pValuesRG,
DataFieldCollection pValuesCPF,
DataFieldCollection pValuesRGPai,
DataFieldCollection pValuesCPFPai,
DataFieldCollection pValuesRGMae,
DataFieldCollection pValuesCPFMae,
DataFieldCollection pValuesRGRequerente,
DataFieldCollection pValuesCPFRequerente,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(PessoaQD.TableName, PessoaQD.TableName);
if (!lReturn.HasError)
{
try
{
lInsert = new InsertCommand(PessoaQD.TableName);
foreach (DataField lField in pValuesPessoa.Keys)
{
lInsert.Fields.Add(lField.Name, pValuesPessoa[lField], (ItemType)lField.DBType);
}
decimal lSequencePessoa;
decimal lSequencePai = 0;
decimal lSequenceMae = 0;
decimal lSequenceRequerente = 0;
lSequencePessoa = DataBaseSequenceControl.GetNext(pInfo, "PES_ID");
lInsert.Fields.Add(PessoaQD._PES_ID.Name, lSequencePessoa, (ItemType)PessoaQD._PES_ID.DBType);
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (pValuesRG.Count > 0)
{
pValuesRG.Add(PessoaDocumentoQD._PES_ID, lSequencePessoa);
lReturn = PessoaDocumentoDo.Insert(pValuesRG, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
}
if (pValuesCPF.Count > 0)
{
pValuesCPF.Add(PessoaDocumentoQD._PES_ID, lSequencePessoa);
lReturn = PessoaDocumentoDo.Insert(pValuesCPF, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
}
if (pValuesSituacaoEscolar.Count > 0)
{
pValuesSituacaoEscolar.Add(SituacaoEscolarQD._PES_ID, lSequencePessoa);
lReturn = SituacaoEscolarDo.Insert(pValuesSituacaoEscolar, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
}
#region Pai
if (pValuesPai.Count > 0)
{
lInsert = new InsertCommand(PessoaQD.TableName);
foreach (DataField lField in pValuesPai.Keys)
{
lInsert.Fields.Add(lField.Name, pValuesPai[lField], (ItemType)lField.DBType);
}
lSequencePai = DataBaseSequenceControl.GetNext(pInfo, "PES_ID");
lInsert.Fields.Add(PessoaQD._PES_ID.Name, lSequencePai, (ItemType)PessoaQD._PES_ID.DBType);
//.........这里部分代码省略.........
示例6: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
Transaction pTransaction,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
bool lLocalTransaction = (pTransaction == null);
if (lLocalTransaction)
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
else
lTransaction = pTransaction;
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(AtuacaoQD.TableName, AtuacaoQD.TableName);
if (!lReturn.HasError)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
//lReturn.Trace("Excluído Atuações...");
//lReturn = UpdateInativo(pValues[AtuacaoQD._PESF_ID].DBToDecimal(), pValues[AtuacaoQD._ATUA_STATUS].ToString(), pInfo);
//if (lReturn.HasError)
//{
// return lReturn;
//}
lInsert = new InsertCommand(AtuacaoQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de insert");
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "ATUA_ID");
lInsert.Fields.Add(AtuacaoQD._ATUA_ID.Name, lSequence, (ItemType)AtuacaoQD._ATUA_ID.DBType);
lReturn.SequenceControl = lSequence;
lReturn.Trace("Executando o Insert");
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Insert finalizado, executando commit");
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例7: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
List<DataFieldCollection> pListInterrupcao,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(DCALC_CONDENACAOQD.TableName, DCALC_CONDENACAOQD.TableName);
if (!lReturn.HasError)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lInsert = new InsertCommand(DCALC_CONDENACAOQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de insert");
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "COND_ID");
lInsert.Fields.Add(DCALC_CONDENACAOQD._COND_ID.Name, lSequence, (ItemType)DCALC_CONDENACAOQD._COND_ID.DBType);
decimal lCOND_ID = 0;
lCOND_ID = lReturn.SequenceControl;
lReturn.Trace("Executando o Insert");
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (pListInterrupcao.Count > 0)
{
foreach (DataFieldCollection lFields in pListInterrupcao)
{
lFields.Add(DCALC_INTERRUPCAOQD._COD_CONDENACAO, lSequence);
lReturn = DCALC_INTERRUPCAODo.Insert(lFields, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
}
}
if (!lReturn.HasError)
{
lReturn.SequenceControl = lSequence;
lReturn.Trace("Insert finalizado, executando commit");
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例8: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(OficioQD.TableName, OficioQD.TableName);
if (!lReturn.HasError)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lInsert = new InsertCommand(OficioQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de insert");
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "OFC_ID");
lInsert.Fields.Add(OficioQD._OFC_ID.Name, lSequence, (ItemType)OficioQD._OFC_ID.DBType);
string lNumeroOficio = "OFC" + lSequence.ToString().PadLeft(7, '0') + "/" + DateTime.Now.Date.Year.ToString();
lInsert.Fields.Add(OficioQD._OFC_NUMERO.Name, lNumeroOficio, (ItemType)OficioQD._OFC_NUMERO.DBType);
lReturn.Trace("Executando o Insert");
lInsert.Execute(lTransaction, false);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Insert finalizado, executando commit");
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例9: Insert
public static OperationResult Insert(
List<DataFieldCollection> pListValues,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(TrmxIrmQD.TableName, TrmxIrmQD.TableName);
if (!lReturn.HasError)
{
try
{
foreach (DataFieldCollection pValues in pListValues)
{
lInsert = new InsertCommand(TrmxIrmQD.TableName);
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "TRMIRM_ID");
lInsert.Fields.Add(TrmxIrmQD._TRMIRM_ID.Name, lSequence, (ItemType)TrmxIrmQD._TRMIRM_ID.DBType);
lInsert.Execute(lTransaction);
if (lReturn.HasError)
{
lTransaction.Rollback();
}
}
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例10: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(DocumentoQD.TableName, DocumentoQD.TableName);
if (!lReturn.HasError)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lInsert = new InsertCommand(DocumentoQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de insert");
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "DOC_ID");
lInsert.Fields.Add(DocumentoQD._DOC_ID.Name, lSequence, (ItemType)DocumentoQD._DOC_ID.DBType);
lReturn.SequenceControl = lSequence;
decimal lDocNumero = 0;
string lNumeroDocumento = "";
if (pValues[DocumentoQD._TDOC_ID].DBToDecimal() == 1)
{
lDocNumero = DataBaseSequenceControl.GetNext(pInfo, "DOC_ATENDIMENTO");
if (System.Configuration.ConfigurationManager.AppSettings["ApplicationMode"].ToString() == "OnLine")
lNumeroDocumento = "A" + pValues[DocumentoQD._NUC_ID].ToString().PadLeft(2,'0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
else
lNumeroDocumento = "T" + pValues[DocumentoQD._NUC_ID].ToString().PadLeft(2, '0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
}
else if (pValues[DocumentoQD._TDOC_ID].DBToDecimal() == 2)
{
lDocNumero = DataBaseSequenceControl.GetNext(pInfo, "DOC_NUMERO");
if (System.Configuration.ConfigurationManager.AppSettings["ApplicationMode"].ToString() == "OnLine")
lNumeroDocumento = "P" + pValues[DocumentoQD._NUC_ID].ToString().PadLeft(2, '0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
else
lNumeroDocumento = "R" + pValues[DocumentoQD._NUC_ID].ToString().PadLeft(2, '0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
}
lInsert.Fields.Add(DocumentoQD._DOC_NUMERO.Name, lNumeroDocumento, (ItemType)DocumentoQD._DOC_NUMERO.DBType);
lReturn.Trace("Executando o Insert");
lInsert.Execute(lTransaction, false);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Insert finalizado, executando commit");
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}
示例11: InsertProcesso
public static OperationResult InsertProcesso(
DataFieldCollection pValuesAgendamentoDefensor,
DataFieldCollection pValuesAtendimento,
List<DataFieldCollection> pListDocumentoMovimentoAtendimento,
DataFieldCollection pValuesProcesso,
List<DataFieldCollection> pListAssuntoProcessual,
List<DataFieldCollection> pListInteressado,
DataFieldCollection pValuesDocMovTramitacao,
List<DataFieldCollection> pListDocumentoMovimentoProcesso,
DataFieldCollection pValuesTramitacao,
DataFieldCollection pValuesDocMovAnexo,
DataFieldCollection pValuesAnexoExterno,
DataFieldCollection pValuesDocMovApf,
DataFieldCollection pValuesAnexoApf,
DataFieldCollection pValuesDocMovSiscop,
DataFieldCollection pValuesAnexoSiscop,
DataFieldCollection pValuesCriminalDatas,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(DocumentoQD.TableName, DocumentoQD.TableName);
if (!lReturn.HasError)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lInsert = new InsertCommand(DocumentoQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de insert");
foreach (DataField lField in pValuesProcesso.Keys)
{
lInsert.Fields.Add(lField.Name, pValuesProcesso[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "DOC_ID");
lInsert.Fields.Add(DocumentoQD._DOC_ID.Name, lSequence, (ItemType)DocumentoQD._DOC_ID.DBType);
lReturn.SequenceControl = lSequence;
decimal lDocNumero = 0;
string lNumeroDocumento = "";
if (pValuesProcesso[DocumentoQD._TDOC_ID].DBToDecimal() == 1)
{
lDocNumero = DataBaseSequenceControl.GetNext(pInfo, "DOC_ATENDIMENTO");
if (System.Configuration.ConfigurationManager.AppSettings["ApplicationMode"].ToString() == "OnLine")
lNumeroDocumento = "A" + pValuesProcesso[DocumentoQD._NUC_ID].ToString().PadLeft(2, '0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
else
lNumeroDocumento = "T" + pValuesProcesso[DocumentoQD._NUC_ID].ToString().PadLeft(2, '0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
}
else if (pValuesProcesso[DocumentoQD._TDOC_ID].DBToDecimal() == 2)
{
lDocNumero = DataBaseSequenceControl.GetNext(pInfo, "DOC_NUMERO");
if (System.Configuration.ConfigurationManager.AppSettings["ApplicationMode"].ToString() == "OnLine")
lNumeroDocumento = "P" + pValuesProcesso[DocumentoQD._NUC_ID].ToString().PadLeft(2, '0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
else
lNumeroDocumento = "R" + pValuesProcesso[DocumentoQD._NUC_ID].ToString().PadLeft(2, '0') + lDocNumero.ToString().PadLeft(5, '0') + "/" + DateTime.Now.Date.Year.ToString();
}
lInsert.Fields.Add(DocumentoQD._DOC_NUMERO.Name, lNumeroDocumento, (ItemType)DocumentoQD._DOC_NUMERO.DBType);
lReturn.Trace("Executando o Insert Documento");
lInsert.Execute(lTransaction, false);
if (!lReturn.HasError)
{
lReturn = AgendamentoDefensorDo.Update(pValuesAgendamentoDefensor, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
lReturn = DocumentoDo.Update(pValuesAtendimento, lTransaction, pInfo);
if (lReturn.HasError)
{
lTransaction.Rollback();
return lReturn;
}
if (pListDocumentoMovimentoAtendimento.Count > 0)
{
//.........这里部分代码省略.........
示例12: Insert
public static OperationResult Insert(
DataFieldCollection pValues,
ConnectionInfo pInfo
)
{
Transaction lTransaction;
lTransaction = new Transaction(Instance.CreateDatabase(pInfo));
bool lLocalTransaction = (lTransaction != null);
InsertCommand lInsert;
OperationResult lReturn = new OperationResult(TriagemQD.TableName, TriagemQD.TableName);
if (!lReturn.HasError)
{
try
{
if (lLocalTransaction)
{
lReturn.Trace("Transação local, instanciando banco...");
}
lInsert = new InsertCommand(TriagemQD.TableName);
lReturn.Trace("Adicionando campos ao objeto de insert");
foreach (DataField lField in pValues.Keys)
{
lInsert.Fields.Add(lField.Name, pValues[lField], (ItemType)lField.DBType);
}
decimal lSequence;
lSequence = DataBaseSequenceControl.GetNext(pInfo, "TRG_ID");
lInsert.Fields.Add(TriagemQD._TRG_ID.Name, lSequence, (ItemType)TriagemQD._TRG_ID.DBType);
lReturn.SequenceControl = lSequence;
decimal lSequenceSenha;
if (pValues[TriagemQD._ASTTRG_ID].ToString() == "1")
{
lSequenceSenha = DataBaseSequenceControl.GetNext(lTransaction, TriagemQD.TableName, "TRG_SENHA", " NUC_ID = " + pValues[TriagemQD._NUC_ID] + " AND TO_CHAR(TRG_REGDATE,'dd/MM/yyyy') = TO_CHAR(SYSDATE,'dd/MM/yyyy') AND ASTTRG_ID = 1 AND TRG_PRIORIDADE = " + pValues[TriagemQD._TRG_PRIORIDADE]);
lInsert.Fields.Add(TriagemQD._TRG_SENHA.Name, lSequenceSenha, (ItemType)TriagemQD._TRG_SENHA.DBType);
}
else if (pValues[TriagemQD._ASTTRG_ID].ToString() == "4")
{
lSequenceSenha = DataBaseSequenceControl.GetNext(lTransaction, TriagemQD.TableName, "TRG_SENHA", " NUC_ID = " + pValues[TriagemQD._NUC_ID] + " AND TO_CHAR(TRG_REGDATE,'dd/MM/yyyy') = TO_CHAR(SYSDATE,'dd/MM/yyyy') AND ASTTRG_ID = 4 AND TRG_PRIORIDADE = " + pValues[TriagemQD._TRG_PRIORIDADE]);
lInsert.Fields.Add(TriagemQD._TRG_SENHA.Name, lSequenceSenha, (ItemType)TriagemQD._TRG_SENHA.DBType);
}
else if (pValues[TriagemQD._ASTTRG_ID].ToString() == "7")
{
lSequenceSenha = DataBaseSequenceControl.GetNext(lTransaction, TriagemQD.TableName, "TRG_SENHA", " NUC_ID = " + pValues[TriagemQD._NUC_ID] + " AND TO_CHAR(TRG_REGDATE,'dd/MM/yyyy') = TO_CHAR(SYSDATE,'dd/MM/yyyy') AND ASTTRG_ID = 7 AND TRG_PRIORIDADE = " + pValues[TriagemQD._TRG_PRIORIDADE]);
lInsert.Fields.Add(TriagemQD._TRG_SENHA.Name, lSequenceSenha, (ItemType)TriagemQD._TRG_SENHA.DBType);
}
lReturn.Trace("Executando o Insert");
lInsert.Execute(lTransaction);
if (!lReturn.HasError)
{
if (lLocalTransaction)
{
if (!lReturn.HasError)
{
lReturn.Trace("Insert finalizado, executando commit");
lTransaction.Commit();
}
else
{
lTransaction.Rollback();
}
}
}
else
{
if (lLocalTransaction)
lTransaction.Rollback();
}
}
catch (Exception ex)
{
lReturn.OperationException = new SerializableException(ex);
if (lLocalTransaction)
lTransaction.Rollback();
}
}
return lReturn;
}