示例#1
0
        //+---------------------------------------------------------------------------
        //
        //  function:   EnumerateFaxOutgoingJobs
        //
        //  Synopsis:   Enumerates the Fax Jobs in the Outbox folder
        //
        //  Arguments:  [objFaxOutgoingJobs] - Fax Outgoing Jobs Object
        //
        //  Returns:    bool - true if the function was successful
        //
        //----------------------------------------------------------------------------
        static bool EnumerateFaxOutgoingJobs(IFaxOutgoingJobs objFaxOutgoingJobs, bool bCancelJob, string strJobId)
        {
            //check for NULL
            if ((objFaxOutgoingJobs == null) || (bCancelJob == true && strJobId == null))
            {
                System.Console.WriteLine("EnumerateFaxOutgoingJobs: Parameter passed is NULL");
                return(false);
            }

            IEnumerator objEnumerator = objFaxOutgoingJobs.GetEnumerator();

            objEnumerator.Reset();

            while (objEnumerator.MoveNext())
            {
                IFaxOutgoingJob objFaxOutgoingJob = (IFaxOutgoingJob)objEnumerator.Current;
                if (bCancelJob == true)
                {
                    if (String.Compare(objFaxOutgoingJob.Id, strJobId, true, CultureInfo.CurrentCulture) == 0)
                    {
                        objFaxOutgoingJob.Cancel();
                    }
                    System.Console.WriteLine("Job cancelled successfully");
                    return(true);
                }
                else
                {
                    System.Console.Write("Outgoing Job Id: " + objFaxOutgoingJob.Id);
                    System.Console.Write(" Subject: " + objFaxOutgoingJob.Subject);
                    System.Console.Write(" SenderName: " + objFaxOutgoingJob.Sender.Name);
                    System.Console.Write(" Submission Id: " + objFaxOutgoingJob.SubmissionId);
                    System.Console.WriteLine("");
                }
            }
            if (bCancelJob == false)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //+---------------------------------------------------------------------------
        //
        //  function:   EnumerateFaxOutgoingJobs
        //
        //  Synopsis:   Enumerates the Fax Jobs in the Outbox folder
        //
        //  Arguments:  [objFaxOutgoingJobs] - Fax Outgoing Jobs Object
        //
        //  Returns:    bool - true if the function was successful
        //
        //----------------------------------------------------------------------------
        static bool EnumerateFaxOutgoingJobs(IFaxOutgoingJobs objFaxOutgoingJobs)
        {
            //check for NULL
            if (objFaxOutgoingJobs == null)
            {
                System.Console.WriteLine("EnumerateFaxOutgoingJobs: Parameter passed is NULL");
                return(false);
            }
            System.Console.WriteLine("Enumerating Outgoing Jobs ...");

            IEnumerator objEnumerator = objFaxOutgoingJobs.GetEnumerator();

            objEnumerator.Reset();

            while (objEnumerator.MoveNext())
            {
                IFaxOutgoingJob objFaxOutgoingJob = (IFaxOutgoingJob)objEnumerator.Current;
                System.Console.WriteLine("Outgoing Job Id: " + objFaxOutgoingJob.Id);
            }
            return(true);
        }
        //+---------------------------------------------------------------------------
        //
        //  function:   EnumerateFaxOutgoingJobs
        //
        //  Synopsis:   Enumerates the Fax Jobs in the Outbox folder
        //
        //  Arguments:  [objFaxOutgoingJobs] - Fax Outgoing Jobs Object
        //
        //  Returns:    bool - true if the function was successful
        //
        //----------------------------------------------------------------------------
        static bool EnumerateFaxOutgoingJobs(IFaxOutgoingJobs objFaxOutgoingJobs, bool bCancelJob, string strJobId)
        {
            //check for NULL
                        if ((objFaxOutgoingJobs == null) || (bCancelJob == true && strJobId == null))
                        {
                                System.Console.WriteLine("EnumerateFaxOutgoingJobs: Parameter passed is NULL");
                                return false;
                        }

                        IEnumerator objEnumerator = objFaxOutgoingJobs.GetEnumerator();
                        objEnumerator.Reset();

                        while(objEnumerator.MoveNext())
                        {
                                IFaxOutgoingJob objFaxOutgoingJob = (IFaxOutgoingJob)objEnumerator.Current;
                                if (bCancelJob == true)
                                {
                                        if(String.Compare(objFaxOutgoingJob.Id, strJobId, true, CultureInfo.CurrentCulture) == 0)
                                                objFaxOutgoingJob.Cancel();
                                        System.Console.WriteLine("Job cancelled successfully");
                                        return true;
                                }
                                else
                                {

                                        System.Console.Write("Outgoing Job Id: " + objFaxOutgoingJob.Id);
                                        System.Console.Write(" Subject: " + objFaxOutgoingJob.Subject);
                                        System.Console.Write(" SenderName: " + objFaxOutgoingJob.Sender.Name);
                                        System.Console.Write(" Submission Id: " + objFaxOutgoingJob.SubmissionId);
                                        System.Console.WriteLine("");
                                }
                        }
                        if (bCancelJob == false)
                                return true;
                        else
                                return false;
        }
        //+---------------------------------------------------------------------------
        //
        //  function:   EnumerateFaxOutgoingJobs
        //
        //  Synopsis:   Enumerates the Fax Jobs in the Outbox folder
        //
        //  Arguments:  [objFaxOutgoingJobs] - Fax Outgoing Jobs Object
        //
        //  Returns:    bool - true if the function was successful
        //
        //----------------------------------------------------------------------------
        static bool EnumerateFaxOutgoingJobs(IFaxOutgoingJobs objFaxOutgoingJobs)
        {
            //check for NULL
                        if (objFaxOutgoingJobs == null)
                        {
                                System.Console.WriteLine("EnumerateFaxOutgoingJobs: Parameter passed is NULL");
                                return false;
                        }
                        System.Console.WriteLine("Enumerating Outgoing Jobs ...");

                        IEnumerator objEnumerator = objFaxOutgoingJobs.GetEnumerator();
                        objEnumerator.Reset();

                        while(objEnumerator.MoveNext())
                        {
                                IFaxOutgoingJob objFaxOutgoingJob = (IFaxOutgoingJob)objEnumerator.Current;
                                System.Console.WriteLine("Outgoing Job Id: " + objFaxOutgoingJob.Id);
                        }
                        return true;
        }