コード例 #1
0
        public void CreatenNewViewSheet(string viewName, string viewDescription, Guid entity)
        {
            EntityMetadata etMetadata            = GlobalOperations.Instance.CRMOpHelper.RetriveEntityAtrribute(entity);
            IEnumerable <AttributeMetadata> attr = etMetadata.Attributes.Where(x => x.AttributeType != null && x.AttributeType == AttributeTypeCode.Lookup);
            GlobalApplicationData           data = GlobalApplicationData.Instance;
            string sheetName = string.Format("{0} - {1}", viewName, etMetadata.LogicalName.ToString());

            CreatenNewExcelSheet(sheetName, new ViewExcelSheetsInfo(Guid.NewGuid(), viewName, viewDescription, etMetadata.LogicalName, entity));
            ViewXml.GenerateNewFechXml((ViewExcelSheetsInfo)data.eSheetsInfomation.getCurrentSheet(), etMetadata);
            ViewExcelSheetsInfo currentSheet = ((ViewExcelSheetsInfo)data.eSheetsInfomation.getCurrentSheet());

            currentSheet.language      = GlobalApplicationData.Instance.currentLanguage;
            currentSheet.relationsList = ViewXml.GenerateViewRelatedObj(currentSheet);
            GlobalOperations.Instance.ExcelOperations.RefreshViewSheet(data.eSheetsInfomation.getCurrentSheet(), attr);
        }
コード例 #2
0
        public void CreatenNewViewSheet(Guid viewId, Guid entity)
        {
            Entity         view                  = CRMOpHelper.GetView(viewId);
            EntityMetadata etMetadata            = CRMOpHelper.RetriveEntityAtrribute(entity);
            IEnumerable <AttributeMetadata> attr = etMetadata.Attributes.Where(x => x.AttributeType != null && x.AttributeType == AttributeTypeCode.Lookup);

            if (view != null && view.Contains("name") && view.Contains("layoutxml") && view.Contains("returnedtypecode") && view.Contains("fetchxml"))
            {
                GlobalApplicationData data      = GlobalApplicationData.Instance;
                string sheetName                = string.Format("{0} - {1}", view["name"].ToString(), view["returnedtypecode"].ToString());
                savedqueryLayoutxmlGrid viewObj = FormXmlMapper.MapViewXmlToObj(view.Attributes["layoutxml"].ToString());
                FetchType fatchObj              = FormXmlMapper.MapFetchXmlToObj(view.Attributes["fetchxml"].ToString());
                CreatenNewExcelSheet(sheetName, new ViewExcelSheetsInfo(viewId, view.Attributes["layoutxml"].ToString(), view.Attributes["fetchxml"].ToString(), viewObj, fatchObj, entity, etMetadata.LogicalName));
                ViewExcelSheetsInfo currentSheet = ((ViewExcelSheetsInfo)data.eSheetsInfomation.getCurrentSheet());
                currentSheet.language      = GlobalApplicationData.Instance.currentLanguage;
                currentSheet.relationsList = ViewXml.GenerateViewRelatedObj(currentSheet);
                ExcelOperations.RefreshViewSheet(data.eSheetsInfomation.getCurrentSheet(), attr);
            }
        }