Пример #1
0
        public static bool CancelaItemVenda(EcfVendaDetalheDTO pEcfVendaDetalhe)
        {
            try
            {
                pEcfVendaDetalhe.Logss = "0";
                MemoryStream StreamJson = new MemoryStream();
                DataContractJsonSerializer SerializaJson = new DataContractJsonSerializer(typeof(EcfVendaDetalheDTO));
                SerializaJson.WriteObject(StreamJson, pEcfVendaDetalhe);
                StreamReader LerStreamJson = new StreamReader(StreamJson);
                StreamJson.Position    = 0;
                pEcfVendaDetalhe.Logss = Biblioteca.MD5String(LerStreamJson.ReadToEnd());

                EcfVendaDetalheDTO Resultado = null;
                using (ISession Session = NHibernateHelper.GetSessionFactory().OpenSession())
                {
                    NHibernateDAL <EcfVendaDetalheDTO> DAL = new NHibernateDAL <EcfVendaDetalheDTO>(Session);
                    Resultado = DAL.SaveOrUpdate(pEcfVendaDetalhe);
                }

                return(Resultado != null);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
            }
        }
Пример #2
0
 public static void VendeItem(EcfVendaDetalheDTO VendaDetalhe)
 {
     try
     {
         DataModule.ACBrECF.VendeItem(VendaDetalhe.Gtin, VendaDetalhe.Produto.DescricaoPdv, VendaDetalhe.EcfIcmsSt.ToString(), VendaDetalhe.Quantidade.Value, VendaDetalhe.ValorUnitario.Value);
     }
     catch (Exception eError)
     {
         MessageBox.Show("Falha ao Registrar Item!", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Log.write(eError.ToString());
         return;
     }
 }
Пример #3
0
        public static EcfVendaDetalheDTO GravaEcfVendaDetalhe(EcfVendaDetalheDTO pEcfVendaDetalhe)
        {
            try
            {
                using (ISession Session = NHibernateHelper.GetSessionFactory().OpenSession())
                {
                    MemoryStream StreamJsonDetalhe = new MemoryStream();
                    DataContractJsonSerializer SerializaJsonDetalhe = new DataContractJsonSerializer(typeof(EcfVendaDetalheDTO));
                    SerializaJsonDetalhe.WriteObject(StreamJsonDetalhe, pEcfVendaDetalhe);
                    StreamReader LerStreamJsonDetalhe = new StreamReader(StreamJsonDetalhe);
                    StreamJsonDetalhe.Position = 0;
                    pEcfVendaDetalhe.Logss     = Biblioteca.MD5String(LerStreamJsonDetalhe.ReadToEnd());

                    NHibernateDAL <EcfVendaDetalheDTO> DAL = new NHibernateDAL <EcfVendaDetalheDTO>(Session);
                    DAL.SaveOrUpdate(pEcfVendaDetalhe);
                    Session.Flush();
                }
                return(pEcfVendaDetalhe);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
            }
        }