本文整理汇总了C#中InsertCommand类的典型用法代码示例。如果您正苦于以下问题:C# InsertCommand类的具体用法?C# InsertCommand怎么用?C# InsertCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InsertCommand类属于命名空间,在下文中一共展示了InsertCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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(PORT_BANNERQD.TableName, PORT_BANNERQD.TableName);
if (!lReturn.HasError){
try{
if (lLocalTransaction){
lReturn.Trace("Transação local, instanciando banco...");
}
lInsert = new InsertCommand(PORT_BANNERQD.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, "BAN_ID");
lInsert.Fields.Add(PORT_BANNERQD._BAN_ID.Name, lSequence, (ItemType)PORT_BANNERQD._BAN_ID.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;
}
示例2: TryCustomProcess
/// <summary>
/// Try and custom process the given InsertCommand when it's appropriate to override
/// with Visual Studio specific behavior
/// </summary>
public bool TryCustomProcess(InsertCommand command)
{
var oleCommandData = OleCommandData.Empty;
try
{
if (_vim.InBulkOperation && !command.IsInsertNewLine)
{
// If we are in the middle of a bulk operation we don't want to forward any
// input to IOleCommandTarget because it will trigger actions like displaying
// Intellisense. Definitely don't want intellisense popping up during say a
// repeat of a 'cw' operation or macro.
//
// The one exception to this rule though is the Enter key. Every single language
// formats Enter in a special way that we absolutely want to preserve in a change
// or macro operation. Go ahead and let it go through here and we'll dismiss
// any intellisense which pops up as a result
return false;
}
if (!_vimApplicationSettings.UseEditorTabAndBackspace && (command.IsBack || command.IsInsertTab))
{
// When the user has opted into 'softtabstop' then Vim has a better understanding of
// <BS> than Visual Studio. Allow that processing to win
return false;
}
if (!TryGetOleCommandData(command, out oleCommandData))
{
// Not a command that we custom process
return false;
}
var versionNumber = _textBuffer.CurrentSnapshot.Version.VersionNumber;
int hr = _nextCommandTarget.Exec(oleCommandData);
// Whether or not an Exec succeeded is a bit of a heuristic. IOleCommandTarget implementations like
// C++ will return E_ABORT if Intellisense failed but the character was actually inserted into
// the ITextBuffer. VsVim really only cares about the character insert. However we must also
// consider cases where the character successfully resulted in no action as a success
return ErrorHandler.Succeeded(hr) || versionNumber < _textBuffer.CurrentSnapshot.Version.VersionNumber;
}
finally
{
if (oleCommandData != null)
{
oleCommandData.Dispose();
}
if (_vim.InBulkOperation && _broker.IsCompletionActive)
{
_broker.DismissDisplayWindows();
}
}
}
示例3: CompareInsert
private bool CompareInsert(InsertCommand x, InsertCommand y)
{
return this.Compare(x.Table, y.Table) && this.CompareColumnAssignments(x.Assignments, y.Assignments);
}
示例4: TryCustomProcessFunc
bool IVimHost.TryCustomProcess(ITextView textView, InsertCommand command)
{
if (TryCustomProcessFunc != null)
{
return TryCustomProcessFunc(textView, command);
}
return false;
}
示例5: VisitInsert
protected override Expression VisitInsert(InsertCommand insert)
{
this.Write("INSERT INTO ");
this.WriteTableName(insert.Table.Name);
this.Write("(");
for (int i = 0, n = insert.Assignments.Count; i < n; i++)
{
ColumnAssignment ca = insert.Assignments[i];
if (i > 0) this.Write(", ");
this.WriteColumnName(ca.Column.Name);
}
this.Write(")");
this.WriteLine(Indentation.Same);
this.Write("VALUES (");
for (int i = 0, n = insert.Assignments.Count; i < n; i++)
{
ColumnAssignment ca = insert.Assignments[i];
if (i > 0) this.Write(", ");
this.Visit(ca.Expression);
}
this.Write(")");
return insert;
}
示例6: TryGetOleCommandData
/// <summary>
/// Try and convert the given insert command to an OleCommand. This should only be done
/// for InsertCommand values which we want to custom process
/// </summary>
private bool TryGetOleCommandData(InsertCommand command, out OleCommandData commandData)
{
if (command.IsBack)
{
commandData = new OleCommandData(VSConstants.VSStd2KCmdID.BACKSPACE);
return true;
}
if (command.IsDelete)
{
commandData = new OleCommandData(VSConstants.VSStd2KCmdID.DELETE);
return true;
}
if (command.IsInsert)
{
var insert = (InsertCommand.Insert)command;
if (insert.Item != null && insert.Item.Length == 1)
{
commandData = OleCommandData.CreateTypeChar(insert.Item[0]);
return true;
}
}
if (command.IsInsertTab)
{
commandData = new OleCommandData(VSConstants.VSStd2KCmdID.TAB);
return true;
}
if (command.IsInsertNewLine)
{
commandData = new OleCommandData(VSConstants.VSStd2KCmdID.RETURN);
return true;
}
commandData = OleCommandData.Empty;
return false;
}
示例7: 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;
}
示例8: TryCustomProcess
/// <summary>
/// Custom processing of an insert command is a host specific operation. By default
/// no custom processing is done
/// </summary>
public virtual bool TryCustomProcess(ITextView textView, InsertCommand command)
{
return false;
}
示例9: VisitInsert
protected override Expression VisitInsert(InsertCommand insert)
{
this.Append("INSERT INTO ");
//if (Dialect.SupportSchema && !string.IsNullOrEmpty(insert.Table.Mapping.Schema))
//{
// sb.Append(Dialect.Quote(insert.Table.Mapping.Schema));
// sb.Append(".");
//}
//this.AppendTableName(insert.Table.Name);
WriteTableName(insert.Table.Mapping);
this.Append("(");
for (int i = 0, n = insert.Assignments.Count; i < n; i++)
{
ColumnAssignment ca = insert.Assignments[i];
if (i > 0) this.Append(", ");
this.AppendColumnName(ca.Column.Name);
}
this.Append(")");
this.AppendLine(Indentation.Same);
this.Append("VALUES (");
for (int i = 0, n = insert.Assignments.Count; i < n; i++)
{
ColumnAssignment ca = insert.Assignments[i];
if (i > 0) this.Append(", ");
this.Visit(ca.Expression);
}
this.Append(")");
return insert;
}
示例10: 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;
}
示例11: Visit
public abstract void Visit(InsertCommand insertCommand);
示例12: TryCustomProcess
/// <summary>
/// Try and custom process the given InsertCommand when it's appropriate to override
/// with Visual Studio specific behavior
/// </summary>
public bool TryCustomProcess(InsertCommand command)
{
var oleCommandData = OleCommandData.Empty;
try
{
if (!TryGetOleCommandData(command, out oleCommandData))
{
// Not a command that we custom process
return false;
}
var versionNumber = _textBuffer.CurrentSnapshot.Version.VersionNumber;
int hr = _nextTarget.Exec(oleCommandData);
// Whether or not an Exec succeeded is a bit of a heuristic. IOleCommandTarget implementations like
// C++ will return E_ABORT if Intellisense failed but the character was actually inserted into
// the ITextBuffer. VsVim really only cares about the character insert. However we must also
// consider cases where the character successfully resulted in no action as a success
return ErrorHandler.Succeeded(hr) || versionNumber < _textBuffer.CurrentSnapshot.Version.VersionNumber;
}
finally
{
if (oleCommandData != null)
{
oleCommandData.Dispose();
}
}
}
示例13: 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;
}
示例14: 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)
{
//.........这里部分代码省略.........
示例15: 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;
}