예제 #1
0
        void OnCancelButtonClick(object sender, RoutedEventArgs e)
        {
            if (_worker != null && _worker.WorkerSupportsCancellation)
            {
               // SubLabel = "Please wait while process will be cancelled...";
                SubLabel = new CommonUtils().GetStringValue("CancelThreadMessage");
                CancelButton.IsEnabled = false;
                _worker.CancelAsync();

            }
        }
예제 #2
0
        public void PrintArabicRecipt()
        {
            try
            {
                // string[][] defectCodes = new String(Length)(Length);




                //   string[] plateDetails=  ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateDetailsInArabic("Private","A");

                int len = AppProperties.recordedViolation.Defect.Length;



                List<string> selcted_defect_categories_list = new List<string>();
                string[][] defectCodes = new string[len][];
                try
                {

                    //int len = AppProperties.recordedViolation.Defect.Length;
                    //string[][] defectCodes = new string[len][];
                    for (int x = 0; x < defectCodes.Length; x++)
                    {
                        defectCodes[x] = new String[4];
                    }
                    // string[][] defect = AppProperties.selectedDefectsEn;
                    for (int i = 0; i < len; i++)
                    {
                        string defect_Code = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                        /*  if (defect_Code.Contains("1.1.1"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "عدم وجود أو وضوح الأرقام التعريفي للشاصي";
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("1.1.4"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "إعادة طباعة أرقام الشاصي بدون شهادة معتمدة";
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("2.1.1"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "تآكل أو كسر أو عطل في إحدى مكونات الفرامل";
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("2.4.3"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "الفرامل<30% للإطارات و<60% لفرامل اليد";
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("2.7.1"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "خلل في توصيلات نظام الفرامل الهيدروليكي";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("4.2.11"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "استخدام إطارات غير مصرح بها (اطارات الثلج)";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("5.2.3"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "عدم صلاحية أو إحكام توصيلات القاطرة والمقطورة";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          } else if (defect_Code.Contains("6.1.2"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "عدم صلاحية أو تثبيت الأنوار التحذيرية أعلى المركبة";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          } 
                          else if (defect_Code.Contains("6.1.9"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "خطا في توزيع الحزم الضوئية";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("6.1.12"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "عدم صلاحية المصابيح خلف أو على جانبي المقطورة";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("7.1.2"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "عدم صلاحية أو تثبيت قواعد ناقل الحركة بشكل أمن";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("7.4.2"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "عدم صلاحية أو وجود أو تثبيت غطاء خزان الوقود";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("9.2.1"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "فقدان احدى معدات السلامة";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                          else if (defect_Code.Contains("9.3.3"))
                          {
                              // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][0] = "تحميل المركبة الثقيلة بصورة تشكل خطورة على الغير";
                              //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                              defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                              defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                              defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                          }
                       
                          else
                          {
                              */
                        defectCodes[i][0] = AppProperties.selectedDefectsEn[i][9];
                        defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                        defectCodes[i][2] = AppProperties.selectedDefectsEn[i][6];
                        defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();



                        // }
                        ////////////////////////////
                        if (!selcted_defect_categories_list.Contains(AppProperties.selectedDefectsEn[i][3]))
                            selcted_defect_categories_list.Add(AppProperties.selectedDefectsEn[i][3]);
                    }
                }
                catch (Exception ex)
                {
                    CommonUtils.WriteLog(ex.StackTrace);
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
                    // throw;
                }

                /////////////////////////////////////////
                ////////Create ZPL for Defect Categories
                ////////////////////////////////////////

                string zpl_defect_categories = string.Empty;

                foreach (string defect_cat in selcted_defect_categories_list)
                {
                    if (defect_cat == "Vehicle Identification")
                    {
                        zpl_defect_categories += "^FO30,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Engine") || (defect_cat == "Steering and Suspension"))
                    {
                        zpl_defect_categories += "^FO50,510^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Safety Requirements")
                    {
                        zpl_defect_categories += "^FO250,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Brake") || (defect_cat == "Wheels and Tyres"))
                    {
                        zpl_defect_categories += "^FO457,545^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Lighting")
                    {
                        zpl_defect_categories += "^FO500,545^GC30,2,B^FS ";
                    }

                }



                string InspectionLocationAr = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetArabicLocationNameFromEn(AppProperties.location.location);

                Hashtable plateDetails = new Hashtable();
                string plateCatAr = string.Empty;
                string plateCodeAr = string.Empty;

                if (AppProperties.vehicle.Country == AppProperties.defaultCountry)
                {
                    plateDetails = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateDetailsInArabic(AppProperties.vehicle.PlateCategory, AppProperties.vehicle.PlateCode);

                    if (plateDetails != null)
                    {
                        plateCatAr = (string)plateDetails[AppProperties.vehicle.PlateCategory];
                        plateCodeAr = (string)plateDetails[AppProperties.vehicle.PlateCode];
                    }

                }
                else
                {
                    //  plateDetails = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateDetailsInArabic(AppProperties.vehicle.PlateCategory, null);

                    //  plateCatAr = (string)plateDetails[AppProperties.vehicle.PlateCategory];
                    plateCatAr = AppProperties.vehicle.PlateCategory;
                    plateCodeAr = AppProperties.vehicle.PlateCode;
                }

                string plate_Source_Ar = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateSourceCodeAr(("" != AppProperties.vehicle.Emirate.Trim()) ? AppProperties.vehicle.Emirate.Trim() : AppProperties.vehicle.Country.Trim());

                string plateDetail;
                // plateDetail = (plate_Source_Ar + " , " + plateCodeAr + " " + new CommonUtils().ConvertToEasternArabicNumerals(ReverseString(AppProperties.vehicle.PlateNumber.ToString())) );
                if (AppProperties.vehicle.PlateCategory == "Public Transportation")
                    plateDetail = (plate_Source_Ar + " , " + plateCodeAr + " " + AppProperties.vehicle.PlateNumber.ToString());
                else
                    plateDetail = (plate_Source_Ar + " , " + plateCodeAr + " " + "  " + plateCatAr + " " + AppProperties.vehicle.PlateNumber.ToString());



                string violationTicketCode = AppProperties.recordedViolation.ViolationTicketCode;
                string issueDate = AppProperties.recordedViolation.ViolationIssueDate.ToString("dd/MM/yy hh:mm");
                string emp_ID = AppProperties.empID;

                string LiscenseNo = AppProperties.vehicle.DriverLicense;





                string print_str = string.Empty;
                ////////////////////////////////////////////////////////////////////
                ///////////For Other printers
                //////////////////////////////////////////////////////////////





                print_str = print_str + "^XA^MD13^CWX,E:TT0003M_.FNT^FS" +



             "^FT450,100,1^CI28^AXN,20,20^F8^FD" + violationTicketCode + "^FS" +
             " ^FT450,121,1^CI28^AXN,20,20^F8^FD" + AppProperties.receiptTitleAr + "^FS" +

             "^FT450,246,1^CI28^AXN,20,20^F8^FD" + issueDate + "^FS" +
              "^FT450,271,1^CI28^AXN,20,20^F8^FD" + InspectionLocationAr + "^FS" +
              "^FT450,297,1^CI28^AXN,20,20^F8^FD" + emp_ID + "^FS" +
              "^FT450,368,1^CI28^AXN,20,20^F8^FD" + LiscenseNo + "^FS" +
              "^FT450,400,1^CI28^AXN,20,20^F8^FD" + plateDetail + "^FS" +

               "^FT550,627,1^CI28^AXN,20,20^F8^FDالقسم :4 تفاصيل الأعطال^FS" +
                "^CI0^FO378,638^GB172,0,1^FS" +


                "^FT550,666,1^CI28^AXN,20,20^F8^FDعدد^FS" +
                "^CI0^FO495,670^GB55,0,1^FS" +
                "^FT480,666,1^CI28^AXN,20,20^F8^FDالعطل^FS" +


                "^CI0^FO105,670^GB375,0,1^FS" +
                  "^FT82,666,1^CI28^AXN,20,20^F8^FDالخطورة^FS" +
                "^CI0^FO14,670^GB68,0,1^FS";
                print_str = print_str + zpl_defect_categories;

                int vertical_Start_Point = 699;

                int max_defect_lenght = 45;
                int max_coments_lenght = 35;
                for (int i = 0; i < defectCodes.Length; i++)
                {
                    String Defect_Code = defectCodes[i][1].ToString().Replace("(D)", "").Trim();
                    String Defect_Name = defectCodes[i][0];
                    String Defect_Severity = defectCodes[i][2];
                    String Coments = defectCodes[i][3];
                    // For Right ALignment



                    var splitedDefectList = new CommonUtils().SplitStringIntoWords(Defect_Name, Defect_Name.Length);

                    String Defect_Name_1stLine = "";
                    String Defect_Name_2ndLine = "";

                    foreach (string str in splitedDefectList)
                    {
                        if (Defect_Name_1stLine.Length + str.Length < max_defect_lenght)
                        {
                            Defect_Name_1stLine += str;
                        }
                        else
                        {
                            Defect_Name_2ndLine += str;
                        }
                    }

                    print_str = print_str + " ^FT550," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Code + "^FS";
                    print_str = print_str + " ^FT480," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Name_1stLine + "^FS";
                    print_str = print_str + " ^FT82," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Severity + "^FS";
                    if (Defect_Name_2ndLine != "")
                    {
                        vertical_Start_Point = vertical_Start_Point + 22;
                        print_str = print_str + " ^FT480," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Name_2ndLine + "^FS";
                    }

                    vertical_Start_Point = vertical_Start_Point + 27;

                    var splitedComentList = new List<string>();
                    String Coments_Name_1stLine = "";
                    String Coments_Name_2ndLine = "";
                    if (Coments != null)
                    {
                        if (new CommonUtils().IsEnglish(Coments))
                        {
                            splitedComentList = Coments.Split(' ').ToList<string>();
                            foreach (string str in splitedComentList)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_coments_lenght)
                                {
                                    Coments_Name_1stLine += str + " ";
                                }
                                else
                                {
                                    Coments_Name_2ndLine += str + " ";
                                }
                            }
                           /* foreach (string str in splitedComentList)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_coments_lenght)
                                {
                                    // Coments_Name_1stLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                    if (isNumeric)
                                        Coments_Name_1stLine += str;
                                    else
                                        Coments_Name_1stLine += str + " ";
                                }
                                else
                                {
                                    // Coments_Name_2ndLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                   // Coments_Name_2ndLine += str + " ";
                                    if (isNumeric)
                                        Coments_Name_2ndLine += str;
                                    else
                                        Coments_Name_2ndLine += str + " ";
                                }
                            } */
                        }
                        else
                        {
                            splitedComentList = new CommonUtils().SplitStringIntoWords2(Coments, Coments.Length);
                           foreach (string str in splitedComentList)
                           {
                               if (Coments_Name_1stLine.Length + str.Length < max_coments_lenght)
                               {
                                   // Coments_Name_1stLine += str + " ";
                                   int n;
                                   bool isNumeric = int.TryParse(str, out n);
                                   if (isNumeric)
                                   {
                                       Coments_Name_1stLine += "";
                                       Coments_Name_1stLine += str;
                                   }
                                   else
                                   {
                                       Coments_Name_1stLine += str;
                                   }
                                      
                               }
                               else
                               {
                                   // Coments_Name_2ndLine += str + " ";
                                   int n;
                                   bool isNumeric = int.TryParse(str, out n);
                                  // Coments_Name_2ndLine += str + " ";
                                   if (isNumeric)
                                   {
                                       Coments_Name_2ndLine += "";
                                       Coments_Name_2ndLine += str;
                                   }
                                   else
                                   {
                                       Coments_Name_2ndLine += str;
                                   }
                               }
                           } 
                        }
                    }





                    print_str = print_str + " ^FT480," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FDالملاحظات^FS";
                    print_str = print_str + " ^FT390," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Coments_Name_1stLine + "^FS";
                    if (Coments_Name_2ndLine != "")
                    {
                        vertical_Start_Point = vertical_Start_Point + 22;
                        print_str = print_str + " ^FT480," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Coments_Name_2ndLine + "^FS";
                    }

                    vertical_Start_Point = vertical_Start_Point + 30;
                }




                print_str = print_str + " ^PQ1,0,1,Y^XZ";



                /////////////////////////////////////////////////
                ///For other printers
                ///////////////////////////////////////////








                //print_str = print_str + " ^PQ1,0,1,Y^XZ";


                UTF8Encoding utf8 = new UTF8Encoding();

                byte[] encodedBytes = utf8.GetBytes(print_str);

                if (count_arabic_print >= 0)
                {
                    if (WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), new CommonUtils().GetStringValue("lblTicketConfirmation"), WPFMessageBoxButtons.YesNo, WPFMessageBoxImage.Question) == WPFMessageBoxResult.Yes)
                    {
                        //MessageBox.Show("Print");
                        //  RawPrinterHelper.SendStringToPrinter("ZDesigner iMZ320 (ZPL)", print_str);
                        ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("Printing"), (bw, we) =>
                        {

                            // check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);
                            RawPrinterHelper.SendBytes("ZDesigner iMZ320 (ZPL)", encodedBytes);
                            // So this check in order to avoid default processing after the Cancel button has been pressed.
                            // This call will set the Cancelled flag on the result structure.
                            ProgressDialog.ProgressDialog.CheckForPendingCancellation(bw, we);

                        }, ProgressDialogSettings.WithSubLabelAndCancel);

                        if (result.Cancelled)
                            return;
                        else if (result.OperationFailed)
                            return;
                        count_eng_print++;
                    }
                }
                else
                {

                    //  MessageBox.Show("Print");
                    // RawPrinterHelper.SendStringToPrinter("ZDesigner iMZ320 (ZPL)", print_str);
                    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("Printing"), (bw, we) =>
                    {

                        // check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);
                        RawPrinterHelper.SendBytes("ZDesigner iMZ320 (ZPL)", encodedBytes);
                        // So this check in order to avoid default processing after the Cancel button has been pressed.
                        // This call will set the Cancelled flag on the result structure.
                        ProgressDialog.ProgressDialog.CheckForPendingCancellation(bw, we);

                    }, ProgressDialogSettings.WithSubLabelAndCancel);

                    if (result.Cancelled)
                        return;
                    else if (result.OperationFailed)
                        return;

                    count_arabic_print++;
                }

                //  RawPrinterHelper.SendBytes("ZDesigner iMZ320 (ZPL)", encodedBytes);


            }
            catch (Exception ex)
            {
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
        private void PrintArabicRecipt()
        {
            try
            {

                string violationTicketCode = violationTicketDetials.ViolationID;
                string issueDate = violationTicketDetials.DateTime;
                string emp_ID = violationTicketDetials.RtaEmpNo;

                string LiscenseNo = violationTicketDetials.DriverLicNo;
                // string plateDetail = violationTicketDetials.VehicleDetailsAr;

                ////////////////////////////////////////////////////////////////////

                Hashtable plateDetails = new Hashtable();
                string plateCatAr = string.Empty;
                string plateCodeAr = string.Empty;

                if ((AppProperties.vehicle.Country == AppProperties.defaultCountry)|| (AppProperties.vehicle.Country == "AE"))
                {
                   
                    
                    plateDetails = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateDetailsInArabic(AppProperties.vehicle.PlateCategory, AppProperties.vehicle.PlateCode);
                    if (plateDetails != null)
                    {
                        plateCatAr = (string)plateDetails[AppProperties.vehicle.PlateCategory];
                        plateCodeAr = (string)plateDetails[AppProperties.vehicle.PlateCode];
                    }
                   
                   
                   
                }
                else
                {
                    //  plateDetails = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateDetailsInArabic(AppProperties.vehicle.PlateCategory, null);

                    //  plateCatAr = (string)plateDetails[AppProperties.vehicle.PlateCategory];
                    plateCatAr = AppProperties.vehicle.PlateCategory;
                    plateCodeAr = AppProperties.vehicle.PlateCode;
                }

                string plate_Source_Ar = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateSourceCodeAr(("" != AppProperties.vehicle.Emirate.Trim()) ? AppProperties.vehicle.Emirate.Trim() : AppProperties.vehicle.Country.Trim());

                string plateDetail;
                // plateDetail = (plate_Source_Ar + " , " + plateCodeAr + " " + new CommonUtils().ConvertToEasternArabicNumerals(ReverseString(AppProperties.vehicle.PlateNumber.ToString())) );
                if (AppProperties.vehicle.PlateCategory == "Public Transportation")
                    plateDetail = (plate_Source_Ar + " , " + plateCodeAr + " " + AppProperties.vehicle.PlateNumber.ToString());
                else
                    plateDetail = (plate_Source_Ar + " , " + plateCodeAr + " " + "  " + plateCatAr + " " + AppProperties.vehicle.PlateNumber.ToString());


                ///////////////////////////////////////////////////////////////////

                //  string InspectionLocationAr = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetArabicLocationNameFromEn(AppProperties.location.location);



                string print_str = string.Empty;

                print_str = print_str + "^XA^MD13^CWX,E:TT0003M_.FNT^FS" +

               ///////////



                "^FT450,100,1^CI28^AXN,20,20^F8^FD" + violationTicketCode + "^FS" +
                "  ^FT450,121,1^CI28^AXN,20,20^F8^FD" + violationTicketDetials.ViolationAdviceAr + "^FS" +

                "^FT450,246,1^CI28^AXN,20,20^F8^FD" + issueDate + "^FS" +
                 "^FT450,271,1^CI28^AXN,20,20^F8^FD" + violationTicketDetials.LocaitonAr + "^FS" +
                 "^FT450,297,1^CI28^AXN,20,20^F8^FD" + emp_ID + "^FS" +
                 "^FT450,368,1^CI28^AXN,20,20^F8^FD" + LiscenseNo + "^FS" +
                 "^FT450,400,1^CI28^AXN,20,20^F8^FD" + plateDetail + "^FS" +

                  "^FT550,627,1^CI28^AXN,20,20^F8^FDالقسم :4 تفاصيل الأعطال^FS" +
                   "^CI0^FO378,638^GB172,0,1^FS" +


                   "^FT550,666,1^CI28^AXN,20,20^F8^FDعدد^FS" +
                   "^CI0^FO495,670^GB55,0,1^FS" +
                   "^FT480,666,1^CI28^AXN,20,20^F8^FDالعطل^FS" +


                   "^CI0^FO105,670^GB375,0,1^FS" +
                     "^FT82,666,1^CI28^AXN,20,20^F8^FDالخطورة^FS" +
                   "^CI0^FO14,670^GB68,0,1^FS";
              
                ////////////////

                string zpl_defect_categories = string.Empty;

                for (int i = 0; i < violationTicketDetials.DefectDetails.Length; i++)
                {
                    string defect_cat = violationTicketDetials.DefectDetails[i].DefectCategory;
                    if (defect_cat == "Vehicle Identification")
                    {
                        zpl_defect_categories += "^FO30,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Engine")  || (defect_cat=="Steering and Suspension"))
                    {
                        zpl_defect_categories += "^FO50,510^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Safety Requirements")
                    {
                        zpl_defect_categories += "^FO250,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Brake") || (defect_cat == "Wheels and Tyres"))
                    {
                        zpl_defect_categories += "^FO457,545^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Lighting")
                    {
                        zpl_defect_categories += "^FO500,545^GC30,2,B^FS ";
                    }

                }
                print_str = print_str + zpl_defect_categories;
                int vertical_Start_Point = 699;
                int max_defect_lenght = 45;
                int max_coments_lenght = 35;
                for (int i = 0; i < violationTicketDetials.DefectDetails.Length; i++)
                {
                    String Defect_Code = violationTicketDetials.DefectDetails[i].DefectCode.ToString().Replace("(D)", "").Trim();
                    String Defect_Name;
                   
                        Defect_Name = violationTicketDetials.DefectDetails[i].DefectNameAr;
                   
                   // String Defect_Name = violationTicketDetials.DefectDetails[i].DefectNameAr;
                    String Defect_Severity = violationTicketDetials.DefectDetails[i].DefectSeverityAr;
                    String Coments = violationTicketDetials.DefectDetails[i].DefectValue;


                    var splitedDefectList = new CommonUtils().SplitStringIntoWords(Defect_Name, Defect_Name.Length);

                    String Defect_Name_1stLine = "";
                    String Defect_Name_2ndLine = "";

                    foreach (string str in splitedDefectList)
                    {
                        if (Defect_Name_1stLine.Length + str.Length < max_defect_lenght)
                        {
                            Defect_Name_1stLine += str;
                        }
                        else
                        {
                            Defect_Name_2ndLine += str;
                        }
                    }


                    //////////////////////////////////
                    print_str = print_str + " ^FT550," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Code + "^FS";
                    print_str = print_str + " ^FT480," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Name_1stLine + "^FS";
                    print_str = print_str + " ^FT82," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Severity + "^FS";
                    if (Defect_Name_2ndLine != String.Empty)
                    {
                        vertical_Start_Point = vertical_Start_Point + 22;
                        print_str = print_str + " ^FT480," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Defect_Name_2ndLine + "^FS";
                    }   

                    vertical_Start_Point = vertical_Start_Point + 27;

                    var splitedComentList = new List<string>();
                    String Coments_Name_1stLine = "";
                    String Coments_Name_2ndLine = "";

                    if (Coments != null)
                    {
                        if (new CommonUtils().IsEnglish(Coments))
                        {
                            splitedComentList = Coments.Split(' ').ToList<string>();
                            foreach (string str in splitedComentList)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_coments_lenght)
                                {
                                    Coments_Name_1stLine += str + " ";
                                }
                                else
                                {
                                    Coments_Name_2ndLine += str + " ";
                                }
                            }
                        }
                        else
                        {
                            splitedComentList = new CommonUtils().SplitStringIntoWords2(Coments, Coments.Length);
                            foreach (string str in splitedComentList)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_coments_lenght)
                                {
                                    // Coments_Name_1stLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                    if (isNumeric)
                                    {
                                        Coments_Name_1stLine += "";
                                        Coments_Name_1stLine += str;
                                    }
                                    else
                                    {
                                        Coments_Name_1stLine += str;
                                    }
                                }
                                else
                                {
                                    // Coments_Name_2ndLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                    // Coments_Name_2ndLine += str + " ";
                                    if (isNumeric)
                                    {
                                        Coments_Name_2ndLine += "";
                                        Coments_Name_2ndLine += str;
                                    }
                                    else
                                    {
                                        Coments_Name_2ndLine += str;
                                    }
                                }
                            } 
                        }
                    }
                   

                   

                    

                    print_str = print_str + " ^FT480," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FDالملاحظات^FS";
                    print_str = print_str + " ^FT390," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Coments_Name_1stLine + "^FS";

                    if (Coments_Name_2ndLine != "")
                    {
                        vertical_Start_Point = vertical_Start_Point + 22;
                        print_str = print_str + " ^FT390," + vertical_Start_Point + ",1^CI28^AXN,20,20^F8^FD" + Coments_Name_2ndLine + "^FS";
                    }  
                    vertical_Start_Point = vertical_Start_Point + 30;
                    ///////////////////////////////
                }
                print_str = print_str + " ^PQ1,0,1,Y^XZ";

                UTF8Encoding utf8 = new UTF8Encoding();

                byte[] encodedBytes = utf8.GetBytes(print_str);

                if (WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), new CommonUtils().GetStringValue("lblTicketConfirmation"), WPFMessageBoxButtons.YesNo, WPFMessageBoxImage.Question) == WPFMessageBoxResult.Yes)
                {
                    //MessageBox.Show("Print");
                    //  RawPrinterHelper.SendStringToPrinter("ZDesigner iMZ320 (ZPL)", print_str);
                    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("Printing"), (bw, we) =>
                    {

                        // check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);
                        RawPrinterHelper.SendBytes("ZDesigner iMZ320 (ZPL)", encodedBytes);
                        // So this check in order to avoid default processing after the Cancel button has been pressed.
                        // This call will set the Cancelled flag on the result structure.
                        ProgressDialog.ProgressDialog.CheckForPendingCancellation(bw, we);

                    }, ProgressDialogSettings.WithSubLabelAndCancel);

                    if (result.Cancelled)
                        return;
                    else if (result.OperationFailed)
                        return;
                    // count_eng_print++;
                }

            }
            catch (Exception ex)
            {
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
예제 #4
0
        public void PrintEnglishRecipt()
        {
            try
            {


                String Violation_ID = AppProperties.recordedViolation.ViolationTicketCode;
                String Violation_Advice = AppProperties.receiptTitle;

                String Inspection_Location = AppProperties.location.location;
                String Emp_No = AppProperties.empID;
                String Liscense_No = AppProperties.vehicle.DriverLicense;
                String plate_details = string.Empty;
                if (AppProperties.vehicle.PlateCategory == "Public Transportation")
                {
                    plate_details = (AppProperties.vehicle.PlateNumber.ToString() + "  " + AppProperties.vehicle.PlateCode + "," +
                    ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateSourceCode((null != AppProperties.vehicle.Emirate) ? AppProperties.vehicle.Emirate : AppProperties.vehicle.Country)).Trim();
                }
                else
                {
                    plate_details = (AppProperties.vehicle.PlateNumber.ToString() + " " + AppProperties.vehicle.PlateCategory + " " + AppProperties.vehicle.PlateCode + "," +
                    ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetPlateSourceCode((null != AppProperties.vehicle.Emirate) ? AppProperties.vehicle.Emirate : AppProperties.vehicle.Country)).Trim();
                }
                String Defect_Details = string.Empty;
                List<string> selcted_defect_categories_list = new List<string>();
                // For Vehicle Defects
                int len = AppProperties.recordedViolation.Defect.Length;
                string[][] defectCodes = new string[len][];
                try
                {

                    for (int x = 0; x < defectCodes.Length; x++)
                    {
                        defectCodes[x] = new String[4];
                    }

                    for (int i = 0; i < len; i++)
                    {
                        string defect_Code = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                        /* if (defect_Code.Contains("2.4.3"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Brake (>30% for wheels, >60% for handbrake)";
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("3.6.1"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Defective spring or displaced more than 10%";
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("4.2.5"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Re-threading tires by un authorized company";
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("5.3.4"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Loose chassis frame or supporting members";
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("5.3.5"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Defective chassis frame or supporting members";
                             //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("5.3.6"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Defective or unsecured frame mem. in load areas";
                             //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("6.1.2"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Defective or not fixing beacon light on top";
                             //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("7.1.2"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Broken or unsecured engine or transm.moun.";
                             //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("8.1.2"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Incorrect air/fuel ratio (modified fuel system)";
                             //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else if (defect_Code.Contains("9.2.1"))
                         {
                             // defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][0] = "Safety equipment missing";
                             //defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                             defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                             defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                             defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                         }
                         else
                         {
                             */
                        defectCodes[i][0] = AppProperties.recordedViolation.Defect[i].DefectName.Trim();
                        defectCodes[i][1] = ((IDBDataLoad)DBDataLoadManager.GetInstance()).GetDefectCode(AppProperties.recordedViolation.Defect[i].DefectID).Trim();
                        defectCodes[i][2] = AppProperties.recordedViolation.Defect[i].DefectSeverity.Trim();
                        defectCodes[i][3] = AppProperties.recordedViolation.Defect[i].DefectValue.Trim();
                        // }
                        if (!selcted_defect_categories_list.Contains(AppProperties.selectedDefectsEn[i][3]))
                            selcted_defect_categories_list.Add(AppProperties.selectedDefectsEn[i][3]);
                    }
                }
                catch (Exception ex)
                {
                    CommonUtils.WriteLog(ex.StackTrace);
                    WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
                    // throw;
                }

                string zpl_defect_categories = string.Empty;

                foreach (string defect_cat in selcted_defect_categories_list)
                {
                    if (defect_cat == "Vehicle Identification")
                    {
                        zpl_defect_categories += "^FO30,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Engine") || (defect_cat == "Steering and Suspension"))
                    {
                        zpl_defect_categories += "^FO50,510^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Safety Requirements")
                    {
                        zpl_defect_categories += "^FO250,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Brake") || (defect_cat == "Wheels and Tyres"))
                    {
                        zpl_defect_categories += "^FO457,545^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Lighting")
                    {
                        zpl_defect_categories += "^FO500,545^GC30,2,B^FS ";
                    }

                }





                string Data_Print = string.Empty;




                /////////////////////////////////////


                Data_Print = Data_Print + "^XA^MD13^CWX,E:TT0003M_.FNT^FS" +
                                            "^FT164,100^AXN,17,18^FD" + AppProperties.recordedViolation.ViolationTicketCode + "^FS" +
                                            " ^FT164,121^AXN,17,18^FD" + Violation_Advice + "^FS" +

                                            "^FT164,246^AXN,17,18^FD" + AppProperties.recordedViolation.ViolationIssueDate.ToString("dd/MM/yy hh:mm") + "^FS" +
                                            "^FT164,271^AXN,17,18^FD" + Inspection_Location + "^FS" +
                                            "^FT164,297^AXN,17,18^FD" + Emp_No + "^FS" +
                                            "^FT164,368^AXN,17,18^FD" + Liscense_No + "^FS" +
                                            "^FT164,400^AXN,17,18^FD" + plate_details + "^FS" +


                                            "^FT22,627^AXN,17,18^FDSection 4: Defect Details:^FS" +
                                            "^FO22,638^GB200,0,1^FS" +
                                            " ^FT22,666^AXN,17,18^FDNo.^FS" +
                                             "^FO22,668^GB40,0,1^FS" +
                                            "^FT79,666^AXN,17,18^FDDefect^FS" +
                                            "^FO79,668^GB390,0,1^FS" +
                                            "^FT484,666^AXN,17,18^FDSeverity^FS" +


                                            "^FO484,668^GB68,0,1^FS";

                Data_Print = Data_Print + zpl_defect_categories;
                int vertical_start_Point = 699;

                int max_defect_lenght = 45;
                int max_Coments_lenght = 35;

                for (int i = 0; i < defectCodes.Length; i++)
                {
                    String Defect_Code = defectCodes[i][1].ToString().Replace("(D)", "").Trim();
                    String Defect_Name = defectCodes[i][0];
                    String Defect_Severity = defectCodes[i][2];
                    String Coments = defectCodes[i][3];

                    string[] splitedDefectList = Defect_Name.Split(' ');

                    String Defect_Name_1stLine = String.Empty;
                    String Defect_Name_2ndLine = String.Empty;

                    foreach (string str in splitedDefectList)
                    {
                        if (Defect_Name_1stLine.Length + str.Length < max_defect_lenght)
                        {
                            Defect_Name_1stLine = Defect_Name_1stLine + str + " ";
                        }
                        else
                        {
                            Defect_Name_2ndLine += str + " ";
                        }
                    }
                    Data_Print = Data_Print + " ^FT22," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Code + "^FS";
                    Data_Print = Data_Print + " ^FT79," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Name_1stLine + "^FS";
                    Data_Print = Data_Print + " ^FT496," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Severity + "^FS";
                    if (Defect_Name_2ndLine != String.Empty)
                    {
                        vertical_start_Point = vertical_start_Point + 22;
                        Data_Print = Data_Print + " ^FT79," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Name_2ndLine + "^FS";
                    }

                    vertical_start_Point = vertical_start_Point + 27;

                    var splitedCmment = new List<string>();
                    String Coments_Name_1stLine = String.Empty;
                    String Comentst_Name_2ndLine = String.Empty;
                    if (Coments != null)
                    {
                        if (new CommonUtils().IsEnglish(Coments))
                        {
                            splitedCmment = Coments.Split(' ').ToList<string>();
                            foreach (string str in splitedCmment)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_Coments_lenght)
                                {
                                    Coments_Name_1stLine = Coments_Name_1stLine + str + " ";
                                }
                                else
                                {
                                    Comentst_Name_2ndLine += str + " ";
                                }
                            }

                        }
                        else
                        {
                            splitedCmment = new CommonUtils().SplitStringIntoWords2(Coments, Coments.Length);                          
                            foreach (string str in splitedCmment)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_Coments_lenght)
                                {
                                    // Coments_Name_1stLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                    if (isNumeric)
                                    {

                                        Coments_Name_1stLine += "";
                                        Coments_Name_1stLine += str;

                                    }
                                    else
                                    {
                                        Coments_Name_1stLine += str;
                                    }
                                }
                                else
                                {
                                    // Coments_Name_2ndLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                    // Coments_Name_2ndLine += str + " ";
                                    if (isNumeric)
                                    {
                                        Comentst_Name_2ndLine += "";
                                        Comentst_Name_2ndLine += str;
                                    }
                                    else
                                    {
                                        
                                        Comentst_Name_2ndLine += str;
                                    }
                                }
                            } 
                        }
                    }


                    //  string[] splitedCmment = Coments.Split(' ');

                   

                    
                    Data_Print = Data_Print + " ^FT79," + vertical_start_Point + "^AXN,17,18^FDComments:^FS";
                    Data_Print = Data_Print + " ^FT178," + vertical_start_Point + "^CI28^AXN,17,18^F8^FD" + Coments_Name_1stLine + "^FS";
                    if (Comentst_Name_2ndLine != String.Empty)
                    {
                        vertical_start_Point = vertical_start_Point + 22;
                        Data_Print = Data_Print + " ^FT79," + vertical_start_Point + "^CI28^AXN,17,18^F8^FD" + Comentst_Name_2ndLine + "^FS";
                    }

                    vertical_start_Point = vertical_start_Point + 30;

                }

                Data_Print = Data_Print + "^PQ1,0,1,Y^XZ";

                UTF8Encoding utf8 = new UTF8Encoding();

                byte[] encodedBytes = utf8.GetBytes(Data_Print);


                /*
                 ////////////////////////////////////////////////
                  /////For All Printer
                  /////////////////////////////////////////////
                Data_Print = Data_Print + "^XA^MD26^CWX,E:TT0003M_.FNT^FS^FT149,125^A@N,17,18,TT0003M_^FH" +
                                            "^FT149,125^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + AppProperties.recordedViolation.ViolationTicketCode + "^FS^CI0" +
                                            " ^FT149,151^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Violation_Advice + "^FS^CI0" +

                                            "^FT158,268^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + AppProperties.recordedViolation.ViolationIssueDate.ToString("dd/MM/yy hh:mm") + "^FS^CI0" +
                                            "^FT158,293^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Inspection_Location + "^FS^CI0" +
                                            "^FT159,319^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Emp_No + "^FS^CI0" +
                                            "^FT161,392^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Liscense_No + "^FS^CI0" +
                                            "^FT160,423^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + plate_details + "^FS^CI0" +


                                            "^FT18,634^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDSection 4: Defect Details:^FS^CI0" +
                                            "^FO18,638^GB200,0,1^FS" +
                                            " ^FT18,666^A@N,17,22,TT0003M_^FH\\^CI17^F8^FDNo.^FS^CI0" +
                                            "^FT75,666^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDDefect^FS^CI0" +
                                            "^FT498,666^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDSeverity^FS^CI0" +
                                             "^FO18,668^GB40,0,1^FS" +
                                            "^FO75,668^GB400,0,1^FS" +
                                            "^FO498,668^GB90,0,1^FS";
                int vertical_start_Point = 699;

                for (int i = 0; i < defectCodes.Length; i++)
                {
                    String Defect_Code = defectCodes[i][1].ToString().Replace("(D)", "").Trim();
                    String Defect_Name = defectCodes[i][0];
                    String Defect_Severity = defectCodes[i][2];
                    String Coments = defectCodes[i][3];

                    Data_Print = Data_Print + " ^FT18," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Defect_Code + "^FS^CI0";
                    Data_Print = Data_Print + " ^FT75," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Defect_Name + "^FS^CI0";
                    Data_Print = Data_Print + " ^FT501," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Defect_Severity + "^FS^CI0";
                    vertical_start_Point = vertical_start_Point + 27;
                    Data_Print = Data_Print + " ^FT75," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDComments:^FS^CI0";
                    Data_Print = Data_Print + " ^FT177," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Coments + "^FS^CI0";
                    vertical_start_Point = vertical_start_Point + 30;

                }

                Data_Print = Data_Print + "  ^PQ1,0,1,Y^XZ";
                 * 
               */

                ////////////////////////////////////////////////
                /////For All Printer
                /////////////////////////////////////////////







                /*


               
                
                 ////////////////////////////////////////////////
                  /////For  Printer With Problem
                 /////////////////////////////////////////////
                Data_Print = Data_Print + "^XA^MD26^CWX,E:TT0003M_.FNT^FS^FT149,125^A@N,17,18,TT0003M_^FH" +
                                            "^FT149,110^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + AppProperties.recordedViolation.ViolationTicketCode + "^FS^CI0" +
                                            " ^FT149,136^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Violation_Advice + "^FS^CI0" +

                                            "^FT158,253^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + AppProperties.recordedViolation.ViolationIssueDate.ToString("dd/MM/yy hh:mm") + "^FS^CI0" +
                                            "^FT158,278^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Inspection_Location + "^FS^CI0" +
                                            "^FT159,304^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Emp_No + "^FS^CI0" +
                                            "^FT161,377^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Liscense_No + "^FS^CI0" +
                                            "^FT160,408^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + plate_details + "^FS^CI0" +


                                            "^FT18,619^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDSection 4: Defect Details:^FS^CI0" +
                                            "^FO18,623^GB200,0,1^FS" +
                                            " ^FT18,651^A@N,17,22,TT0003M_^FH\\^CI17^F8^FDNo.^FS^CI0" +
                                            "^FT75,651^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDDefect^FS^CI0" +
                                            "^FT498,651^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDSeverity^FS^CI0" +
                                             "^FO18,653^GB40,0,1^FS" +
                                            "^FO75,653^GB400,0,1^FS" +
                                            "^FO498,653^GB90,0,1^FS";
                int vertical_start_Point = 684;

                for (int i = 0; i < defectCodes.Length; i++)
                {
                    String Defect_Code = defectCodes[i][1].ToString().Replace("(D)", "").Trim();
                    String Defect_Name = defectCodes[i][0];
                    String Defect_Severity = defectCodes[i][2];
                    String Coments = defectCodes[i][3];

                    Data_Print = Data_Print + " ^FT18," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Defect_Code + "^FS^CI0";
                    Data_Print = Data_Print + " ^FT75," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Defect_Name + "^FS^CI0";
                    Data_Print = Data_Print + " ^FT501," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Defect_Severity + "^FS^CI0";
                    vertical_start_Point = vertical_start_Point + 27;
                    Data_Print = Data_Print + " ^FT75," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FDComments:^FS^CI0";
                    Data_Print = Data_Print + " ^FT177," + vertical_start_Point + "^A@N,17,18,TT0003M_^FH\\^CI17^F8^FD" + Coments + "^FS^CI0";
                    vertical_start_Point = vertical_start_Point + 30;

                }

                Data_Print = Data_Print + "  ^PQ1,0,1,Y^XZ";

               ////////////////////////////////////////////////
                 /////For  Printer With Problem
               /////////////////////////////////////////////


                */

                //   Data_Print = Data_Print + "  ^PQ1,0,1,Y^XZ";










                if (count_eng_print >= 0)
                {
                    if (WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), new CommonUtils().GetStringValue("lblTicketConfirmation"), WPFMessageBoxButtons.YesNo, WPFMessageBoxImage.Question) == WPFMessageBoxResult.Yes)
                    {
                        // MessageBox.Show("Print");

                        ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("Printing"), (bw, we) =>
                        {

                            // check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);
                            RawPrinterHelper.SendBytes("ZDesigner iMZ320 (ZPL)", encodedBytes);
                            // So this check in order to avoid default processing after the Cancel button has been pressed.
                            // This call will set the Cancelled flag on the result structure.
                            ProgressDialog.ProgressDialog.CheckForPendingCancellation(bw, we);

                        }, ProgressDialogSettings.WithSubLabelAndCancel);

                        if (result.Cancelled)
                            return;
                        else if (result.OperationFailed)
                            return;
                        count_eng_print++;
                    }
                }
                else
                {

                    //  MessageBox.Show("Print");
                    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("Printing"), (bw, we) =>
                    {

                        // check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);
                        RawPrinterHelper.SendBytes("ZDesigner iMZ320 (ZPL)", encodedBytes);
                        // So this check in order to avoid default processing after the Cancel button has been pressed.
                        // This call will set the Cancelled flag on the result structure.
                        ProgressDialog.ProgressDialog.CheckForPendingCancellation(bw, we);

                    }, ProgressDialogSettings.WithSubLabelAndCancel);

                    if (result.Cancelled)
                        return;
                    else if (result.OperationFailed)
                        return;
                    count_eng_print++;
                }








            }
            catch (Exception ex)
            {
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }
        }
        private void PrintEnglishRecipt()
        {
            try
            {


                String Violation_ID = violationTicketDetials.ViolationID;
                String Violation_Advice = violationTicketDetials.ViolationAdvice;
                String datetime = violationTicketDetials.DateTime;

                String Inspection_Location = violationTicketDetials.Location;
                String Emp_No = violationTicketDetials.RtaEmpNo;
                String Liscense_No = violationTicketDetials.DriverLicNo;
                String plate_details = violationTicketDetials.VehicleDetials;
                /// string[] splitted_Veh_Info = plate_details.Split(" ");

                string Data_Print = string.Empty;
                Data_Print = Data_Print + "^XA^MD13^CWX,E:TT0003M_.FNT^FS" +
                                               
                ////////////////////////////////////////////////////////////////


                "^FT164,100^AXN,17,18^FD" + Violation_ID + "^FS" +
                                           " ^FT164,121^AXN,17,18^FD" + Violation_Advice + "^FS" +

                                           "^FT164,246^AXN,17,18^FD" + datetime + "^FS" +
                                           "^FT164,271^AXN,17,18^FD" + Inspection_Location + "^FS" +
                                           "^FT164,297^AXN,17,18^FD" + Emp_No + "^FS" +
                                           "^FT164,368^AXN,17,18^FD" + Liscense_No + "^FS" +
                                           "^FT164,400^AXN,17,18^FD" + plate_details + "^FS" +

                                           "^FT22,627^AXN,17,18^FDSection 4: Defect Details:^FS" +
                                           "^FO22,638^GB200,0,1^FS " +
                                           " ^FT22,666^AXN,17,18^FDNo.^FS" +
                                            "^FO22,668^GB40,0,1^FS" +
                                           "^FT79,666^AXN,17,18^FDDefect^FS" +
                                           "^FO79,668^GB390,0,1^FS" +
                                           "^FT484,666^AXN,17,18^FDSeverity^FS" +

                                           "^FO484,668^GB68,0,1^FS";



                ///////////////////

                string zpl_defect_categories = string.Empty;

                for (int i = 0; i < violationTicketDetials.DefectDetails.Length; i++)
                {
                    string defect_cat = violationTicketDetials.DefectDetails[i].DefectCategory;
                    if (defect_cat == "Vehicle Identification")
                    {
                        zpl_defect_categories += "^FO30,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Engine") || (defect_cat=="Steering and Suspension"))
                    {
                        zpl_defect_categories += "^FO50,510^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Safety Requirements")
                    {
                        zpl_defect_categories += "^FO250,510^GC30,2,B^FS ";
                    }
                    if ((defect_cat == "Brake") || (defect_cat == "Wheels and Tyres"))
                    {
                        zpl_defect_categories += "^FO457,545^GC30,2,B^FS ";
                    }
                    if (defect_cat == "Lighting")
                    {
                        zpl_defect_categories += "^FO500,545^GC30,2,B^FS ";
                    }

                }
                Data_Print = Data_Print + zpl_defect_categories;

                int vertical_start_Point = 699;
                int max_defect_lenght = 45;
                int max_Coments_lenght = 35;
                for (int i = 0; i < violationTicketDetials.DefectDetails.Length; i++)
                {
                    String Defect_Code = violationTicketDetials.DefectDetails[i].DefectCode.ToString().Replace("(D)", "").Trim();
                    String Defect_Name;
       
                    Defect_Name = violationTicketDetials.DefectDetails[i].DefectName;
                   
                    String Defect_Severity = violationTicketDetials.DefectDetails[i].DefectSeverity;
                    String Coments = violationTicketDetials.DefectDetails[i].DefectValue;

                    string[] splitedDefectList = Defect_Name.Split(' ');

                    String Defect_Name_1stLine = String.Empty;
                    String Defect_Name_2ndLine = String.Empty;

                    foreach (string str in splitedDefectList)
                    {
                        if (Defect_Name_1stLine.Length + str.Length < max_defect_lenght)
                        {
                            Defect_Name_1stLine = Defect_Name_1stLine + str + " ";
                        }
                        else
                        {
                            Defect_Name_2ndLine += str + " ";
                        }
                    }
                    Data_Print = Data_Print + " ^FT22," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Code + "^FS";
                    Data_Print = Data_Print + " ^FT79," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Name_1stLine + "^FS";
                    Data_Print = Data_Print + " ^FT496," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Severity + "^FS";
                    if (Defect_Name_2ndLine != String.Empty)
                    {
                        vertical_start_Point = vertical_start_Point + 22;
                        Data_Print = Data_Print + " ^FT79," + vertical_start_Point + "^AXN,17,18^FD" + Defect_Name_2ndLine + "^FS";
                    }    
                    vertical_start_Point = vertical_start_Point + 27;

                    vertical_start_Point = vertical_start_Point + 27;

                    var splitedCmment = new List<string>();
                    String Coments_Name_1stLine = String.Empty;
                    String Comentst_Name_2ndLine = String.Empty;
                    if (Coments != null)
                    {
                        if (new CommonUtils().IsEnglish(Coments))
                        {
                            splitedCmment = Coments.Split(' ').ToList<string>();
                            foreach (string str in splitedCmment)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_Coments_lenght)
                                {
                                    Coments_Name_1stLine = Coments_Name_1stLine + str + " ";
                                }
                                else
                                {
                                    Comentst_Name_2ndLine += str + " ";
                                }
                            }
                        }
                        else
                        {
                            splitedCmment = new CommonUtils().SplitStringIntoWords2(Coments, Coments.Length);
                            foreach (string str in splitedCmment)
                            {
                                if (Coments_Name_1stLine.Length + str.Length < max_Coments_lenght)
                                {
                                    // Coments_Name_1stLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                    if (isNumeric)
                                    {
                                        Coments_Name_1stLine += "";
                                        Coments_Name_1stLine += str;
                                    }
                                    else
                                    {
                                        Coments_Name_1stLine += str ;
                                    }
                                }
                                else
                                {
                                    // Coments_Name_2ndLine += str + " ";
                                    int n;
                                    bool isNumeric = int.TryParse(str, out n);
                                    // Coments_Name_2ndLine += str + " ";
                                    if (isNumeric)
                                    {
                                        Comentst_Name_2ndLine += "";
                                        Comentst_Name_2ndLine += str;
                                    }
                                    else
                                    {
                                        Comentst_Name_2ndLine += str;
                                    }
                                }
                            } 
                        }
                    }


                    //  string[] splitedCmment = Coments.Split(' ');

                    

                   

                    Data_Print = Data_Print + " ^FT79," + vertical_start_Point + "^AXN,17,18^FDComments:^FS";
                    Data_Print = Data_Print + " ^FT178," + vertical_start_Point + "^CI28^AXN,17,18^F8^FD" + Coments_Name_1stLine + "^FS";

                    if (Comentst_Name_2ndLine != String.Empty)
                    {
                        vertical_start_Point = vertical_start_Point + 22;
                        Data_Print = Data_Print + " ^FT178," + vertical_start_Point + "^CI28^AXN,17,18^F8^FD" + Comentst_Name_2ndLine + "^FS";
                    } 
                   
                    vertical_start_Point = vertical_start_Point + 30;

                    //////////////////////////




                }

                Data_Print = Data_Print + "^PQ1,0,1,Y^XZ";
                UTF8Encoding utf8 = new UTF8Encoding();

                byte[] encodedBytes = utf8.GetBytes(Data_Print);

                if (WPFMessageBox.Show(new CommonUtils().GetStringValue("Confirmation"), new CommonUtils().GetStringValue("lblTicketConfirmation"), WPFMessageBoxButtons.YesNo, WPFMessageBoxImage.Question) == WPFMessageBoxResult.Yes)
                {
                    // MessageBox.Show("Print");

                    ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(this.m_MainWindow, new CommonUtils().GetStringValue("Printing"), (bw, we) =>
                    {

                        // check = iLogin.LoginOnline(AppProperties.empUserName, AppProperties.empPassword);
                        RawPrinterHelper.SendBytes("ZDesigner iMZ320 (ZPL)", encodedBytes);
                        // So this check in order to avoid default processing after the Cancel button has been pressed.
                        // This call will set the Cancelled flag on the result structure.
                        ProgressDialog.ProgressDialog.CheckForPendingCancellation(bw, we);

                    }, ProgressDialogSettings.WithSubLabelAndCancel);

                    if (result.Cancelled)
                        return;
                    else if (result.OperationFailed)
                        return;

                }
            }
            catch (Exception ex)
            {
                WPFMessageBox.Show(new CommonUtils().GetStringValue("Exception"), ex.Message, ex.StackTrace, WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
            }

        }