private void btnSend_Click(object sender, EventArgs e) { if (btnSend.Text == "Send") { DBAccess SendBugs = new DBAccess(); if (SendBugs.SendBug(Application.ProductVersion, BugCategory, txtDescription.Text) == true) { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Information"; ShowMessage.Content = "Report successfully sent."; ShowMessage.ShowDialog(); btnSend.Text = "Close"; btnCancel.Enabled = false; } else { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Error"; ShowMessage.Content = "Error sending problem report.\n\nDetails:\n" + SendBugs.error; ShowMessage.ShowDialog(); } } else { this.Close(); } }
private void btnSignup_Click(object sender, EventArgs e) { if (btnSignup.Text == "Close") { this.Close(); } else { DBAccess Signup = new DBAccess(); if (Signup.SignUp(txtUserName.Text, txtPassword.Text) == true) { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Information"; ShowMessage.Content = txtUserName.Text + " has been Sucessfully registered."; ShowMessage.ShowDialog(); btnSignup.Text = "Close"; btnCancel.Enabled = false; } else { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Error"; ShowMessage.Content = Signup.error; ShowMessage.ShowDialog(); } } }
private void bg_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { if (LoggedIn == false) { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Error"; ShowMessage.Content = "Incorrect Username or Password."; ShowMessage.ShowDialog(); txtPassword.Text = ""; lblPassword.ForeColor = Color.Red; } else { Properties.Settings.Default.UserName = txtUserName.Text; this.Close(); } }
private void btnAdd_Click(object sender, EventArgs e) { if (txtOtherName.Text == "") { lblOtherName.ForeColor = Color.Red; } else { lblOtherLink.ForeColor = Color.Black; if (OtherCategory == "") { lblOtherCategory.ForeColor = Color.Red; } else { lblOtherName.ForeColor = Color.Black; if (txtOtherLink.Text.StartsWith("http://www.") != true) { lblOtherLink.ForeColor = Color.Red; } else { lblOtherCategory.ForeColor = Color.Black; DBAccess AddOthers = new DBAccess(); if (AddOthers.AddOther(txtOtherAuthor.Text, txtOtherName.Text, OtherCategory, txtOtherLink.Text, txtOtherComment.Text)) { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Information"; ShowMessage.Content = "The file has been successfully added."; ShowMessage.ShowDialog(); } else { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Error"; ShowMessage.Content = "Error adding file.\n\nDetails:\n" + AddOthers.error; ShowMessage.ShowDialog(); } } } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); bool onlyInstance = false; Mutex mutex = new Mutex(true, @"Local\" + "78296522-6302-4263-ac2c-a7efe36c8eaa", out onlyInstance); if (!onlyInstance) { MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Warning"; ShowMessage.Content = "StudyMate is already running."; ShowMessage.StartPosition = FormStartPosition.CenterScreen; ShowMessage.ShowDialog(); return; } else { Application.Run(new MainFrm()); GC.KeepAlive(mutex); } }
private void btnSave_Click(object sender, EventArgs e) { string OldPassword = ""; DBAccess GetOldPassword = new DBAccess(); OldPassword = GetOldPassword.Get("SELECT Password FROM UsersList WHERE UserName = '******'", "Password"); if (txtOldPassword.Text == OldPassword) { // Set New Password SqlConnection Connection = new SqlConnection(Properties.Settings.Default.StudyMateConnectionString); SqlCommand Command = new SqlCommand(); Command = new SqlCommand("UPDATE UsersList SET [Password] = '" + txtConfirmNewPassword.Text + "' WHERE (UserName = '******')", Connection); Connection.Open(); Command.ExecuteNonQuery(); Connection.Close(); MessageFrm ShowMessage = new MessageFrm(); ShowMessage.Title = "Information"; ShowMessage.Content = "Password Changed Successfully."; ShowMessage.ShowDialog(); btnCancel.Enabled = false; this.Close(); } else { lblOldPassword.ForeColor = Color.Red; txtOldPassword.Text = ""; } }