Пример #1
0
        private void reportViewItem_DisplayerRequested(object sender, ReferenceEventArgs e)
        {
            if (tempReport.Report != null && tempFilePath != "")
            {
                if (!File.Exists(tempFilePath))
                {
                    tempReport.SaveReportToFile(out tempFilePath);
                }
                tempProcess = new Process();
                tempProcess.StartInfo.FileName = tempReport.RealName;
#if RELEASE
                try
                {
#endif
                tempProcess.Start();
#if RELEASE
            }
            catch (Exception ex)
            {
                CASMessage.Show(MessageType.LoadMessage, new object[] { ex.Message });
                processStartSuccessfully = false;
            }
#endif
            }
            e.Cancel = true;
        }
        private void EditSelectedItem()
        {
            MaintenancePerformance selectedItem = maintenanceComplianceListView.SelectedItem;

            if (selectedItem == null)
            {
                return;
            }
            string caption = aircraft.RegistrationNumber + ". Maintenance Status. " + selectedItem.CheckTypeExtended + " check";
            MaintenancePerformanceForm form = new MaintenancePerformanceForm(caption);

            form.ReadOnly = readOnly;
            form.UpdateDisplayedData(selectedItem);
            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (form.SaveDisplayedData(selectedItem))
                {
                    selectedItem.Save(false);
                    DisplayItems();
                }
                else
                {
                    CASMessage.Show(MessageType.InvalidValue, new object[] { "Check" });
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Проверить поля ProductKey и ComponyName в USB ключе и реестре
        /// </summary>
        public static void CheckLicenseInformation()
        {
            timer.Enabled   = false;
            _isUsbKeyFound  = false;
            _isLicenseFound = false;
            var windowsRegistryLicenseInformation = WindowsRegistryDataManager.GetRegistryInformation();

            if (windowsRegistryLicenseInformation == null)
            {
                CASMessage.Show(MessageType.LicenseInformationNotEqual);
                Environment.Exit(Environment.ExitCode);
            }

            _isLicenseFound = true;


            if (DateTime.Now.Date > windowsRegistryLicenseInformation.Expires.Date)
            {
                CASMessage.Show(MessageType.LicenseExpired);
                Environment.Exit(Environment.ExitCode);
            }

            if (DateTime.Now.Date < windowsRegistryLicenseInformation.Expires.Date &&
                (windowsRegistryLicenseInformation.Expires.Date - DateTime.Now.Date).TotalDays > 180)
            {
                CASMessage.Show(MessageType.LicenseViolation);
                Environment.Exit(Environment.ExitCode);
            }

            form.Text = new GlobalTermsProvider()["SystemName"] + ". Evaluation copy. Valid till " +
                        windowsRegistryLicenseInformation.Expires.ToString(
                new GlobalTermsProvider()["DateFormat"].ToString());

            timer.Enabled = true;
        }
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (dateTimePickerPerformDate.Value.Date > DateTime.Today)
     {
         MessageBox.Show("Picked date can't be higher then current", (string)new TermsProvider()["SystemName"],
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     else if (!CheckTypeOfCheck())
     {
         CASMessage.Show(MessageType.InvalidValue, new object[] { "Check" });
         return;
     }
     else
     {
         DialogResult = DialogResult.OK;
         Close();
     }
 }
        private void AddNewItem()
        {
            MaintenancePerformanceForm form = new MaintenancePerformanceForm(aircraft.RegistrationNumber + ". Maintenance Status. New check");

            form.ReadOnly = readOnly;
            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                MaintenancePerformance newItem = new MaintenancePerformance();
                if (form.SaveDisplayedData(newItem))
                {
                    aircraft.AddMaintenancePerformance(newItem);
                    DisplayItems();
                }
                else
                {
                    CASMessage.Show(MessageType.InvalidValue, new object[] { "Check" });
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Проверить поля ProductKey и ComponyName в USB ключе и реестре
        /// </summary>
        public static void CheckLicenseInformation()
        {
            timer.Enabled  = false;
            isUSBKeyFound  = false;
            isLicenseFound = false;
            LicenseInformation windowsRegistryLicenseInformation =
                WindowsRegistryDataManager.GetRegistryInformation();

            if (windowsRegistryLicenseInformation == null)
            {
                CASMessage.Show(MessageType.LicenseInformationNotEqual);
                Environment.Exit(Environment.ExitCode);
            }
            LicenseInformation usbLicenseInformation = USBKeyDataManager.GetUSBKeyData();

            if (usbLicenseInformation == null)
            {
                isLicenseFound = true;


                if (DateTime.Now.Date > windowsRegistryLicenseInformation.Expires.Date)
                {
                    CASMessage.Show(MessageType.LicenseExpired);
                    Environment.Exit(Environment.ExitCode);
                    return;
                }

                if (DateTime.Now.Date < windowsRegistryLicenseInformation.Expires.Date && (windowsRegistryLicenseInformation.Expires.Date - DateTime.Now.Date).TotalDays > 45)
                {
                    CASMessage.Show(MessageType.LicenseViolation);
                    Environment.Exit(Environment.ExitCode);
                    return;
                }

                form.Text = new TermsProvider()["SystemName"] + ". Evaluation copy. Valid till " +
                            windowsRegistryLicenseInformation.Expires.ToString(
                    new TermsProvider()["DateFormat"].ToString());
            }
            else
            {
                if (usbLicenseInformation.Company != windowsRegistryLicenseInformation.Company)
                {
                    form.Enabled = false;
                    if (messageForm != null)
                    {
                        messageForm.Close();
                    }
                    messageForm = new MessageForm();

                    messageForm.MessageText =
                        string.Format(new MessageInfoProvider()[MessageType.USBKeyNotValid.ToString()].ToString(),
                                      windowsRegistryLicenseInformation.Company);
                    messageForm.Text = MessageType.USBKeyNotValid.ToString();
                    messageForm.ShowDialog();
                    form.Enabled = true;
                    if (messageForm.IsRetryButtonPushed)
                    {
                        CheckLicenseInformation();
                        return;
                    }
                    ConnectionManager.Disconnect();
                    Environment.Exit(Environment.ExitCode);
                }
                isUSBKeyFound = true;

                if (messageForm != null)
                {
                    messageForm.Close();
                }
                form.Text = new TermsProvider()["SystemName"] + ". Licensed to " +
                            windowsRegistryLicenseInformation.Company;
            }
            timer.Enabled = true;
        }