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); } }
public FundTypesUC(FundTypes ft) { InitializeComponent(); this.DataContext = ft; ftl = ft; isEdit = true; }
private void btnCancel_Click(object sender, RoutedEventArgs e) { FundTypes exp = new FundTypes(); this.DataContext = exp; if (this.CancelButtonClick != null) { this.CancelButtonClick(this, e); } }
private void btnEditFund_Click(object sender, RoutedEventArgs e) { FundTypes ft = grdFundtype.SelectedItem as FundTypes; if (ft != null) { stpMisc.Visibility = Visibility.Visible; FundTypesUC fuc = new FundTypesUC(ft); stpMisc.Children.Add(fuc); Misc.Visibility = Visibility.Collapsed; fuc.SaveButtonClick += Fuc_SaveButtonClick; fuc.CancelButtonClick += Fuc_CancelButtonClick; } else { MessageBox.Show("Please select Fund type to Edit"); } }
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"); } }