public void CreatenNewFormSheet(Guid formId) { Entity form = CRMOpHelper.GetForm(formId); if (form != null && form.Contains("name") && form.Contains("formxml") && form.Contains("objecttypecode")) { GlobalApplicationData data = GlobalApplicationData.Instance; string sheetName = string.Format("{0} - {1}", form["name"].ToString(), form["objecttypecode"].ToString()); FormType formObj = FormXmlMapper.MapFormXmlToObj(form.Attributes["formxml"].ToString()); CreatenNewExcelSheet(sheetName, new FormExcelSheetsInfo(formId, form.Attributes["formxml"].ToString(), formObj)); data.eSheetsInfomation.getCurrentSheet().language = GlobalApplicationData.Instance.currentLanguage; ExcelOperations.RefreshFormSheet(data.eSheetsInfomation.getCurrentSheet()); } }
private static string getFecthXmlString(List <ViewFeo> viewFeoList, FetchType fecthObj) { foreach (ViewFeo viewFeo in viewFeoList) { if (viewFeo.AttributeObj != null) { addNewAttributeToFech(fecthObj, viewFeo.AttributeName, viewFeo.AttributeObj); } else { throw new Exception("Relation Not Found"); } } return(FormXmlMapper.MapObjToFetchXml(fecthObj)); }
public void RefreshCurrentFormSheet() { GlobalApplicationData data = GlobalApplicationData.Instance; if (data.eSheetsInfomation.getCurrentSheet().sheetType == ExcelSheetInfo.ExcelSheetType.form) { Entity form = CRMOpHelper.GetForm(Guid.Parse(data.eSheetsInfomation.getCurrentSheet().objectName)); if (form != null && form.Contains("name") && form.Contains("formxml") && form.Contains("objecttypecode")) { string sheetName = string.Format("{0} - {1}", form["name"].ToString(), form["objecttypecode"].ToString()); FormType formObj = FormXmlMapper.MapFormXmlToObj(form.Attributes["formxml"].ToString()); data.eSheetsInfomation.getCurrentSheet().language = GlobalApplicationData.Instance.currentLanguage; ExcelOperations.RefreshFormSheet(data.eSheetsInfomation.getCurrentSheet()); } } }
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); } }
private static string getViewXmlString(List <ViewFeo> viewFeoList, savedqueryLayoutxmlGrid viewObj) { List <savedqueryLayoutxmlGridRowCell> newcellList = new List <savedqueryLayoutxmlGridRowCell>(); if (viewObj.row != null && viewObj.row.cell != null) { List <savedqueryLayoutxmlGridRowCell> oldcellList = viewObj.row.cell.ToList(); foreach (ViewFeo viewFeo in viewFeoList) { if (viewFeo.AttributeObj != null) { string attributeNameAlias = string.IsNullOrEmpty(viewFeo.AttributeObj.relationAlias) ? viewFeo.AttributeName : string.Concat(viewFeo.AttributeObj.relationAlias, ".", viewFeo.AttributeName); addCellToView(newcellList, oldcellList, attributeNameAlias, viewFeo.AttributeWidth); } else { throw new Exception("Relation Not Found"); } } viewObj.row.cell = newcellList.ToArray(); } return(FormXmlMapper.MapObjToViewXml(viewObj)); }