private static void RegisterServer(IExternalServer server)
        {
            ExternalService service = ExternalServiceRegistry.GetService(server.GetServiceId());

            service.AddServer(server);
        }
        private bool getFittingInfo(MEPSection section, DataTable fittingTB, bool forHTML = false)
        {
            if (fittingTB == null || section == null)
            {
                return(false);
            }

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null || helper.ReportData == null)
            {
                return(false);
            }

            List <string> fittingFields = new List <string>();

            if (helper.ReportData.FittingFields != null)
            {
                getFields(fittingFields);
            }

            if (forHTML)
            {
                helper.addColumns(fittingTB, fittingFields.Count);
            }
            else
            {
                helper.addColumns(fittingTB, fittingFields.Count + 2);
            }

            List <FamilyInstance> fittings = new List <FamilyInstance>();

            SectionsInfo.getSectionElements(section, null, fittings, null, null);
            if (fittings.Count < 1)
            {
                return(false);
            }

            int nIndex = 0;

            foreach (FamilyInstance fitting in fittings)
            {
                List <string> paramVals = new List <string>();
                if (!forHTML)
                {
                    if (nIndex == 0)
                    {
                        paramVals.Add(section.Number.ToString());
                    }
                    else
                    {
                        paramVals.Add(" ");
                    }
                }

                foreach (string fieldName in fittingFields)
                {
                    try
                    {
                        PressureLossParameter PLParam = helper.getPressureLossParamByName(helper.ReportData.FittingFields, fieldName);
                        if (PLParam == null)
                        {
                            continue;
                        }

                        string strVal = ReportConstants.emptyValue;
                        if ((PLParam.GetFrom & (int)SectionMemberType.Section) > 0)
                        {
                            strVal = SectionsInfo.getSectionInfoByParamName(section, fieldName, PLParam.GetFrom, fitting.Id);
                        }
                        else if ((PLParam.GetFrom & (int)SectionMemberType.Fitting) > 0)
                        {
                            if (helper.Domain == ReportResource.pipeDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_METHOD_SERVER_PARAM))
                            {
                                string strValGUID = fitting.get_Parameter(fieldName).AsString();
                                Guid   serverGUID = new Guid(strValGUID);

                                //convert the GUID to server name
                                //get the service first, and then get the server
                                MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropService) as MultiServerService;
                                if (service != null && serverGUID != null)
                                {
                                    IExternalServer server = service.GetServer(new Guid(strValGUID));
                                    if (server != null)
                                    {
                                        strVal = server.GetName();
                                    }
                                }
                            }
                            else if (helper.Domain == ReportResource.ductDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_FITTING_LOSS_METHOD_SERVER_PARAM))
                            {
                                string strValGUID = fitting.get_Parameter(fieldName).AsString();
                                Guid   serverGUID = new Guid(strValGUID);

                                //convert the GUID to server name
                                //get the service first, and then get the server
                                MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropService) as MultiServerService;
                                if (service != null && serverGUID != null)
                                {
                                    IExternalServer server = service.GetServer(new Guid(strValGUID));
                                    if (server != null)
                                    {
                                        strVal = server.GetName();
                                    }
                                }
                            }
                            else if (fieldName == ReportResource.elementId)
                            {
                                strVal = fitting.Id.ToString();
                            }
                            else
                            {
                                strVal = helper.getParamValue(fitting.get_Parameter(fieldName));
                            }
                        }
                        else if ((PLParam.GetFrom & (int)SectionMemberType.Type) > 0)
                        {
                            strVal = getFittingSymbolInfoByParamName(fitting, fieldName);
                        }

                        paramVals.Add(strVal);
                    }
                    catch
                    {
                        //...
                    }
                }

                if (!forHTML) //for csv, the last column is section pressure loss report
                {
                    string strVal = ReportConstants.mergeValue;
                    if (nIndex == 0)
                    {
                        strVal = helper.getTotalPressureLossByType(section, SectionMemberType.Fitting);
                    }

                    paramVals.Add(strVal);
                }

                nIndex++;

                helper.addRow(fittingTB, paramVals);
            }

            return(true);
        }