private void SignIn_useEmailToLogin() { if (txtEmail.Text == "") { MessageBox.Show("Email field can not be empty."); return; } if (!FormatChecking.Password(txtPassword.Text)) { return; } if (!DataBaseControl.MatchingEmail_OfAllTable(txtEmail.Text)) { MessageBox.Show("Email does not exist"); return; } user = LoginByEmailAndPassword(txtEmail.Text, txtPassword.Text); if (user == User.Quit) { MessageBox.Show("Email or Password is wrong."); return; } userEmail = txtEmail.Text; Close(); }
public static void Insert(string topUpData) { string insertSql = "INSERT INTO TopUpHistory " + " VALUES( '" + PlayerDataBaseControl.playerID + "', '" + PointCardDataBaseControl.pointCardID + "', '" + topUpData + "' );"; DataBaseControl.ExecuteSql(insertSql); }
private void SignUp() { if (txtUserAccountName.Text == "") { MessageBox.Show("User Account Name should not be empty."); return; } if (txtPassword.Text == "") { MessageBox.Show("User Account Name should not be empty."); return; } bool anyError = false; if (!FormatChecking.UserName(txtUserAccountName.Text)) { anyError = true; } if (!FormatChecking.Password(txtPassword.Text)) { anyError = true; } if (anyError) { CleanUpTextBox(); return; } if (DataBaseControl.MatchingAccountName_OfAllTable(txtUserAccountName.Text)) { MessageBox.Show("Sorry, the User Account Name has been used."); return; } if (txtEmail.Text != "" && PlayerDataBaseControl.MatchingEmail(txtEmail.Text)) { MessageBox.Show("Sorry, the Email has been used."); return; } PlayerDataBaseControl.Insert(txtUserAccountName.Text, txtPassword.Text, txtEmail.Text); userAccountName = txtUserAccountName.Text; userEmail = txtEmail.Text; PlayerDataBaseControl.playerAccountName = userAccountName; PlayerDataBaseControl.Load_PlayerID_By_PlayerAccountName(); user = User.Player; Close(); }
public static void Insert() { string insertSql = "INSERT INTO ProblemReport " + " VALUES( '" + "R" + (SystemDataBaseControl.Get_ProblemReportNum() + 1).ToString().PadLeft(7, '0') + "', '" + PlayerDataBaseControl.playerID + "', '" + title + "', '" + detail + "' );"; DataBaseControl.ExecuteSql(insertSql); }
public static void Updata_isEnglish(bool updataValue) { isEnglish = updataValue; string updateSql = "UPDATE Staff SET isEnglish = " + updataValue + " WHERE StaffID = \'" + staffID + "\' ;"; DataBaseControl.ExecuteSql(updateSql); }
public static void Insert(string playerAccountName, string playerPassword, string playerEmail) { string insertSql = "INSERT INTO Player(PlayerID, PlayerAccountName, PlayerPassword, PlayerEmail)" + " VALUES( \"P" + (SystemDataBaseControl.Get_PlayerNum() + 1).ToString().PadLeft(7, '0') + "\", \"" + playerAccountName + "\", \"" + playerPassword + "\", \"" + playerEmail + "\");"; DataBaseControl.ExecuteSql(insertSql); SystemDataBaseControl.Updata_PlayerNum_PlusOne(); }
public static void Load() { DataBaseControl.Load(dataTable, "SELECT * FROM TopUpHistory " + " WHERE StrComp( PlayerID, '" + PlayerDataBaseControl.playerID + "', 0) = 0 ; "); PointCardIDs = new string[dataTable.Rows.Count]; TopUpDates = new string[dataTable.Rows.Count]; for (int i = 0; i < dataTable.Rows.Count; i++) { PointCardIDs[i] = dataTable.Rows[i]["PointCardID"].ToString(); TopUpDates[i] = dataTable.Rows[i]["TopUpDate"].ToString(); } }
public static bool MatchingOneColumn_OfTable(string tableName, string column, string value) { // Check Exist in Table // DataBaseControl.Load(dataTable, "SELECT * FROM " + tableName + " WHERE StrComp(" + column + ", '" + value + "', 0) = 0 ; "); if (dataTable.Rows.Count != 0) { return(true); } return(false); }
public static void Load() { DataBaseControl.Load(dataTable, "SELECT * FROM ProblemReport "); problemReportIDs = new string[dataTable.Rows.Count]; titles = new string[dataTable.Rows.Count]; details = new string[dataTable.Rows.Count]; for (int i = 0; i < dataTable.Rows.Count; i++) { problemReportIDs[i] = dataTable.Rows[i]["ProblemReportID"].ToString(); titles[i] = dataTable.Rows[i]["Title"].ToString(); details[i] = dataTable.Rows[i]["Detail"].ToString(); } }
public static void Insert() { string insertSql = "INSERT INTO PointCard " + " VALUES( '" + pointCardID + "', '" + activePwd + "', " + retailValue + ", " + goldCoins + ", " + remainLuckyDrawTimes + ", '" + status + "', '" + generationDate + "');"; DataBaseControl.ExecuteSql(insertSql); }
private User LoginByAccountNameAndPassword(string accountName, string password) { if (PlayerDataBaseControl.MatchingAccountPassword(accountName, password)) { return(User.Player); } if (DataBaseControl.MatchingAccountPassword_InStaffTable(accountName, password)) { return(User.Staff); } if (DataBaseControl.MatchingAccountPassword_InCSMTable(accountName, password)) { return(User.CustomerServiceManager); } return(User.Quit); }
private User LoginByEmailAndPassword(string email, string password) { if (PlayerDataBaseControl.MatchingEmailPassword(email, password)) { return(User.Player); } if (DataBaseControl.MatchingEmailPassword_InStaffTable(email, password)) { return(User.Staff); } if (DataBaseControl.MatchingEmailPassword_InCSMTable(email, password)) { return(User.CustomerServiceManager); } return(User.Quit); }
private void SignIn_useUserNameToLogin() { bool anyError = false; if (!FormatChecking.UserName(txtUserAccountName.Text)) { anyError = true; } if (!FormatChecking.Password(txtPassword.Text)) { anyError = true; } if (anyError) { return; } if (!DataBaseControl.MatchingAccountName_OfAllTable(txtUserAccountName.Text)) { MessageBox.Show("User Account Name does not exist."); return; } user = LoginByAccountNameAndPassword(txtUserAccountName.Text, txtPassword.Text); if (user == User.Quit) { MessageBox.Show("User Account Name or Password is wrong."); return; } userAccountName = txtUserAccountName.Text; userEmail = txtEmail.Text; Close(); }
public static bool MatchingTwoColumn(string columnOne, string columnOneValue, string columnTwo, string columnTwoValue) { return(DataBaseControl.MatchingTwoColumn_OfTable("Staff", columnOne, columnOneValue, columnTwo, columnTwoValue)); }
public static bool MatchingOneColumn(string columnName, string target) { return(DataBaseControl.MatchingOneColumn_OfTable("Staff", columnName, target)); }
public static string GetData_ByColumn(string column, string value, string targetColumn) { return(DataBaseControl.GetData("Staff", column, value, targetColumn)); }
public static void Updata(string updataColumn, string updataValue) { DataBaseControl.Updata("CSM", "CSMID", CSMID, updataColumn, updataValue); }
public static void Updata(string updataColumn, string updataValue) { DataBaseControl.Updata("Staff", "StaffID", staffID, updataColumn, updataValue); }
public static void Updata_PointCardNum_PlusOne() { string updateSql = "UPDATE System SET PointCardNum = PointCardNum + 1;"; DataBaseControl.ExecuteSql(updateSql); }
public static int Get_ProblemReportNum() { DataBaseControl.Load("SELECT * FROM System;"); return(int.Parse(DataBaseControl.dataTable.Rows[0]["ProblemReportNum"].ToString())); }
public static void Updata(string updataColumn, string updataValue) { DataBaseControl.Updata("Player", "PlayerID", playerID, updataColumn, updataValue); }
public static void Updata_ProblemReportNum(int value) { string updateSql = "UPDATE System SET ProblemReportNum = " + value + ";"; DataBaseControl.ExecuteSql(updateSql); }
public static void Updata(string updataColumn, string updataValue) { DataBaseControl.Updata("PointCard", "PointCardID", pointCardID, updataColumn, updataValue); }
public static void Updata_ProblemReportNum_PlusOne() { string updateSql = "UPDATE System SET ProblemReportNum = ProblemReportNum + 1;"; DataBaseControl.ExecuteSql(updateSql); }