public bool InsertProduct(ManageItems mi) { string query = "INSERT INTO ManageItems VALUES ('" + mi.ItemId + "','" + mi.ItemName + "','" + mi.ItemPrice + "')"; try { dcc.ConnectWithDB(); int n = dcc.ExecuteSQL(query); dcc.CloseConnection(); return(true); } catch (Exception exp) { return(false); } }
public List <Snacks> GetAllData() { List <Snacks> listOfSnacks = new List <Snacks>(); string query = "SELECT * from Snacks"; dcc.ConnectWithDB(); SqlDataReader sdr = dcc.GetData(query); while (sdr.Read()) { Snacks sk = new Snacks(); sk.Sid = sdr["Sid"].ToString(); sk.Sname = sdr["Sname"].ToString(); sk.Ssell = Convert.ToInt32(sdr["Ssell"].ToString()); // emp.PhnNumber = sdr["PhnNumber"].ToStrings(); // emp.Dsell = sdr["Dsell"].ToString(); // emp.Designation = sdr["Designation"].ToString(); listOfSnacks.Add(sk); } dcc.CloseConnection(); return(listOfSnacks); }
public List <Drinks> GetAllData() { List <Drinks> listOfDrink = new List <Drinks>(); string query = "SELECT * from Drinks"; dcc.ConnectWithDB(); SqlDataReader sdr = dcc.GetData(query); while (sdr.Read()) { Drinks di = new Drinks(); di.Did = sdr["Did"].ToString(); di.Dname = sdr["Dname"].ToString(); di.Dsell = Convert.ToInt32(sdr["Dsell"].ToString()); // emp.PhnNumber = sdr["PhnNumber"].ToStrings(); // emp.Dsell = sdr["Dsell"].ToString(); // emp.Designation = sdr["Designation"].ToString(); listOfDrink.Add(di); } dcc.CloseConnection(); return(listOfDrink); }
public bool InsertEmployee(Employees emp) { string query = "INSERT into Employees VALUES ('" + emp.EmpId + "', '" + emp.Name + "', '" + emp.PhnNumber + "', " + emp.Salary + ", '" + emp.Designation + "')"; try { dcc.ConnectWithDB(); int n = dcc.ExecuteSQL(query); dcc.CloseConnection(); return(true); } catch (Exception exp) { return(false); } }
public bool InsertUser(Login l) { string query = "INSERT into Login Values ('" + l.Id + "', '" + l.Password + "', " + l.Role + ")"; try { dcc.ConnectWithDB(); int n = dcc.ExecuteSQL(query); return(true); } catch (Exception exp) { return(false); } finally { dcc.CloseConnection(); } }