/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (BillingAddress != null) { hashCode = hashCode * 59 + BillingAddress.GetHashCode(); } if (ContactDetails != null) { hashCode = hashCode * 59 + ContactDetails.GetHashCode(); } if (FiscalNumber != null) { hashCode = hashCode * 59 + FiscalNumber.GetHashCode(); } if (Locale != null) { hashCode = hashCode * 59 + Locale.GetHashCode(); } if (PersonalInformation != null) { hashCode = hashCode * 59 + PersonalInformation.GetHashCode(); } if (ShippingAddress != null) { hashCode = hashCode * 59 + ShippingAddress.GetHashCode(); } return(hashCode); } }
private bool ValidateFiscalNumberFunc() { bool result = false; //IN:009268 BackOffice - NIF auto-complete Clean fields on insert different VAT if (_configurationCountry != null) { result = FiscalNumber.IsValidFiscalNumber(_entryFiscalNumber.Text, _configurationCountry.Code2); } /* IN009061 - used to force field to be shown in error or not */ _genericCRUDWidgetXPOFiscalNumber.Validated = result; /* IN009061 - avoid duplicated FiscalNumber */ if (DialogMode.Insert.Equals(_dialogMode) && result) { FiscalNumberAlreadyExists(_entryFiscalNumber.Text); } else if (DialogMode.Update.Equals(_dialogMode) && result) { if (!_entryFiscalNumber.Text.Equals(_customer.FiscalNumber)) { FiscalNumberAlreadyExists(_entryFiscalNumber.Text); } } return(result); }
private bool ValidateFiscalNumberFunc() { bool result = false; if (_configurationCountry != null) { result = FiscalNumber.IsValidFiscalNumber(_entryFiscalNumber.Text, _configurationCountry.Code2); } return(result); }
public override int GetHashCode() { unchecked { var hashCode = (TimeRaw != null ? TimeRaw.GetDeterministicHashCode() : 0); hashCode = (hashCode * 397) ^ Sum.GetHashCode(); hashCode = (hashCode * 397) ^ (FiscalNumber != null ? FiscalNumber.GetDeterministicHashCode() : 0); hashCode = (hashCode * 397) ^ (FiscalDocument != null ? FiscalDocument.GetDeterministicHashCode() : 0); hashCode = (hashCode * 397) ^ (FiscalSign != null ? FiscalSign.GetDeterministicHashCode() : 0); hashCode = (hashCode * 397) ^ (N != null ? N.GetDeterministicHashCode() : 0); return(hashCode); } }
/// <summary> /// Returns true if Customer instances are equal /// </summary> /// <param name="other">Instance of Customer to be compared</param> /// <returns>Boolean</returns> public bool Equals(Customer other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( BillingAddress == other.BillingAddress || BillingAddress != null && BillingAddress.Equals(other.BillingAddress) ) && ( ContactDetails == other.ContactDetails || ContactDetails != null && ContactDetails.Equals(other.ContactDetails) ) && ( FiscalNumber == other.FiscalNumber || FiscalNumber != null && FiscalNumber.Equals(other.FiscalNumber) ) && ( Locale == other.Locale || Locale != null && Locale.Equals(other.Locale) ) && ( PersonalInformation == other.PersonalInformation || PersonalInformation != null && PersonalInformation.Equals(other.PersonalInformation) ) && ( ShippingAddress == other.ShippingAddress || ShippingAddress != null && ShippingAddress.Equals(other.ShippingAddress) )); }
void EntryValidation_Changed(object sender, EventArgs e) { try { EntryBoxValidation input = ((sender as EntryValidation).Parent.Parent.Parent as EntryBoxValidation); input.EntryValidation.Validate(); if (input.EntryValidation.Validated && input.Name == "COMPANY_FISCALNUMBER") { bool isValidFiscalNumber = FiscalNumber.IsValidFiscalNumber(input.EntryValidation.Text, _entryBoxSelectSystemCountry.Value.Code2); input.EntryValidation.Validated = isValidFiscalNumber; } Validate(); } catch (Exception ex) { _log.Error(ex.Message, ex); } }
private string GenerateXmlStringWB() { /* IN007016 - escaping the following list of chars using "System.Security.SecurityElement.Escape()" method: * * " " * ' ' * < < * > > * & & */ _log.Debug($"string ServicesAT.GenerateXmlStringWB() :: {_documentMaster.DocumentNumber}"); //IN009347 Documentos PT - Alteração do Layout dos dados do Cliente #Lindote 2020 /* IN009150 (IN009075) - Decrypt phase */ string entityName = ""; string entityAddress = ""; string entityZipCode = ""; string entityCity = ""; string entityLocality = ""; // string entityCountry = ""; string entityFiscalNumber = ""; if (!string.IsNullOrEmpty(_documentMaster.EntityName)) { entityName = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityName); } if (!string.IsNullOrEmpty(_documentMaster.EntityAddress)) { entityAddress = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityAddress); } if (!string.IsNullOrEmpty(_documentMaster.EntityZipCode)) { entityZipCode = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityZipCode); } if (!string.IsNullOrEmpty(_documentMaster.EntityCity)) { entityCity = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityCity); } if (!string.IsNullOrEmpty(_documentMaster.EntityLocality)) { entityCity = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityLocality); } // if (!string.IsNullOrEmpty(_documentMaster.EntityCountry)) { entityCountry = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityCountry); } if (!string.IsNullOrEmpty(_documentMaster.EntityFiscalNumber)) { entityFiscalNumber = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityFiscalNumber); } /* IN009150 - end */ //Init Local Vars string customerTaxID = FiscalNumber.ExtractFiscalNumber(entityFiscalNumber); string sbContentLines = string.Empty; //MovementStartTime equal/greater system DateTime to prevent -100 error (Override _documentMaster.MovementStartTime) _movementStartTime = DateTime.Now; //Test mode, increase DocumentNumber only when Develop if (_increaseDocumentNumber) { Utils.IncreaseDocumentNumber(_documentMaster); } //Get Lines Content sbContentLines = Utils.GetDocumentWayBillContentLines(_documentMaster); StringBuilder sb = new StringBuilder(); //Soap Envelope sb.Append("<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"); //Soap Header sb.Append(" <S:Header>"); sb.Append(" <wss:Security xmlns:wss=\"http://schemas.xmlsoap.org/ws/2002/12/secext/\">"); sb.Append(" <wss:UsernameToken>"); sb.Append(" <wss:Username>" + _atAccountFiscalNumber + "</wss:Username>"); sb.Append(" <wss:Password>" + _accountPasswordEncrypted + "</wss:Password>"); sb.Append(" <wss:Nonce>" + _symetricKeyEncrypted + "</wss:Nonce>"); sb.Append(" <wss:Created>" + _dateOfCriationEncrypted + "</wss:Created>"); sb.Append(" </wss:UsernameToken>"); sb.Append(" </wss:Security>"); sb.Append(" </S:Header>"); //Soap Body sb.Append(" <S:Body>"); sb.Append(" <ns2:envioDocumentoTransporteRequestElem xmlns:ns2=\"https://servicos.portaldasfinancas.gov.pt/sgdtws/documentosTransporte/\">"); sb.Append(" <TaxRegistrationNumber>" + _atTaxRegistrationNumber + "</TaxRegistrationNumber>"); sb.Append(" <CompanyName>" + SecurityElement.Escape(entityName) + "</CompanyName>"); sb.Append(" <CompanyAddress>"); //Change "AddressDetail" to "Addressdetail" else error: complex-type 2.4: in element CompanyAddress of type //Only sent is not empty Addressdetail,City,PostalCode,Country sb.Append(" <Addressdetail>" + SecurityElement.Escape(entityAddress) + "</Addressdetail>"); sb.Append(" <City>" + entityCity + "</City>"); sb.Append(" <PostalCode>" + entityZipCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.EntityCountry + "</Country>"); sb.Append(" </CompanyAddress>"); sb.Append(" <DocumentNumber>" + _documentMaster.DocumentNumber + "</DocumentNumber>"); //WIP: CancellWayBills : Find "//WIP: CancellWayBills : " to continue in Uncomment in PosDocumentFinanceSelectRecordDialog.cs //Used to Cancel Documents, ex After we have it in DB, resulted from a Sent WB //Currently disabled Problems :"Não pode ser alterado um Documento de Transporte quando a Data de Início já decorreu." if (!string.IsNullOrEmpty(_documentMaster.ATDocCodeID)) { /* IN009083 - only Transportation Documents have "ATDocCodeID" when successfully sent to AT */ sb.Append(" <ATDocCodeID>" + _documentMaster.ATDocCodeID + "</ATDocCodeID>"); } sb.Append(" <MovementStatus>" + _documentMaster.DocumentStatusStatus + "</MovementStatus>"); sb.Append(" <MovementDate>" + _documentMaster.DocumentDate + "</MovementDate>"); sb.Append(" <MovementType>" + _documentMaster.DocumentType.Acronym + "</MovementType>"); sb.Append(" <CustomerTaxID>" + customerTaxID + "</CustomerTaxID>"); sb.Append(" <CustomerAddress>"); //Only sent is not empty Addressdetail,City,PostalCode,Country sb.Append(" <Addressdetail>" + SecurityElement.Escape(entityAddress) + "</Addressdetail>"); sb.Append(" <City>" + entityCity + "</City>"); sb.Append(" <PostalCode>" + entityZipCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.EntityCountry + "</Country>"); sb.Append(" </CustomerAddress>"); //Required to be after <CustomerAddress> sb.Append(" <CustomerName>" + SecurityElement.Escape(entityName) + "</CustomerName>"); sb.Append(" <AddressTo>"); sb.Append(" <Addressdetail>" + SecurityElement.Escape(_documentMaster.ShipToAddressDetail) + "</Addressdetail>"); sb.Append(" <City>" + _documentMaster.ShipToCity + "</City>"); sb.Append(" <PostalCode>" + _documentMaster.ShipToPostalCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.ShipToCountry + "</Country>"); sb.Append(" </AddressTo>"); sb.Append(" <AddressFrom>"); sb.Append(" <Addressdetail>" + SecurityElement.Escape(_documentMaster.ShipFromAddressDetail) + "</Addressdetail>"); sb.Append(" <City>" + _documentMaster.ShipFromCity + "</City>"); sb.Append(" <PostalCode>" + _documentMaster.ShipFromPostalCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.ShipFromCountry + "</Country>"); sb.Append(" </AddressFrom>"); //Dont Sent MovementEndTime, not required //sb.Append(" <MovementEndTime>" + _documentMaster.MovementEndTime.ToString(SettingsApp.DateTimeFormatCombinedDateTime) + "</MovementEndTime>"); sb.Append(" <MovementStartTime>" + _movementStartTime.ToString(SettingsApp.DateTimeFormatCombinedDateTime) + "</MovementStartTime>"); //VehicleID if (!string.IsNullOrEmpty(_documentMaster.ShipFromDeliveryID)) { sb.Append(" <VehicleID>" + _documentMaster.ShipFromDeliveryID + "</VehicleID>"); } //Line //Generated Content sb.Append(sbContentLines); sb.Append(" </ns2:envioDocumentoTransporteRequestElem>"); sb.Append(" </S:Body>"); sb.Append("</S:Envelope>"); TextReader textReader = new StringReader(sb.ToString()); XDocument xmlDocument = XDocument.Load(textReader); //Save Soap xmlDocument.Save(_pathSaveSoap); return(xmlDocument.ToString()); }
private string GenerateXmlStringDC() { _log.Debug($"string ServiceAT.GenerateXmlStringDC() :: {_documentMaster.DocumentNumber}"); /* IN009150 (IN009075) */ string entityFiscalNumber = ""; if (!string.IsNullOrEmpty(_documentMaster.EntityFiscalNumber)) { entityFiscalNumber = GlobalFramework.PluginSoftwareVendor.Decrypt(_documentMaster.EntityFiscalNumber); } /* IN009150 - end */ //Init Local Vars string customerTaxID = FiscalNumber.ExtractFiscalNumber(entityFiscalNumber); string sbContentCustomerTax = string.Empty; string sbContentLinesAndDocumentTotals = string.Empty; //Test mode, increase DocumentNumber only when Develop if (_increaseDocumentNumber) { Utils.IncreaseDocumentNumber(_documentMaster); } //Diferent sbContentCustomerTax if OutSide Portugal if (_documentMaster.EntityCountryOid.Equals(SettingsApp.XpoOidConfigurationCountryPortugal)) { sbContentCustomerTax = string.Format(" <CustomerTaxID>{0}</CustomerTaxID>", customerTaxID); } else { sbContentCustomerTax = string.Format(@" <ns2:InternationalCustomerTaxID> <TaxIDNumber>{0}</TaxIDNumber> <TaxIDCountry>{1}</TaxIDCountry> </ns2:InternationalCustomerTaxID>" , customerTaxID , _documentMaster.EntityCountry ); } //Get Lines Content sbContentLinesAndDocumentTotals = Utils.GetDocumentContentLinesAndDocumentTotals(_documentMaster); //Init StringBuilder StringBuilder sb = new StringBuilder(); //Soap Header sb.Append("<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"); sb.Append(" <S:Header>"); sb.Append(" <wss:Security xmlns:wss=\"http://schemas.xmlsoap.org/ws/2002/12/secext/\">"); sb.Append(" <wss:UsernameToken>"); sb.Append(" <wss:Username>" + _atAccountFiscalNumber + "</wss:Username>"); sb.Append(" <wss:Password>" + _accountPasswordEncrypted + "</wss:Password>"); sb.Append(" <wss:Nonce>" + _symetricKeyEncrypted + "</wss:Nonce>"); sb.Append(" <wss:Created>" + _dateOfCriationEncrypted + "</wss:Created>"); sb.Append(" </wss:UsernameToken>"); sb.Append(" </wss:Security>"); sb.Append("</S:Header>"); //Soap Body sb.Append(" <S:Body>"); sb.Append(" <ns2:RegisterInvoiceElem xmlns:ns2=\"http://servicos.portaldasfinancas.gov.pt/faturas/\">"); sb.Append(" <TaxRegistrationNumber>" + _atTaxRegistrationNumber + "</TaxRegistrationNumber>"); sb.Append(" <ns2:InvoiceNo>" + _documentMaster.DocumentNumber + "</ns2:InvoiceNo>"); sb.Append(" <ns2:InvoiceDate>" + _documentMaster.DocumentDate + "</ns2:InvoiceDate>"); sb.Append(" <ns2:InvoiceType>" + _documentMaster.DocumentType.Acronym + "</ns2:InvoiceType>"); sb.Append(" <ns2:InvoiceStatus>N</ns2:InvoiceStatus>"); //Generated Content sb.Append(sbContentCustomerTax); sb.Append(sbContentLinesAndDocumentTotals); sb.Append(" </ns2:RegisterInvoiceElem>"); sb.Append(" </S:Body>"); sb.Append("</S:Envelope>"); TextReader textReader = new StringReader(sb.ToString()); XDocument xmlDocument = XDocument.Load(textReader); //Save Soap xmlDocument.Save(_pathSaveSoap); return(xmlDocument.ToString()); }
private void InitUI(bool useDataDemo) { //Get Values from Config Guid systemCountry; Guid systemCurrency; //bool debug = false; bool useDatabaseDataDemo = Convert.ToBoolean(GlobalFramework.Settings["useDatabaseDataDemo"]); if (GlobalFramework.Settings["xpoOidConfigurationCountrySystemCountry"] != string.Empty) { systemCountry = new Guid(GlobalFramework.Settings["xpoOidConfigurationCountrySystemCountry"]); } else { systemCountry = SettingsApp.XpoOidConfigurationCountryPortugal; } if (GlobalFramework.Settings["xpoOidConfigurationCurrencySystemCurrency"] != string.Empty) { systemCurrency = new Guid(GlobalFramework.Settings["xpoOidConfigurationCurrencySystemCurrency"]); } else { systemCurrency = SettingsApp.XpoOidConfigurationCurrencyEuro; } //Init Inital Values cfg_configurationcountry intialValueConfigurationCountry = (cfg_configurationcountry)FrameworkUtils.GetXPGuidObject(typeof(cfg_configurationcountry), systemCountry); cfg_configurationcurrency intialValueConfigurationCurrency = (cfg_configurationcurrency)FrameworkUtils.GetXPGuidObject(typeof(cfg_configurationcurrency), systemCurrency); try { //Init dictionary for Parameters + Widgets _dictionaryObjectBag = new Dictionary <cfg_configurationpreferenceparameter, EntryBoxValidation>(); //Pack VBOX VBox vbox = new VBox(true, 2) { WidthRequest = 300 }; //Country CriteriaOperator criteriaOperatorSystemCountry = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled <> 1) AND (RegExFiscalNumber IS NOT NULL)"); _entryBoxSelectSystemCountry = new XPOEntryBoxSelectRecordValidation <cfg_configurationcountry, TreeViewConfigurationCountry>(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_country"), "Designation", "Oid", intialValueConfigurationCountry, criteriaOperatorSystemCountry, SettingsApp.RegexGuid, true); _entryBoxSelectSystemCountry.EntryValidation.IsEditable = false; _entryBoxSelectSystemCountry.EntryValidation.Validate(_entryBoxSelectSystemCountry.Value.Oid.ToString()); //Disabled, Now Country and Currency are disabled _entryBoxSelectSystemCountry.ButtonSelectValue.Sensitive = true; _entryBoxSelectSystemCountry.EntryValidation.Sensitive = true; _entryBoxSelectSystemCountry.ClosePopup += delegate { ////Require to Update RegEx _entryBoxZipCode.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExZipCode; _entryBoxZipCode.EntryValidation.Validate(); //Require to Update RegEx and Criteria to filter Country Clients Only _entryBoxFiscalNumber.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExFiscalNumber; _entryBoxFiscalNumber.EntryValidation.Validate(); if (_entryBoxFiscalNumber.EntryValidation.Validated) { bool isValidFiscalNumber = FiscalNumber.IsValidFiscalNumber(_entryBoxFiscalNumber.EntryValidation.Text, _entryBoxSelectSystemCountry.Value.Code2); _entryBoxFiscalNumber.EntryValidation.Validated = isValidFiscalNumber; } //Call Main Validate Validate(); }; //Currency CriteriaOperator criteriaOperatorSystemCurrency = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled <> 1)"); _entryBoxSelectSystemCurrency = new XPOEntryBoxSelectRecordValidation <cfg_configurationcurrency, TreeViewConfigurationCurrency>(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_currency"), "Designation", "Oid", intialValueConfigurationCurrency, criteriaOperatorSystemCurrency, SettingsApp.RegexGuid, true); _entryBoxSelectSystemCurrency.EntryValidation.IsEditable = false; _entryBoxSelectSystemCurrency.EntryValidation.Validate(_entryBoxSelectSystemCurrency.Value.Oid.ToString()); //Disabled, Now Country and Currency are disabled //_entryBoxSelectSystemCurrency.ButtonSelectValue.Sensitive = false; //_entryBoxSelectSystemCurrency.EntryValidation.Sensitive = false; _entryBoxSelectSystemCurrency.ClosePopup += delegate { //Call Main Validate Validate(); }; //Add to Vbox vbox.PackStart(_entryBoxSelectSystemCountry, true, true, 0); vbox.PackStart(_entryBoxSelectSystemCurrency, true, true, 0); //Start Render Dynamic Inputs CriteriaOperator criteriaOperator = CriteriaOperator.Parse("(Disabled = 0 OR Disabled is NULL) AND (FormType = 1 AND FormPageNo = 1)"); SortProperty[] sortProperty = new SortProperty[2]; sortProperty[0] = new SortProperty("Ord", SortingDirection.Ascending); XPCollection xpCollection = new XPCollection(GlobalFramework.SessionXpo, typeof(cfg_configurationpreferenceparameter), criteriaOperator, sortProperty); if (xpCollection.Count > 0) { string label = string.Empty; string regEx = string.Empty; object regExObj = null; bool required = false; foreach (cfg_configurationpreferenceparameter item in xpCollection) { label = (item.ResourceString != null && resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], item.ResourceString) != null) ? resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], item.ResourceString) : string.Empty; regExObj = FrameworkUtils.GetFieldValueFromType(typeof(SettingsApp), item.RegEx); regEx = (regExObj != null) ? regExObj.ToString() : string.Empty; required = Convert.ToBoolean(item.Required); //Override Db Regex if (item.Token == "COMPANY_POSTALCODE") { regEx = _entryBoxSelectSystemCountry.Value.RegExZipCode; } if (item.Token == "COMPANY_FISCALNUMBER") { regEx = _entryBoxSelectSystemCountry.Value.RegExFiscalNumber; } //IN009295 Start POS - Capital Social com valor por defeito if (item.Token == "COMPANY_STOCK_CAPITAL") { item.Value = "1"; } //Debug //_log.Debug(string.Format("Label: [{0}], RegEx: [{1}], Required: [{2}]", label, regEx, required)); EntryBoxValidation entryBoxValidation = new EntryBoxValidation( this, label, KeyboardMode.AlfaNumeric, regEx, required ) { Name = item.Token }; //Use demo data to fill values if (useDataDemo) { if (item.Token == "COMPANY_NAME") { entryBoxValidation.EntryValidation.Text = "LogicPulse"; } if (item.Token == "COMPANY_BUSINESS_NAME") { entryBoxValidation.EntryValidation.Text = "Technologies, Ltda"; } if (item.Token == "COMPANY_ADDRESS") { entryBoxValidation.EntryValidation.Text = "Rua Capitão Salgueiro Maia, 7"; } if (item.Token == "COMPANY_CITY") { entryBoxValidation.EntryValidation.Text = "Figueira da Foz"; } if (item.Token == "COMPANY_POSTALCODE") { entryBoxValidation.EntryValidation.Text = "3080-000"; } if (item.Token == "COMPANY_COUNTRY") { entryBoxValidation.EntryValidation.Text = "Portugal"; } if (item.Token == "COMPANY_FISCALNUMBER") { entryBoxValidation.EntryValidation.Text = "999999990"; } if (item.Token == "COMPANY_STOCK_CAPITAL") { entryBoxValidation.EntryValidation.Text = "1000"; } if (item.Token == "COMPANY_EMAIL") { entryBoxValidation.EntryValidation.Text = "*****@*****.**"; } if (item.Token == "COMPANY_WEBSITE") { entryBoxValidation.EntryValidation.Text = "www.logicpulse.com"; } } //Only Assign Value if Debugger Attached: Now the value for normal user is cleaned in Init Database, we keep this code here, may be usefull //if (Debugger.IsAttached == true || useDatabaseDataDemo && !useDataDemo) { entryBoxValidation.EntryValidation.Text = item.Value; } //if (Debugger.IsAttached == true) //{ // if (debug) _log.Debug(String.Format("[{0}:{1}]:item.Value: [{2}], entryBoxValidation.EntryValidation.Text: [{3}]", Debugger.IsAttached == true, useDatabaseDataDemo, item.Value, entryBoxValidation.EntryValidation.Text)); //} //Assign shared Event entryBoxValidation.EntryValidation.Changed += EntryValidation_Changed; //If is ZipCode Assign it to _entryBoxZipCode Reference if (item.Token == "COMPANY_POSTALCODE") { _entryBoxZipCode = entryBoxValidation; _entryBoxZipCode.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExZipCode; } //If is FiscalNumber Assign it to entryBoxSelectCustomerFiscalNumber Reference else if (item.Token == "COMPANY_FISCALNUMBER") { _entryBoxFiscalNumber = entryBoxValidation; _entryBoxFiscalNumber.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExFiscalNumber; } if (item.Token == "COMPANY_TAX_ENTITY") { entryBoxValidation.EntryValidation.Text = "Global"; } //Call Validate entryBoxValidation.EntryValidation.Validate(); //Pack and Add to ObjectBag vbox.PackStart(entryBoxValidation, true, true, 0); _dictionaryObjectBag.Add(item, entryBoxValidation); } } Viewport viewport = new Viewport() { ShadowType = ShadowType.None }; viewport.Add(vbox); _scrolledWindow = new ScrolledWindow(); _scrolledWindow.ShadowType = ShadowType.EtchedIn; _scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); _scrolledWindow.Add(viewport); viewport.ResizeMode = ResizeMode.Parent; _scrolledWindow.ResizeMode = ResizeMode.Parent; } catch (Exception ex) { _log.Error(ex.Message, ex); } }
private string GenerateXmlStringWB() { //Init Local Vars string customerTaxID = FiscalNumber.ExtractFiscalNumber(_documentMaster.EntityFiscalNumber); string sbContentLines = string.Empty; //MovementStartTime equal/greater system DateTime to prevent -100 error (Override _documentMaster.MovementStartTime) _movementStartTime = DateTime.Now; //Test mode, increase DocumentNumber only when Develop if (_increaseDocumentNumber) { Utils.IncreaseDocumentNumber(_documentMaster); } //Get Lines Content sbContentLines = Utils.GetDocumentWayBillContentLines(_documentMaster); StringBuilder sb = new StringBuilder(); //Soap Envelope sb.Append("<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"); //Soap Header sb.Append(" <S:Header>"); sb.Append(" <wss:Security xmlns:wss=\"http://schemas.xmlsoap.org/ws/2002/12/secext/\">"); sb.Append(" <wss:UsernameToken>"); sb.Append(" <wss:Username>" + _atAccountFiscalNumber + "</wss:Username>"); sb.Append(" <wss:Password>" + _accountPasswordEncrypted + "</wss:Password>"); sb.Append(" <wss:Nonce>" + _symetricKeyEncrypted + "</wss:Nonce>"); sb.Append(" <wss:Created>" + _dateOfCriationEncrypted + "</wss:Created>"); sb.Append(" </wss:UsernameToken>"); sb.Append(" </wss:Security>"); sb.Append(" </S:Header>"); //Soap Body sb.Append(" <S:Body>"); sb.Append(" <ns2:envioDocumentoTransporteRequestElem xmlns:ns2=\"https://servicos.portaldasfinancas.gov.pt/sgdtws/documentosTransporte/\">"); sb.Append(" <TaxRegistrationNumber>" + _atTaxRegistrationNumber + "</TaxRegistrationNumber>"); sb.Append(" <CompanyName>" + _documentMaster.EntityName + "</CompanyName>"); sb.Append(" <CompanyAddress>"); //Change "AddressDetail" to "Addressdetail" else error: complex-type 2.4: in element CompanyAddress of type //Only sent is not empty Addressdetail,City,PostalCode,Country sb.Append(" <Addressdetail>" + _documentMaster.EntityAddress + "</Addressdetail>"); sb.Append(" <City>" + _documentMaster.EntityCity + "</City>"); sb.Append(" <PostalCode>" + _documentMaster.EntityZipCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.EntityCountry + "</Country>"); sb.Append(" </CompanyAddress>"); sb.Append(" <DocumentNumber>" + _documentMaster.DocumentNumber + "</DocumentNumber>"); //WIP: CancellWayBills : Find "//WIP: CancellWayBills : " to continue in Uncomment in PosDocumentFinanceSelectRecordDialog.cs //Used to Cancel Documents, ex After we have it in DB, resulted from a Sent WB //Currently disabled Problems :"Não pode ser alterado um Documento de Transporte quando a Data de Início já decorreu." //if (! string.IsNullOrEmpty(_documentMaster.ATDocCodeID)) sb.Append(" <ATDocCodeID>" + _documentMaster.ATDocCodeID + "</ATDocCodeID>"); sb.Append(" <MovementStatus>" + _documentMaster.DocumentStatusStatus + "</MovementStatus>"); sb.Append(" <MovementDate>" + _documentMaster.DocumentDate + "</MovementDate>"); sb.Append(" <MovementType>" + _documentMaster.DocumentType.Acronym + "</MovementType>"); sb.Append(" <CustomerTaxID>" + customerTaxID + "</CustomerTaxID>"); sb.Append(" <CustomerAddress>"); //Only sent is not empty Addressdetail,City,PostalCode,Country sb.Append(" <Addressdetail>" + _documentMaster.EntityAddress + "</Addressdetail>"); sb.Append(" <City>" + _documentMaster.EntityCity + "</City>"); sb.Append(" <PostalCode>" + _documentMaster.EntityZipCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.EntityCountry + "</Country>"); sb.Append(" </CustomerAddress>"); //Required to be after <CustomerAddress> sb.Append(" <CustomerName>" + _documentMaster.EntityName + "</CustomerName>"); sb.Append(" <AddressTo>"); sb.Append(" <Addressdetail>" + _documentMaster.ShipToAddressDetail + "</Addressdetail>"); sb.Append(" <City>" + _documentMaster.ShipToCity + "</City>"); sb.Append(" <PostalCode>" + _documentMaster.ShipToPostalCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.ShipToCountry + "</Country>"); sb.Append(" </AddressTo>"); sb.Append(" <AddressFrom>"); sb.Append(" <Addressdetail>" + _documentMaster.ShipFromAddressDetail + "</Addressdetail>"); sb.Append(" <City>" + _documentMaster.ShipFromCity + "</City>"); sb.Append(" <PostalCode>" + _documentMaster.ShipFromPostalCode + "</PostalCode>"); sb.Append(" <Country>" + _documentMaster.ShipFromCountry + "</Country>"); sb.Append(" </AddressFrom>"); //Dont Sent MovementEndTime, not required //sb.Append(" <MovementEndTime>" + _documentMaster.MovementEndTime.ToString(SettingsApp.DateTimeFormatCombinedDateTime) + "</MovementEndTime>"); sb.Append(" <MovementStartTime>" + _movementStartTime.ToString(SettingsApp.DateTimeFormatCombinedDateTime) + "</MovementStartTime>"); //VehicleID if (!string.IsNullOrEmpty(_documentMaster.ShipFromDeliveryID)) { sb.Append(" <VehicleID>" + _documentMaster.ShipFromDeliveryID + "</VehicleID>"); } //Line //Generated Content sb.Append(sbContentLines); sb.Append(" </ns2:envioDocumentoTransporteRequestElem>"); sb.Append(" </S:Body>"); sb.Append("</S:Envelope>"); XmlDocument xc = new XmlDocument(); TextReader textReader = new StringReader(sb.ToString()); XDocument xmlDocument = XDocument.Load(textReader); //Save Soap xmlDocument.Save(_pathSaveSoap); return(xmlDocument.ToString()); }