private void printBtn_Click(object sender, RoutedEventArgs e) { Boolean gatePass = false; ModeSelect(); TypeSelect(); if (modeSelected == 0 || typeSelected == 0) { MessageBox.Show("ยังไม่ได้เลือกการค้นหาหรือยังไม่ได้เลือกประเภทใบคำสั่ง", "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning); } else { Application.Current.Properties["cardType"] = typeSelected.ToString(); if (modeSelected == 4) { GetDate(); Application.Current.Properties["queryData"] = daySelect; Application.Current.Properties["queryType"] = "byRecordDate"; gatePass = true; } else if (modeSelected == 5) { GetDate(); Application.Current.Properties["queryData"] = daySelect; Application.Current.Properties["queryType"] = "byFinishDate"; gatePass = true; } else if (modeSelected == 1) { Application.Current.Properties["queryData"] = this.queryString.Text; Application.Current.Properties["queryType"] = "byOrderNumber"; if (queryString.Text.Contains('-') == false || queryString.Text[0] == '-' || queryString.Text[queryString.Text.Length - 1] == '-') { MessageBox.Show("กรอกลำดับสั่งไม่ถูกต้อง กรุณากรอกใหม่", "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning); } else { gatePass = true; } } else if (modeSelected == 2) { Application.Current.Properties["queryData"] = this.queryString.Text; Application.Current.Properties["queryType"] = "byReceiveNumber"; gatePass = true; } if (gatePass == true) { try { gatePass = false; Application.Current.Properties["cardType"] = typeSelected; SucceedLogCreate("reportPrint : printing click"); cardList ses = new cardList(); ses.Show(); } catch (Exception ex) { ErrorLogCreate(ex); } } } }