private void TransmitirSiafisico(Empenho objModel, Usuario usuario, int resource)
        {
            try
            {
                var ug = _regional.Buscar(new Regional {
                    Id = Convert.ToInt32(usuario.RegionalId)
                }).FirstOrDefault()?.Uge;
                var months = _mes.Buscar(new EmpenhoMes {
                    Id = objModel.Id
                }).Cast <IMes>().ToList();
                var items = _item.Buscar(new EmpenhoItem {
                    EmpenhoId = objModel.Id
                }).ToList();

                if ((objModel.StatusSiafisicoCT != "S" || string.IsNullOrEmpty(objModel.StatusSiafisicoCT)) && string.IsNullOrEmpty(objModel.NumeroCT))
                {
                    objModel.StatusSiafisicoCT = "E";

                    EnumAcaoSiaf acaoSiaf = EnumAcaoSiaf.Alterar;

                    if (string.IsNullOrEmpty(objModel.NumeroCT))
                    {
                        //objModel.NumeroCT = _siafem.InserirEmpenhoSiafisico(usuario.CPF, Decrypt(usuario.SenhaSiafem), objModel, months, items, ug);
                        acaoSiaf = EnumAcaoSiaf.Inserir;
                    }
                    else
                    {
                        //objModel.NumeroCT = _siafem.InserirEmpenhoSiafisicoAlteracao(usuario.CPF, Decrypt(usuario.SenhaSiafem), objModel, months, ug);
                        acaoSiaf = EnumAcaoSiaf.Alterar;
                    }

                    var senha = Decrypt(usuario.SenhaSiafem);

                    objModel.NumeroCT = base.TransmitirEmpenho(objModel, usuario, ug, months, items, acaoSiaf, senha);

                    objModel.StatusSiafisicoCT = "S";

                    base.TransmitirItens(EnumTipoServicoFazenda.Siafisico, objModel, items, usuario, ug, resource);
                }


                objModel.NumeroEmpenhoSiafisico   = _siafem.ContablizarEmpenho(usuario.CPF, Decrypt(usuario.SenhaSiafem), objModel, ug);
                objModel.TransmitidoSiafisico     = true;
                objModel.StatusSiafemSiafisico    = "S";
                objModel.DataTransmitidoSiafisico = DateTime.Now;
                objModel.MensagemSiafemSiafisico  = null;
            }
            catch (Exception ex)
            {
                objModel.StatusSiafemSiafisico   = "E";
                objModel.MensagemSiafemSiafisico = ex.Message;
                throw SaveLog(ex, (short?)EnumAcao.Transmitir, resource);
            }
            finally
            {
                Salvar(objModel, null, null, resource, (int)EnumAcao.Transmitir);
            }
        }
        private void TransmitirSiafisico(EmpenhoReforco objModel, Usuario usuario, int resource)
        {
            try
            {
                var ug = _regional.Buscar(new Regional {
                    Id = Convert.ToInt32(usuario.RegionalId)
                }).First().Uge;
                var months = _mes.Buscar(new EmpenhoReforcoMes {
                    Id = objModel.Id
                }).Cast <IMes>().ToList();
                var items = _item.Buscar(new EmpenhoReforcoItem {
                    EmpenhoId = objModel.Id
                }).ToList();

                if (objModel.StatusSiafisicoCT != "S")
                {
                    objModel.StatusSiafisicoCT = "E";
                    objModel.NumeroCT          = _siafem.InserirEmpenhoReforcoSiafisico(usuario.CPF, Decrypt(usuario.SenhaSiafem), objModel, months, ug);
                    objModel.StatusSiafisicoCT = "S";
                }

                foreach (var empenhoItem in items)
                {
                    if (empenhoItem.StatusSiafisicoItem == "N" || empenhoItem.StatusSiafisicoItem == "E")
                    {
                        InserirEmpenhoSiafisico(objModel, usuario, empenhoItem, ug, resource);
                    }
                    else if (empenhoItem.StatusSiafisicoItem == "S")
                    {
                        InserirEmpenhoSiafisicoAlteracao(objModel, usuario, empenhoItem, ug, resource);
                    }
                }

                objModel.NumeroEmpenhoSiafisico   = _siafem.ContablizarEmpenho(usuario.CPF, Decrypt(usuario.SenhaSiafem), objModel, ug);
                objModel.TransmitidoSiafisico     = true;
                objModel.StatusSiafemSiafisico    = "S";
                objModel.DataTransmitidoSiafisico = DateTime.Now;
                objModel.MensagemSiafemSiafisico  = null;
            }
            catch (Exception ex)
            {
                objModel.StatusSiafemSiafisico   = "E";
                objModel.MensagemSiafemSiafisico = ex.Message;
                throw SaveLog(ex, (short?)EnumAcao.Transmitir, resource);
            }
            finally
            {
                Salvar(objModel, null, null, resource, (int)EnumAcao.Transmitir);
            }
        }