当前位置: 首页>>代码示例>>C#>>正文


C# Transaction.Rollback方法代码示例

本文整理汇总了C#中Transaction.Rollback方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.Rollback方法的具体用法?C# Transaction.Rollback怎么用?C# Transaction.Rollback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


在下文中一共展示了Transaction.Rollback方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: From

        public static DataSet From(ConnectionInfo pInfo, string pSelectQuery, DataFieldCollection pConditionalParameters)
        {
            DataBase lDB;
            Transaction lTransaction = null;
            DataSet lReturn = new DataSet();

            try
            {

                lDB = Instance.CreateDatabase(pInfo);

                lTransaction = new Transaction(lDB);

                lReturn = From(lTransaction, pSelectQuery, pConditionalParameters);

                lTransaction.Commit();
            }
            catch (Exception lException)
            {

                if (lTransaction != null)
                    lTransaction.Rollback();

                throw lException;
            }

            return lReturn;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_LOTACAO,代码行数:28,代码来源:Select.cs

示例2: Do

        public override CommandResult Do(IExecutionContext context)
        {
            Transaction transaction = new Transaction
            {
                TransactionName = TransactionName,
                TransactionState = TransactionState.Undefined
            };

            try
            {
                context.ExecutedPackage.AddTransaction(transaction);
                Command.Do(context, transaction);
                SetProgress(context, Command, CommandResult.Next);
                transaction.TransactionState = TransactionState.Active;
            }
            catch
            {
                transaction.Rollback();
            }
            finally
            {
                transaction.Save(context);
            }
            return CommandResult.Next;
        }
开发者ID:vgrinin,项目名称:gin,代码行数:25,代码来源:TransactionContainer.cs

示例3: Delete_proposto

        public static int Delete_proposto(
          ConnectionInfo pInfo,
          string pPESF_ID
       )
        {
            string lQuery = "";
            int lResult;
            Transaction lTransaction;

            lTransaction = new Transaction(Instance.CreateDatabase(pInfo));

            bool lLocalTransaction = (lTransaction != null);

            object lTable;

            lQuery = " DELETE FROM " + DIARIA_PROPOSTOQD.TableName;
            lQuery += " WHERE PESF_ID = " + pPESF_ID;

            SelectCommand lSelect = new SelectCommand(lQuery);

            try
            {
                lTable = lSelect.ReturnScalar(Instance.CreateDatabase(pInfo));
                lResult = 1;
            }
            catch (Exception Err)
            {

                lResult = 0;

                if (lLocalTransaction)
                    lTransaction.Rollback();
            }

            return lResult;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:36,代码来源:DIARIA_PROPOSTODo.cs

示例4: 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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_PORTAL,代码行数:65,代码来源:AtuacaoDo.cs

示例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);
//.........这里部分代码省略.........
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:101,代码来源:PessoaDo.cs

示例6: 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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:77,代码来源:PLANOINTERNODo.cs

示例7: 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();
                }
//.........这里部分代码省略.........
开发者ID:andreibaptista,项目名称:DEF_PUB_PORTAL,代码行数:101,代码来源:PessoaFuncaoDo.cs

示例8: TestTransactionWithNestedCalls

		public void TestTransactionWithNestedCalls()
		{
			Transaction transaction = new Transaction();
			// create some variables to work with
			try
			{
				IList lists = MailingList.ListAll;
				foreach( MailingList list in lists )
				{
					Key key = Key.GetKey( true, list );
					IList members = transaction.RetrieveList( typeof(Member), key, null );
					foreach( Member member in members )
					{
						transaction.Persist( member );
					}
					transaction.Persist( list );
				}
				transaction.Commit();
			}
			catch( Exception e )
			{
				string x = e.Message;
				transaction.Rollback();
				throw;
			}
		}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:26,代码来源:TestList.cs

示例9: 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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:81,代码来源:SituacaoFamiliarDo.cs

示例10: 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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:95,代码来源:RegistroMensalAtividadeDo.cs

示例11: 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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:99,代码来源:DocumentoDo.cs

示例12: 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)
                        {
//.........这里部分代码省略.........
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:101,代码来源:DocumentoDo.cs

示例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(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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:91,代码来源:TriagemDo.cs

示例14: 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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:96,代码来源:SystemUserDo.cs

示例15: 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;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_CALC,代码行数:71,代码来源:TrmxIrmDo.cs


注:本文中的Transaction.Rollback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。