Exemple #1
0
        //+---------------------------------------------------------------------------
        //
        //  function:   addRule
        //
        //  Synopsis:   adds a routing rule to FaxOutboundRoutingRules
        //
        //  Arguments:  [objFaxOutRoutRules] - FaxOutboundRoutingRules object pointing to the Routing Rules of the current server
        //                [strGrpName] - Routing Group Name
        //                [strDevId] - device ids for the new group
        //
        //  Returns:    bool: true if passed successfully
        //
        //----------------------------------------------------------------------------
        static bool addRule(IFaxOutboundRoutingRules objFaxOutRoutRules, string strGrpName, string strDevId, string strCountryCode, string strAreaCode, bool bUseDevice)
        {
            bool bRetVal = false;
            IFaxOutboundRoutingRule objFaxOutRoutRule = null;

            //check for null
            if (objFaxOutRoutRules == null || (strGrpName == null && bUseDevice == false) || (strDevId == null && bUseDevice == true) || strCountryCode == null || strAreaCode == null)
            {
                System.Console.WriteLine("addRule: Parameter passed is null");
                bRetVal = false;
                goto Exit;
            }
            int iDevId = -1;

            if (strDevId != null)
            {
                iDevId = Int32.Parse(strDevId, CultureInfo.CurrentCulture.NumberFormat);
            }

            //Set Area Code and Country Code for all codes
            objFaxOutRoutRule = objFaxOutRoutRules.Add(Int32.Parse(strCountryCode, CultureInfo.CurrentCulture.NumberFormat), Int32.Parse(strAreaCode, CultureInfo.CurrentCulture.NumberFormat), bUseDevice, strGrpName, iDevId);
            System.Console.WriteLine("Rule added successfully. ");
            bRetVal = true;
Exit:
            return(bRetVal);
        }
