Example #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");
 }
Example #2
0
        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 btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                RegistrationGrid.IsEnabled = false;
                //Registration details to send
                LicenseViewModel licvm = new LicenseViewModel();
                licvm.ServiceList = new List <Service>();
                licvm.ServiceList.AddRange(SearchTypeList);
                licvm.CompanyName = txtCompanyName.Text;
                licvm.EmailID     = txtEmailID.Text;
                licvm.Key         = Guid.NewGuid().ToString();
                licvm.MacAddress  = AppUtility.GetMachineData("MACAddress");
                licvm.MobileNo    = txtMobileNumber.Text;
                licvm.Name        = txtFullName.Text;
                licvm.SystemCount = Convert.ToInt32(txtLicenseCount.Text);
                licvm.SystemName  = System.Net.Dns.GetHostName();
                licvm.IsActivated = false;
                // Page Event Logger
                AppUtility.PageEventLogger(PageLogID, "Submit Button", 1, "Registration Button Click Started", "Normal");

                //Registeration of Client
                Int64 RegistrationID = MainWindow._FactoryConnection.Registration().FirstTimeRegistration(txtCompanyName.Text, Convert.ToInt32(txtLicenseCount.Text), txtEmailID.Text, licvm.Key, licvm.SystemName, licvm.MacAddress, txtFullName.Text, txtMobileNumber.Text, SearchTypeList);

                // Page Event Logger
                AppUtility.PageEventLogger(PageLogID, "Submit Button", 1, "Registration Done", "Normal");
                if (RegistrationID > 0)
                {
                    // Page Event Logger
                    AppUtility.PageEventLogger(PageLogID, "Submit Button", 1, "Mailig Process Started", "Normal");
                    AppUtility.SendRegistrationMail(licvm);
                }

                MessageBox.Show("Please send the mail.");
                Frame MainFrame1 = AppUtility.FindChild <Frame>(Application.Current.MainWindow, "MainFrame");
                MainFrame1.Navigate(new System.Uri("Forms/Activation.xaml", UriKind.RelativeOrAbsolute));
                // Page Event Logger
                AppUtility.PageEventLogger(PageLogID, "Submit Button", 1, "Registration Button Click 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;
            }
        }
        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 btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // Page Event Logger
         AppUtility.PageEventLogger(PageLogID, "Submit", 1, "User Name and Password Setup", "Normal");
         bool IsDone = MainWindow._FactoryConnection.UserMaster().UpdateAdminUser(txtUserID.Text, txtPassword.Password, txtConfirmPassword.Password);
         // Page Event Logger
         AppUtility.PageEventLogger(PageLogID, "Submit", 1, "User Name and Password Setup Done", "Normal");
         MessageBox.Show("User Successfully created. Please remember your credentials for future.");
         Frame MainFrame = AppUtility.FindChild <Frame>(Application.Current.MainWindow, "MainFrame");
         MainFrame.Navigate(new System.Uri("Forms/EmailConfiguration.xaml", UriKind.RelativeOrAbsolute));
     }
     catch (Exception ex)
     {
         // Page Event Logger
         AppUtility.PageEventLogger(PageLogID, "Submit", 1, ex.StackTrace, "Error");
         MessageBox.Show("Their is some issue please login with mobileno as user name and password.");
     }
 }
Example #6
0
        private void btnActivate_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Windows[0].Height = this.Height;
            try
            {
                // Page Event Logger
                AppUtility.PageEventLogger(PageLogID, "Activation Button", 1, "Activation Button Click", "Normal");
                txtActivationKey.SelectAll();
                string           Value = Utility.Utility.Decrypt(txtActivationKey.Selection.Text);
                LicenseViewModel licvm = Newtonsoft.Json.JsonConvert.DeserializeObject <LicenseViewModel>(Value);

                if (licvm != null)
                {
                    var _ExistReg = MainWindow._FactoryConnection.Registration().GetSingleRegistraionDetail(licvm.Key);
                    if (_ExistReg != null)
                    {
                        if (Convert.ToBoolean(licvm.IsActivated) && licvm.SystemName == System.Net.Dns.GetHostName())
                        {
                            _ExistReg.ActivationKey = licvm.ActivationKey;
                            // Page Event Logger
                            AppUtility.PageEventLogger(PageLogID, "Activation Button", 1, "Product Activated", "Normal");
                            MessageBox.Show("Your product has been activated till " + licvm.ActivationUptoDtTm);
                            AppUtility.AdminUserCreateAndRoleMapping(_ExistReg, licvm);
                            // Page Event Logger
                            AppUtility.PageEventLogger(PageLogID, "Activation Button", 1, "Moved To Super Admin Password Change", "Normal");
                            Frame MainFrame = AppUtility.FindChild <Frame>(Application.Current.MainWindow, "MainFrame");
                            MainFrame.Navigate(new System.Uri("Forms/SuperAdminPasswordChange.xaml", UriKind.RelativeOrAbsolute));
                        }
                        else if (Convert.ToBoolean(licvm.IsActivated) && (_ExistReg.LicenseCount - _ExistReg.LicenseUsed) > 0)
                        {
                            AppUtility.PageEventLogger(PageLogID, "Activation Button", 1, "Register Other Systems", "Normal");
                            bool IsRegisterd = AppUtility.AdditionSystemRegistration(_ExistReg, licvm);
                            if (IsRegisterd)
                            {
                                MessageBox.Show("This device is registered successfully");
                                LoginWindow frm = new LoginWindow();
                                this.Cursor = Cursors.Arrow;
                                frm.Show();
                                Application.Current.MainWindow.Close();
                            }
                            else
                            {
                                MessageBox.Show("Please contact the administrator.");
                            }
                        }
                        else
                        {
                            // Page Event Logger
                            AppUtility.PageEventLogger(PageLogID, "Activation Button", 1, "Mail Process Triggerred Again", "Normal");
                            MessageBox.Show("Your product has not been activated. Please send mail again");


                            LicenseViewModel licvmn = new LicenseViewModel();
                            licvmn.ServiceList = new List <Service>();
                            licvmn.ServiceList.AddRange(MainWindow._FactoryConnection.SearchTypeMasters().SearchTypeList(_ExistReg.RegistrationID));
                            licvmn.CompanyName = _ExistReg.CompanyName;
                            licvmn.EmailID     = _ExistReg.EmailID;
                            licvmn.Key         = _ExistReg.Key;
                            licvmn.MacAddress  = _ExistReg.MacAddress;
                            licvmn.MobileNo    = _ExistReg.MobileNo;
                            licvmn.Name        = _ExistReg.MobileNo;
                            licvmn.SystemCount = _ExistReg.LicenseCount;
                            licvmn.SystemName  = _ExistReg.SystemName;
                            AppUtility.SendRegistrationMail(licvmn);
                        }
                    }
                }
                else
                {
                    // Page Event Logger
                    AppUtility.PageEventLogger(PageLogID, "Activation Button", 1, "Invalid Activation Key", "Normal");
                    MessageBox.Show("Registration key is not valid. Please Try Again");
                }
            }
            catch (Exception ex)
            {
                // Page Event Logger
                AppUtility.PageEventLogger(PageLogID, "Activation Button", 1, ex.StackTrace, "Error");
                MessageBox.Show("Registration key is not valid. Please Try Again");
            }
        }
 private void Page_Unloaded(object sender, RoutedEventArgs e)
 {
     AppUtility.PageEventLogger(PageLogID, "Page_Unloaded", 1, "Form UnLoad", "Normal");
     AppUtility.UpdatePageLogger(PageLogID);
 }
 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;
     }
 }