public CreateOrderDocument GetOrderDocumentData(string OrderDocXML)
        {
            CreateOrderDocument _coData = new CreateOrderDocument();


            ObjectParameter opExportPath  = new ObjectParameter("p_cExportPath", "");
            ObjectParameter opPDFFileName = new ObjectParameter("p_cKey", "");
            ObjectParameter opErrorDesc   = new ObjectParameter("p_cError", "");



            var obj = context.DodajPantheonDokument(OrderDocXML, opExportPath, opPDFFileName, opErrorDesc);


            string sExportPath  = Convert.ToString(opExportPath.Value);
            string sPDFFileName = Convert.ToString(opPDFFileName.Value);
            string sErrorDesc   = Convert.ToString(opErrorDesc.Value);


            if (sErrorDesc.Length > 0)
            {
                throw new Exception("PDO Run Procedure _upJM_CreateSupplierOrder error:" + "<br><br>" + sErrorDesc);
            }

            _coData.ExportPath = sExportPath;
            _coData.PDFFile    = sPDFFileName;
            _coData.ErrorDesc  = sErrorDesc;


            return(_coData);
        }
        //public string GetOrderPDFFilePDO(int iPDOOrderID)
        //{
        //    try
        //    {
        //        OrderPDOFullModel rfm = orderPDORepo.GetOrderByID(iPDOOrderID);
        //        string curFile = "";
        //        string sResult = "";

        //        if (rfm != null)
        //        {
        //            rfm.NarociloStevilka_P = (rfm.NarociloStevilka_P != null) ? rfm.NarociloStevilka_P : "xxx";

        //            // če je 5x neuspešno, potem se pošlje mail Daniju
        //            if ((rfm.P_UnsuccCountCreatePDFPantheon >= 5) && (rfm.P_SendWarningToAdmin == 0))
        //            {

        //                messageRepo.CreateEmailForAdmin_NoPDFForOrder("", rfm.NarociloStevilka_P.ToString(), rfm.P_TransportOrderPDFName, false);
        //                rfm.P_SendWarningToAdmin = 1;
        //                return "NOT_EXIST";
        //            }
        //            else if (rfm.P_SendWarningToAdmin == 1)
        //            {
        //                DataTypesHelper.LogThis("Za naročilo št. " + rfm.NarociloStevilka_P + " ni bilo kreirano PDF in je bil poslal že mail administraotrju.");
        //                return "NOT_EXIST";
        //            }

        //            curFile = ((rfm.P_TransportOrderPDFDocPath != null) && (rfm.P_TransportOrderPDFDocPath.Length > 0)) ? rfm.P_TransportOrderPDFDocPath : "";

        //            sResult = File.Exists(curFile) ? "EXIST" : "NOT_EXIST";
        //        }

        //        if (sResult != "EXIST")
        //        {
        //            LaunchPantheonCreatePDF();
        //            rfm.P_UnsuccCountCreatePDFPantheon++;
        //            rfm.P_LastTSCreatePDFPantheon = DateTime.Now;
        //        }
        //        else
        //        {
        //            InquiryStatus stat = orderPDORepo.GetPovprasevanjaStatusByCode(Enums.StatusOfInquiry.KREIRAN_POSLAN_PDF.ToString());
        //            if (stat != null)
        //            {
        //                rfm.StatusID = stat.StatusPovprasevanjaID;
        //                rfm.P_GetPDFOrderFile = DateTime.Now;
        //                // Create mail for prevoznik
        //                messageRepoPDO.CreateEmailForSupplierOrder(rfm);
        //            }

        //        }

        //        orderPDORepo.SaveOrder(rfm, true, false);

        //        return sResult;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}


        public void CreateOrderTransport(CreateOrderModel model)
        {
            try
            {
                RecallFullModel rfm = recallRepo.GetRecallFullModelByID(model.RecallID);

                if (rfm.P_CreateOrder.Year < 2000)
                {
                    DataTypesHelper.LogThis("cREATE oRDER xml");
                    string xml = GetXMLForOrder(model);
                    DataTypesHelper.LogThis(xml);

                    DataTypesHelper.LogThis("Run Create order procedure _upJM_CreateSupplierOrder");
                    // run store procedure _upJM_CreateSupplierOrder
                    CreateOrderDocument coData = sqlFunctionRepo.GetOrderDocumentData(xml);


                    DataTypesHelper.LogThis("Update Create order Recall Data");
                    // update odpoklic - uspešno kreirana naročilnica v pantheonu


                    RecallStatus stat = recallRepo.GetRecallStatusByCode(Enums.StatusOfRecall.USTVARJENO_NAROCILO.ToString());
                    if (stat != null)
                    {
                        rfm.StatusID = stat.StatusOdpoklicaID;
                    }

                    rfm.P_UnsuccCountCreatePDFPantheon = 0;
                    rfm.P_CreateOrder              = DateTime.Now;
                    rfm.P_TransportOrderPDFName    = coData.PDFFile.ToString();
                    rfm.P_TransportOrderPDFDocPath = coData.ExportPath.ToString();
                    recallRepo.SaveRecall(rfm, true);

                    //DataTypesHelper.LogThis("Launch Create PDF Pantheon.exe");
                    // launch Pantheon EXE command
                    //LaunchPantheonCreatePDF();
                    DataTypesHelper.LogThis("Finish CreateOrderTransport");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        public CreateOrderDocument GetOrderDocumentData(string OrderDocXML)
        {
            CreateOrderDocument _coData = new CreateOrderDocument();


            ObjectParameter opExportPath  = new ObjectParameter("p_cExportPath", "");
            ObjectParameter opPDFFileName = new ObjectParameter("p_cKey", "");
            ObjectParameter opErrorDesc   = new ObjectParameter("p_cError", "");



            var obj = context.DodajPantheonDokument(OrderDocXML, opExportPath, opPDFFileName, opErrorDesc);


            string sExportPath  = Convert.ToString(opExportPath.Value);
            string sPDFFileName = Convert.ToString(opPDFFileName.Value);
            string sErrorDesc   = Convert.ToString(opErrorDesc.Value);

            DataTypesHelper.LogThis("Številka naročilnice: " + sPDFFileName);

            if (sErrorDesc.Length > 0)
            {
                DataTypesHelper.LogThis("Error create naročilnica : " + sErrorDesc);
            }

            if (sErrorDesc.Length > 0)
            {
                throw new Exception(ValidationExceptionError.res_28 + "<br><br>" + sErrorDesc);
            }

            _coData.ExportPath = sExportPath;
            _coData.PDFFile    = sPDFFileName;
            _coData.ErrorDesc  = sErrorDesc;


            return(_coData);
        }