public ClsTaxData getSingleTaxData(int taxId) { ClsTaxData taxData = new ClsTaxData(); try { string querry = @"SELECT * FROM tbl_tax WHERE taxId = '" + taxId + "'; "; DataTable dt = new DataTable(); dt = CONN.getDataTable(querry); if (dt.Rows.Count > 0) { taxData._taxId = Convert.ToInt32(dt.Rows[0]["taxId"].ToString()); taxData._description = dt.Rows[0]["description"].ToString(); taxData._symbol = dt.Rows[0]["symbol"].ToString(); taxData._taxPercentage = Convert.ToDouble(dt.Rows[0]["taxPercentage"]); taxData._effectFrom = Convert.ToDateTime(dt.Rows[0]["effective_from"]); taxData._effectTo = Convert.ToDateTime(dt.Rows[0]["effective_to"]); } } catch (Exception ex) { throw ex; } return(taxData); }
public bool insertData_tax(ClsTaxData tax) { bool isOK = false; string querry = string.Empty; try { querry += @"INSERT INTO tbl_tax (taxId, description, taxPercentage, symbol, effective_from, effective_to) VALUES ("; querry += "'" + tax._taxId + "',"; querry += "'" + tax._description + "',"; querry += "'" + tax._taxPercentage + "',"; querry += "'" + tax._symbol + "',"; querry += "'" + tax._effectFrom + "',"; querry += "'" + tax._effectTo + "'"; querry += ");"; isOK = CONN.update(querry); } catch (Exception ex) { throw ex; } return(isOK); }
public bool updateData_tax(ClsTaxData tax) { bool isOK = false; string querry = string.Empty; try { querry += "UPDATE tbl_tax SET "; querry += "description = '" + tax._description + "', "; querry += "symbol = '" + tax._symbol + "', "; querry += "taxPercentage = '" + tax._taxPercentage + "', "; querry += "effective_from = '" + tax._effectFrom + "',"; querry += "effective_to ='" + tax._effectTo + "'"; querry += "WHERE taxId = '" + tax._taxId + "';"; isOK = CONN.update(querry); } catch (Exception ex) { throw ex; } return(isOK); }