示例#1
0
        private void NewRowManual(ref PDataLabelLookupRow ARow)
        {
            // Deal with the primary key - we need a unique Category code and value code
            // We use the first category code from our category list
            Type DataTableType;

            // Load Data
            PDataLabelLookupCategoryTable allCategories = new PDataLabelLookupCategoryTable();
            DataTable CacheDT = TDataCache.GetCacheableDataTableFromCache("DataLabelLookupCategoryList", String.Empty, null, out DataTableType);

            allCategories.Merge(CacheDT);
            ARow.CategoryCode = allCategories.Rows[0][0].ToString();

            // We need a simple string for the value code
            string newName        = Catalog.GetString("NEWVALUE");
            Int32  countNewDetail = 0;

            if (FMainDS.PDataLabelLookup.Rows.Find(new object[] { ARow.CategoryCode, newName }) != null)
            {
                while (FMainDS.PDataLabelLookup.Rows.Find(new object[] { ARow.CategoryCode, newName + countNewDetail.ToString() }) != null)
                {
                    countNewDetail++;
                }

                newName += countNewDetail.ToString();
            }

            ARow.ValueCode = newName;
        }
        private void NewRowManual(ref PDataLabelLookupRow ARow)
        {
            // Deal with the primary key - we need a unique Category code and value code
            // We use the first category code from our category list
            Type DataTableType;

            // Load Data
            PDataLabelLookupCategoryTable allCategories = new PDataLabelLookupCategoryTable();
            DataTable CacheDT = TDataCache.GetCacheableDataTableFromCache("DataLabelLookupCategoryList", String.Empty, null, out DataTableType);

            allCategories.Merge(CacheDT);
            ARow.CategoryCode = allCategories.Rows[0][0].ToString();

            // We need a simple string for the value code
            string newName = Catalog.GetString("NEWVALUE");
            Int32 countNewDetail = 0;

            if (FMainDS.PDataLabelLookup.Rows.Find(new object[] { ARow.CategoryCode, newName }) != null)
            {
                while (FMainDS.PDataLabelLookup.Rows.Find(new object[] { ARow.CategoryCode, newName + countNewDetail.ToString() }) != null)
                {
                    countNewDetail++;
                }

                newName += countNewDetail.ToString();
            }

            ARow.ValueCode = newName;
        }