public static RegistryHandler GetLienceKey() { RegistryHandler registry = new RegistryHandler(); RegistryKey regkey = Registry.LocalMachine.CreateSubKey(liencePath); registry.LisenceKey =(string)regkey.GetValue("LienceKey"); return registry; }
public static RegistryHandler ReadRegistry() { RegistryHandler registry = new RegistryHandler(); RegistryKey regKeyAppRoot = Registry.CurrentUser.CreateSubKey(path); registry.Status = (string)regKeyAppRoot.GetValue("Status"); registry.UserName = (string)regKeyAppRoot.GetValue("UserName"); registry.Password = (string)regKeyAppRoot.GetValue("Password"); return registry; }
private void btnLgin_Click(object sender, EventArgs e) { try { this.CustomResult = System.Windows.Forms.DialogResult.No; if (!IsValidRegistration || Common.CalculateH(txtUserName.Text) == SuperAdmin) { if (string.IsNullOrEmpty(txtUserName.Text)) { lblError.Text = "Please enter the User Name..."; txtUserName.Focus(); lblError.Visible = true; } else if (string.IsNullOrEmpty(txtPassword.Text)) { lblError.Text = "Please enter the Password..."; txtPassword.Focus(); lblError.Visible = true; } else if (Common.CalculateH(txtUserName.Text) == SuperAdmin && Common.CalculateH(txtPassword.Text) == SuperAdminPassword) { //if (IsValidRegistration) CustomResult = DialogResult.Ignore; this.Close(); } else { MessageBox.Show("Not Valid."); //this.CustomResult = System.Windows.Forms.DialogResult.No; } } else { bool result = false; string GetLienceKey = string.Empty; string GetLienceReg = string.Empty; //int comparedRegisterValue = 0; //GetLienceReg = Convert.ToString(RegistryHandler.GetLienceKey()); ////GetLienceKey = Common.CreateUniqueKey(); //comparedRegisterValue = string.Compare(GetLienceKey, GetLienceReg); //if (comparedRegisterValue>0) //{ lblError.Visible = false; if (string.IsNullOrEmpty(txtUserName.Text)) { lblError.Text = "Please enter the User Name..."; txtUserName.Focus(); lblError.Visible = true; } else if (string.IsNullOrEmpty(txtPassword.Text)) { lblError.Text = "Please enter the Password..."; txtPassword.Focus(); lblError.Visible = true; } else { DataTable dt = null; dt = SystemUser.Login(txtUserName.Text.Trim(), txtPassword.Text.Trim()); result = SetUserSetting(dt); if (result) { UserLog.Log(Common.CURRENT_USER.Id, UserActions.Logged_In_Suceessfully, "UserName:"******"UserName:"******"Login", ex, "Login Exception"); } }