private void UpdateUIVatExemptionReason() { bool requireToChooseVatExemptionReason = true; try { // Override Default with Config Value requireToChooseVatExemptionReason = Convert.ToBoolean(GlobalFramework.Settings["requireToChooseVatExemptionReason"]); } catch (Exception) { _log.Error("Error Missing Config Parameter Key: [requireToChooseVatExemptionReason]"); } try { //Get VatExemptionReason GenericCRUDWidgetXPO genericCRUDWidgetXPO = (this._crudWidgetList.GetFieldWidget("VatExemptionReason") as GenericCRUDWidgetXPO); if ( ( (_xpoComboBoxVatOnTable != null && _xpoComboBoxVatOnTable.Value != null && _xpoComboBoxVatOnTable.Value.Oid == SettingsApp.XpoOidConfigurationVatRateDutyFree) || (_xpoComboBoxVatDirectSelling != null && _xpoComboBoxVatDirectSelling.Value != null && _xpoComboBoxVatDirectSelling.Value.Oid == SettingsApp.XpoOidConfigurationVatRateDutyFree) ) && requireToChooseVatExemptionReason ) { _xpoComboBoxVatExemptionReason.Sensitive = true; genericCRUDWidgetXPO.Required = true; } else { //Assign Default Value to Undefined _xpoComboBoxVatExemptionReason.Active = 0; _xpoComboBoxVatExemptionReason.Sensitive = false; genericCRUDWidgetXPO.Required = false; } //Call Validate to update UI genericCRUDWidgetXPO.ValidateField(); } catch (Exception ex) { _log.Error(ex.Message, ex); } }
private void InitUI() { try { //Init Local Vars _configurationCountry = (_dataSourceRow as ERP_Customer).Country; if (_dialogMode != DialogMode.Insert) { _customer = (_dataSourceRow as ERP_Customer); string sql = string.Format("SELECT COUNT(*) as Count FROM fin_documentfinancemaster WHERE EntityFiscalNumber = '{0}';", _customer.FiscalNumber); var sqlResult = GlobalFramework.SessionXpo.ExecuteScalar(sql); _totalNumberOfFinanceDocuments = Convert.ToUInt16(sqlResult); if (_customer.Oid == SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity) { _isFinalConsumerEntity = true; } } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(Resx.global_record_order, entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(Resx.global_record_code, entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true)); //Name Entry entryName = new Entry(); BOWidgetBox boxName = new BOWidgetBox(Resx.global_name, entryName); vboxTab1.PackStart(boxName, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxName, _dataSourceRow, "Name", SettingsApp.RegexAlfaNumericExtended, true)); //FiscalNumber _entryFiscalNumber = new Entry(); BOWidgetBox boxFiscalNumber = new BOWidgetBox(Resx.global_fiscal_number, _entryFiscalNumber); vboxTab1.PackStart(boxFiscalNumber, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFiscalNumber, _dataSourceRow, "FiscalNumber", _configurationCountry.RegExFiscalNumber, false)); //Discount Entry entryDiscount = new Entry(); BOWidgetBox boxDiscount = new BOWidgetBox(Resx.global_discount, entryDiscount); vboxTab1.PackStart(boxDiscount, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscount, _dataSourceRow, "Discount", SettingsApp.RegexPercentage, true)); //PriceType XPOComboBox xpoComboBoxPriceType = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationPriceType), (DataSourceRow as ERP_Customer).PriceType, "Designation"); BOWidgetBox boxPriceType = new BOWidgetBox(Resx.global_price_type, xpoComboBoxPriceType); vboxTab1.PackStart(boxPriceType, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPriceType, DataSourceRow, "PriceType", SettingsApp.RegexGuid, true)); //CustomerType XPOComboBox xpoComboBoxCustomerType = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerType), (DataSourceRow as ERP_Customer).CustomerType, "Designation"); BOWidgetBox boxCustomerType = new BOWidgetBox(Resx.global_customer_types, xpoComboBoxCustomerType); vboxTab1.PackStart(boxCustomerType, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCustomerType, DataSourceRow, "CustomerType", SettingsApp.RegexGuid, true)); ////DISABLED : DiscountGroup //XPOComboBox xpoComboBoxDiscountGroup = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerDiscountGroup), (DataSourceRow as ERP_Customer).DiscountGroup, "Designation"); //BOWidgetBox boxDiscountGroup = new BOWidgetBox(Resx.global_discount_group, xpoComboBoxDiscountGroup); //vboxTab1.PackStart(boxDiscountGroup, false, false, 0); //_crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscountGroup, DataSourceRow, "DiscountGroup", SettingsApp.RegexGuid, true)); //Supplier CheckButton checkButtonSupplier = new CheckButton(Resx.global_supplier); vboxTab1.PackStart(checkButtonSupplier, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonSupplier, _dataSourceRow, "Supplier")); //Disabled CheckButton checkButtonDisabled = new CheckButton(Resx.global_record_disabled); if (_dialogMode == DialogMode.Insert) { checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled; } vboxTab1.PackStart(checkButtonDisabled, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled")); //Append Tab _notebook.AppendPage(vboxTab1, new Label(Resx.global_record_main_detail)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab2 VBox vboxTab2 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Address Entry entryAddress = new Entry(); BOWidgetBox boxAddress = new BOWidgetBox(Resx.global_address, entryAddress); vboxTab2.PackStart(boxAddress, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxAddress, _dataSourceRow, "Address", SettingsApp.RegexAlfaNumericExtended, false)); //Locality Entry entryLocality = new Entry(); BOWidgetBox boxLocality = new BOWidgetBox(Resx.global_locality, entryLocality); vboxTab2.PackStart(boxLocality, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLocality, _dataSourceRow, "Locality", SettingsApp.RegexAlfaNumericExtended, false)); //ZipCode _entryZipCode = new Entry() { WidthRequest = 100 };; BOWidgetBox boxZipCode = new BOWidgetBox(Resx.global_zipcode, _entryZipCode); vboxTab2.PackStart(boxZipCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxZipCode, _dataSourceRow, "ZipCode", _configurationCountry.RegExZipCode, false)); //City Entry entryCity = new Entry(); BOWidgetBox boxCity = new BOWidgetBox(Resx.global_city, entryCity); vboxTab2.PackStart(boxCity, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCity, _dataSourceRow, "City", SettingsApp.RegexAlfaNumericExtended, false)); //Hbox ZipCode and City HBox hboxZipCodeAndCity = new HBox(false, _boxSpacing); hboxZipCodeAndCity.PackStart(boxZipCode, true, true, 0); hboxZipCodeAndCity.PackStart(boxCity, true, true, 0); vboxTab2.PackStart(hboxZipCodeAndCity, false, false, 0); //CountrySortProperty SortProperty[] sortPropertyCountry = new SortProperty[1]; sortPropertyCountry[0] = new SortProperty("Designation", SortingDirection.Ascending); //Country _xpoComboBoxCountry = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationCountry), (DataSourceRow as ERP_Customer).Country, "Designation", null, sortPropertyCountry); BOWidgetBox boxCountry = new BOWidgetBox(Resx.global_country, _xpoComboBoxCountry); vboxTab2.PackStart(boxCountry, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCountry, DataSourceRow, "Country", SettingsApp.RegexGuid, true)); //Phone Entry entryPhone = new Entry(); BOWidgetBox boxPhone = new BOWidgetBox(Resx.global_phone, entryPhone); vboxTab2.PackStart(boxPhone, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPhone, _dataSourceRow, "Phone", SettingsApp.RegexAlfaNumericExtended, false)); //MobilePhone Entry entryMobilePhone = new Entry(); BOWidgetBox boxMobilePhone = new BOWidgetBox(Resx.global_mobile_phone, entryMobilePhone); vboxTab2.PackStart(boxMobilePhone, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxMobilePhone, _dataSourceRow, "MobilePhone", SettingsApp.RegexAlfaNumericExtended, false)); //Hbox Phone and MobilePhone HBox hboxPhoneAndMobilePhone = new HBox(false, _boxSpacing); hboxPhoneAndMobilePhone.PackStart(boxPhone, true, true, 0); hboxPhoneAndMobilePhone.PackStart(boxMobilePhone, true, true, 0); vboxTab2.PackStart(hboxPhoneAndMobilePhone, false, false, 0); //Fax Entry entryFax = new Entry(); BOWidgetBox boxFax = new BOWidgetBox(Resx.global_fax, entryFax); vboxTab2.PackStart(boxFax, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFax, _dataSourceRow, "Fax", SettingsApp.RegexAlfaNumericExtended, false)); //Email Entry entryEmail = new Entry(); BOWidgetBox boxEmail = new BOWidgetBox(Resx.global_email, entryEmail); vboxTab2.PackStart(boxEmail, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxEmail, _dataSourceRow, "Email", SettingsApp.RegexEmail, false)); //Hbox Fax and Email HBox hboxFaxAndEmail = new HBox(false, _boxSpacing); hboxFaxAndEmail.PackStart(boxFax, true, true, 0); hboxFaxAndEmail.PackStart(boxEmail, true, true, 0); vboxTab2.PackStart(hboxFaxAndEmail, false, false, 0); //Append Tab _notebook.AppendPage(vboxTab2, new Label(Resx.global_contacts)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab3 VBox vboxTab3 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //CardNumber Entry entryCardNumber = new Entry(); BOWidgetBox boxCardNumber = new BOWidgetBox(Resx.global_card_number, entryCardNumber); vboxTab3.PackStart(boxCardNumber, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCardNumber, _dataSourceRow, "CardNumber", SettingsApp.RegexAlfaNumericExtended, false)); //CardCredit Entry entryCardCredit = new Entry(); BOWidgetBox boxCardCredit = new BOWidgetBox(Resx.global_card_credit_amount, entryCardCredit); vboxTab3.PackStart(boxCardCredit, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCardCredit, _dataSourceRow, "CardCredit", SettingsApp.RegexDecimalGreaterEqualThanZero, false)); //DateOfBirth Entry entryDateOfBirth = new Entry(); BOWidgetBox boxDateOfBirth = new BOWidgetBox(Resx.global_dob, entryDateOfBirth); vboxTab3.PackStart(boxDateOfBirth, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDateOfBirth, _dataSourceRow, "DateOfBirth", SettingsApp.RegexDate, false)); //Append Tab _notebook.AppendPage(vboxTab3, new Label(Resx.global_others)); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Disable Components entryName.Sensitive = GetEntryNameSensitiveValue(); entryCardCredit.Sensitive = false; _entryFiscalNumber.Sensitive = GetEntryFiscalNumberSensitiveValue(); _xpoComboBoxCountry.Sensitive = GetEntryFiscalNumberSensitiveValue(); //Get References to GenericCRUDWidgetXPO _genericCRUDWidgetXPOFiscalNumber = (_crudWidgetList.GetFieldWidget("FiscalNumber") as GenericCRUDWidgetXPO); _genericCRUDWidgetXPOZipCode = (_crudWidgetList.GetFieldWidget("ZipCode") as GenericCRUDWidgetXPO); //Call Validation _genericCRUDWidgetXPOFiscalNumber.ValidateField(ValidateFiscalNumberFunc); //Update Components UpdateCountryRegExComponents(); //Events _entryFiscalNumber.Changed += delegate { ValidateFiscalNumber(); }; _xpoComboBoxCountry.Changed += delegate { UpdateCountryRegExComponents(); }; } catch (System.Exception ex) { _log.Error(ex.Message, ex); } }
public DocumentFinanceDialogPage8(Window pSourceWindow, String pPageName, String pPageIcon, Widget pWidget, bool pEnabled = true) : base(pSourceWindow, pPageName, pPageIcon, pWidget, pEnabled) { //Init private vars _pagePad = (_sourceWindow as PosDocumentFinanceDialog).PagePad; _session = (_pagePad as DocumentFinanceDialogPagePad).Session; _crudWidgetList = new GenericCRUDWidgetListXPO(_session); //Get Target Object //Guid customerGuid = new Guid("0cf40622-578b-417d-b50f-e945fefb5d68");//Consumidor Final|0.0 Guid customerGuid = new Guid("765859cc-29c2-4925-be89-0486d03684f2");//Carlos Fernandes|5.0 //Guid customerGuid = new Guid("78c08879-6d08-4146-9cc9-914f427926c6");//Cristina Janeiro|12.5 _valueCustomer = (erp_customer)FrameworkUtils.GetXPGuidObject(_session, typeof(erp_customer), customerGuid); //Client (Used in _crudWidgetList) _entryBoxClient = new EntryBoxValidation(_sourceWindow, string.Format("{0}/WL", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_customer")), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, true); _entryBoxClient.EntryValidation.Changed += delegate { Validate(); }; _entryBoxClientValidation = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_customer"), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, true); _entryBoxClientValidation.EntryValidation.Changed += delegate { Validate(); }; //FiscalNumber _entryBoxFiscalNumber = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fiscal_number"), KeyboardMode.Alfa, _valueCustomer.Country.RegExFiscalNumber, true); _entryBoxFiscalNumber.EntryValidation.Changed += delegate { /*ValidateFiscalNumber();*/ Validate(); }; //Address _entryBoxAddress = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_address"), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false); //_entryBoxAddress.WidthRequest = _pagePad.EntryBoxMaxWidth; _entryBoxAddress.EntryValidation.Changed += delegate { Validate(); }; //Locality _entryBoxLocality = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_locality"), KeyboardMode.Alfa, SettingsApp.RegexAlfa, false); //_entryBoxLocality.WidthRequest = _pagePad.EntryBoxMaxWidth; _entryBoxLocality.EntryValidation.Changed += delegate { Validate(); }; //ZipCode _entryBoxZipCode = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_zipcode"), KeyboardMode.Alfa, _valueCustomer.Country.RegExZipCode, false); _entryBoxZipCode.WidthRequest = 200; _entryBoxZipCode.EntryValidation.Changed += delegate { Validate(); }; //City _entryBoxCity = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_city"), KeyboardMode.Alfa, SettingsApp.RegexAlfa, false); //_entryBoxCity.WidthRequest = _pagePad.EntryBoxMaxWidth - 200; _entryBoxCity.EntryValidation.Changed += delegate { Validate(); }; //Country (Used in _crudWidgetList) CriteriaOperator criteriaOperator = CriteriaOperator.Parse("CurrencyCode = 'EUR'"); _entryBoxSelectCountry = new XPOEntryBoxSelectRecord <cfg_configurationcountry, TreeViewConfigurationCountry>(_sourceWindow, string.Format("{0}/WL", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_country")), "Designation", "Oid", _valueCustomer.Country, criteriaOperator); //_entryBoxSelectCountry.WidthRequest = _pagePad.EntryBoxMaxWidth; _entryBoxSelectCountry.Entry.IsEditable = false; //CountryValidation _entryBoxSelectCountryValidation = new XPOEntryBoxSelectRecordValidation <cfg_configurationcountry, TreeViewConfigurationCountry>(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_country"), "Designation", "Oid", _valueCustomer.Country, criteriaOperator, SettingsApp.RegexGuid, true); //_entryBoxSelectCountryValidation.WidthRequest = _pagePad.EntryBoxMaxWidth; _entryBoxSelectCountryValidation.EntryValidation.IsEditable = false; //Test _selectedXPGuidObject :) //_entryBoxSelectCountryValidation.EntryValidation.Changed += delegate { // _log.Debug(string.Format("_entryBoxCountryValidation.Selected.Code3: [{0}]", _entryBoxSelectCountryValidation.Value.Code3)); //}; //Notes _entryBoxNotes = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_notes"), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false); //_entryBoxNotes.WidthRequest = _pagePad.EntryBoxMaxWidth; _entryBoxNotes.EntryValidation.Changed += delegate { Validate(); }; ////OPTIONAL: REQUIRE Assign Values TO Work On NON XpoWidget Mode ELSE Leave Blanck and XPOWidget Init Will fill Initial Values //_entryBoxClient.Entry.Text = xCustomer.Name; _entryBoxClientValidation.EntryValidation.Text = _valueCustomer.Name; ////Assign Value First //_entryBoxCountry.Value = xCustomer.Country; //_entryBoxCountry.Entry.Text = xCustomer.Country.Designation; ////Assign Value First //_entryBoxCountryValidation.Value = xCustomer.Country; //_entryBoxCountryValidation.EntryValidation.Text = xCustomer.Country.Designation; //Using Labels ;) GenericCRUDWidget <XPGuidObject> crudWidgetClientName = new GenericCRUDWidgetXPO(_entryBoxClient, _entryBoxClient.Label, _valueCustomer, "Name", SettingsApp.RegexAlfaNumericExtended, true); GenericCRUDWidget <XPGuidObject> crudWidgetClientCountry = new GenericCRUDWidgetXPO(_entryBoxSelectCountry, _entryBoxSelectCountry.Label, _valueCustomer, "Country", SettingsApp.RegexGuid, true); _crudWidgetList.Add(crudWidgetClientName); _crudWidgetList.Add(crudWidgetClientCountry); Button button = new Button("VALIDATE & UpdateRecord"); button.Clicked += delegate { if (_crudWidgetList.ValidateRecord()) { //Using WidgetList _crudWidgetList.UpdateRecord(DialogMode.Update); } }; //Pack VBOX VBox vbox = new VBox(false, 2); vbox.PackStart(_entryBoxClient, false, false, 0); vbox.PackStart(_entryBoxClientValidation, false, false, 0); vbox.PackStart(_entryBoxSelectCountry, false, false, 0); vbox.PackStart(_entryBoxSelectCountryValidation, false, false, 0); vbox.PackStart(button, true, true, 0); PackStart(vbox); }
private void InitUI() { try { //Init Local Vars _configurationCountry = (_dataSourceRow as erp_customer).Country; /* When customers already have a document issued to them, edit Fiscal Number field is not allowed */ if (_dialogMode != DialogMode.Insert) { _customer = (_dataSourceRow as erp_customer); /* IN009249 - begin */ string customerFiscalNumberCrypto = GlobalFramework.PluginSoftwareVendor.Encrypt(_customer.FiscalNumber); string countSQL = string.Format("EntityFiscalNumber = '{0}'", customerFiscalNumberCrypto); var countResult = GlobalFramework.SessionXpo.Evaluate(typeof(fin_documentfinancemaster), CriteriaOperator.Parse("Count()"), CriteriaOperator.Parse(countSQL)); _totalNumberOfFinanceDocuments = Convert.ToUInt16(countResult); /* IN009249 - end */ if (_customer.Oid == SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity) { _isFinalConsumerEntity = true; } } //erp_customer customers = null; SortingCollection sortCollection = new SortingCollection(); sortCollection.Add(new SortProperty("Code", DevExpress.Xpo.DB.SortingDirection.Ascending)); CriteriaOperator criteria = CriteriaOperator.Parse(string.Format("(Disabled = 0 OR Disabled IS NULL)")); ICollection collectionCustomers = GlobalFramework.SessionXpo.GetObjects(GlobalFramework.SessionXpo.GetClassInfo(typeof(erp_customer)), criteria, sortCollection, int.MaxValue, false, true); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab1 VBox vboxTab1 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Ord Entry entryOrd = new Entry(); BOWidgetBox boxLabel = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_order"), entryOrd); vboxTab1.PackStart(boxLabel, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true)); //Code Entry entryCode = new Entry(); BOWidgetBox boxCode = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), entryCode); vboxTab1.PackStart(boxCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true)); //FiscalNumber _entryFiscalNumber = new Entry(); BOWidgetBox boxFiscalNumber = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fiscal_number"), _entryFiscalNumber); vboxTab1.PackStart(boxFiscalNumber, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFiscalNumber, _dataSourceRow, "FiscalNumber", _configurationCountry.RegExFiscalNumber, true));/* IN009061 */ //Name _entryName = new Entry(); BOWidgetBox boxName = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_name"), _entryName); vboxTab1.PackStart(boxName, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxName, _dataSourceRow, "Name", SettingsApp.RegexAlfaNumericPlus, true));/* IN009253 */ //Discount Entry entryDiscount = new Entry(); BOWidgetBox boxDiscount = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_discount"), entryDiscount); vboxTab1.PackStart(boxDiscount, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscount, _dataSourceRow, "Discount", SettingsApp.RegexPercentage, true)); //PriceType IN:009261 XPOComboBox xpoComboBoxPriceType = new XPOComboBox(DataSourceRow.Session, typeof(fin_configurationpricetype), (DataSourceRow as erp_customer).PriceType, "Designation", null, null, 1); BOWidgetBox boxPriceType = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_price_type"), xpoComboBoxPriceType); vboxTab1.PackStart(boxPriceType, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPriceType, DataSourceRow, "PriceType", SettingsApp.RegexGuid, true)); //CustomerType IN009261 SortProperty[] sortPropertyCostumerType = new SortProperty[1]; sortPropertyCostumerType[0] = new SortProperty("Designation", SortingDirection.Descending); _xpoComboBoxCustomerType = new XPOComboBox(DataSourceRow.Session, typeof(erp_customertype), (DataSourceRow as erp_customer).CustomerType, "Designation", null, sortPropertyCostumerType, 1); BOWidgetBox boxCustomerType = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_customer_types"), _xpoComboBoxCustomerType); vboxTab1.PackStart(boxCustomerType, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCustomerType, DataSourceRow, "CustomerType", SettingsApp.RegexGuid, true)); ////DISABLED : DiscountGroup //XPOComboBox xpoComboBoxDiscountGroup = new XPOComboBox(DataSourceRow.Session, typeof(erp_customerdiscountgroup), (DataSourceRow as erp_customer).DiscountGroup, "Designation"); //BOWidgetBox boxDiscountGroup = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_discount_group, xpoComboBoxDiscountGroup); //vboxTab1.PackStart(boxDiscountGroup, false, false, 0); //_crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscountGroup, DataSourceRow, "DiscountGroup", SettingsApp.RegexGuid, true)); //Supplier CheckButton checkButtonSupplier = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_supplier")); vboxTab1.PackStart(checkButtonSupplier, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonSupplier, _dataSourceRow, "Supplier")); //Disabled CheckButton checkButtonDisabled = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_disabled")); if (_dialogMode == DialogMode.Insert) { checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled; } vboxTab1.PackStart(checkButtonDisabled, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled")); //Append Tab _notebook.AppendPage(vboxTab1, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_main_detail"))); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab2 VBox vboxTab2 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //Address _entryAddress = new Entry(); BOWidgetBox boxAddress = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_address"), _entryAddress); vboxTab2.PackStart(boxAddress, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxAddress, _dataSourceRow, "Address", SettingsApp.RegexAlfaNumericPlus, false));/* IN009253 */ //Locality _entryLocality = new Entry(); BOWidgetBox boxLocality = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_locality"), _entryLocality); vboxTab2.PackStart(boxLocality, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLocality, _dataSourceRow, "Locality", SettingsApp.RegexAlfaNumericPlus, false));/* IN009253 */ //ZipCode _entryZipCode = new Entry() { WidthRequest = 100 };; BOWidgetBox boxZipCode = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_zipcode"), _entryZipCode); vboxTab2.PackStart(boxZipCode, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxZipCode, _dataSourceRow, "ZipCode", _configurationCountry.RegExZipCode, false)); //City _entryCity = new Entry(); BOWidgetBox boxCity = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_city"), _entryCity); vboxTab2.PackStart(boxCity, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCity, _dataSourceRow, "City", SettingsApp.RegexAlfaNumericPlus, false)); /* IN009176, IN009253 */ //Hbox ZipCode and City HBox hboxZipCodeAndCity = new HBox(false, _boxSpacing); hboxZipCodeAndCity.PackStart(boxZipCode, true, true, 0); hboxZipCodeAndCity.PackStart(boxCity, true, true, 0); vboxTab2.PackStart(hboxZipCodeAndCity, false, false, 0); //CountrySortProperty SortProperty[] sortPropertyCountry = new SortProperty[1]; sortPropertyCountry[0] = new SortProperty("Designation", SortingDirection.Ascending); //Country _xpoComboBoxCountry = new XPOComboBox(DataSourceRow.Session, typeof(cfg_configurationcountry), (DataSourceRow as erp_customer).Country, "Designation", null, sortPropertyCountry); BOWidgetBox boxCountry = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_country"), _xpoComboBoxCountry); vboxTab2.PackStart(boxCountry, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCountry, DataSourceRow, "Country", SettingsApp.RegexGuid, true)); //Phone Entry entryPhone = new Entry(); BOWidgetBox boxPhone = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_phone"), entryPhone); vboxTab2.PackStart(boxPhone, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPhone, _dataSourceRow, "Phone", SettingsApp.RegexAlfaNumericExtended, false)); //MobilePhone Entry entryMobilePhone = new Entry(); BOWidgetBox boxMobilePhone = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_mobile_phone"), entryMobilePhone); vboxTab2.PackStart(boxMobilePhone, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxMobilePhone, _dataSourceRow, "MobilePhone", SettingsApp.RegexAlfaNumericExtended, false)); //Hbox Phone and MobilePhone HBox hboxPhoneAndMobilePhone = new HBox(false, _boxSpacing); hboxPhoneAndMobilePhone.PackStart(boxPhone, true, true, 0); hboxPhoneAndMobilePhone.PackStart(boxMobilePhone, true, true, 0); vboxTab2.PackStart(hboxPhoneAndMobilePhone, false, false, 0); //Fax Entry entryFax = new Entry(); BOWidgetBox boxFax = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fax"), entryFax); vboxTab2.PackStart(boxFax, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFax, _dataSourceRow, "Fax", SettingsApp.RegexAlfaNumericExtended, false)); //Email Entry entryEmail = new Entry(); BOWidgetBox boxEmail = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_email"), entryEmail); vboxTab2.PackStart(boxEmail, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxEmail, _dataSourceRow, "Email", SettingsApp.RegexEmail, false)); //Hbox Fax and Email HBox hboxFaxAndEmail = new HBox(false, _boxSpacing); hboxFaxAndEmail.PackStart(boxFax, true, true, 0); hboxFaxAndEmail.PackStart(boxEmail, true, true, 0); vboxTab2.PackStart(hboxFaxAndEmail, false, false, 0); //Append Tab _notebook.AppendPage(vboxTab2, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_contacts"))); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Tab3 VBox vboxTab3 = new VBox(false, _boxSpacing) { BorderWidth = (uint)_boxSpacing }; //CardNumber Entry entryCardNumber = new Entry(); BOWidgetBox boxCardNumber = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_card_number"), entryCardNumber); vboxTab3.PackStart(boxCardNumber, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCardNumber, _dataSourceRow, "CardNumber", SettingsApp.RegexAlfaNumericExtended, false)); //CardCredit Entry entryCardCredit = new Entry(); BOWidgetBox boxCardCredit = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_card_credit_amount"), entryCardCredit); vboxTab3.PackStart(boxCardCredit, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCardCredit, _dataSourceRow, "CardCredit", SettingsApp.RegexDecimalGreaterEqualThanZero, false)); //DateOfBirth Entry entryDateOfBirth = new Entry(); BOWidgetBox boxDateOfBirth = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_dob"), entryDateOfBirth); vboxTab3.PackStart(boxDateOfBirth, false, false, 0); _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDateOfBirth, _dataSourceRow, "DateOfBirth", SettingsApp.RegexDate, false)); //Append Tab _notebook.AppendPage(vboxTab3, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_others"))); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Disable Components _entryName.Sensitive = GetEntryNameSensitiveValue(); entryCardCredit.Sensitive = false; _entryFiscalNumber.Sensitive = GetEntryFiscalNumberSensitiveValue(); _xpoComboBoxCountry.Sensitive = GetEntryFiscalNumberSensitiveValue(); //Get References to GenericCRUDWidgetXPO _genericCRUDWidgetXPOFiscalNumber = (_crudWidgetList.GetFieldWidget("FiscalNumber") as GenericCRUDWidgetXPO); _genericCRUDWidgetXPOZipCode = (_crudWidgetList.GetFieldWidget("ZipCode") as GenericCRUDWidgetXPO); //Call Validation _genericCRUDWidgetXPOFiscalNumber.ValidateField(ValidateFiscalNumberFunc); //Update Components UpdateCountryRegExComponents(); //string teste = (DataSourceRow as erp_customer).CustomerType.Designation; //Events _entryFiscalNumber.Changed += delegate { ValidateFiscalNumber(); }; _xpoComboBoxCountry.Changed += delegate { UpdateCountryRegExComponents(); }; //IN009260 Inserir Cliente permite código já inserido entryCode.FocusOutEvent += delegate { foreach (erp_customer item in collectionCustomers) { if (entryCode.Text == item.Code.ToString()) { Utils.ShowMessageTouch(GlobalApp.WindowBackOffice, DialogFlags.DestroyWithParent | DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_validation_error"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_code_number_exists")); entryCode.Text = ""; } } }; entryOrd.FocusOutEvent += delegate { foreach (erp_customer item in collectionCustomers) { if (entryOrd.Text == item.Code.ToString()) { Utils.ShowMessageTouch(GlobalApp.WindowBackOffice, DialogFlags.DestroyWithParent | DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_validation_error"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_code_number_exists")); entryOrd.Text = ""; } } }; } catch (System.Exception ex) { _log.Error("void DialogCustomer.InitUI(): " + ex.Message, ex); } }