private void ListViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { var item = sender as ListViewItem; if (item != null && item.IsSelected) { int cardType = (int)Application.Current.Properties["cardType"]; dynamic selectedItem = jobList.SelectedItems[0]; var orderNumber = selectedItem.Col1; var receiveNumber = selectedItem.Col2; var recordDate = selectedItem.Col3; var finishDate = selectedItem.Col4; var customerName = selectedItem.Col5; var productName = selectedItem.Col6; List <String> cardData = new List <String>(); cardData.Add(orderNumber); cardData.Add(receiveNumber); cardData.Add(recordDate); cardData.Add(finishDate); cardData.Add(customerName); cardData.Add(productName); if (cardType == 4) { //material card PrepMaterialCard(orderNumber); } else if (cardType == 3) { //printing card PrepPrintCard(orderNumber); } else if (cardType == 2) { //printing blowing card PrepBlowCard(orderNumber); } else if (cardType == 1) { PrepCuttingCard(orderNumber); } Application.Current.Properties["cardData"] = cardData; SucceedLogCreate("cardList : preview job list"); ReportPreview ses = new ReportPreview(); ses.Show(); this.Close(); } } catch (Exception ex) { ErrorLogCreate(ex); MessageBox.Show("เกิดข้อผิดพลาด ข้อมูล error บันทึกอยู่ในไฟล์ log กรุณาแจ้งข้อมูลดังกล่าวแก่ทีมติดตั้ง" , "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void ListViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { var item = sender as ListViewItem; if (item != null && item.IsSelected) { int cardType = (int)Application.Current.Properties["cardType"]; dynamic selectedItem = jobList.SelectedItems[0]; var orderNumber = selectedItem.Col1; var receiveNumber = selectedItem.Col2; var recordDate = selectedItem.Col3; var finishDate = selectedItem.Col4; var customerName = selectedItem.Col5; var productName = selectedItem.Col6; List<String> cardData = new List<String>(); cardData.Add(orderNumber); cardData.Add(receiveNumber); cardData.Add(recordDate); cardData.Add(finishDate); cardData.Add(customerName); cardData.Add(productName); if (cardType == 4) { //material card PrepMaterialCard(orderNumber); } else if (cardType == 3) { //printing card PrepPrintCard(orderNumber); } else if (cardType == 2) { //printing blowing card PrepBlowCard(orderNumber); } else if (cardType == 1) { PrepCuttingCard(orderNumber); } Application.Current.Properties["cardData"] = cardData; SucceedLogCreate("cardList : preview job list"); ReportPreview ses = new ReportPreview(); ses.Show(); this.Close(); } } catch (Exception ex) { ErrorLogCreate(ex); MessageBox.Show("เกิดข้อผิดพลาด ข้อมูล error บันทึกอยู่ในไฟล์ log กรุณาแจ้งข้อมูลดังกล่าวแก่ทีมติดตั้ง" , "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning); } }