コード例 #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;
        }
コード例 #2
0
        private void NewRecord(Object sender, EventArgs e)
        {
            // Deal with the possibility that we have no categories set up for the primary key for this table
            Type DataTableType;

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

            allCategories.Merge(CacheDT);

            if (allCategories.Rows.Count == 0)
            {
                string Msg =
                    "Before you attempt to save a New Local Data Option you should return to the Partner Setup screen and create a new 'Local Data Option List Name'.";
                MessageBox.Show(Msg, "Open Petra Client", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            CreateNewPDataLabelLookup();
        }
コード例 #3
0
        /// <summary>
        /// Initialises DataSets and Tables
        ///
        /// </summary>
        /// <returns>void</returns>
        private void InitialiseDataStructures(PDataLabelValuePartnerTable ADataTableValuePartner,
            PDataLabelValueApplicationTable ADataTableValueApplication)
        {
            FDataLabelDT = (PDataLabelTable)TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.DataLabelList);

            // FDataLabelDT.Tablename := 'PDataLabel';
            // MessageBox.Show('FDataLabelDT.Rows[0].Key: ' + FDataLabelDT.Row[0].Key.ToString);
            FDataLabelUseDT = (PDataLabelUseTable)TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.DataLabelUseList);

            // MessageBox.Show('FDataLabelUseDT.Rows[0].Key: ' + FDataLabelUseDT.Row[0].Idx1.ToString);
            FDataLabelLookupDT = (PDataLabelLookupTable)TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.DataLabelLookupList);

            // MessageBox.Show('FDataLabelLookupDT.Row[0].CategoryCode: ' + FDataLabelLookupDT.Row[0].CategoryCode);
            FDataLabelLookupCategoryDT = (PDataLabelLookupCategoryTable)TDataCache.TMPartner.GetCacheablePartnerTable(
                TCacheablePartnerTablesEnum.DataLabelLookupCategoryList);

            // MessageBox.Show('FDataLabelLookupCategoryDT.Row[0].CategoryCode: ' + FDataLabelLookupCategoryDT.Row[0].CategoryCode);
            // Set up DataSet that holds all DataTables
            FLocalDataDS = new OfficeSpecificDataLabelsTDS("OfficeSpecificData");

            // Merge in cached Typed DataTables (should be done differently in the future when TypedDataSet.Tables.Add works fine)
            FLocalDataDS.Merge(FDataLabelDT);
            FLocalDataDS.Merge(FDataLabelUseDT);
            FLocalDataDS.Merge(FDataLabelLookupDT);
            FLocalDataDS.Merge(FDataLabelLookupCategoryDT);
            FDataLabelValuePartnerDT = ADataTableValuePartner;
            FDataLabelValueApplicationDT = ADataTableValueApplication;
        }