//CRUD-LOGIN private async Task LoginDataAsync() { await Task.Delay(0); dbconn.conn.Open(); var query = $"SELECT * FROM Employee WHERE id = '{model.id}' AND password = '******'"; var cmd = new SqlCommand(query, dbconn.conn); var dr = cmd.ExecuteReader(); if (dr.HasRows) { MainFormView main = new MainFormView(); LoginAccess login = new LoginAccess(); login.Hide(); main.Show(); while (dr.Read()) { App.Uid = dr[0].ToString(); App.UserName = dr[1].ToString(); } } else { MessageBox.Show("DATA USER NOT FOUND", "WARNING"); } }
private async Task ReadDataAsync() { await Task.Delay(0); dbconn.conn.Open(); var query = $"SELECT * FROM Member"; var cmd = new SqlCommand(query, dbconn.conn); var dr = cmd.ExecuteReader(); if (dr.HasRows) { MainFormView main = new MainFormView(); LoginAccess login = new LoginAccess(); login.Hide(); main.Show(); while (dr.Read()) { while (dr.Read()) { collection.Add(new Member { id = dr[0].ToString(), membership_id = dr[1].ToString(), name = dr[2].ToString(), email = dr[3].ToString(), phone_number = dr[4].ToString(), address = dr[5].ToString(), date_of_birth = dr[6].ToString(), gender = dr[7].ToString(), created_at = dr[8].ToString(), last_updated_at = dr[9].ToString(), deleted_at = dr[10].ToString(), }); } } } else { MessageBox.Show("DATA USER NOT FOUND", "WARNING"); } dbconn.conn.Close(); }