public void CreatenNewOptionSetSheet(OptionSetMetadata optionSetMetadata, AttributeMetadata currentAttribute) { GlobalApplicationData appData = GlobalApplicationData.Instance; string sheetName = optionSetMetadata.MetadataId.ToString(); OptionSetExcelSheetsInfo excelSheet = new OptionSetExcelSheetsInfo(ExcelSheetInfo.ExcelSheetType.optionSet, optionSetMetadata, currentAttribute); CreatenNewExcelSheet(sheetName, excelSheet); GlobalOperations.Instance.ExcelOperations.refreshOptionSetSheet(GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet()); }
public void RefreshCurrentSheet() { if (GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet() != null) { GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet().language = GlobalApplicationData.Instance.currentLanguage; switch (GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet().sheetType) { case ExcelSheetInfo.ExcelSheetType.attribute: { EntityMetadata currentEntity = CRMOpHelper.RetriveEntityAtrribute(((AttributeExcelSheetsInfo)GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet()).entityMedata.LogicalName); ((AttributeExcelSheetsInfo)GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet()).entityMedata = currentEntity; IEnumerable <string> formAttr = CRMOpHelper.GetAttributeOfTheMainForm(currentEntity.ObjectTypeCode.Value); ExcelOperations.refreshAttributeSheeet(GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet(), currentEntity, GlobalApplicationData.Instance.allEntities, formAttr); break; } case ExcelSheetInfo.ExcelSheetType.optionSet: { OptionSetExcelSheetsInfo currentOption = (OptionSetExcelSheetsInfo)GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet(); EntityMetadata currentEntity = CRMOpHelper.RetriveEntityAtrribute(currentOption.parentAttribute.EntityLogicalName); IEnumerable <AttributeMetadata> currentOpt = currentEntity.Attributes.Where(x => x is EnumAttributeMetadata && ((EnumAttributeMetadata)x).OptionSet != null && ((EnumAttributeMetadata)x).OptionSet.MetadataId.ToString() == currentOption.objectName); if (currentOpt.Count() > 0) { currentOption.optionData = ((EnumAttributeMetadata)currentOpt.First()).OptionSet; ExcelOperations.refreshOptionSetSheet((ExcelSheetInfo)currentOption); } break; } case ExcelSheetInfo.ExcelSheetType.entity: { ExcelSheetInfo sheet = GlobalApplicationData.Instance.eSheetsInfomation.getCurrentSheet(); FilterBySolution(GlobalApplicationData.Instance.currentSolution.SolutionName); EntityMetadata[] allEntities = GetEntitiesWithAttributes(); GlobalApplicationData.Instance.allEntities = allEntities.OrderBy(p => Utils.getLocalizedLabel(p.DisplayName.LocalizedLabels, sheet.language)).ToArray(); ExcelOperations.refreshEntitySheeet(sheet, allEntities); break; } case ExcelSheetInfo.ExcelSheetType.form: { RefreshCurrentFormSheet(); break; } case ExcelSheetInfo.ExcelSheetType.view: { RefreshCurrentViewSheet(); break; } } } }
public OptionSetRequestGenerator(OptionSetExcelSheetsInfo optionMetadata) { this.languageCode = optionMetadata.language; this.optionMetadata = optionMetadata; }