private static void addCellToView(List <savedqueryLayoutxmlGridRowCell> cellList, List <savedqueryLayoutxmlGridRowCell> oldList, string attributeName, string attributewidth)
        {
            int    outObj;
            string width = int.TryParse(attributewidth, out outObj) ? outObj.ToString() : "100";
            IEnumerable <savedqueryLayoutxmlGridRowCell> cells = oldList.Where(x => x.name.EndsWith(attributeName, StringComparison.InvariantCultureIgnoreCase));

            if (cells.Count() == 0)
            {
                cellList.Add(new savedqueryLayoutxmlGridRowCell()
                {
                    name  = attributeName,
                    width = width
                });
            }
            else
            {
                savedqueryLayoutxmlGridRowCell currentcell = cells.First();
                cellList.Add(new savedqueryLayoutxmlGridRowCell()
                {
                    name                   = attributeName,
                    width                  = width,
                    LabelId                = currentcell.LabelId,
                    label                  = currentcell.label,
                    ishidden               = currentcell.ishidden,
                    disableSorting         = currentcell.disableSorting,
                    disableMetaDataBinding = currentcell.disableMetaDataBinding,
                    desc                   = currentcell.desc,
                    cellType               = currentcell.cellType,
                });
            }
        }
        public static void GenerateNewFechXml(ViewExcelSheetsInfo sheetView, EntityMetadata etMetadata)
        {
            FetchEntityType et = new FetchEntityType();

            et.name  = etMetadata.LogicalName;
            et.Items = new object[3] {
                new FetchOrderType()
                {
                    attribute = etMetadata.PrimaryIdAttribute, descending = false
                }, new FetchAttributeType()
                {
                    name = etMetadata.PrimaryIdAttribute
                }, new FetchAttributeType()
                {
                    name = etMetadata.PrimaryNameAttribute
                }
            };
            sheetView.fetchObj.Items        = new object[] { et };
            sheetView.fetchObj.version      = "1.0";
            sheetView.fetchObj.outputformat = FetchTypeOutputformat.xmlplatform;
            sheetView.fetchObj.mapping      = FetchTypeMapping.logical;
            savedqueryLayoutxmlGridRowCell[] cells = new savedqueryLayoutxmlGridRowCell[1] {
                new savedqueryLayoutxmlGridRowCell()
                {
                    name = etMetadata.PrimaryNameAttribute, width = "150"
                }
            };
            sheetView.viewObj.row = new savedqueryLayoutxmlGridRow()
            {
                cell = cells, name = "result", id = etMetadata.PrimaryIdAttribute
            };
            sheetView.viewObj.select  = "1";
            sheetView.viewObj.preview = "1";
            sheetView.viewObj.@object = etMetadata.ObjectTypeCode.ToString();
            sheetView.viewObj.icon    = "1";
            sheetView.viewObj.jump    = etMetadata.PrimaryNameAttribute;
            sheetView.viewObj.name    = "resultset";
        }