Exemplo n.º 1
0
        //================================================================================
        /// <summary>
        /// Binds DataDataItems to respective DataTable, Removes duplicate DataItems and
        /// Assigned DataTableDesc from BindingDataTableRefs
        /// </summary>
        /// <param name="enumColl"></param>
        public void BindDataItemsToEachDataTable(CompanyDataItemCollection <CompanyDataItem> dataItemColl
                                                 )
        {
            foreach (T obj in this)
            {
                CompanyDataItemCollection <CompanyDataItem> forEachDataTableDataItemColl =
                    new CompanyDataItemCollection <CompanyDataItem>();
                forEachDataTableDataItemColl = dataItemColl.Find(obj.BindingDataTableRefs);
                if (forEachDataTableDataItemColl.Count != 0)
                {
                    obj.DataItems = forEachDataTableDataItemColl.RemoveDuplicateDataItems();
                }
                string[] tableDescs = new string[obj.BindingDataTableRefs.Length];

                for (int i = 0; i < obj.BindingDataTableRefs.Length; i++)
                {
                    tableDescs[i] = this.GetDataTableDesc(obj.BindingDataTableRefs[i]);
                }
                obj.BindingDataTableDescs = tableDescs;

                string sqlScriptText = Null.String;
                //if (obj.DataItems != null)
                //    sqlScriptText = (new Company.DMS.BusinessEntities.SqlDataItemScriptBuilder())
                //                    .BuildDataItemSqlScript(obj);

                obj.DataTableSqlScript = sqlScriptText;
            }
        }
        public CompanyDataItemCollection <T> this[
            CompanyUnitHierarchy CompanyUnitObj, params int[] dataTableRefs]
        {
            get
            {
                CompanyDataItemCollection <T> tempColl =
                    this.GetAllDataItemForCompanyHierarchy(
                        CompanyUnitObj.CompanyUnitRef, CompanyUnitObj.CompanyUnitParentRef,
                        CompanyUnitObj.CompanyUnitGrandParentRef, CompanyUnitObj.CompanyUnitGreatGrandParentRef);

                //tempColl = tempColl.Find(dataTableRefs);

                return(tempColl.Find(dataTableRefs));
            }
        }