public bool EnterQuestion(string userID, string question) { //string newType = "CU"; DBQueries db = new DBQueries(); List <object> bookstore = new List <object>( new object[] { userID, question } ); return(db.INSERT_INTO_TABLE("UserData", bookstore)); }
public int PlaceOrderFinal(int userID) { DBQueries dbQ = new DBQueries(); bool res = false; var conn = new SqlConnection(Properties.Settings.Default.dbConnectionString); int orderId = 0; try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "INSERT INTO Orders (UserID, Status) VALUES " + " (@UserID, @Status)"; cmd.Parameters.AddWithValue("@UserID", userID); cmd.Parameters.AddWithValue("@Status", "P"); conn.Open(); cmd.ExecuteScalar(); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } DBGetID dbG = new DBGetID(); orderId = (dbG.GetID("Orders", conn)) - 1; foreach (var item in orderItemList) { List <object> bookstore1 = new List <object>( new object[] { orderId, item.BookID, item.Quantity } ); dbQ.INSERT_INTO_TABLE("OrderItem", bookstore1); } return(orderId); }
public bool Register(string username, string password1, string password2, string fullName) { if (!UserRegister.VerifyRegistration(username, password1, password2, fullName)) { ErrorMessage = "Please fill in all fields."; return(false); } if (DALUserInfo.HasInvalidPassword(password1)) { ErrorMessage = "Password requires at least six alphanumeric characters."; return(false); } string newType = "CU"; DBQueries db = new DBQueries(); List <object> bookstore = new List <object>( new object[] { username, password1, newType, 0, fullName } ); return(db.INSERT_INTO_TABLE("UserData", bookstore)); }