private void btn_newproduct_Click(object sender, RoutedEventArgs e) { Win_add_edit_product w_p = new Win_add_edit_product(); w_p.win_type = 1;//حالت افزودن w_p.ShowDialog(); ShowProductInfo(SearchStatement); }
private void btn_editproduct_Click(object sender, RoutedEventArgs e) { object item = dataGrid_product.SelectedItem; Win_add_edit_product w_p = new Win_add_edit_product(); w_p.win_type = 2;//حالت ویرایش w_p.ProductId = Convert.ToInt32((dataGrid_product.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text); w_p.ProductName = (dataGrid_product.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; w_p.ProductDesc = (dataGrid_product.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text; w_p.ShowDialog(); ShowProductInfo(SearchStatement); }