//+--------------------------------------------------------------------------- // // function: addGroup // // Synopsis: adds a routing group to FaxOutboundRoutingGroups // // Arguments: [objFaxOutRoutGrps] - FaxOutboundRoutingGroups object pointing to the Routing Groups of the current server // [strGrpName] - Routing Group Name // [strDevIds] - device ids for the new group // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool addGroup(IFaxOutboundRoutingGroups objFaxOutRoutGrps, string strGrpName, string strDevIds) { bool bRetVal = false; bool bRet = false; int iDevCount=0; IFaxOutboundRoutingGroup objFaxOutRoutGrp = null; IFaxDeviceIds objFaxDevIds = null; //check for NULL if (objFaxOutRoutGrps == null || strGrpName == null || strDevIds == null) { System.Console.WriteLine("addGroup: Parameter passed is null"); bRetVal = false; goto Exit; } objFaxOutRoutGrp = objFaxOutRoutGrps.Add(strGrpName); string[] devArr = SplitDevIds(strDevIds, ref iDevCount, ref bRet); objFaxDevIds = objFaxOutRoutGrp.DeviceIds; for(int i = 0; i < iDevCount ; i++) { int iVal = Int32.Parse(devArr[i], CultureInfo.CurrentCulture.NumberFormat); objFaxDevIds.Add(iVal); } System.Console.WriteLine("Group added successfully. "); bRetVal = true; Exit: return bRetVal; }
//+--------------------------------------------------------------------------- // // function: addGroup // // Synopsis: adds a routing group to FaxOutboundRoutingGroups // // Arguments: [objFaxOutRoutGrps] - FaxOutboundRoutingGroups object pointing to the Routing Groups of the current server // [strGrpName] - Routing Group Name // [strDevIds] - device ids for the new group // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool addGroup(IFaxOutboundRoutingGroups objFaxOutRoutGrps, string strGrpName, string strDevIds) { bool bRetVal = false; bool bRet = false; int iDevCount = 0; IFaxOutboundRoutingGroup objFaxOutRoutGrp = null; IFaxDeviceIds objFaxDevIds = null; //check for NULL if (objFaxOutRoutGrps == null || strGrpName == null || strDevIds == null) { System.Console.WriteLine("addGroup: Parameter passed is null"); bRetVal = false; goto Exit; } objFaxOutRoutGrp = objFaxOutRoutGrps.Add(strGrpName); string[] devArr = SplitDevIds(strDevIds, ref iDevCount, ref bRet); objFaxDevIds = objFaxOutRoutGrp.DeviceIds; for (int i = 0; i < iDevCount; i++) { int iVal = Int32.Parse(devArr[i], CultureInfo.CurrentCulture.NumberFormat); objFaxDevIds.Add(iVal); } System.Console.WriteLine("Group added successfully. "); bRetVal = true; Exit: return(bRetVal); }
//+--------------------------------------------------------------------------- // // function: removeGroup // // Synopsis: removes a routing group from FaxOutboundRoutingGroups based on index // // Arguments: [objFaxOutRoutGrps] - FaxOutboundRoutingGroups object pointing to the Routing Groups of the current server // [index] - index of the group to be removed // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool removeGroup(IFaxOutboundRoutingGroups objFaxOutRoutGrps, int index) { bool bRetVal = false; long lCount = 0; //check for null if (objFaxOutRoutGrps == null) { System.Console.WriteLine("removeGroup: Parameter passed is null"); bRetVal = false; goto Exit; } //get count of groups lCount = objFaxOutRoutGrps.Count; //invalid index if (index > lCount || index <= 0) { System.Console.Write("removeGroup: Invalid index value. It can be from 1 to "); System.Console.WriteLine(lCount); bRetVal = false; goto Exit; } //remove group objFaxOutRoutGrps.Remove(index); System.Console.WriteLine("Group removed successfully. "); bRetVal = true; Exit: return(bRetVal); }
//+--------------------------------------------------------------------------- // // function: removeGroup // // Synopsis: removes a routing group from FaxOutboundRoutingGroups based on index // // Arguments: [objFaxOutRoutGrps] - FaxOutboundRoutingGroups object pointing to the Routing Groups of the current server // [index] - index of the group to be removed // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool removeGroup(IFaxOutboundRoutingGroups objFaxOutRoutGrps, int index) { bool bRetVal = false; long lCount =0; //check for null if (objFaxOutRoutGrps == null) { System.Console.WriteLine("removeGroup: Parameter passed is null"); bRetVal = false; goto Exit; } //get count of groups lCount = objFaxOutRoutGrps.Count; //invalid index if(index > lCount || index <=0) { System.Console.Write("removeGroup: Invalid index value. It can be from 1 to "); System.Console.WriteLine(lCount); bRetVal = false; goto Exit; } //remove group objFaxOutRoutGrps.Remove(index); System.Console.WriteLine("Group removed successfully. "); bRetVal = true; Exit: return bRetVal; }
//+--------------------------------------------------------------------------- // // function: listGroups // // Synopsis: list of Routing Groups on the Server // // Arguments: [objFaxOutRoutGrps] - FaxOutboundRoutingGroups object pointing to the Routing Groups of the current server // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool listGroups(IFaxOutboundRoutingGroups objFaxOutRoutGrps) { bool bRetVal = true; long lCount =0; IFaxOutboundRoutingGroup objFaxOutRoutGrp = null; string strGrpName = null; //check for null if (objFaxOutRoutGrps == null) { System.Console.WriteLine("listGroups: Parameter passed is null"); goto Exit; } System.Console.WriteLine(" Listing Routing Group details...."); lCount = objFaxOutRoutGrps.Count; //enumerate for(int i =0; i< lCount; i++) { IFaxDeviceIds objFaxDevIds = null; FAX_GROUP_STATUS_ENUM enumStatus; objFaxOutRoutGrp = objFaxOutRoutGrps[i+1]; objFaxDevIds = objFaxOutRoutGrp.DeviceIds; strGrpName = objFaxOutRoutGrp.Name; enumStatus = objFaxOutRoutGrp.Status; //print all the details System.Console.WriteLine(" ==================================================="); System.Console.Write("Group No: "); System.Console.Write(i+1); System.Console.WriteLine("Group Name = "); System.Console.WriteLine(strGrpName); if(enumStatus == FAX_GROUP_STATUS_ENUM.fgsALL_DEV_VALID ) System.Console.WriteLine("Status : All the devices in the routing group are valid and available for sending outgoing faxes. " ); if (enumStatus == FAX_GROUP_STATUS_ENUM.fgsEMPTY) System.Console.WriteLine("Status : The routing group does not contain any devices. " ); if (enumStatus == FAX_GROUP_STATUS_ENUM.fgsALL_DEV_NOT_VALID) System.Console.WriteLine("Status : The routing group does not contain any available devices for sending faxes. (Devices can be \"unavailable\" when they are offline and when they do not exist.) " ); if (enumStatus == FAX_GROUP_STATUS_ENUM.fgsSOME_DEV_NOT_VALID) System.Console.WriteLine("Status : The routing group contains some devices that are unavailable for sending faxes. (Devices can be \"unavailable\" when they are offline and when they do not exist.) " ); if(!listDeviceIds(objFaxDevIds)) { //we dont want to log any error here as the error will be logged in the function itself bRetVal = false; } } Exit: return bRetVal; }
//+--------------------------------------------------------------------------- // // function: listGroups // // Synopsis: list of Routing Groups on the Server // // Arguments: [objFaxOutRoutGrps] - FaxOutboundRoutingGroups object pointing to the Routing Groups of the current server // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool listGroups(IFaxOutboundRoutingGroups objFaxOutRoutGrps) { bool bRetVal = true; long lCount = 0; IFaxOutboundRoutingGroup objFaxOutRoutGrp = null; string strGrpName = null; //check for null if (objFaxOutRoutGrps == null) { System.Console.WriteLine("listGroups: Parameter passed is null"); goto Exit; } System.Console.WriteLine(" Listing Routing Group details...."); lCount = objFaxOutRoutGrps.Count; //enumerate for (int i = 0; i < lCount; i++) { IFaxDeviceIds objFaxDevIds = null; FAX_GROUP_STATUS_ENUM enumStatus; objFaxOutRoutGrp = objFaxOutRoutGrps[i + 1]; objFaxDevIds = objFaxOutRoutGrp.DeviceIds; strGrpName = objFaxOutRoutGrp.Name; enumStatus = objFaxOutRoutGrp.Status; //print all the details System.Console.WriteLine(" ==================================================="); System.Console.Write("Group No: "); System.Console.Write(i + 1); System.Console.WriteLine("Group Name = "); System.Console.WriteLine(strGrpName); if (enumStatus == FAX_GROUP_STATUS_ENUM.fgsALL_DEV_VALID) { System.Console.WriteLine("Status : All the devices in the routing group are valid and available for sending outgoing faxes. "); } if (enumStatus == FAX_GROUP_STATUS_ENUM.fgsEMPTY) { System.Console.WriteLine("Status : The routing group does not contain any devices. "); } if (enumStatus == FAX_GROUP_STATUS_ENUM.fgsALL_DEV_NOT_VALID) { System.Console.WriteLine("Status : The routing group does not contain any available devices for sending faxes. (Devices can be \"unavailable\" when they are offline and when they do not exist.) "); } if (enumStatus == FAX_GROUP_STATUS_ENUM.fgsSOME_DEV_NOT_VALID) { System.Console.WriteLine("Status : The routing group contains some devices that are unavailable for sending faxes. (Devices can be \"unavailable\" when they are offline and when they do not exist.) "); } if (!listDeviceIds(objFaxDevIds)) { //we dont want to log any error here as the error will be logged in the function itself bRetVal = false; } } Exit: return(bRetVal); }