private void Login_Load(object sender, EventArgs e) { Lab_InvalidLogin.Hide(); Lab_InvaldActivation.Hide(); DataTable dtb = this.cntrl.GetActivation(); Load_Login(dtb); }
public void Load_Login(DataTable choice) { try { RegistryKey regKey = Registry.CurrentUser.CreateSubKey("pappyjoe"); string SystemName = (string)regKey.GetValue("Server"); if (choice.Rows.Count > 0) { //============= Start 365 Days Activation Validity hexcodes1 = choice.Rows[0]["hexacode"].ToString(); if (hexcodes1 != "") { intAgain = int.Parse(hexcodes1, System.Globalization.NumberStyles.HexNumber); } regdate1 = choice.Rows[0]["registrationdate"].ToString(); if (regdate1 == "") { this.cntrl.update_activation(); } else { System.DateTime firstDate = Convert.ToDateTime(regdate1); System.DateTime secondDate = DateTime.Now.Date; String diff2 = (secondDate - firstDate).TotalDays.ToString(); int number = Int32.Parse(diff2); if (number > intAgain || number == intAgain) { DialogResult dialog = MessageBox.Show("Your system date is correct...?", "System Date", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dialog == DialogResult.Yes) { this.cntrl.update_activation(); MessageBox.Show("PAPPYJOE RENEW ACTIVATION.\n\n Your Pappyjoe Subscription has expired. Kindly contact 0484-2597272 for renewal of subscription.", "PAPPYJOE RENEW ACTIVATION", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Application.Exit(); } } } //=========== End 365 Days Activation Validity if (SystemName == Environment.MachineName) { if (choice.Rows[0]["getcode"].ToString() == GetMacAddress()) { Lab_InvalidLogin.Hide(); Lab_InvaldActivation.Hide(); DataTable sd = this.cntrl.Activation_Details(); if (sd.Rows.Count > 0) { string listgetcode = GetMacAddress(); string listactcode = MD5Hash(GetMacAddress()); string actcode = sd.Rows[0]["actcode"].ToString(); if (actcode == listactcode) { RegistryKey regKeyAppRoot = Registry.CurrentUser.CreateSubKey("pappyjoe"); string strWindowsState = (string)regKeyAppRoot.GetValue("username"); if (strWindowsState != null) { txt_userName.Text = strWindowsState.ToString(); } panel1.Hide(); panel2.Show(); } else { txt_getCode.Text = GetMacAddress(); panel1.Show(); panel1.Location = new System.Drawing.Point(18, 37); panel2.Hide(); } } } else { txt_getCode.Text = GetMacAddress(); panel1.Show(); panel1.Location = new System.Drawing.Point(18, 37); panel2.Hide(); } } else { //****************************client********************************** DataTable client = this.cntrl.Activation_Details(); if (client.Rows.Count > 0) { string listgetcode = client.Rows[0]["getcode"].ToString(); string listactcode = MD5Hash(listgetcode); string actcode = client.Rows[0]["actcode"].ToString(); if (actcode == listactcode) { RegistryKey regKeyAppRoot = Registry.CurrentUser.CreateSubKey("pappyjoe"); string strWindowsState = (string)regKeyAppRoot.GetValue("username"); if (strWindowsState != null) { txt_userName.Text = strWindowsState.ToString(); } panel1.Hide(); panel2.Show(); } else { txt_getCode.Text = GetMacAddress(); panel1.Show(); panel1.Location = new System.Drawing.Point(18, 37); panel2.Hide(); } } } } else { this.cntrl.Save_activation_Null(); Application.Exit(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txt_password_KeyDown(object sender, KeyEventArgs e) { Lab_InvalidLogin.Hide(); }
private void txt_userName_KeyDown(object sender, KeyEventArgs e) { Lab_InvalidLogin.Hide(); }