Ejemplo n.º 1
0
        //LogOff User Before Delete
        void TreeView_RecordBeforeDelete(object sender, EventArgs e)
        {
            sys_userdetail userDetail = (_dataSourceRow as sys_userdetail);

            //If User deleted Force Logout in Sytem
            GlobalApp.WindowStartup.LogOutUser(false, userDetail);
        }
Ejemplo n.º 2
0
 public void LogOutUser(bool pGotoStartupWindow, sys_userdetail pUserDetail)
 {
     if (
         GlobalFramework.SessionApp.LoggedUsers.ContainsKey(pUserDetail.Oid))
     {
         GlobalFramework.SessionApp.LoggedUsers.Remove(pUserDetail.Oid);
         GlobalFramework.SessionApp.Write();
         FrameworkUtils.Audit("USER_LOGOUT", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_user_logout"), pUserDetail.Name));
         //Only Reset LoggedUser if equal to pUser
         if (GlobalFramework.LoggedUser.Equals(pUserDetail))
         {
             GlobalFramework.LoggedUser            = null;
             GlobalFramework.LoggedUserPermissions = null;
         }
     }
     //Update Table, In case user change Users in BackOffice
     GlobalApp.WindowStartup.TablePadUser.UpdateSql();
     //Required to Assign Details to Update Select User
     AssignUserDetail();
     //Show Startup Windows, or Not (Silent Mode)
     if (pGotoStartupWindow)
     {
         GlobalApp.WindowStartup.ShowAll();
     }
 }
Ejemplo n.º 3
0
        public DialogUserDetail(Window pSourceWindow, GenericTreeViewXPO pTreeView, DialogFlags pFlags, DialogMode pDialogMode, XPGuidObject pXPGuidObject)
            : base(pSourceWindow, pTreeView, pFlags, pDialogMode, pXPGuidObject)
        {
            this.Title = Utils.GetWindowTitle(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_edit_user"));
            SetSizeRequest(500, 469);

            //Store References
            _userDetail   = (DataSourceRow as sys_userdetail);
            _isLoggedUser = (_userDetail == GlobalFramework.LoggedUser);

            //Store Current User Unchanged Profile
            _currentUserPermissionProfileGuid = (_userDetail.Profile != null && _dialogMode == DialogMode.Update)
                ? _userDetail.Profile.Oid
                : Guid.Empty;

            //Store Current User Unchanged PasswordReset
            _currentUserPasswordReset = _userDetail.PasswordReset;
            //Store Current User Unchanged Disabled
            _currentUserDisabled = _userDetail.Disabled;

            //Init UI
            InitUI();
            InitNotes();
            ShowAll();
        }
Ejemplo n.º 4
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //FinanceDocument

        //Used to trigger all Errors
        public static fin_documentfinancemaster PersistFinanceDocumentMinimal(Guid pDocumentFinanceType)
        {
            //Store current Logged Details
            sys_userdetail loggedUser = GlobalFramework.LoggedUser;
            pos_configurationplaceterminal loggedTerminal = GlobalFramework.LoggedTerminal;

            //Reset Current Logged Details
            GlobalFramework.LoggedUser     = null;
            GlobalFramework.LoggedTerminal = null;
            fin_documentfinancemaster documentFinanceMaster = null;

            try
            {
                //Create Empty ArticleBag
                ArticleBag articleBag = new ArticleBag();
                //Create ProcessFinanceDocumentParameter
                ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter(pDocumentFinanceType, articleBag);
                //Reset Defaults
                processFinanceDocumentParameter.Currency = Guid.Empty;
                documentFinanceMaster = ProcessFinanceDocument.PersistFinanceDocument(processFinanceDocumentParameter);
                Console.WriteLine(string.Format("documentFinanceMaster.DocumentNumber: [{0}]", documentFinanceMaster.DocumentNumber));
            }
            finally
            {
                //Restore Old Logged Details
                GlobalFramework.LoggedUser     = loggedUser;
                GlobalFramework.LoggedTerminal = loggedTerminal;
            }

            return(documentFinanceMaster);
        }
Ejemplo n.º 5
0
        //XpoMode
        public TreeViewUser(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default)
        {
            Type xpoGuidObjectType = typeof(sys_userdetail);
            //Override Default Value with Parameter Default Value, this way we can have diferent Default Values for GenericTreeView
            sys_userdetail defaultValue = (pDefaultValue != null) ? pDefaultValue as sys_userdetail : null;
            //Override Default DialogType with Parameter Dialog Type, this way we can have diferent DialogTypes for GenericTreeView
            Type typeDialogClass = (pDialogType != null) ? pDialogType : typeof(DialogUserDetail);

            // XPO column properties
            List <GenericTreeViewColumnProperty> columnProperties = new List <GenericTreeViewColumnProperty>();

            columnProperties.Add(new GenericTreeViewColumnProperty("Code")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), MinWidth = 100
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Name")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_users"), Expand = true
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("Profile")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_profile"), ChildName = "Designation", MinWidth = 160
            });
            //columnProperties.Add(new GenericTreeViewColumnProperty("MobilePhone") { Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_mobile_phone });
            columnProperties.Add(new GenericTreeViewColumnProperty("FiscalNumber")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fiscal_number"), MinWidth = 100
            });
            columnProperties.Add(new GenericTreeViewColumnProperty("UpdatedAt")
            {
                Title = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_date_updated"), MinWidth = 150, MaxWidth = 150
            });

            //configure criteria/xpcollection/model
            CriteriaOperator criteria      = pXpoCriteria;
            XPCollection     xpoCollection = new XPCollection(GlobalFramework.SessionXpo, xpoGuidObjectType, criteria);

            //Call Base Initializer
            base.InitObject(
                pSourceWindow,                 //Pass parameter
                defaultValue,                  //Pass parameter
                pGenericTreeViewMode,          //Pass parameter
                pGenericTreeViewNavigatorMode, //Pass parameter
                columnProperties,              //Created Here
                xpoCollection,                 //Created Here
                typeDialogClass                //Created Here
                );

            //Protection to LogOff User
            this.RecordBeforeDelete += TreeView_RecordBeforeDelete;
        }
