private void btnSave_Click(object sender, RoutedEventArgs e) { FundTypes ft = this.DataContext as FundTypes; SQLiteDatabase db = new SQLiteDatabase(); if (isEdit) { ft.Id = ftl.Id; Dictionary <string, string> dic1 = Utility.GetTypePropertyValues <FundTypes>(ft); string s = db.Update("FundType", dic1, " ID =" + Convert.ToString(ft.Id) + ""); db.ExecuteNonQuery(s); } else { Dictionary <string, string> dic1 = Utility.GetTypePropertyValues <FundTypes>(ft); dic1.Remove("Id"); string s = db.Insert("FundType", dic1); db.ExecuteNonQuery(s); } if (this.SaveButtonClick != null) { this.SaveButtonClick(this, e); } }
private void GrdExpDeleteButton_Click(object sender, RoutedEventArgs e) { for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual) { if (vis is DataGridRow) { var row = (DataGridRow)vis; SelectedExpenseItem = row.Item as Expense; MessageBoxResult dialogResult = MessageBox.Show("Are you sure you want to delete the Expense +", "Delete Expense", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { if (SelectedExpenseItem != null) { string sql = "DELETE FROM EXPENSES where ID ='" + SelectedExpenseItem.ID + "'"; db = new SQLiteDatabase(); db.ExecuteNonQuery(sql); MessageBox.Show("Expense deleted"); SelectedExpenseItem = null; LoadExpenses(); FillExpenseForm(new Expense()); } } break; } } }
private void UpdateSeqWithNextNumber(string Nextnumber, string Seq) { db = new SQLiteDatabase(); string qry = "UPDATE Sequence Set NextNumber=" + (Convert.ToInt32(Nextnumber) + 1) + ", Sequence='" + Seq + "' WHERE TabName='Donations'"; db.ExecuteNonQuery(qry); }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { // try { SQLiteConnection.CreateFile("Donations.db"); } catch (Exception ex) { } SQLiteDatabase db = new SQLiteDatabase(); db.ExecuteNonQuery(txtQuery.Text); txtOutcome.Text = "Executed Successfully"; } catch (Exception ex) { txtOutcome.Text = ex.Message; } }
private void BtnExpSave_Click(object sender, RoutedEventArgs e) { Expense exp = this.DataContext as Expense; exp.ExpenseNo = txtExpNo.Text; SQLiteDatabase db = new SQLiteDatabase(); Expense eobj = exp; eobj.FundType = Convert.ToString(cbExpFundType.SelectedValue); eobj.TxnType = Convert.ToString(cbTxnType.SelectedValue); eobj.ExpDate = Convert.ToDateTime(eobj.ExpDate).ToSqlLiteDatetime(); if (IsExpEdit) { eobj.Modified = DateTime.Now.ToSqlLiteDatetime(); eobj.ModifiedBy = LoginUser.UName; eobj.Created = Convert.ToDateTime(exp.Created).ToSqlLiteDatetime(); eobj.CreatedBy = exp.CreatedBy; Dictionary <string, string> dic1 = Utility.GetTypePropertyValues <Expense>(eobj); string s = db.Update("Expenses", dic1, " ID =" + Convert.ToString(exp.ID) + ""); db.ExecuteNonQuery(s); } else { eobj.Created = DateTime.Now.ToSqlLiteDatetime(); eobj.CreatedBy = LoginUser.UName; Dictionary <string, string> dic1 = Utility.GetTypePropertyValues <Expense>(eobj); string s = db.Insert("Expenses", dic1); db.ExecuteNonQuery(s); } if (this.SaveButtonClick != null) { this.SaveButtonClick(this, e); } }
private void btnDeleteDonation_Click(object sender, RoutedEventArgs e) { MessageBoxResult dialogResult = MessageBox.Show("Are you sure you want to delete the Donation +", "Delete Donation", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { SelectedItem = grdDonations.SelectedItem as Donation; if (SelectedItem != null) { string sql = "DELETE FROM DONATIONS where ReceiptNo ='" + SelectedItem.ReceiptNo + "'"; db = new SQLiteDatabase(); db.ExecuteNonQuery(sql); MessageBox.Show("Donation deleted"); LoadData(); } } }
private void btnDeleteExp_Click(object sender, RoutedEventArgs e) { if (grdExpenses.SelectedItem != null) { SelectedExpenseItem = grdExpenses.SelectedItem as Expense; MessageBoxResult dialogResult = MessageBox.Show("Are you sure you want to delete the Expense?", "Delete Expense", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { if (SelectedExpenseItem != null) { string sql = "DELETE FROM EXPENSES where ID ='" + SelectedExpenseItem.ID + "'"; db = new SQLiteDatabase(); db.ExecuteNonQuery(sql); MessageBox.Show("Expense deleted"); SelectedExpenseItem = null; LoadExpenses(); } } } }
private void btnDeleteFund_Click(object sender, RoutedEventArgs e) { FundTypes ft = grdFundtype.SelectedItem as FundTypes; if (ft != null) { MessageBoxResult dialogResult = MessageBox.Show("Are you sure you want to delete the Fund Type?", "Delete Fund Type", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { string sql = "DELETE FROM FundType where ID ='" + ft.Id + "'"; db = new SQLiteDatabase(); db.ExecuteNonQuery(sql); MessageBox.Show("FundType deleted"); btnMisc_Click(null, null); } } else { MessageBox.Show("Please select Fund type to delete"); } }
private void btnSaveDonation_Click(object sender, RoutedEventArgs e) { if (txtName.Text == "" || txtAmount.Text == "") { MessageBox.Show("Please enter Name and Amount."); return; } if (txtEmail.Text != "") { if (!Regex.IsMatch(txtEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { MessageBox.Show("Please enter correct Email"); return; } } if (txtPhone.Text != "") { if (!Regex.IsMatch(txtPhone.Text, @"[^0-9]+")) { MessageBox.Show("Please enter correct phone number"); return; } } /* * if (cbByType.SelectedItem != null) * { * if ((cbByType.SelectedItem as ComboBoxItem).Content.ToString() != "By Cash") * { * MessageBox.Show("Please Enter Neft/ DD / Check Number"); * return; * } * } */ db = new SQLiteDatabase(); Donation dobj = new Donation(); dobj.ReceiptNo = txtSLNo.Text;// dobj.Ddate = TxtDate.Text; dobj.Name = txtName.Text; dobj.Gender = (bool)rbfeMale.IsChecked ? "Female" : "Male"; dobj.Email = txtEmail.Text; dobj.Phone = txtPhone.Text; dobj.Place = txtPlace.Text; dobj.FundType = cbFundType.Text; dobj.Amount = Convert.ToDecimal((!string.IsNullOrWhiteSpace(txtAmount.Text) ? txtAmount.Text : "0")); dobj.BTNo = txtBNo.Text; dobj.Address = txtAddress.Text; dobj.Comment = txtComment.Text; dobj.AmountType = cbByType.Text; dobj.Place = txtPlace.Text; if (IsDonationEdit) { dobj.Modified = DateTime.Now.ToSqlLiteDatetime(); dobj.ModifiedBy = LoginUser.UName; dobj.Created = Convert.ToDateTime(SelectedItem.Created).ToSqlLiteDatetime(); dobj.CreatedBy = SelectedItem.CreatedBy; Dictionary <string, string> dic1 = GetTypePropertyValues <Donation>(dobj); string s = db.Update("Donations", dic1, " ReceiptNo =" + Convert.ToString(dobj.ReceiptNo) + ""); db.ExecuteNonQuery(s); } else { dobj.Created = DateTime.Now.ToSqlLiteDatetime(); dobj.CreatedBy = LoginUser.UName; Dictionary <string, string> dic1 = GetTypePropertyValues <Donation>(dobj); string s = db.Insert("Donations", dic1); db.ExecuteNonQuery(s); NextNumber = ""; } splAddDonation.Visibility = Visibility.Collapsed; splDonations.Visibility = Visibility.Visible; LoadData(); IsDonationEdit = false; FillDoantionForm(new Donation()); SelectedItem = null; }