private static void Main() { //Example code InitDB(); RecordFunctions.PrintRows(); RecordFunctions.exportTable(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "exporteddb"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new PHPApplication()); }
private void DoneButton_Click(object sender, EventArgs e) { try { RecordFunctions.EditRecord(id, itemComboBox.SelectedItem.ToString(), Math.Round(float.Parse(textBox2.Text), 2), textBox3.Text); } catch { MessageBox.Show("Data types are incorrect"); } this.Close(); }
static void Main() { //Example code InitDB(); RecordFunctions.InsertRecord("record name", 4.7, "2343-33-55"); RecordFunctions.PrintRows(); RecordFunctions.exportTable(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "exporteddb"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
private void btnRemove_Click(object sender, EventArgs e) { //Store index to of item to be removed if (OrdersListBox.SelectedIndex >= 0) { ListViewItem tmp = OrdersListBox.SelectedItem as ListViewItem; int removeIndex = Int32.Parse(tmp.Tag.ToString()); //Calls into sqlite api to delete record at index RecordFunctions.DeleteRecord(removeIndex); //Re-populate the list box PopulateOrders(); } }
private void AddCurOrder(object sender, EventArgs e) { if (curOrder.Count > 0) { int orderid = RecordFunctions.getOrderID() + 1; for (int i = 0; i < curOrder.Count; i++) { RecordFunctions.InsertRecord(orderid, curOrder[i].name, curOrder[i].value, DateTime.Now.ToString()); } curOrder = new List <Item>(); PopulateOrder(); } else { MessageBox.Show("No item selected"); } }
private void btnEdit_Click(object sender, EventArgs e) { if (OrdersListBox.SelectedIndex >= 0) { //Keep selected index for record update and to preserve the highlighted record int boxIndex = OrdersListBox.SelectedIndex; //Determin primary key for the item in the DB ListViewItem tmp = OrdersListBox.SelectedItem as ListViewItem; int editIndex = Int32.Parse(tmp.Tag.ToString()); string editDate = RecordFunctions.getRecordByID(editIndex).saleDate; //edit the record int the DB AddOrderPopup editorder = new AddOrderPopup(editIndex, editDate); editorder.Show(); //Re-populate the list box editorder.FormClosed += new FormClosedEventHandler(EditDone); } }
private void PopulateOrders() { //Populate the orderlist with sales records in the db BindingList <SaleRecord> orderList = new BindingList <SaleRecord>(RecordFunctions.GetRecords()); // Clear OrdersListBox ready for new data OrdersListBox.Items.Clear(); //iterate through orderList to format and add items to list box for (int i = 0; i < orderList.Count; i++) { ListViewItem tmp = new ListViewItem("Order number: " + orderList[i].orderID + " | " + "Name: " + orderList[i].itemName + " | " + "Price: " + orderList[i].itemValue + " | " + "Sale Date: " + orderList[i].saleDate); //item tagged with its pk in db so that we are not releying on order box index as this will always be wrong after a remove tmp.Tag = orderList[i].id; OrdersListBox.Items.Add(tmp); } }
private void button1_click(object sender, EventArgs e) { MessageBox.Show("Inserted record"); RecordFunctions.InsertRecord(name: "testItem", value: 4, "2001-02-12"); }