Ejemplo n.º 6
0
        public PosSendMessageDialog(Window pSourceWindow, DialogFlags pDialogFlags, string pWindowIcon)
        //public PosInputTextDialog(Window pSourceWindow, DialogFlags pDialogFlags, string pWindowTitle, string pEntryLabel, string pDefaultValue, string pRule, bool pRequired)
            : base(pSourceWindow, pDialogFlags, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_send_message"), pWindowIcon, "Label", "Default", SettingsApp.RegexAlfaNumericExtended, true)
        {
            this.HeightRequest = 320;

            //UserDetail
            CriteriaOperator criteriaOperatorUser = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1)");

            _entryBoxSelectUser = new XPOEntryBoxSelectRecordValidation <sys_userdetail, TreeViewUser>(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_user"), "Designation", "Oid", _valueUser, criteriaOperatorUser, SettingsApp.RegexGuid, false);
            _entryBoxSelectUser.EntryValidation.IsEditable = false;
            //Public Reference
            _valueUser = _entryBoxSelectUser.Value;

            //Terminal
            CriteriaOperator criteriaOperatorTerminal = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1)");

            _entryBoxSelectTerminal = new XPOEntryBoxSelectRecordValidation <pos_configurationplaceterminal, TreeViewConfigurationPlaceTerminal>(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_user"), "Designation", "Oid", _valueTerminal, criteriaOperatorTerminal, SettingsApp.RegexGuid, false);
            _entryBoxSelectTerminal.EntryValidation.IsEditable = false;
            //Public Reference
            _valueTerminal = _entryBoxSelectTerminal.Value;

            _vbox.PackStart(_entryBoxSelectTerminal, true, true, 0);
            _vbox.PackStart(_entryBoxSelectUser, true, true, 0);
            _vbox.ShowAll();

            //dialog.VBoxContent.PackStart(textViewTouch, true, true, 0);
            //dialog.VBoxContent.ShowAll();

            /*
             * //Init Local Vars
             * String windowTitle = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_send_message;
             * Size windowSize = new Size(600, 500);
             * String fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_send_message.png");
             *
             * //Init Content
             * Fixed fixedContent = new Fixed();
             * fixedContent.Put(new Label("Place content here"), 0, 0);
             *
             * //ActionArea Buttons
             * TouchButtonIconWithText buttonOk = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok);
             * TouchButtonIconWithText buttonCancel = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel);
             *
             * //ActionArea
             * ActionAreaButtons actionAreaButtons = new ActionAreaButtons();
             * actionAreaButtons.Add(new ActionAreaButton(buttonOk, ResponseType.Ok));
             * actionAreaButtons.Add(new ActionAreaButton(buttonCancel, ResponseType.Cancel));
             * //Init Object
             * this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, fixedContent, actionAreaButtons);
             */
        }
        public static bool PersistWorkSessionMovement(Session pSession, pos_worksessionperiod pWorkSessionPeriod, pos_worksessionmovementtype pWorkSessionMovementType, fin_documentfinancemaster pDocumentFinanceMaster, fin_documentfinancepayment pDocumentFinancePayment, sys_userdetail pUserDetail, pos_configurationplaceterminal pTerminal, DateTime pDate, decimal pMovementAmount, string pDescription, uint pOrd = 1)
        {
            //Prevent Deleted Objects, Get Fresh Objects
            sys_userdetail userDetail = pSession.GetObjectByKey <sys_userdetail>(GlobalFramework.LoggedUser.Oid);
            pos_configurationplaceterminal terminal = pSession.GetObjectByKey <pos_configurationplaceterminal>(GlobalFramework.LoggedTerminal.Oid);
            pos_worksessionmovementtype    workSessionMovementType = pSession.GetObjectByKey <pos_worksessionmovementtype>(pWorkSessionMovementType.Oid);

            try
            {
                pos_worksessionmovement workSessionMovement = new pos_worksessionmovement(pSession)
                {
                    Ord = pOrd,
                    WorkSessionPeriod       = pWorkSessionPeriod,
                    WorkSessionMovementType = workSessionMovementType,
                    UserDetail     = userDetail,
                    Terminal       = terminal,
                    Date           = pDate,
                    MovementAmount = pMovementAmount,
                    Description    = pDescription
                };
                //Assign parent DocumentFinanceMaster and PaymentMethod
                if (pDocumentFinanceMaster != null)
                {
                    workSessionMovement.DocumentFinanceMaster = pDocumentFinanceMaster;
                    workSessionMovement.DocumentFinanceType   = pDocumentFinanceMaster.DocumentType;
                    workSessionMovement.PaymentMethod         = pDocumentFinanceMaster.PaymentMethod;
                }
                //Assign parent DocumentFinancePayment and PaymentMethod
                if (pDocumentFinancePayment != null)
                {
                    workSessionMovement.DocumentFinancePayment = pDocumentFinancePayment;
                    workSessionMovement.DocumentFinanceType    = pDocumentFinancePayment.DocumentType;
                    workSessionMovement.PaymentMethod          = pDocumentFinancePayment.PaymentMethod;
                }

                //Save WorkSessionMovement if not in UOW
                if (pSession.GetType() == typeof(Session))
                {
                    workSessionMovement.Save();
                }

                return(true);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                return(false);
            }
        }
Ejemplo n.º 8
0
        public PosPinPadDialog(Window pSourceWindow, DialogFlags pDialogFlags, sys_userdetail pUserDetail)
            : base(pSourceWindow, pDialogFlags)
        {
            //Dialog compile time preferences
            Boolean showCancel   = false;
            int     DialogHeight = (showCancel) ? 465 : 440;//465 : 400;

            //Init Local Vars Parameters
            _selectedUserDetail = pUserDetail;
            //Init Local Vars
            String            windowTitle           = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_request_user_pin");
            Size              windowSize            = new Size(332, DialogHeight);
            String            fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_users.png");
            String            fontNumberPadPinButtonKeysTextAndLabel = GlobalFramework.Settings["fontNumberPadPinButtonKeysTextAndLabel"];
            ActionAreaButtons actionAreaButtons;

            //Init Content
            Fixed fixedContent = new Fixed();

            //NumberPadPin
            _numberPadPin = new NumberPadPin(pSourceWindow, "numberPadPin", System.Drawing.Color.Transparent, fontNumberPadPinButtonKeysTextAndLabel, "12", Color.White, Color.Black, 100, 67);
            _numberPadPin.ButtonKeyOK.Clicked += ButtonKeyOK_Clicked;

            fixedContent.Put(_numberPadPin, 0, 0);

            if (showCancel)
            {
                //ActionArea Buttons
                TouchButtonIconWithText buttonCancel = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel);

                //ActionArea
                actionAreaButtons = new ActionAreaButtons();
                actionAreaButtons.Add(new ActionAreaButton(buttonCancel, ResponseType.Cancel));
            }
            else
            {
                actionAreaButtons = new ActionAreaButtons();
            }

            //Init Mode
            _numberPadPin.Mode = (_selectedUserDetail.PasswordReset) ? NumberPadPinMode.PasswordOld :
                                 NumberPadPinMode.Password;

            //Events
            this.KeyReleaseEvent += PosPinPadDialog_KeyReleaseEvent;

            //Init Object
            this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, fixedContent, actionAreaButtons);
        }
