private void btnLoginEnter_Click(object sender, EventArgs e) { string sqlString = @"SELECT pass FROM t_members WHERE username LIKE '" + comboUsers.Text + @"' ;"; if (txtPasswordEntered.Text == db.GetSingleLastValue(sqlString, "pass")) { sqlString = @"SELECT name FROM t_members WHERE username LIKE '" + comboUsers.Text + @"' ;"; string name = db.GetSingleLastValue(sqlString, "name"); sqlString = @"SELECT surname FROM t_members WHERE username LIKE '" + comboUsers.Text + @"' ;"; string surname = db.GetSingleLastValue(sqlString, "surname"); MessageBox.Show("logged in: " + name + " " + surname); sqlString = @"SELECT passlevel FROM t_members WHERE username LIKE '" + comboUsers.Text + @"' ;"; glob.passLevel = Convert.ToInt32(db.GetSingleLastValue(sqlString, "passlevel")); //Transfer user and passsword level to static class members). glob.loggedUser = comboUsers.Text; sqlString = @"SELECT role FROM t_members WHERE username LIKE '" + comboUsers.Text + @"' ;"; glob.role = db.GetSingleLastValue(sqlString, "role"); this.Hide(); FormStart frm = new FormStart(); frm.ShowDialog(); this.Close(); } else { MessageBox.Show("Wrong user name or password"); } }
public bool FindInColumn(string valToCheck, string column, string table) //Check if valToCheck is already in table { string foundValue = null; string sqlString = null; bool FoundDuplicates = false; sqlString = string.Format(@"SELECT {0} FROM {1} WHERE {0} like '{2}';", column, table, valToCheck); foundValue = db.GetSingleLastValue(sqlString, column); if (!String.IsNullOrEmpty(foundValue)) { FoundDuplicates = true; } return(FoundDuplicates); }
private void btnLogin_Click(object sender, EventArgs e) { string sqlString = string.Format(@"SELECT filename FROM t_workingdoc WHERE workinguser LIKE '{0}';", glob.loggedUser); //check if there is notcommited file string FileNotCommited = (db.GetSingleLastValue(sqlString, "filename")); if (String.IsNullOrEmpty(FileNotCommited)) { string TempFolderPath = db.GetRepozPath() + @"\\" + db.GetRepozName() + @"\\Temp"; //Delete repository temp folder sy.ClearFolder(TempFolderPath); this.Hide(); FormLogin FrmLogin = new FormLogin(); FrmLogin.ShowDialog(); //this.Close(); } else { MessageBox.Show("There are documents to be commited before exit"); } }