//+--------------------------------------------------------------------------- // // 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: listDeviceIds // // Synopsis: lists the set of devices on for a routing group // // Arguments: [IFaxDeviceIds] - FaxDevIds object pointing to the list of device ids are part of the routing group // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool listDeviceIds(IFaxDeviceIds objFaxDevIds) { long lDevId = 0; long count = 0; bool bRetVal = false; //check for null if (objFaxDevIds == null) { System.Console.WriteLine("listDevices: Parameter passed is null"); goto Exit; } count = objFaxDevIds.Count; for (int i = 0; i < count; i++) { lDevId = objFaxDevIds[i + 1]; System.Console.Write("Device No: "); System.Console.Write(i); System.Console.Write(" Device Id: "); System.Console.Write(lDevId); System.Console.WriteLine(); } bRetVal = true; Exit: return(bRetVal); }
//+--------------------------------------------------------------------------- // // function: listDeviceIds // // Synopsis: lists the set of devices on for a routing group // // Arguments: [IFaxDeviceIds] - FaxDevIds object pointing to the list of device ids are part of the routing group // // Returns: bool: true if passed successfully // //---------------------------------------------------------------------------- static bool listDeviceIds(IFaxDeviceIds objFaxDevIds) { long lDevId = 0; long count = 0; bool bRetVal = false; //check for null if (objFaxDevIds == null) { System.Console.WriteLine("listDevices: Parameter passed is null"); goto Exit; } count = objFaxDevIds.Count; for (int i = 0; i < count; i++) { lDevId = objFaxDevIds[i+1]; System.Console.Write("Device No: "); System.Console.Write(i); System.Console.Write(" Device Id: "); System.Console.Write(lDevId); System.Console.WriteLine(); } 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); }