Ejemplo n.º 9
0
 public void DeleteLoggedUsers()
 {
     try
     {
         foreach (Guid item in GlobalFramework.SessionApp.LoggedUsers.Keys)
         {
             sys_userdetail user = (sys_userdetail)FrameworkUtils.GetXPGuidObject(typeof(sys_userdetail), item);
             FrameworkUtils.Audit("USER_LOGOUT", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_used_forced_logout"), user.Name));
         }
         GlobalFramework.SessionApp.LoggedUsers.Clear();
     }
     catch (Exception ex)
     {
         _log.Error(ex.Message, ex);
     }
 }
Ejemplo n.º 10
0
        public bool ValidatePassword(sys_userdetail pUserDetail)
        {
            bool   result   = false;
            string password = _entryPin.Text;

            string sql = string.Format(@"
                SELECT 
                    AccessPin 
                FROM 
                    sys_userdetail 
                WHERE 
                    (Disabled <> 1 OR Disabled IS NULL)
                    AND Oid = '{0}'
                ;", pUserDetail.Oid
                                       );

            try
            {
                var resultObject = GlobalFramework.SessionXpo.ExecuteScalar(sql);

                if (resultObject != null && resultObject.GetType() == typeof(String) && CryptographyUtils.SaltedString.ValidateSaltedString(resultObject.ToString(), password))
                {
                    _entryPin.ModifyText(StateType.Normal, Utils.ColorToGdkColor(Color.Black));
                    _entryPin.Visibility = false;
                    _entryPinShowStatus  = false;
                    result = true;
                }
                else
                {
                    FrameworkUtils.Audit("USER_LOGIN_ERROR", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_user_login_error"), pUserDetail.Name));
                    _entryPin.ModifyText(StateType.Normal, Utils.ColorToGdkColor(Color.Red));
                    _entryPin.Text       = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "status_message_pin_error");
                    _entryPin.Visibility = true;
                    _entryPinShowStatus  = true;
                    result = false;
                }

                return(result);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                return(result);
            }
        }
Ejemplo n.º 11
0
        void _tablePadUsers_Clicked(object sender, EventArgs e)
        {
            TouchButtonBase button = (TouchButtonBase)sender;

            //Assign CurrentId to TablePad.CurrentId, to Know last Clicked Button Id
            _tablePadUsers.SelectedButtonOid = button.CurrentButtonOid;
            //To be Used in Dialog Result
            _selectedUserDetail = (sys_userdetail)FrameworkUtils.GetXPGuidObject(typeof(sys_userdetail), button.CurrentButtonOid);

            if (_selectedUserDetail.PasswordReset)
            {
                //_log.Debug(string.Format("Name: [{0}], PasswordReset: [{1}]", _selectedUserDetail.Name, _selectedUserDetail.PasswordReset));
                Utils.ShowMessageTouch(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_information"),
                                       string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_user_request_change_password"), _selectedUserDetail.Name, SettingsApp.DefaultValueUserDetailAccessPin)
                                       );
            }

            //Send Response to Replace the Old Ok Button
            Respond(ResponseType.Ok);
        }
Ejemplo n.º 12
0
        //Start Application or Change User
        private void ProcessLogin(sys_userdetail pUserDetail)
        {
            GlobalFramework.LoggedUser            = pUserDetail;
            GlobalFramework.LoggedUserPermissions = FrameworkUtils.GetUserPermissions();
            FrameworkUtils.Audit("USER_LOGIN", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_user_login"), pUserDetail.Name));

            //SessionApp Add LoggedUser
            if (!GlobalFramework.SessionApp.LoggedUsers.ContainsKey(GlobalFramework.LoggedUser.Oid))
            {
                GlobalFramework.SessionApp.LoggedUsers.Add(pUserDetail.Oid, FrameworkUtils.CurrentDateTimeAtomic());
            }
            else
            {
                GlobalFramework.SessionApp.LoggedUsers[GlobalFramework.LoggedUser.Oid] = FrameworkUtils.CurrentDateTimeAtomic();
            }
            GlobalFramework.SessionApp.Write();

            //Returns to default mode
            _mode = NumberPadPinMode.Password;
            UpdateStatusLabels();

            //Process Notifications After Login/Create First Time PosWindow
            //Disabled SystemNotification and ShowNotifications. Moved to Startup Window
            //FrameworkUtils.SystemNotification();
            //Utils.ShowNotifications(_sourceWindow, pUserDetail.Oid);

            //TK016235 BackOffice - Mode
            if (GlobalFramework.AppUseBackOfficeMode)
            {
                Utils.ShowBackOffice(_sourceWindow);
            }
            else
            {
                Utils.ShowFrontOffice(_sourceWindow);
            }
        }
Ejemplo n.º 13
0
        private static bool SystemPrintInsert(fin_documentfinancemaster pDocumentFinanceMaster, fin_documentfinancepayment pDocumentFinancePayment, string pPrinterDesignation, int pPrintCopies, List <int> pCopyNames, bool pSecondPrint, string pPrintMotive, sys_userdetail pUserDetail, pos_configurationplaceterminal pConfigurationPlaceTerminal)
        {
            bool result = false;

            try
            {
                //Start UnitOfWork
                using (UnitOfWork uowSession = new UnitOfWork())
                {
                    string designation = String.Empty;
                    //Get Objects into Current UOW Session
                    sys_userdetail userDetail = (sys_userdetail)FrameworkUtils.GetXPGuidObject(uowSession, typeof(sys_userdetail), pUserDetail.Oid);
                    pos_configurationplaceterminal configurationPlaceTerminal = (pos_configurationplaceterminal)FrameworkUtils.GetXPGuidObject(uowSession, typeof(pos_configurationplaceterminal), pConfigurationPlaceTerminal.Oid);

                    //Convert CopyNames List to Comma Delimited String
                    string copyNamesCommaDelimited = CustomReport.CopyNamesCommaDelimited(pCopyNames);

                    //SystemPrint
                    sys_systemprint systemPrint = new sys_systemprint(uowSession)
                    {
                        Date        = FrameworkUtils.CurrentDateTimeAtomic(),
                        Designation = designation,
                        PrintCopies = pPrintCopies,
                        CopyNames   = copyNamesCommaDelimited,
                        SecondPrint = pSecondPrint,
                        UserDetail  = userDetail,
                        Terminal    = configurationPlaceTerminal
                    };
                    if (pPrintMotive != String.Empty)
                    {
                        systemPrint.PrintMotive = pPrintMotive;
                    }

                    //Mode: DocumentFinanceMaster
                    if (pDocumentFinanceMaster != null)
                    {
                        fin_documentfinancemaster documentFinanceMaster = (fin_documentfinancemaster)FrameworkUtils.GetXPGuidObject(uowSession, typeof(fin_documentfinancemaster), pDocumentFinanceMaster.Oid);
                        systemPrint.DocumentMaster = documentFinanceMaster;
                        designation = string.Format("{0} {1} : {2}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printed"), documentFinanceMaster.DocumentType.Designation, documentFinanceMaster.DocumentNumber);
                        //Update DocumentFinanceMaster
                        if (!documentFinanceMaster.Printed)
                        {
                            documentFinanceMaster.Printed = true;
                        }
                    }
                    //Mode: DocumentFinancePayment
                    if (pDocumentFinancePayment != null)
                    {
                        fin_documentfinancepayment documentFinancePayment = (fin_documentfinancepayment)FrameworkUtils.GetXPGuidObject(uowSession, typeof(fin_documentfinancepayment), pDocumentFinancePayment.Oid);
                        systemPrint.DocumentPayment = documentFinancePayment;
                        designation = string.Format("{0} {1} : {2}", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printed"), documentFinancePayment.DocumentType.Designation, documentFinancePayment.PaymentRefNo);
                    }
                    systemPrint.Designation = designation;

                    try
                    {
                        //Commit UOW Changes : Before get current OrderMain
                        uowSession.CommitChanges();
                        //Audit
                        FrameworkUtils.Audit("SYSTEM_PRINT_FINANCE_DOCUMENT", designation);
                        result = true;
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message, ex);
                        uowSession.RollbackTransaction();
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
            return(result);
        }
 //Main Method  - With and Without Session
 public static bool PersistWorkSessionMovement(pos_worksessionperiod pWorkSessionPeriod, pos_worksessionmovementtype pWorkSessionMovementType, fin_documentfinancemaster pDocumentFinanceMaster, fin_documentfinancepayment pDocumentFinancePayment, sys_userdetail pUserDetail, pos_configurationplaceterminal pTerminal, DateTime pDate, decimal pMovementAmount, string pDescription, uint pOrd = 1)
 {
     return(PersistWorkSessionMovement(GlobalFramework.SessionXpo, pWorkSessionPeriod, pWorkSessionMovementType, pDocumentFinanceMaster, pDocumentFinancePayment, pUserDetail, pTerminal, pDate, pMovementAmount, pDescription));
 }
Ejemplo n.º 15
0
        public static bool Restore(Window pSourceWindow, DataBaseRestoreFrom pRestoreFrom)
        {
            try
            {
                //FrameworkUtils.ShowWaitingCursor();

                Init();

                bool   restoreResult  = false;
                string sql            = string.Empty;
                string fileName       = string.Empty;
                string fileNamePacked = string.Empty;
                //default pathBackups from Settings, can be Overrided in ChooseFromFilePickerDialog Mode
                string pathBackups = _pathBackups;
                DataBaseBackupFileInfo fileInfo = null;
                Guid systemBackupGuid           = Guid.Empty;
                //Required to assign current FileName and FileNamePacked after restore, else name will be the TempName ex acegvpls.soj & n2sjiamk.32o
                sys_systembackup systemBackup = null;
                string           currentFileName = string.Empty, currentFileNamePacked = string.Empty, currentFilePath = string.Empty, currentFileHash = string.Empty;
                sys_userdetail   currentUserDetail = null;

                switch (pRestoreFrom)
                {
                case DataBaseRestoreFrom.SystemBackup:
                    fileInfo = GetSelectRecordFileName(pSourceWindow);
                    //Equal to Filename not FileNamePacked
                    fileNamePacked = fileInfo.FileNamePacked;
                    if (_debug)
                    {
                        _log.Debug(string.Format("RestoreBackup: FileNamePacked:[{0}], FileHashDB:[{1}], FileHashFile:[{2}] FileHashValid:[{3}]", fileInfo.FileNamePacked, fileInfo.FileHashDB, fileInfo.FileHashFile, fileInfo.FileHashValid));
                    }
                    if (fileInfo.Response != ResponseType.Cancel && !fileInfo.FileHashValid)
                    {
                        //#EQUAL#1
                        string message = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_restore_error_invalid_backup_file"), fileNamePacked);
                        Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, new Size(600, 300), MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), message);
                        return(false);
                    }
                    break;

                case DataBaseRestoreFrom.ChooseFromFilePickerDialog:
                    FileFilter          fileFilterBackups = Utils.GetFileFilterBackups();
                    PosFilePickerDialog dialog            = new PosFilePickerDialog(pSourceWindow, DialogFlags.DestroyWithParent, fileFilterBackups, FileChooserAction.Open);
                    ResponseType        response          = (ResponseType)dialog.Run();
                    if (response == ResponseType.Ok)
                    {
                        fileNamePacked = dialog.FilePicker.Filename;
                        //Override Default pathBackups
                        pathBackups = string.Format("{0}/", Path.GetDirectoryName(fileNamePacked));

                        dialog.Destroy();
                    }
                    else
                    {     /* IN009164 */
                        dialog.Destroy();
                        return(false);
                    }
                    break;

                default:
                    break;
                }

                if (GlobalFramework.DatabaseType != DatabaseType.MSSqlServer)
                {
                    fileName = Path.ChangeExtension(fileNamePacked, _fileExtension);
                }
                else
                {
                    //Require to assign filename and packed filename from fileInfo
                    fileName       = fileInfo.FileName;
                    fileNamePacked = fileInfo.FileName;
                }

                if (fileName != string.Empty)
                {
                    if (_debug)
                    {
                        _log.Debug(string.Format("Restore Filename:[{0}] to pathBackups[{1}]", fileNamePacked, pathBackups));
                    }
                    if (GlobalFramework.DatabaseType != DatabaseType.MSSqlServer)
                    {
                        // Old Method before PluginSoftwareVendor Implementation
                        //restoreResult = Utils.ZipUnPack(fileNamePacked, pathBackups, true);
                        restoreResult = GlobalFramework.PluginSoftwareVendor.RestoreBackup(SettingsApp.SecretKey, fileNamePacked, pathBackups, true);
                        if (_debug)
                        {
                            _log.Debug(string.Format("RestoreBackup: unpackResult:[{0}]", restoreResult));
                        }
                    }

                    if (restoreResult || GlobalFramework.DatabaseType == DatabaseType.MSSqlServer)
                    {
                        //Get properties from SystemBackup Object before Restore, to Assign Properties after Restore (FilePath,FileHash,User,Terminal)
                        sql = string.Format("SELECT Oid FROM sys_systembackup WHERE fileNamePacked = '{0}';", Path.GetFileName(fileNamePacked));
                        systemBackupGuid = FrameworkUtils.GetGuidFromQuery(sql);
                        if (systemBackupGuid != Guid.Empty)
                        {
                            systemBackup          = (sys_systembackup)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_systembackup), systemBackupGuid);
                            currentFileName       = systemBackup.FileName;
                            currentFileNamePacked = systemBackup.FileNamePacked;
                            currentFilePath       = systemBackup.FilePath;
                            currentFileHash       = systemBackup.FileHash;
                            currentUserDetail     = systemBackup.User;
                        }

                        //Send fileNamePacked only to show its name in success dialog
                        if (Restore(pSourceWindow, fileName, fileNamePacked, systemBackup))
                        {
                            //Audit DATABASE_RESTORE
                            FrameworkUtils.Audit("DATABASE_RESTORE", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_database_restore"), fileNamePacked));
                            //Required to DropIdentity before get currentDocumentFinanceYear Object, else it exists in old non restored Session
                            GlobalFramework.SessionXpo.DropIdentityMap();
                            //Get Current Active FinanceYear
                            fin_documentfinanceyears currentDocumentFinanceYear = ProcessFinanceDocumentSeries.GetCurrentDocumentFinanceYear();

                            //Disable all Active FinanceYear Series and SeriesTerminal if Exists
                            if (currentDocumentFinanceYear != null)
                            {
                                ProcessFinanceDocumentSeries.DisableActiveYearSeriesAndTerminalSeries(currentDocumentFinanceYear);
                            }

                            //Restore SystemBackup properties else it keeps temp names after Restore acegvpls.soj & n2sjiamk.32o, empty hash etc
                            if (systemBackupGuid != Guid.Empty)
                            {
                                //ReFresh UserDetail from Repository
                                currentUserDetail = (currentUserDetail != null) ? (sys_userdetail)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_userdetail), currentUserDetail.Oid) : null;
                                //Get Current Restored systemBackup Object
                                systemBackup                = (sys_systembackup)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_systembackup), systemBackupGuid);
                                systemBackup.FileName       = currentFileName;
                                systemBackup.FileNamePacked = currentFileNamePacked;
                                systemBackup.FilePath       = currentFilePath;
                                systemBackup.FileHash       = currentFileHash;
                                systemBackup.User           = currentUserDetail;
                                systemBackup.Save();
                            }
                            //If Cant get Record, because works on ChooseFromFilePickerDialog, we must recreate Record from file, only in the case of record with miss fileNamePacked
                            else
                            {
                                sql = "DELETE FROM sys_systembackup WHERE FilePath IS NULL AND FileHash IS NULL AND User IS NULL;";
                                GlobalFramework.SessionXpo.ExecuteNonQuery(sql);
                            }

                            //Audit
                            FrameworkUtils.Audit("APP_CLOSE");
                            //Call QuitWithoutConfirmation without Audit
                            LogicPos.QuitWithoutConfirmation(false);

                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        //#EQUAL#1
                        string message = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_restore_error_invalid_backup_file"), fileNamePacked);
                        Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, new Size(600, 300), MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), message);
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                return(false);
            }
            finally
            {
                //FrameworkUtils.HideWaitingCursor();
            }
        }
