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 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_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; } }