private void button1_Click(object sender, EventArgs e) { try { connection.Open(); SqlDataAdapter adp1 = new SqlDataAdapter("select Pin From login_info where Username = '******' ", connection); DataTable dt1 = new DataTable(); adp1.Fill(dt1); if (dt1.Rows.Count >= 1) { MessageBox.Show("this username already existed"); } else { SqlCommand cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into login_info values( '" + Username.Text + "','" + Pin.Text + "')"; cmd.ExecuteNonQuery(); connection.Close(); if (label5.ForeColor == System.Drawing.Color.Red || label6.ForeColor == System.Drawing.Color.Red) { MessageBox.Show("Please change your password"); Pin.Clear(); Pin.Focus(); } else { MessageBox.Show("successful registration!!!"); Username.Clear(); Pin.Clear(); Username.Focus(); } } } catch (Exception) { MessageBox.Show("registration failed!"); } finally { } }
private void JiraLogin_Load(object sender, EventArgs e) { pinEntry = new Pin(this); if (open != null && !open.IsDisposed) { open.Show(); open.Focus(); return; } else { open = this; } if (StaticHandler._Main == null && StaticHandler._ThemedMain == null) { this.Location = new Point(this.Location.X - this.Width, this.Location.Y); } else { if (StaticHandler._Main != null) { this.Location = new Point(StaticHandler._Main.Location.X - this.Width, StaticHandler._Main.Location.Y); } if (StaticHandler._ThemedMain != null) { this.Location = new Point(StaticHandler._ThemedMain.Location.X - this.Width, StaticHandler._ThemedMain.Location.Y); } } this.TopMost = true; if (Setting.Value.Jira_SavePassword && Setting.Value.Jira_EncryptedPassword != null && Setting.Value.Jira_EncryptedPassword != "" && this.Visible) { if (pinEntry == null || pinEntry.IsDisposed) { pinEntry = new Pin(this); } pinEntry.Show(); pinEntry.Focus(); } else { this.Focus(); } /*if (username != "") * Username.Text = username;*/ open.Show(); FillUsername(); if (Setting.Value.Jira_SavePassword && Setting.Value.Jira_EncryptedPassword != null && Setting.Value.Jira_EncryptedPassword != "" && this.Visible) { if (pinEntry == null || pinEntry.IsDisposed) { pinEntry = new Pin(this); } pinEntry.Show(); pinEntry.Focus(); } open.Show(); }