Ejemplo n.º 1
0
        public static XML_DOC_SET_TYPE DSC_ConvertToSettable(XML_DOC_DSC_TYPE xmlDocDsc)
        {
            XML_DOC_SET_TYPE xmlDocSet = new XML_DOC_SET_TYPE();

            xmlDocSet.property = null;

            COMPLEX_DSC_TYPE[] subComps = xmlDocDsc.complex;
            COMPLEX_SET_TYPE[] tmpComps = new COMPLEX_SET_TYPE[1];
            tmpComps[0] = DSC_ConvertToSettable(subComps[0]);

            xmlDocSet.complex = tmpComps;

            return(xmlDocSet);
        }
Ejemplo n.º 2
0
        //To retrieve the property value in the XML_DOC_SET_TYPE
        //gets the given property value in the XML_DOC_SET_TYPE
        public static string GetThePropValueFromXMLDOCSETType(XML_DOC_SET_TYPE xmlDocSET, string name)
        {
            string str_ret = string.Empty;

            if (xmlDocSET != null && name.Length > 0)
            {
                foreach (COMPLEX_SET_TYPE complex in xmlDocSET.complex)
                {
                    if (complex != null && (complex.sysname != null && complex.sysname.Length > 0))
                    {
                        str_ret = GetThePropValueRecursively(complex, name);
                    }
                }
            }
            return(str_ret);
        }
