public validadorDanfe(DadosNfce _dtNfce) { // validar se tem q haver 1 item e 1 pagamento foreach (var item in _dtNfce.itensList) { if (item.NCM == String.Empty) { throw new ApplicationException("#Nota sem NCM.#"); } } if (_dtNfce.pgtsList.Count < 1) { throw new ApplicationException("#Nota sem Pagamento.#"); } if (_dtNfce.itensList.Count < 1) { throw new ApplicationException("#Nota Sem itens.#"); } if (!String.IsNullOrEmpty(_dtNfce.CPF_CNPJ_dest)) { if(!IsCpf(_dtNfce.CPF_CNPJ_dest) && !IsCnpj(_dtNfce.CPF_CNPJ_dest)) throw new ApplicationException("#CPF ou CNPJ invalido.#"); if (String.IsNullOrEmpty(_dtNfce.RazaoSocial_dest)) throw new ApplicationException("#Nota sem nome.#"); } }
public makeXml(DadosNfce _dtNfce, Utils.ConfigureXml _config, X509Certificate2 _cert) { config = _config; dtNfce = _dtNfce; cert = _cert; //strTef = _strTef; processXml(); }
public void ProcessaCupom(DadosNfce _dtNFCE) { dtNFCE = _dtNFCE; mq = new MessageQueue(@".\Private$\NFCe_Contingencia", false); try { if (mq.GetAllMessages().Count() > 0) { Utils.Logger.getInstance.error(dtNFCE.IdAccount + ": Contingencia: fila count(" + mq.GetAllMessages().Count() + ")" + dtNFCE.IdAccount); throw new Exception("Contingencia"); } enviaSeFaz.verificaStatusSefaz(); config.configNFCe.Contingencia = false; } catch (Exception ex) { Utils.Logger.getInstance.error("Contingencia: " + dtNFCE.IdAccount); Utils.Logger.getInstance.error(ex.ToString()); config.configNFCe.Contingencia = true; } xmlData = new makeXml(dtNFCE, config, cert); id_db = ManagerDB.Instance.SelectMaxNFCEidDB(config.configNFCe.Serie, xmlData.chaveAcesso); string resposta = config.configNFCe.Contingencia ? "XML gerado em Contingencia" : "XML gerado"; ManagerDB.Instance.InsertNfceStatus(id_db, (int)StatusCupom.CupomGeradoXml, resposta, ""); Processa(); }
public validador(DadosNfce _dados) { dados = _dados; }