private void btn_newcustomer_Click(object sender, RoutedEventArgs e) { win_add_edit_customer w_ae = new win_add_edit_customer(); w_ae.win_Type = 1;//به منظور افزودن مشتری w_ae.ShowDialog(); ShowCustomerInfo(SearchStatement); }
private void btn_editcustomer_Click(object sender, RoutedEventArgs e) { object item = dataGrid_customer.SelectedItem; win_add_edit_customer w_ae = new win_add_edit_customer(); w_ae.win_Type = 2;//به منظور بروزرسانی اطلاعات مشتری if (item == null) { MessageBox.Show("ابتدا یک مشتری را انتخاب نمایید"); return; } w_ae.CID = Convert.ToInt32((dataGrid_customer.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text); w_ae.CName = (dataGrid_customer.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; w_ae.CTel = (dataGrid_customer.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text; w_ae.CAddress = (dataGrid_customer.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text; w_ae.ShowDialog(); ShowCustomerInfo(SearchStatement); }