コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = LearnerUln.GetHashCode();
         hashCode = (hashCode * 397) ^ (PriceEpisodeIdentifierForComparison != null ? PriceEpisodeIdentifierForComparison.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Ukprn.GetHashCode();
         hashCode = (hashCode * 397) ^ ContractType;
         hashCode = (hashCode * 397) ^ TransactionType;
         hashCode = (hashCode * 397) ^ SfaContributionPercentageToCompare.GetHashCode();
         hashCode = (hashCode * 397) ^ AmountToCompare.GetHashCode();
         hashCode = (hashCode * 397) ^ CollectionPeriod;
         hashCode = (hashCode * 397) ^ AcademicYear;
         hashCode = (hashCode * 397) ^ DeliveryPeriod;
         hashCode = (hashCode * 397) ^ (LearnerReferenceNumber != null ? LearnerReferenceNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LearningAimReference != null ? LearningAimReference.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ProgrammeType.GetHashCode();
         hashCode = (hashCode * 397) ^ StandardCode.GetHashCode();
         hashCode = (hashCode * 397) ^ FrameworkCode.GetHashCode();
         hashCode = (hashCode * 397) ^ PathwayCode.GetHashCode();
         hashCode = (hashCode * 397) ^ (LearningAimFundingLineType != null ? LearningAimFundingLineType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AccountId.GetHashCode();
         return(hashCode);
     }
 }
コード例 #2
0
 public IStandardResult Fail(StandardCode code, string message, object data = null)
 {
     Code    = code;
     Message = message;
     Data    = data;
     return(this);
 }
コード例 #3
0
        public SQLSettings()
        {
            InitializeComponent();

            StandardCode standardCode = new StandardCode();
            standardCode.GetDatabaseCredentials();

            txtServername.Text = MainWindow.sqlServername;
            txtDatabasename.Text = MainWindow.sqlDatabase;
            txtUsername.Text = MainWindow.sqlUsername;
            txtPassword.Password = MainWindow.sqlPassword;
        }
コード例 #4
0
        public override int GetHashCode()
        {
            unchecked
            {
                const int hashBase   = (int)2166136261;
                const int multiplier = 16777619;

                int hash = hashBase;
                hash = (hash * multiplier) ^ StandardCode.GetHashCode();
                hash = (hash * multiplier) ^ (StandardReference is null ? 0 : StandardReference.GetHashCode());
                return(hash);
            }
        }
コード例 #5
0
        public SQLSettings(MainWindow mw)
        {
            InitializeComponent();

            StandardCode standardCode = new StandardCode();
            standardCode.GetDatabaseCredentials();

            txtServername.Text = MainWindow.sqlServername;
            txtDatabasename.Text = MainWindow.sqlDatabase;
            txtUsername.Text = MainWindow.sqlUsername;
            txtPassword.Password = MainWindow.sqlPassword;
            // standardCode.HideLineButtons();

            if (!MainWindow.stat_bLoggedIn)
            {

                MainWindow.stat_iActiveLineNumber = 0;
                mw.HideLineButtons();
                mw.SetControlVisibilityOnLineChange();
                mw.btnSettings.Visibility = Visibility.Hidden;
                mw.btnStart.Visibility = Visibility.Hidden;
                mw.btnStop.Visibility = Visibility.Hidden;
                mw.btnLogOn.Visibility = Visibility.Hidden;
                mw.btnLogOff.Visibility = Visibility.Hidden;
                mw.imageBuhlerLogo.Opacity = 1;
                mw.btnReports.Visibility = Visibility.Hidden;
                mw.btnDisableZoom.Visibility = Visibility.Hidden;
                mw.btnEnableZoom.Visibility = Visibility.Hidden;
                mw.btnSaveZoom.Visibility = Visibility.Hidden;
                mw.image1.IsEnabled = false;
                mw.txtAlarms.IsEnabled = false;
                mw.lblLastReadTime.Visibility = Visibility.Hidden;
                mw.lblBadTags.Visibility = Visibility.Hidden;
                mw.txtLoggedInUser.IsEnabled = false;
                mw.progBarUserLevel.IsEnabled = false;
                //  standardCode.HideLineButtons(myMainWindow);
            }
        }
コード例 #6
0
 public string GetStandardId() => string.IsNullOrWhiteSpace(StandardUId) ? StandardCode.ToString() : StandardUId;
コード例 #7
0
 public string GetStandardId() => !string.IsNullOrWhiteSpace(StandardReference) ? StandardReference : StandardCode > 0 ? StandardCode.ToString() : string.Empty;
コード例 #8
0
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            StandardCode standardCode = new StandardCode();
            string SqlConnectionString = "Data Source=" + txtServername.Text + ";Initial Catalog=" + txtDatabasename.Text + ";User Id=" + txtUsername.Text + ";Password="******";";
            bool connected = standardCode.TestSQLDatabaseConnection(SqlConnectionString);

            MessageBox.Show("Able to connect to SQL : " + connected, "Connection " + connected, MessageBoxButton.OK, MessageBoxImage.Information);
        }