Ejemplo n.º 16
0
        /* 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);
        }
Ejemplo n.º 17
0
        public static bool Add(Session pSession, ProcessArticleStockMode pMode, fin_documentfinancedetail pDocumentDetail, erp_customer pCustomer, int pOrd, DateTime pDocumentDate, string pDocumentNumber, fin_article pArticle, decimal pQuantity, string pNotes)
        {
            //Log4Net
            log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            bool    result   = false;
            decimal quantity = 0.0m;

            try
            {
                switch (pMode)
                {
                case ProcessArticleStockMode.Out:
                    quantity = -(pQuantity);
                    break;

                case ProcessArticleStockMode.In:
                    quantity = pQuantity;
                    break;
                }

                //Get Objects in same Session
                erp_customer customer = (erp_customer)pSession.GetObjectByKey(typeof(erp_customer), pCustomer.Oid);
                fin_article  article  = (fin_article)pSession.GetObjectByKey(typeof(fin_article), pArticle.Oid);
                pos_configurationplaceterminal terminal = (pos_configurationplaceterminal)pSession.GetObjectByKey(typeof(pos_configurationplaceterminal), GlobalFramework.LoggedTerminal.Oid);
                sys_userdetail userDetail = (sys_userdetail)pSession.GetObjectByKey(typeof(sys_userdetail), GlobalFramework.LoggedUser.Oid);

                fin_articlestock articleStock = new fin_articlestock(pSession)
                {
                    Customer     = customer,
                    Date         = pDocumentDate,
                    Article      = article,
                    Quantity     = quantity,
                    Notes        = pNotes,
                    CreatedWhere = terminal,
                    CreatedBy    = userDetail
                };
                if (pDocumentNumber != string.Empty)
                {
                    articleStock.DocumentNumber = pDocumentNumber;
                }
                if (pDocumentDetail != null)
                {
                    articleStock.DocumentNumber = pDocumentDetail.DocumentMaster.DocumentNumber;
                    articleStock.DocumentMaster = pDocumentDetail.DocumentMaster;
                    articleStock.DocumentDetail = pDocumentDetail;
                }

                //Only saves if not Working on a Unit Of Work Transaction
                if (pSession.GetType() != typeof(UnitOfWork))
                {
                    articleStock.Save();
                }

                //Audit
                switch (pMode)
                {
                case ProcessArticleStockMode.Out:
                    FrameworkUtils.Audit("STOCK_MOVEMENT_OUT", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_stock_movement_out"), article.Designation, FrameworkUtils.DecimalToString(quantity, SettingsApp.DecimalFormatStockQuantity)));
                    break;

                case ProcessArticleStockMode.In:
                    FrameworkUtils.Audit("STOCK_MOVEMENT_IN", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_stock_movement_in"), article.Designation, FrameworkUtils.DecimalToString(quantity, SettingsApp.DecimalFormatStockQuantity)));
                    break;
                }

                result = true;
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }

            return(result);
        }
Ejemplo n.º 18
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Logic

        public bool ProcessPassword(Window pSourceWindow, sys_userdetail pUserDetail)
        {
            bool result = false;

            try
            {
                switch (_mode)
                {
                case NumberPadPinMode.Password:
                    //Valid User
                    if (ValidatePassword(pUserDetail))
                    {
                        //Start Application
                        ProcessLogin(pUserDetail);
                        //Finish Job usefull to PosPinDialog send Respond(ResponseType.Ok) when Done
                        result = true;
                    }
                    break;

                case NumberPadPinMode.PasswordOld:
                    //Valid User
                    if (ValidatePassword(pUserDetail))
                    {
                        _mode = NumberPadPinMode.PasswordNew;
                        UpdateStatusLabels();
                    }
                    break;

                case NumberPadPinMode.PasswordNew:
                    //Check If New Password is Equal to Old Password using ValidatePassword
                    if (CryptographyUtils.SaltedString.ValidateSaltedString(pUserDetail.AccessPin, _entryPin.Text))
                    {
                        //Show Error Message
                        ResponseType responseType = Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_change_password"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "pos_pinpad_message_password_equal_error"));
                        ClearEntryPinStatusMessage(true);
                    }
                    else
                    {
                        _passwordNew = _entryPin.Text;
                        _mode        = NumberPadPinMode.PasswordNewConfirm;
                        UpdateStatusLabels();
                    }
                    break;

                case NumberPadPinMode.PasswordNewConfirm:
                    if (_passwordNew == _entryPin.Text)
                    {
                        //Commit Changes
                        pUserDetail.AccessPin         = CryptographyUtils.SaltedString.GenerateSaltedString(_passwordNew);
                        pUserDetail.PasswordReset     = false;
                        pUserDetail.PasswordResetDate = FrameworkUtils.CurrentDateTimeAtomic();
                        pUserDetail.Save();
                        FrameworkUtils.Audit("USER_CHANGE_PASSWORD", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_user_change_password"), pUserDetail.Name));
                        ResponseType responseType = Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_change_password"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "pos_pinpad_message_password_changed"));
                        //Start Application
                        ProcessLogin(pUserDetail);
                        //Finish Job usefull to PosPinDialog send Respond(ResponseType.Ok) when Done
                        result = true;
                    }
                    else
                    {
                        //Show Error Message
                        ResponseType responseType = Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_change_password"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "pos_pinpad_message_password_confirmation_error"));
                        ClearEntryPinStatusMessage(true);
                        //Return to
                        _mode = NumberPadPinMode.PasswordNew;
                        UpdateStatusLabels();
                        //Reset passwordNew
                        _passwordNew = string.Empty;
                    }
                    break;

                case NumberPadPinMode.PasswordReset:
                    //Valid User
                    if (ValidatePassword(pUserDetail))
                    {
                        _mode = NumberPadPinMode.PasswordNew;
                        UpdateStatusLabels();
                    }
                    //Return to default request password mode
                    else
                    {
                        _mode = NumberPadPinMode.Password;
                    }
                    break;

                default:
                    break;
                }

                //Always focus Entry
                _entryPin.GrabFocus();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            return(result);
        }