Exemple #1
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     //Page Logger
     PageLogID = AppUtility.PageLogger(2, 1);
     // Page Event Logger
     AppUtility.PageEventLogger(PageLogID, "Constructor", 1, "Form Load", "Normal");
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;
            //Page Logger
            PageLogID = AppUtility.PageLogger(0, 1);
            // Page Event Logger
            AppUtility.PageEventLogger(PageLogID, "Constructor", 1, "Form Load", "Normal");

            string SystemName = System.Net.Dns.GetHostName();
            string MacAddress = AppUtility.GetMachineData("MACAddress");
            //Initiliazing Frame
            var items         = _FactoryConnection.Registration().GetRegistraionDetails();
            int _licensecount = 0;

            foreach (var dd in items)
            {
                if (dd.IsActivated == true && dd.IsSentForRegistration == true && dd.IsActive == true && DateTime.Now.AddDays(-1) < dd.ActivatedTillDtTm)
                {
                    _licensecount = 1;
                    var _ExistReg = _FactoryConnection.LicenseKeys().GetLicenseDetail(dd.RegistrationID, SystemName).ToList();

                    foreach (var item in _ExistReg)
                    {
                        AppUtility.PageEventLogger(PageLogID, "Constructor", 1, "Sent To Login Page", "Normal");
                        LoginWindow frm = new LoginWindow();
                        this.Cursor = Cursors.Arrow;
                        frm.Show();
                        this.Close();
                        break;
                    }
                    // Page Event Logger
                }
                else if (dd.IsActivated == true && DateTime.Now.AddDays(-1) > dd.ActivatedTillDtTm)
                {
                    _licensecount = 0;
                    //License Deativation
                    bool done = _FactoryConnection.Registration().LicenseDeactivation(dd);
                }
                if (_licensecount == 0)
                {
                    var _Licenses = _FactoryConnection.Registration().GetALLRegistraionDetails().OrderByDescending(o => o.ActivatedTillDtTm).ToList();
                    foreach (var item in _Licenses)
                    {
                        MessageBox.Show("Your license has been exipred on " + item.ActivatedTillDtTm + ". Please register again.");
                        break;
                    }
                }
            }
            if (_licensecount == 0)
            {
                var _Licenses = _FactoryConnection.Registration().GetALLRegistraionDetails().OrderByDescending(o => o.ActivatedTillDtTm).ToList();
                foreach (var item in _Licenses)
                {
                    MessageBox.Show("Your license has been exipred on " + item.ActivatedTillDtTm + ". Please register again.");
                    break;
                }
            }
            this.Cursor = Cursors.Arrow;
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //Page Logger
            PageLogID = AppUtility.PageLogger(9, 1);
            // Page Event Logger
            AppUtility.PageEventLogger(PageLogID, "Page_Loaded", 1, "Form Load", "Normal");
            DbModel db   = new DbModel();
            var     user = db.UserMasters.Where(w => w.RoleID == 1 && w.UserName != w.Password).ToList();

            foreach (var item in user)
            {
                Frame MainFrame = AppUtility.FindChild <Frame>(Application.Current.MainWindow, "MainFrame");
                MainFrame.Navigate(new System.Uri("Forms/EmailConfiguration.xaml", UriKind.RelativeOrAbsolute));
                break;
            }
        }
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     RegistrationGrid.IsEnabled            = false;
     Application.Current.Windows[0].Height = this.Height;
     try
     {
         //Page Logger
         PageLogID = AppUtility.PageLogger(1, 1);
         // Page Event Logger
         AppUtility.PageEventLogger(PageLogID, "Constructor", 1, "Form Load", "Normal");
         //Getting System Info
         string SystemName = System.Net.Dns.GetHostName();
         string MacAddress = AppUtility.GetMachineData("MACAddress");
         //Validating Data
         var items = MainWindow._FactoryConnection.Registration().GetRegistraionDetails();
         SearchTypeList = MainWindow._FactoryConnection.SearchTypeMasters().SearchTypeList();
         listBoxSeachType.ItemsSource = SearchTypeList;
         string PageName = "Forms/Login.xaml";
         foreach (var dd in items)
         {
             if (dd.IsActivated == true && dd.IsSentForRegistration == true)
             {
                 // Page Event Logger
                 AppUtility.PageEventLogger(PageLogID, "Constructor", 1, "Sent To Login Page", "Normal");
                 break;
             }
             else if ((dd.IsActivated == false || dd.IsActivated == null) && dd.IsSentForRegistration == true)
             {
                 PageName = "Forms/Activation.xaml";
                 // Page Event Logger
                 AppUtility.PageEventLogger(PageLogID, "Constructor", 1, "Mail Process Triggerred Again", "Normal");
                 //Registration details to send
                 LicenseViewModel licvm = new LicenseViewModel();
                 licvm.ServiceList = new List <Service>();
                 licvm.ServiceList.AddRange(MainWindow._FactoryConnection.SearchTypeMasters().SearchTypeList(dd.RegistrationID));
                 licvm.CompanyName = dd.CompanyName;
                 licvm.EmailID     = dd.EmailID;
                 licvm.Key         = dd.Key;
                 licvm.MacAddress  = dd.MacAddress;
                 licvm.MobileNo    = dd.MobileNo;
                 licvm.Name        = dd.Name;
                 licvm.SystemCount = dd.LicenseCount;
                 licvm.SystemName  = dd.SystemName;
                 licvm.IsActivated = false;
                 AppUtility.SendRegistrationMail(licvm);
                 MessageBox.Show("Please send mail again for activation key.");
                 Frame MainFrame = AppUtility.FindChild <Frame>(Application.Current.MainWindow, "MainFrame");
                 MainFrame.Navigate(new System.Uri(PageName, UriKind.RelativeOrAbsolute));
                 break;
             }
         }
         // Page Event Logger
         AppUtility.PageEventLogger(PageLogID, "Constructor", 1, "Form Load END", "Normal");
     }
     catch (Exception ex)
     {
         // Page Event Logger
         AppUtility.PageEventLogger(PageLogID, "Submit Button", 1, ex.Message + " | " + ex.StackTrace, "Error");
         MessageBox.Show("There is some error, Please contact administrator.");
     }
     finally
     {
         RegistrationGrid.IsEnabled = true;
     }
 }