public void deleteRecord(QuoteItem quoteRecord) { using (SQLiteConnection conn = new SQLiteConnection(connectionString)) { if (conn == null) { throw new Exception("Connection String is Null."); } SQLiteCommand query = new SQLiteCommand("deleteRecord", conn); conn.Open(); query.CommandType = CommandType.StoredProcedure; SQLiteParameter param1 = new SQLiteParameter("jobno", SqlDbType.VarChar); param1.Value = quoteRecord.jobno; query.Parameters.Add(param1); query.ExecuteNonQuery(); } }
public List <QuoteItem> GetQuoteItemRepo() { List <QuoteItem> item_list = new List <QuoteItem>(); using (SQLiteConnection conn = new SQLiteConnection(connectionString)) { if (conn == null) { throw new Exception("Connection String is Null. Set the value of Connection String in ->Properties-?Settings.settings"); } SQLiteCommand query = new SQLiteCommand("SELECT * FROM QTE_ITEMS", conn); conn.Open(); SQLiteDataAdapter sqlDataAdapter = new SQLiteDataAdapter(query); DataTable dt = new DataTable(); sqlDataAdapter.Fill(dt); foreach (DataRow row in dt.Rows) { QuoteItem q = new QuoteItem(); q.qty = Convert.ToInt32(row["qty"]); q.item = row["item"].ToString(); q.rate = (double)row["rate"]; q.descr = row["descr"].ToString(); q.grouping = Convert.ToInt32(row["grouping"]); q.taxable = Convert.ToBoolean(row["taxable"]); q.discountable = Convert.ToBoolean(row["discountable"]); q.printable = Convert.ToBoolean(row["printable"]); q.jobno = row["jobno"].ToString(); q.line_total = (double)row["line_total"]; q.tax_total = (double)row["tax_total"]; q.tab_index = Convert.ToInt32(row["tab_index"]); q.row_index = Convert.ToInt32(row["row_index"]); item_list.Add(q); } return(item_list); } }
public void AddNewQuoteItem(QuoteItem quoteRecord) { using (SQLiteConnection conn = new SQLiteConnection(connectionString)) { if (conn == null) { throw new Exception("Connection String is Null. Set the value of Connection String in MovieCatalog->Properties-?Settings.settings"); } else if (quoteRecord == null) { throw new Exception("The passed argument 'movieRecord' is null"); } SQLiteCommand query = new SQLiteCommand("addRecord", conn); conn.Open(); query.CommandType = CommandType.StoredProcedure; SQLiteParameter param1 = new SQLiteParameter("qty", SqlDbType.Int); SQLiteParameter param2 = new SQLiteParameter("item", SqlDbType.VarChar); SQLiteParameter param3 = new SQLiteParameter("rate", SqlDbType.Real); SQLiteParameter param4 = new SQLiteParameter("descr", SqlDbType.VarChar); SQLiteParameter param5 = new SQLiteParameter("grouping", SqlDbType.Int); SQLiteParameter param6 = new SQLiteParameter("taxable", SqlDbType.Bit); SQLiteParameter param7 = new SQLiteParameter("discountable", SqlDbType.Bit); SQLiteParameter param8 = new SQLiteParameter("printable", SqlDbType.Bit); SQLiteParameter param9 = new SQLiteParameter("jobno", SqlDbType.VarChar); SQLiteParameter param10 = new SQLiteParameter("line_total", SqlDbType.Real); SQLiteParameter param11 = new SQLiteParameter("tax_total", SqlDbType.Real); SQLiteParameter param12 = new SQLiteParameter("tab_index", SqlDbType.Int); SQLiteParameter param13 = new SQLiteParameter("row_index", SqlDbType.Int); param1.Value = quoteRecord.qty; param2.Value = quoteRecord.item; param3.Value = quoteRecord.rate; param4.Value = quoteRecord.descr; param5.Value = quoteRecord.grouping; param6.Value = quoteRecord.taxable; param7.Value = quoteRecord.discountable; param8.Value = quoteRecord.printable; param9.Value = quoteRecord.jobno; param10.Value = quoteRecord.line_total; param11.Value = quoteRecord.tax_total; param12.Value = quoteRecord.tab_index; param13.Value = quoteRecord.row_index; query.Parameters.Add(param1); query.Parameters.Add(param2); query.Parameters.Add(param3); query.Parameters.Add(param4); query.Parameters.Add(param5); query.Parameters.Add(param6); query.Parameters.Add(param7); query.Parameters.Add(param8); query.Parameters.Add(param9); query.Parameters.Add(param10); query.Parameters.Add(param11); query.Parameters.Add(param12); query.Parameters.Add(param13); query.ExecuteNonQuery(); } }
public void updateRecord(QuoteItem quoteRecord) { }