Beispiel #1
0
        //Extra Stuff to LogicPos BootStrap
        private static void InitExtended()
        {
            try
            {
                //TODO
                //http://stackoverflow.com/questions/9640240/accessing-a-resource-file-from-a-different-project-with-resourcemanager-c-sharp
                //ResourceManager rm = new ResourceManager("Namespace.LanguageLocalization", logicpos.financial.library.Classes);

                //Override Paths
                GlobalFramework.Path["assets"]  = @"c:\SVN\logicpos\trunk\src\logicpos\Assets\";
                GlobalFramework.Path["reports"] = @"c:\SVN\logicpos\trunk\src\logicpos\Resources\Reports\";
                //Get Terminal from DB
                GlobalFramework.LoggedUser = (sys_userdetail)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_userdetail), new Guid(GlobalFramework.Settings["xpoOidUserDetailDefaultLoggedUser"]));
                //Get Permissions
                GlobalFramework.LoggedUserPermissions = FrameworkUtils.GetUserPermissions();
                //Override Terminal Printer (PDF)
                //GlobalFramework.LoggedTerminal.Printer = (sys_configurationprinters)GlobalFramework.SessionXpo.GetObjectByKey(typeof(sys_configurationprinters), SettingsApp.LoggedTerminalPrinter);
                GlobalApp.PrinterExportPDF = (sys_configurationprinters)GlobalFramework.SessionXpo.GetObjectByKey(typeof(sys_configurationprinters), SettingsApp.XpoOidPrinterExportPDF);
                GlobalApp.PrinterThermal   = (sys_configurationprinters)GlobalFramework.SessionXpo.GetObjectByKey(typeof(sys_configurationprinters), SettingsApp.XpoOidPrinterThermal);

                if (GlobalFramework.LoggedTerminal == null)
                {
                    _log.Debug("Invalid Printer. Working Without Printer");
                }
                //Override Licence
                GlobalFramework.LicenceCompany = "Logicpulse : Demonstração";
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Beispiel #2
0
        public void UpdateMenuPrivileges()
        {
            string currentNodePrivilegesToken;

            //Required to Reload Object before Get New Permissions
            GlobalFramework.LoggedUser = (sys_userdetail)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_userdetail), GlobalFramework.LoggedUser.Oid);
            //Update Session Privileges
            GlobalFramework.LoggedUserPermissions = FrameworkUtils.GetUserPermissions(GlobalFramework.LoggedUser);

            //Update Backoffice Menu
            if (_accordionDefinition != null && _accordionDefinition.Count > 0)
            {
                foreach (var parentLevel in _accordionDefinition)
                {
                    if (parentLevel.Value.Childs.Count > 0)
                    {
                        foreach (var childLevel in parentLevel.Value.Childs)
                        {
                            currentNodePrivilegesToken = string.Format(_nodePrivilegesTokenFormat, childLevel.Key.ToUpper());
                            //_log.Debug(string.Format("[{0}]=[{1}] [{2}]=[{3}]", childLevel.Value.NodeButton.Sensitive, childLevel.Value.NodeButton.Name, currentNodePrivilegesToken, FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken)));
                            //If have (Content | Events | ExternalApp) & Privileges or the Button is Enabled, Else is Disabled
                            if (FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken) && (childLevel.Value.Content != null || childLevel.Value.Clicked != null || childLevel.Value.ExternalAppFileName != null))
                            {
                                childLevel.Value.NodeButton.Sensitive = true;
                            }
                            else
                            {
                                childLevel.Value.NodeButton.Sensitive = false;
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
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(Resx.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);
            Utils.ShowFrontOffice(_sourceWindow);
        }
Beispiel #4
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Event: touchButtonPosToolbarShowChangeUser

        void touchButtonPosToolbarShowChangeUserDialog_Clicked(object sender, EventArgs e)
        {
            PosChangeUserDialog dialogChangeUser = new PosChangeUserDialog(this, Gtk.DialogFlags.DestroyWithParent);

            try
            {
                string terminalInfo = string.Empty;

                int responseChangeUser = dialogChangeUser.Run();
                if (responseChangeUser == (int)ResponseType.Ok)
                {
                    //Already logged
                    if (GlobalFramework.SessionApp.LoggedUsers.ContainsKey(dialogChangeUser.UserDetail.Oid))
                    {
                        GlobalFramework.LoggedUser            = (SYS_UserDetail)FrameworkUtils.GetXPGuidObject(typeof(SYS_UserDetail), dialogChangeUser.UserDetail.Oid);
                        GlobalFramework.LoggedUserPermissions = FrameworkUtils.GetUserPermissions();
                        _ticketList.UpdateTicketListButtons();
                        FrameworkUtils.Audit("USER_CHANGE", string.Format(Resx.audit_message_user_change, GlobalFramework.LoggedUser.Name));
                        terminalInfo = string.Format("{0} : {1}", GlobalFramework.LoggedTerminal.Designation, GlobalFramework.LoggedUser.Name);
                        if (_labelTerminalInfo.Text != terminalInfo)
                        {
                            _labelTerminalInfo.Text = terminalInfo;
                        }
                    }
                    //Not Logged, Request Pin Login
                    else
                    {
                        PosPinPadDialog dialogPinPad   = new PosPinPadDialog(dialogChangeUser, Gtk.DialogFlags.DestroyWithParent, dialogChangeUser.UserDetail);
                        int             responsePinPad = dialogPinPad.Run();
                        if (responsePinPad == (int)ResponseType.Ok)
                        {
                            if (!GlobalFramework.SessionApp.LoggedUsers.ContainsKey(dialogChangeUser.UserDetail.Oid))
                            {
                                GlobalFramework.SessionApp.LoggedUsers.Add(dialogChangeUser.UserDetail.Oid, FrameworkUtils.CurrentDateTimeAtomic());
                                GlobalFramework.SessionApp.Write();
                                GlobalFramework.LoggedUser            = (SYS_UserDetail)FrameworkUtils.GetXPGuidObject(typeof(SYS_UserDetail), dialogChangeUser.UserDetail.Oid);
                                GlobalFramework.LoggedUserPermissions = FrameworkUtils.GetUserPermissions();
                                _ticketList.UpdateTicketListButtons();
                                FrameworkUtils.Audit("USER_LOGIN", string.Format(Resx.audit_message_user_login, GlobalFramework.LoggedUser.Name));
                                terminalInfo = string.Format("{0} : {1}", GlobalFramework.LoggedTerminal.Designation, GlobalFramework.LoggedUser.Name);
                                if (_labelTerminalInfo.Text != terminalInfo)
                                {
                                    _labelTerminalInfo.Text = terminalInfo;
                                }
                                //After First time Login ShowNotifications
                                Utils.ShowNotifications(dialogPinPad);
                            }
                        }
                        ;

                        dialogPinPad.Destroy();
                    }
                }
                ;
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
            finally
            {
                dialogChangeUser.Destroy();
            }
        }