Exemple #2
0
        //+---------------------------------------------------------------------------
        //
        //  function:   removeRule
        //
        //  Synopsis:   removes a routing rule from FaxOutboundRoutingRules based on index
        //
        //  Arguments:  [objFaxOutRoutRules] - FaxOutboundRoutingRules object pointing to the Routing Rules of the current server
        //                [index] - index of the group to be removed
        //
        //  Returns:    bool: true if passed successfully
        //
        //----------------------------------------------------------------------------
        static bool removeRule(IFaxOutboundRoutingRules objFaxOutRoutRules, int index)
        {
            bool bRetVal = false;
            long lCount  = 0;

            //check for null
            if (objFaxOutRoutRules == null)
            {
                System.Console.WriteLine("removeRule: Parameter passed is null");
                bRetVal = false;
                goto Exit;
            }

            //get the count
            lCount = objFaxOutRoutRules.Count;
            //check if valid
            if (index > lCount || index <= 0)
            {
                System.Console.Write("removeRule: Invalid index value. It can be from 1 to ");
                System.Console.WriteLine(lCount);
                bRetVal = false;
                goto Exit;
            }

            //remove rule
            objFaxOutRoutRules.Remove(index);
            System.Console.WriteLine("Rule removed successfully. ");
            bRetVal = true;
Exit:
            return(bRetVal);
        }
        //+---------------------------------------------------------------------------
        //
        //  function:   addRule
        //
        //  Synopsis:   adds a routing rule to FaxOutboundRoutingRules
        //
        //  Arguments:  [objFaxOutRoutRules] - FaxOutboundRoutingRules object pointing to the Routing Rules of the current server
        //                [strGrpName] - Routing Group Name
        //                [strDevId] - device ids for the new group
        //
        //  Returns:    bool: true if passed successfully
        //
        //----------------------------------------------------------------------------
        static bool addRule(IFaxOutboundRoutingRules objFaxOutRoutRules, string strGrpName, string strDevId, string strCountryCode , string strAreaCode, bool bUseDevice)
        {
            bool bRetVal = false;
                        IFaxOutboundRoutingRule objFaxOutRoutRule = null;

                        //check for null
                        if (objFaxOutRoutRules == null || (strGrpName == null && bUseDevice == false) || (strDevId == null && bUseDevice == true ) || strCountryCode == null || strAreaCode == null)
                        {
                                System.Console.WriteLine("addRule: Parameter passed is null");
                                bRetVal = false;
                                goto Exit;
                        }
                        int iDevId = -1;
                        if(strDevId != null)
                            iDevId = Int32.Parse(strDevId, CultureInfo.CurrentCulture.NumberFormat);

                        //Set Area Code and Country Code for all codes
                        objFaxOutRoutRule =  objFaxOutRoutRules.Add(Int32.Parse(strCountryCode, CultureInfo.CurrentCulture.NumberFormat), Int32.Parse(strAreaCode, CultureInfo.CurrentCulture.NumberFormat), bUseDevice, strGrpName, iDevId);
                        System.Console.WriteLine("Rule added successfully. ");
                        bRetVal = true;
            Exit:
                        return bRetVal;
        }
        //+---------------------------------------------------------------------------
        //
        //  function:   removeRule
        //
        //  Synopsis:   removes a routing rule from FaxOutboundRoutingRules based on index
        //
        //  Arguments:  [objFaxOutRoutRules] - FaxOutboundRoutingRules object pointing to the Routing Rules of the current server
        //                [index] - index of the group to be removed
        //
        //  Returns:    bool: true if passed successfully
        //
        //----------------------------------------------------------------------------
        static bool removeRule(IFaxOutboundRoutingRules objFaxOutRoutRules, int index)
        {
            bool bRetVal = false;
                        long lCount =0;
                        //check for null
                        if (objFaxOutRoutRules == null)
                        {
                                System.Console.WriteLine("removeRule: Parameter passed is null");
                                bRetVal = false;
                                goto Exit;
                        }

                        //get the count
                        lCount = objFaxOutRoutRules.Count;
                        //check if valid
                        if(index > lCount || index <=0)
                        {
                                System.Console.Write("removeRule: Invalid index value. It can be from 1 to ");
                                System.Console.WriteLine(lCount);
                                bRetVal = false;
                                goto Exit;
                        }

                        //remove rule
                        objFaxOutRoutRules.Remove(index);
                        System.Console.WriteLine("Rule removed successfully. ");
                        bRetVal = true;
            Exit:
                        return bRetVal;
        }
        //+---------------------------------------------------------------------------
        //
        //  function:   listRules
        //
        //  Synopsis:   list of Routing Rules on the Server
        //
        //  Arguments:  [objFaxOutRoutRules] - FaxOutboundRoutingRules object pointing to the Routing Rules of the current server
        //
        //  Returns:    bool: true if passed successfully
        //
        //----------------------------------------------------------------------------
        static bool listRules(IFaxOutboundRoutingRules objFaxOutRoutRules)
        {
            bool bRetVal = true;
                        long lCount =0;
                        IFaxOutboundRoutingRule objFaxOutRoutRule = null;

                        //check for null
                        if (objFaxOutRoutRules == null)
                        {
                                System.Console.WriteLine("listRules: Parameter passed is null");
                                goto Exit;
                        }

                        System.Console.WriteLine(" Listing Routing Rule details.... ");

                        lCount = objFaxOutRoutRules.Count;

                        for(int i =0; i< lCount; i++)
                        {
                                long lDeviceId = 0;
                                long lAreaCode = 0;
                                long lCountryCode = 0;
                                bool bUseDevice = false;
                                FAX_RULE_STATUS_ENUM enumStatus;
                                string  strGrpName = null;

                                objFaxOutRoutRule = objFaxOutRoutRules[i+1] ;
                                lAreaCode = objFaxOutRoutRule.AreaCode;
                                lCountryCode = objFaxOutRoutRule.CountryCode;
                                lDeviceId = objFaxOutRoutRule.DeviceId;
                                strGrpName = objFaxOutRoutRule.GroupName;
                                bUseDevice = objFaxOutRoutRule.UseDevice;
                                enumStatus = objFaxOutRoutRule.Status;

                                System.Console.WriteLine(" ===================================================");
                                System.Console.Write("Rule No: ");
                                System.Console.Write(i+1);
                                System.Console.Write("Group Name = ");
                                System.Console.WriteLine(strGrpName);

                                if(lAreaCode == (long) FAX_ROUTING_RULE_CODE_ENUM.frrcANY_CODE)
                                        System.Console.WriteLine("Area Code: The outbound routing rule applies to all area codes. ");
                                else
                                {
                                        System.Console.Write("Area Code: ");
                                        System.Console.WriteLine(lAreaCode);
                                }

                                if (lCountryCode == (long) FAX_ROUTING_RULE_CODE_ENUM.frrcANY_CODE)
                                        System.Console.WriteLine("Country Code: The outbound routing rule applies to all area codes. ");
                                else
                                {
                                        System.Console.Write("Country Code: ");
                                        System.Console.WriteLine(lCountryCode);
                                }

                                System.Console.Write("Associated Device Id: = ");
                                System.Console.WriteLine(lDeviceId);

                                if(bUseDevice == true)
                                        System.Console.WriteLine("Applies to single device ");
                                else
                                        System.Console.WriteLine("Applies to group of devices. ");

                                if (enumStatus == FAX_RULE_STATUS_ENUM.frsVALID)
                                        System.Console.WriteLine("Status : The routing rule is valid and can be applied to outbound faxes. ");
                                if(enumStatus ==  FAX_RULE_STATUS_ENUM.frsEMPTY_GROUP )
                                        System.Console.WriteLine("Status : The routing rule cannot be applied because the rule uses an outbound routing group for its destination and the group is empty. ") ;
                                if(enumStatus ==   FAX_RULE_STATUS_ENUM.frsALL_GROUP_DEV_NOT_VALID)
                                        System.Console.WriteLine("Status : The routing rule cannot be applied because the rule uses an existing outbound routing group for its destination and the group does not contain devices that are valid for sending faxes. ");
                                if (enumStatus == FAX_RULE_STATUS_ENUM.frsSOME_GROUP_DEV_NOT_VALID)
                                        System.Console.WriteLine("Status : The routing rule uses an existing outbound routing group for its destination but the group contains devices that are not valid for sending faxes. ") ;
                                if (enumStatus == FAX_RULE_STATUS_ENUM.frsBAD_DEVICE)
                                        System.Console.WriteLine("Status : The routing rule cannot be applied because the rule uses a single device for its destination and that device is not valid for sending faxes. ") ;
                        }
            Exit:
                        return bRetVal;
        }
