public bool Delete(string Id) { try { string query = "DELETE from Employee WHERE Id = '" + Id + "'"; string query1 = "DELETE from Login WHERE Id = '" + Id + "'"; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); dcc.CloseConnection(); dcc.ConnectWithDB(); int y = dcc.ExecuteSQL(query1); dcc.CloseConnection(); return(true); } catch (Exception ex) { return(false); } }
public bool Update(Admin a) { try { string query = "UPDATE Admin SET Name = '" + a.Name + "', DOB = " + a.DOB + ", Gender = '" + a.Gender + "',Email= '" + a.Email + "',ContactNo= '" + a.ContactNo + "' WHERE Id= '" + a.ID + "'"; string query1 = "UPDATE Login SET Username='******', Password='******', Type='Employee' WHERE Id= '" + a.ID + "' "; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); dcc.CloseConnection(); dcc.ConnectWithDB(); int y = dcc.ExecuteSQL(query1); dcc.CloseConnection(); return(true); } catch (Exception ex) { return(false); } }
public bool Insert(Employee a) { try { string query = "INSERT into Employee VALUES ('" + a.ID + "', '" + a.Name + "', '" + a.DOB + "','" + a.Gender + "','" + a.Email + "','" + a.ContactNo + "','" + a.Salary + "','" + a.Type + "','" + a.Address + "' )"; string query1 = "INSERT into Login VALUES ('" + a.ID + "', '" + a.Username + "', '" + a.Password + "', 'Employee')"; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); dcc.CloseConnection(); dcc.ConnectWithDB(); int y = dcc.ExecuteSQL(query1); dcc.CloseConnection(); return(true); } catch (Exception ex) { return(false); } }