protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(FIN_Article), "Ord"); //Disable now using AlfaNumeric Code, not Integer //Code = FrameworkUtils.GetNextTableFieldID("FIN_Article", "Code").ToString(); Type = this.Session.GetObjectByKey <FIN_ArticleType>(SettingsApp.XpoOidArticleDefaultType); Class = this.Session.GetObjectByKey <FIN_ArticleClass>(SettingsApp.XpoOidArticleDefaultClass); //VatOnTable = this.Session.GetObjectByKey<FIN_ConfigurationVatRate>(SettingsApp.XpoOidArticleDefaultVatOnTable); //VatDirectSelling = this.Session.GetObjectByKey<FIN_ConfigurationVatRate>(SettingsApp.XpoOidArticleDefaultVatDirectSelling); if (SettingsApp.AppMode == AppOperationMode.Default) { //Force users to choose Tax for both modes Normal and TakeAway VatOnTable = null; VatDirectSelling = null; } else { VatOnTable = null; VatDirectSelling = this.Session.GetObjectByKey <FIN_ConfigurationVatRate>(SettingsApp.XpoOidArticleDefaultVatDirectSelling); } UnitMeasure = this.Session.GetObjectByKey <CFG_ConfigurationUnitMeasure>(SettingsApp.XpoOidArticleDefaultUnitMeasure); UnitSize = this.Session.GetObjectByKey <CFG_ConfigurationUnitSize>(SettingsApp.XpoOidArticleDefaultUnitSize); Template = this.Session.GetObjectByKey <SYS_ConfigurationPrintersTemplates>(SettingsApp.XpoOidArticleDefaultTemplate); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationplaceterminal), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationplaceterminal), "Code"); TemplateTicket = this.Session.GetObjectByKey <sys_configurationprinterstemplates>(SettingsApp.XpoOidConfigurationPrintersTemplateTicket); TemplateTablesConsult = this.Session.GetObjectByKey <sys_configurationprinterstemplates>(SettingsApp.XpoOidConfigurationPrintersTemplateTableConsult); InputReaderTimerInterval = 200; }
protected override void OnAfterConstruction() { // Init EncryptedAttributes - Load Encrypted Attributes Fields if Exist - Required for New Records to have InitEncryptedAttributes else it Triggers Exception on Save InitEncryptedAttributes <ERP_Customer>(); Ord = FrameworkUtils.GetNextTableFieldID(nameof(ERP_Customer), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(ERP_Customer), "Code"); Country = this.Session.GetObjectByKey <CFG_ConfigurationCountry>(SettingsApp.ConfigurationSystemCountry.Oid); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationplacemovementtype), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationplacemovementtype), "Code"); //In Retail Mode VatDirectSelling is always true; if (SettingsApp.AppMode == AppOperationMode.Retail) { VatDirectSelling = true; } }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(fin_documentfinanceyears), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(fin_documentfinanceyears), "Code"); int currentYear = FrameworkUtils.CurrentDateTimeAtomic().Year; FiscalYear = currentYear; Acronym = string.Format("{0}{1}{2}", FiscalYear, "A", Code / 10); Designation = string.Format("{0} {1} {2}{3}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fiscal_year"), FiscalYear, "A", Code / 10); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(FIN_DocumentFinanceYears), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(FIN_DocumentFinanceYears), "Code"); int currentYear = FrameworkUtils.CurrentDateTimeAtomic().Year; FiscalYear = currentYear; Acronym = string.Format("{0}{1}{2}", FiscalYear, "A", Code / 10); Designation = string.Format("{0} {1} {2}{3}", Resx.global_fiscal_year, FiscalYear, "A", Code / 10); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(SYS_ConfigurationPoleDisplay), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(SYS_ConfigurationPoleDisplay), "Code"); VID = "0x0000"; PID = "0x0000"; EndPoint = "Ep01"; CodeTable = "0x10"; DisplayCharactersPerLine = 20; GoToStandByInSeconds = 60; }
protected override void OnAfterConstruction() { // Init EncryptedAttributes - Load Encrypted Attributes Fields if Exist - Required for New Records to have InitEncryptedAttributes else it Triggers Exception on Save InitEncryptedAttributes <SYS_UserDetail>(); Ord = FrameworkUtils.GetNextTableFieldID(nameof(SYS_UserDetail), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(SYS_UserDetail), "Code"); //Required for New Users AccessPin = CryptographyUtils.SaltedString.GenerateSaltedString(SettingsApp.DefaultValueUserDetailAccessPin); PasswordReset = true; ButtonImage = string.Format("{0}{1}", GlobalFramework.Path["assets"], SettingsApp.DefaultValueUserDetailButtonImage); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Terminals //Duplicate method from logicpos.Utils public static pos_configurationplaceterminal GetTerminal() { pos_configurationplaceterminal configurationPlaceTerminal = null; //Debug Directive disabled by Mario, if enabled we cant force Hardware id in Release, if we want to ignore appHardwareId from config we just delete it //If assigned in Config use it, else does nothing and use default ####-####-####-####-####-#### if (SettingsApp.AppHardwareId != null && SettingsApp.AppHardwareId != String.Empty) { GlobalFramework.LicenceHardwareId = SettingsApp.AppHardwareId; } try { //Try TerminalID from Database configurationPlaceTerminal = (pos_configurationplaceterminal)FrameworkUtils.GetXPGuidObjectFromField(typeof(pos_configurationplaceterminal), "HardwareId", GlobalFramework.LicenceHardwareId); } catch (Exception ex) { _log.Error(ex.Message, ex); } //Create a new db terminal if (configurationPlaceTerminal == null) { try { //Persist Terminal in DB configurationPlaceTerminal = new pos_configurationplaceterminal(GlobalFramework.SessionXpo) { Ord = FrameworkUtils.GetNextTableFieldID("pos_configurationplaceterminal", "Ord"), Code = FrameworkUtils.GetNextTableFieldID("pos_configurationplaceterminal", "Code"), Designation = "Terminal #" + FrameworkUtils.GetNextTableFieldID("pos_configurationplaceterminal", "Code"), HardwareId = GlobalFramework.LicenceHardwareId //Fqdn = GetFQDN() }; configurationPlaceTerminal.Save(); } catch (Exception ex) { _log.Error(string.Format("Error! Cant Register a new TerminalId [{0}] with HardwareId: [{1}], Error: [2]", configurationPlaceTerminal.Oid, configurationPlaceTerminal.HardwareId, ex.Message), ex); Environment.Exit(0); } } return(configurationPlaceTerminal); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(fin_article), "Ord"); Type = this.Session.GetObjectByKey <fin_articletype>(SettingsApp.XpoOidArticleDefaultType); Class = this.Session.GetObjectByKey <fin_articleclass>(SettingsApp.XpoOidArticleDefaultClass); if (SettingsApp.AppMode == AppOperationMode.Default) { //Force users to choose Tax for both modes Normal and TakeAway VatOnTable = null; VatDirectSelling = null; } else { VatOnTable = null; VatDirectSelling = this.Session.GetObjectByKey <fin_configurationvatrate>(SettingsApp.XpoOidArticleDefaultVatDirectSelling); } UnitMeasure = this.Session.GetObjectByKey <cfg_configurationunitmeasure>(SettingsApp.XpoOidArticleDefaultUnitMeasure); UnitSize = this.Session.GetObjectByKey <cfg_configurationunitsize>(SettingsApp.XpoOidArticleDefaultUnitSize); Template = this.Session.GetObjectByKey <sys_configurationprinterstemplates>(SettingsApp.XpoOidArticleDefaultTemplate); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(RPT_Report), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(RPT_Report), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(CFG_ConfigurationPreferenceParameter), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(CFG_ConfigurationPreferenceParameter), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(pos_usercommissiongroup), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(pos_usercommissiongroup), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(SYS_ConfigurationPrinters), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(SYS_ConfigurationPrinters), "Code"); ShowInDialog = true; }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(SYS_SystemAuditType), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(SYS_SystemAuditType), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(fin_configurationvatexemptionreason), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(fin_configurationvatexemptionreason), "Code"); }
/* ERR201810#15 - Database backup issues */ //public static bool Backup() //{ // return Backup(null); //} public static bool Backup(Window pSourceWindow) { bool backupResult = true; string fileName = string.Empty; string fullFileNamePacked = string.Empty; string fileHash = string.Empty; Thread thread; try { //FrameworkUtils.ShowWaitingCursor(); Init(); /* IN009164 - Begin */ string xpoConnectionString = string.Format(GlobalFramework.Settings["xpoConnectionString"], GlobalFramework.DatabaseName.ToLower()); XpoDefault.DataLayer = XpoDefault.GetDataLayer(xpoConnectionString, AutoCreateOption.None); Session SessionXpoForBackupPurposes = new Session(XpoDefault.DataLayer) { LockingOption = LockingOption.None }; _log.Debug(string.Format("bool Backup(Window pSourceWindow) :: Init XpoDefault.DataLayer [ {0} ]", SessionXpoForBackupPurposes.ToString())); /* IN009164 - End */ //Initialize object before start Actions, to allocate database (automatic backups) and assign CreatedAt, this way next Terminal Skip Backup when trigger backup event sys_systembackup systemBackup = new sys_systembackup(SessionXpoForBackupPurposes) { FileName = Path.GetRandomFileName(), FileNamePacked = Path.GetRandomFileName(), DataBaseType = GlobalFramework.DatabaseType, Version = FrameworkUtils.GetNextTableFieldID("sys_systembackup", "Version", false), Terminal = (pos_configurationplaceterminal)SessionXpoForBackupPurposes.GetObjectByKey(typeof(pos_configurationplaceterminal), GlobalFramework.LoggedTerminal.Oid) }; systemBackup.Save(); switch (GlobalFramework.DatabaseType) { case DatabaseType.MonoLite: case DatabaseType.SQLite: fileName = GetBackupFileName(_fileExtension, systemBackup.Version, ""); //Non Thread //resultBackup = BackupSQLite(fileName); //Thread thread = new Thread(() => backupResult = BackupSQLite(fileName)); Utils.ThreadStart(pSourceWindow, thread); break; case DatabaseType.MSSqlServer: fileName = GetBackupFileName(_fileExtension, systemBackup.Version, ""); //Non Thread //resultBackup = BackupMSSqlServer(fileName); //Thread thread = new Thread(() => backupResult = BackupMSSqlServer(Path.GetFileName(fileName), SessionXpoForBackupPurposes)); Utils.ThreadStart(pSourceWindow, thread); break; case DatabaseType.MySql: fileName = GetBackupFileName(_fileExtension, systemBackup.Version, ""); //Non Thread //resultBackup = BackupMySql(_backupConnectionString, fileName); //Thread thread = new Thread(() => backupResult = BackupMySql(_backupConnectionString, fileName)); Utils.ThreadStart(pSourceWindow, thread); break; default: break; } /* IN007007 */ _log.Debug(string.Format("Backup DatabaseType: [ {0} ] to FileName: [ {1} ], resultBackup:[ {2} ]", GlobalFramework.DatabaseType, fileName, backupResult)); if (_debug) { _log.Debug(string.Format("Backup DatabaseType: [ {0} ] to FileName: [ {1} ], resultBackup:[ {2} ]", GlobalFramework.DatabaseType, fileName, backupResult)); } if (backupResult) { //Update SystemBackup after Backup systemBackup.FileName = Path.GetFileName(fileName); systemBackup.FilePath = Path.GetDirectoryName(fileName); //Extra Protection for System Automatic Backups, with unlogged users sys_userdetail userDetail = (GlobalFramework.LoggedUser != null) ? (sys_userdetail)SessionXpoForBackupPurposes.GetObjectByKey(typeof(sys_userdetail), GlobalFramework.LoggedUser.Oid) : null; if (userDetail != null) { systemBackup.User = userDetail; } //Non MSSqlServer Work: Cant Get Remote File Sizes, Hash etc from LPDev Backups if (GlobalFramework.DatabaseType != DatabaseType.MSSqlServer) { //systemBackup.FileSize = new FileInfo(fileName).Length; systemBackup.FileNamePacked = Path.ChangeExtension(systemBackup.FileName, SettingsApp.BackupExtension); //Compress File : Required OSSlash fullFileNamePacked = FrameworkUtils.OSSlash(string.Format(@"{0}\{1}", systemBackup.FilePath, systemBackup.FileNamePacked)); // Old Method before PluginSoftwareVendor Implementation //backupResult = Utils.ZipPack(new string[] { fileName }, fullFileNamePacked); backupResult = GlobalFramework.PluginSoftwareVendor.BackupDatabase(SettingsApp.SecretKey, new string[] { fileName }, fullFileNamePacked); // Add FileHash if (backupResult) { systemBackup.FileHash = FrameworkUtils.MD5HashFile(fullFileNamePacked); } } //MSSqlServer else { //Must Assign FileName to FileNamePacked else next backup violate iFileNamePacked_SystemBackup Index systemBackup.FileNamePacked = systemBackup.FileName; } if (backupResult) { //Commit Object systemBackup.Save(); //Remove Temporary Backup /* ERR201810#15 - Database backup issues */ //try { if (File.Exists(fileName)) { File.Delete(fileName); } } //catch (Exception ex) { _log.Error(ex.Message, ex); } //Post Backup FrameworkUtils.Audit("DATABASE_BACKUP", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_database_backup"), (fullFileNamePacked != string.Empty) ? fullFileNamePacked : systemBackup.FileNamePacked )); //Moved to Thread Outside > Only Show if not in Silence Mode if (pSourceWindow != null) { Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, _sizeDialog, MessageType.Info, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_information"), string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_backup_successfully"), systemBackup.FileNamePacked)); } } else { //On Error Delete Object form Database, this way we dont have a invalid Backup systemBackup.Delete(); /* * IN007007 * * This implementation covers only "non-DatabaseType.MSSqlServer" database, when calling the method to secure-compact database file: * > GlobalFramework.PluginSoftwareVendor.BackupDatabase...Utils.ZipPack * * Please note that variable "backupResult" never changes its value when "DatabaseType.MSSqlServer", therefore is not being covered by this. */ // Show only when "Silent Mode" is on if (pSourceWindow != null) { Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, _sizeDialog, MessageType.Warning, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_information"), string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_backup_error_when_secure_compacting"), systemBackup.FileNamePacked)); } _log.Debug($"DataBaseBackup.Backup(Window pSourceWindow): {string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_backup_error_when_secure_compacting"), systemBackup.FileNamePacked)}"); } } else { //Moved to Thread Outside > Only Show if not in Silence Mode if (pSourceWindow != null) { Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, _sizeDialog, MessageType.Error, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_backup_error"), Path.GetFileName(fileName))); } } /* IN009164 */ SessionXpoForBackupPurposes.Disconnect(); } catch (Exception ex) { _log.Error("bool Backup(Window pSourceWindow) :: Error during backup process: " + ex.Message, ex); // _log.Error("bool Backup(Window pSourceWindow) :: Error during backup process on Session [ " + SessionXpoForBackupPurposes.ToString() + " ]: " + ex.Message, ex); // SessionXpoForBackupPurposes.Disconnect(); } return(backupResult); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(FIN_ArticleType), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(FIN_ArticleType), "Code"); HavePrice = true; }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(fin_articlefamily), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(fin_articlefamily), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(sys_userpermissionitem), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(sys_userpermissionitem), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(FIN_ConfigurationPriceType), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(FIN_ConfigurationPriceType), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(sys_configurationprinterstemplates), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(sys_configurationprinterstemplates), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(FIN_ArticleClass), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(FIN_ArticleClass), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(pos_worksessionmovementtype), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(pos_worksessionmovementtype), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationcashregister), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(pos_configurationcashregister), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(erp_customertype), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(erp_customertype), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(cfg_configurationunitsize), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(cfg_configurationunitsize), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(POS_ConfigurationMaintenance), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(POS_ConfigurationMaintenance), "Code"); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(FIN_DocumentFinanceYearSerieTerminal), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(FIN_DocumentFinanceYearSerieTerminal), "Code").ToString(); }
protected override void OnAfterConstruction() { Ord = FrameworkUtils.GetNextTableFieldID(nameof(fin_documentfinancetype), "Ord"); Code = FrameworkUtils.GetNextTableFieldID(nameof(fin_documentfinancetype), "Code"); }