Exemple #6
0
        //+---------------------------------------------------------------------------
        //
        //  function:   listRules
        //
        //  Synopsis:   list of Routing Rules on the Server
        //
        //  Arguments:  [objFaxOutRoutRules] - FaxOutboundRoutingRules object pointing to the Routing Rules of the current server
        //
        //  Returns:    bool: true if passed successfully
        //
        //----------------------------------------------------------------------------
        static bool listRules(IFaxOutboundRoutingRules objFaxOutRoutRules)
        {
            bool bRetVal = true;
            long lCount  = 0;
            IFaxOutboundRoutingRule objFaxOutRoutRule = null;

            //check for null
            if (objFaxOutRoutRules == null)
            {
                System.Console.WriteLine("listRules: Parameter passed is null");
                goto Exit;
            }

            System.Console.WriteLine(" Listing Routing Rule details.... ");

            lCount = objFaxOutRoutRules.Count;

            for (int i = 0; i < lCount; i++)
            {
                long lDeviceId    = 0;
                long lAreaCode    = 0;
                long lCountryCode = 0;
                bool bUseDevice   = false;
                FAX_RULE_STATUS_ENUM enumStatus;
                string strGrpName = null;

                objFaxOutRoutRule = objFaxOutRoutRules[i + 1];
                lAreaCode         = objFaxOutRoutRule.AreaCode;
                lCountryCode      = objFaxOutRoutRule.CountryCode;
                lDeviceId         = objFaxOutRoutRule.DeviceId;
                strGrpName        = objFaxOutRoutRule.GroupName;
                bUseDevice        = objFaxOutRoutRule.UseDevice;
                enumStatus        = objFaxOutRoutRule.Status;

                System.Console.WriteLine(" ===================================================");
                System.Console.Write("Rule No: ");
                System.Console.Write(i + 1);
                System.Console.Write("Group Name = ");
                System.Console.WriteLine(strGrpName);

                if (lAreaCode == (long)FAX_ROUTING_RULE_CODE_ENUM.frrcANY_CODE)
                {
                    System.Console.WriteLine("Area Code: The outbound routing rule applies to all area codes. ");
                }
                else
                {
                    System.Console.Write("Area Code: ");
                    System.Console.WriteLine(lAreaCode);
                }


                if (lCountryCode == (long)FAX_ROUTING_RULE_CODE_ENUM.frrcANY_CODE)
                {
                    System.Console.WriteLine("Country Code: The outbound routing rule applies to all area codes. ");
                }
                else
                {
                    System.Console.Write("Country Code: ");
                    System.Console.WriteLine(lCountryCode);
                }

                System.Console.Write("Associated Device Id: = ");
                System.Console.WriteLine(lDeviceId);

                if (bUseDevice == true)
                {
                    System.Console.WriteLine("Applies to single device ");
                }
                else
                {
                    System.Console.WriteLine("Applies to group of devices. ");
                }


                if (enumStatus == FAX_RULE_STATUS_ENUM.frsVALID)
                {
                    System.Console.WriteLine("Status : The routing rule is valid and can be applied to outbound faxes. ");
                }
                if (enumStatus == FAX_RULE_STATUS_ENUM.frsEMPTY_GROUP)
                {
                    System.Console.WriteLine("Status : The routing rule cannot be applied because the rule uses an outbound routing group for its destination and the group is empty. ");
                }
                if (enumStatus == FAX_RULE_STATUS_ENUM.frsALL_GROUP_DEV_NOT_VALID)
                {
                    System.Console.WriteLine("Status : The routing rule cannot be applied because the rule uses an existing outbound routing group for its destination and the group does not contain devices that are valid for sending faxes. ");
                }
                if (enumStatus == FAX_RULE_STATUS_ENUM.frsSOME_GROUP_DEV_NOT_VALID)
                {
                    System.Console.WriteLine("Status : The routing rule uses an existing outbound routing group for its destination but the group contains devices that are not valid for sending faxes. ");
                }
                if (enumStatus == FAX_RULE_STATUS_ENUM.frsBAD_DEVICE)
                {
                    System.Console.WriteLine("Status : The routing rule cannot be applied because the rule uses a single device for its destination and that device is not valid for sending faxes. ");
                }
            }
Exit:
            return(bRetVal);
        }