Ejemplo n.º 3
0
        //sets the specified property value in XML_DOC_SET_TYPE
        public static bool SetThePropValueInXMLDOCSETType(ref XML_DOC_SET_TYPE xmlDocSET, string complexName, string name, string new_value)
        {
            bool bRet = false;

            if (xmlDocSET != null && name.Length > 0)
            {
                for (int k = 0; k < xmlDocSET.complex.Length; k++)
                {
                    if (xmlDocSET.complex[k] != null && (xmlDocSET.complex[k].sysname != null && xmlDocSET.complex[k].sysname.Length > 0))
                    {
                        if (xmlDocSET.complex[k].sysname == complexName)
                        {
                            complexName = null;
                        }
                        bRet = SetThePropValueRecursively(ref xmlDocSET.complex[k], complexName, name, new_value);
                    }
                }
            }
            return(bRet);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Inits the values.
        /// </summary>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintReleaseDevice.Browser.PrintJobs.InitValues.jpg"/>
        /// </remarks>
        private void InitValues()
        {
            try
            {
                bool create = CreateWS();
                if (create)
                {
                    XML_DOC_DSC_TYPE  xmlDoc = new XML_DOC_DSC_TYPE();
                    ARG_SETTABLE_TYPE arg    = new ARG_SETTABLE_TYPE();
                    arg.Item = (E_MFP_JOB_TYPE)E_MFP_JOB_TYPE.PRINT;

                    xmlDoc = mfpWebService.GetJobSettableElements(arg, ref OsaDirectManager.Core.g_WSDLGeneric);

                    XML_DOC_SET_TYPE SETxmlDoc = null;

                    SETxmlDoc = OsaDirectManager.Core.ConvertDSCToSETType(xmlDoc);
                    Session["XML_DOC_SET_TYPE"] = (XML_DOC_SET_TYPE)SETxmlDoc;
                }
            }
            catch (SoapException)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
 public void SetJobElements(OSA_JOB_ID_TYPE jid, XML_DOC_SET_TYPE set)
 {
     base.SetJobElements(jid, set, ref wsdlGeneric);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Runs the WS calls.
        /// </summary>
        /// <returns>string</returns>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintReleaseDevice.Browser.PrintJobs.RunWSCalls.jpg"/>
        /// </remarks>
        private string RunWSCalls()
        {
            string returnValue = string.Empty;

            try
            {
                Hashtable htPrintFiles = new Hashtable();
                htPrintFiles.Add(0, Session["__SelectedFiles"] as string);
                Session["PrintFiles"] = htPrintFiles;

                // retrieve UISessionId from header sent from MFP
                string sessionID = Request.QueryString["UISessionId"].ToString();
                Session["UISESSIONID"] = sessionID;
                bool isWsCreated = CreateWS();
                //subscribe data
                ACCESS_POINT_TYPE aType = new ACCESS_POINT_TYPE();
                aType.URLType = E_ADDRESSPOINT_TYPE.SOAP;
                string sLocalAddrs        = @Request.Params["LOCAL_ADDR"].ToString();
                string sRequestCurAppPath = Request.ApplicationPath;
                if (String.Compare(WebConfigurationManager.AppSettings["UseSSL"].ToString(), "true", true, CultureInfo.CurrentCulture) == 0)
                {
                    aType.Value = @"https://";
                }
                else
                {
                    aType.Value = @"http://";
                }
                aType.Value = aType.Value + @sLocalAddrs + @sRequestCurAppPath + @"/MFPEventsCapture.asmx";

                if (isWsCreated)
                {
                    // create a new Print job
                    string printedFiles = Session["__SelectedFiles"] as string;
                    string printJobIDs  = string.Empty;

                    Dictionary <string, OSA_JOB_ID_TYPE> jobStatus = new Dictionary <string, OSA_JOB_ID_TYPE>();

                    if (!string.IsNullOrEmpty(printedFiles))
                    {
                        string[] printedFileList = printedFiles.Split(",".ToCharArray());

                        for (int fileIndex = 0; fileIndex < printedFileList.Length; fileIndex++)
                        {
                            string currentPrintFile = printedFileList[fileIndex].Trim();
                            try
                            {
                                OSA_JOB_ID_TYPE currentJobID = (OSA_JOB_ID_TYPE)mfpWebService.CreateJob(E_MFP_JOB_TYPE.PRINT, Session["UISESSIONID"].ToString(), ref OsaDirectManager.Core.g_WSDLGeneric);
                                printJobIDs += (OSA_JOB_ID_TYPE)currentJobID;

                                XML_DOC_SET_TYPE setData = (XML_DOC_SET_TYPE)Session["XML_DOC_SET_TYPE"];
                                if (setData != null && IsJobCreated())
                                {
                                    string urlPath = ProvideFilePath(currentPrintFile);

                                    OsaDirectManager.Core.SetThePropValueInXMLDOCSETType(ref setData, "delivery-info", "file-name", "unknown.prn");
                                    OsaDirectManager.Core.SetThePropValueInXMLDOCSETType(ref setData, "http-destination", "url", urlPath);
                                }
                                Session["XML_DOC_SET_TYPE"] = (XML_DOC_SET_TYPE)setData;
                                //populate the file ext
                                Session["FILEEXT"] = OsaDirectManager.Core.GetFileExtension(setData);
                                // set up all Print parameters specified above
                                mfpWebService.SetJobElements(currentJobID, setData, ref OsaDirectManager.Core.g_WSDLGeneric);
                                //subscribe for ON_HKEY_PRESSED event
                                mfpWebService.Subscribe(currentJobID, E_EVENT_ID_TYPE.ON_HKEY_PRESSED, aType, true, ref OsaDirectManager.Core.g_WSDLGeneric);
                                mfpWebService.ExecuteJob(currentJobID, ref OsaDirectManager.Core.g_WSDLGeneric);
                                jobStatus.Add(currentPrintFile, currentJobID);
                            }
                            catch (SoapException soapEx)
                            {
                                DisplaySoapException(soapEx);
                                break;
                            }
                            catch (Exception generalExp)
                            {
                                DisplayException(generalExp);
                                break;;
                            }
                        }
                        Session["deleteJobs"] = null;
                    }

                    if (!string.IsNullOrEmpty(printJobIDs))
                    {
                        Session["CurrentJobIDs"] = jobStatus;
                    }
                }
                else
                {
                    DisplayMessage("Failed to create Webservice Object");
                }
            }
            catch (Exception generalExp)
            {
                DisplayException(generalExp);
            }
            return(returnValue);
        }