コード例 #9
0
        DispatcherTimer timerWriteReporting = new DispatcherTimer(); //Logs the current value of all tags that need to be reported on

        #endregion Fields

        #region Constructors

        public MainWindow()
        {
            InitializeComponent();
            dllName = DllDirectory + dllName;
            Plc.Instance.ConnectTo(PLCIpAddress, 0,2);

            threadPLCComms = new Thread(new ThreadStart(CheckPLCComms));
            threadPLCComms.Start();
            bThreadsToRun = true;

            DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Initializing Objects...", 10);
            //Thread.Sleep(500);

            standardCode = new StandardCode();

            DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Checking Directories...", 20);
            //Thread.Sleep(500);

            bool bExists = standardCode.CreateDirectoryStructure();

            if (bExists)
            {

                DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Loading Credentials...", 30);
                //Thread.Sleep(500);
                standardCode.GetDatabaseCredentials();

                SqlConnectionString = "Data Source=" + sqlServername + ";Initial Catalog=" + sqlDatabase + ";User Id=" + sqlUsername + ";Password="******"; Connection Timeout=10;";

                DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Testing Connection...", 40);
                //Thread.Sleep(500);
                bool validConnection = standardCode.TestSQLDatabaseConnection(SqlConnectionString);

                if (validConnection)
                {
                    DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Validating Settings...", 50);
                    //Thread.Sleep(500);
                    bool bSettingsLoaded = standardCode.LoadApplicationSettings(SqlConnectionString);
                    //standardCode.GetSettingsFromXMLFile();

                    DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Connecting To PLC...", 60);
                    //Thread.Sleep(500);

                    bool validFormat = standardCode.ValidatePLCConfiguration(PLCIpAddress, PLCRackNo, PLCSlotNum);  //Validates the loaded settings
                    if (validFormat)
                    {
                        bool bContinue = false;
                        string sRackSlot = PLCRackNo.Trim() + "." + PLCSlotNum.Trim();

                        try
                        {
                            //PLC1_R = new Controller(PLCIpAddress, Controller.CPU.S7300, sRackSlot);         //Set PLC Rack and Slot number
                            //PLC1_W = new Controller(PLCIpAddress, Controller.CPU.S7300, sRackSlot);         //Set PLC Rack and Slot number
                            bContinue = true;
                        }
                        catch (Exception ex)
                        {
                            bContinue = false;
                            MessageBox.Show("Error creating PLC connection object!\n" + ex.Message, "Check PLC Config Settings", MessageBoxButton.OK, MessageBoxImage.Error);
                        }

                        DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("PLC Objects Created...", 80);
                        //Thread.Sleep(500);
                        if (bContinue)
                        {
                            timerWriteLog.Tick += new EventHandler(timerWriteLog_Tick);
                            timerWriteLog.Interval = new TimeSpan(0, 0, 0, 10, 0);
                            timerAlarmFlash.Tick += new EventHandler(timerAlarmFlash_Tick);
                            timerAlarmFlash.Interval = new TimeSpan(0, 0, 0, 1, 0);
                            timerNoCommFlash.Tick += new EventHandler(timerNoCommFlash_Tick);
                            timerNoCommFlash.Interval = new TimeSpan(0, 0, 0, 2, 0);
                            timerAutoLogOff.Tick += new EventHandler(timerAutoLogOff_Tick);
                            timerAutoLogOff.Interval = new TimeSpan(0, 0, 1, 0, 0);
                            timerApplicationHints.Tick += new EventHandler(timerApplicationHints_Tick);
                            timerApplicationHints.Interval = new TimeSpan(0, 0, 10, 0, 0);
                            timerAlarmHorn.Tick += new EventHandler(timerAlarmHorn_Tick);
                            timerAlarmHorn.Interval = new TimeSpan(0, 0, 0, 1, 0);
                            timerWriteReporting.Tick += new EventHandler(timerWriteReporting_Tick);
                            timerWriteReporting.Interval = new TimeSpan(0, 0, 1, 0, 0);
                            timerCleanHistoricLog.Tick += new EventHandler(timerCleanHistoricLog_Tick);
                            timerCleanHistoricLog.Interval = new TimeSpan(0, 1, 0, 0, 0);

                            sElementDescription_Changed += new EventHandler(MainWindow_sElementDescription_Changed);
                            sElementStatus_Changed += new EventHandler(MainWindow_sElementStatus_Changed);
                            sActiveLine_Changed += new EventHandler(MainWindow_sActiveLine_Changed);
                            bFault_Changed += new EventHandler(MainWindow_bFault_Changed);
                            iActiveLine_Changed += new EventHandler(MainWindow_iActiveLine_Changed);
                            bLoggedIn_Changed += new EventHandler(MainWindow_bLoggedIn_Changed);
                            bCmdModify_Changed += new EventHandler(MainWindow_bCmdModify_Changed);

                            if (MainWindow.stat_bShowApplicationHints == true)
                            {
                                alHints = standardCode.LoadApplicationHints(SqlConnectionString);
                                timerApplicationHints.IsEnabled = true;
                                timerApplicationHints.Start();
                            }

                            #region S7 Link Initialization

                            //tagroupSecStaFeedOff = new TagGroup(PLC1_R);
                            //tagroupSmartTags = new TagGroup(PLC1_R);
                            //tagroupAdditionalSmartTags = new TagGroup(PLC1_R);
                            //tagroupSecStates = new TagGroup();
                            //tagroupSecStatesFAULT = new TagGroup();
                            //tagroupSecParEmptying = new TagGroup(PLC1_R);
                            //tagroupSecOutEmptying = new TagGroup(PLC1_R);

                            #endregion

                            DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Finalizing Parameters...", 90);
                            Thread.Sleep(500);
                            //------------------------------------------------------------------------------//
                            //                             -->* CHANGE *<--                                 //
                            //------------------------------------------------------------------------------//
                            stat_sPlantName = "GBM - Maize Mill 168 t/h";
                            stat_sPlantLocation = "KITWE, ZAMBIA";

                            //MainWindow mw;

                            //ProductsViewModelDataContext = new KNEKT.Classes.Products.ProductsViewModel();

                            //Create instance of each display page to navigate to using buttons
                            pageINT1 = new DisplayPages.INT1(Plc.Instance,this);
                            pageFCL1 = new DisplayPages.FCL1(PLC1_W);
                            pageMTR1 = new DisplayPages.MTR1(PLC1_W);
                            pageMIL1 = new DisplayPages.MIL1A(PLC1_W);
                            pageMIL2 = new DisplayPages.MIL1B(PLC1_W);

                            //binProductManagement = new DisplayPages.DisplayWindows.BinProductManagement() { DataContext = ProductsViewModelDataContext };

                            pageSettings = new DisplayPages.Settings();
                            pageReportViewer = new DisplayPages.ReportViewer();
                            pageProfibusNetwork = new DisplayPages.ProfibusNetwork();

                            //Assign the PLC_W Write instance to each manual control and scale info on every display page
                            //pageINT1._Setpoint_A1001.SpeedControl_WriteController = PLC1_W;
                            //pageINT1.manualControl_A1059.ManualControl_WriteController = PLC1_W;
                            //pageINT1.manualControl_A1060.ManualControl_WriteController = PLC1_W;
                            //pageINT1.manualControl_A1061.ManualControl_WriteController = PLC1_W;
                            //pageINT1.manualControl_A1062.ManualControl_WriteController = PLC1_W;
                            //pageTRF1.manualControl_A1059.ManualControl_WriteController = PLC1_W;
                            //pageTRF1.manualControl_A1060.ManualControl_WriteController = PLC1_W;
                            //pageTRF1.manualControl_A1061.ManualControl_WriteController = PLC1_W;
                            //pageTRF1.manualControl_A1062.ManualControl_WriteController = PLC1_W;
                            ////pageFCL1.FlowbalancerInfo_A2026.FlowbalancerInfo3_WriteController = PLC1_W;
                            ////pageFCL1.FlowbalancerInfo_A2027.FlowbalancerInfo3_WriteController = PLC1_W;
                            ////pageFCL1.FlowbalancerInfo_A2028.FlowbalancerInfo3_WriteController = PLC1_W;
                            //pageFCL1.MYFCInfo_A2039.MYFCInfo_WriteController = PLC1_W;
                            //pageSCL1.FlowbalancerInfo_A2053.FlowbalancerInfo1_WriteController = PLC1_W;
                            //pageSCL1.FlowbalancerInfo_A2054.FlowbalancerInfo1_WriteController = PLC1_W;
                            //pageSCL1.FlowbalancerInfo_A2055.FlowbalancerInfo1_WriteController = PLC1_W;
                            //pageSCL1.MYFCInfo_A2039.MYFCInfo_WriteController = PLC1_W;
                            //pageMIL1.ScaleInfo_A0150.ScaleInfo_Controller_W = PLC1_W;
                            //pageMIL1.manualControl_A0150.ManualControl_WriteController = PLC1_W;
                            //pageMTR1.manualControl_A0150.ManualControl_WriteController = PLC1_W;
                            //pageSCG1._Setpoint_A3010.SpeedControl_WriteController = PLC1_W;

                            //-->

                            //MillerCallButton.MillerCallButton_WriteController = PLC1_W;

                            //pageMIL1A._4073SC.SpeedControl_WriteController = PLC1_W;
                            //pageTRF1.ScaleInfo_1019.ScaleInfo_Controller_W = PLC1_W;

                            //Set the type of line for each line in the relevant order (1 = normal line, 2 = Milling line)
                            alLineTypes.Add(1); //INT1
                            alLineTypes.Add(1); //FCL1
                            alLineTypes.Add(1); //MTR1
                            alLineTypes.Add(2); //MIL1
                            alLineTypes.Add(2); //MIL2
                            //alLineTypes.Add(2); //MIL1B

                            DisplayPages.DisplayWindows.SplashScreenWindow.CurrentLoadingStatus("Application Starting...", 100);
                            //Thread.Sleep(500);
                            DisplayPages.DisplayWindows.SplashScreenWindow.EndDisplay();

                            _mainFrame.Navigate(new DisplayPages.StartPage());                          //--> *Navigate to the start page

                            LoadVisualApplicationSettings();                                           //Loads the visual application settings
                            //StartCommunicationThread();                                                 //Start the commincation threads
                            InitSendersAndRecievers();                                                  //Initialize all senders and recievers
                            bLoggedIn = false;                                                          //Set LoggedIn status to False

                            #region Visibilities (Labels buttons and timers)
                            btnJob.Visibility = Visibility.Hidden;
                            #endregion
                        }
                    }
                    else //End PLC configuration settings
                    {
                        DisplayPages.DisplayWindows.SplashScreenWindow.EndDisplay();
                        MessageBox.Show("Some of the PLC settings are not correct. The program will not start until these settings are corrected", "Format of Settings Incorrect", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
                else //End connect to Database
                {
                    stat_bLoggedIn = false;
                    stat_iActiveLineNumber = 0;
                    SetControlVisibilityOnLineChange();

                    _mainFrame.Navigate(new _PagesSettings.SQLSettings(this));
                    HideLineButtons();
                    HideControlsOnException();
                    DisplayPages.DisplayWindows.SplashScreenWindow.EndDisplay();
                    MessageBox.Show("Please update the database connection details on the settings page to continue", "Invalid Database credentials", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else //End Create Directories
            {
                DisplayPages.DisplayWindows.SplashScreenWindow.EndDisplay();
                MessageBox.Show("The required directory structure has not been created.\nPlease run the program as an Administrator to create the directories.\nThe program will not start until these directories are created", "Directories do not Exist", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }