示例#1
0
 public bool DeleteFuelType(int fuelTypeID)
 {
     string sql = " Delete  FuelTypes where FuelTypeID =" + fuelTypeID;
     db = new DBAccess();
     int rows_affected = db.ExecuteNonQuery(sql);
     if (rows_affected == 1) return true;
     else return false;
 }
示例#2
0
 public bool UpdateFuelType(FuelTypeDTO fuleTypeDTO)
 {
     string sql = "update FuelTypes set FuelTypeName='" + fuleTypeDTO.FuleTypeName
         + @"' where FuelTypeID =" + fuleTypeDTO.FuelTypeID;
     db = new DBAccess();
     int rows_affected = db.ExecuteNonQuery(sql);
     if (rows_affected == 1) return true;
     else return false;
 }
示例#3
0
 public bool NewFuelType(FuelTypeDTO fuleTypeDTO)
 {
     string sql = "Insert into FuleTypes (FuelTypeName) values ("+
         "'"+fuleTypeDTO.FuleTypeName+@"')";
     db = new DBAccess();
     int rows_affected = db.ExecuteNonQuery(sql);
     if (rows_affected == 1) return true;
     else return false;
 }
示例#4
0
 public DataTable GetFuelTypes()
 {
     db = new DBAccess();
     DataTable dt = new DataTable();
     string sql = "Select * from FuelTypes ";
     dt = db.ExecuteDataTable(sql);
     if (dt.Rows.Count <= 0)
     {
         return null;
     }
     else
     {
         return dt;
     }
 }
示例#5
0
 public bool VerifyUser(LoginDTO loginDTO)
 {
     db = new DBAccess();
     string sql = @"Select * from Users where
     username='******' and password = '******'";
     DataTable dtUsers = new DataTable();
     dtUsers = db.ExecuteDataTable(sql);
     if (dtUsers.Rows.Count == 1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
示例#6
0
 public FuelTypeDTO GetFuelType(int fuelTypeID)
 {
     db = new DBAccess();
     DataTable dt = new DataTable();
     string sql = "Select * from FuelTypes where FuelTypeID=" + fuelTypeID;
     dt = db.ExecuteDataTable(sql);
     if (dt.Rows.Count <= 0)
     {
         return null;
     }
     else
     {
         FuelTypeDTO fuelTypeDTO = new FuelTypeDTO();
         fuelTypeDTO.FuelTypeID = int.Parse(dt.Rows[0]["FuelTypeID"].ToString());
         fuelTypeDTO.FuleTypeName = dt.Rows[0]["FuelTypeName"].ToString();
         return fuelTypeDTO;
     }
 }