Exemplo n.º 1
0
        protected virtual void ImportData(SingleChoiceActionExecuteEventArgs e)
        {
            ChoiceActionItem  activeItem    = e.SelectedChoiceActionItem;
            ListView          lv            = (ListView)View;
            ImportDataManager importManager = new ImportDataManager(Application);

            switch (activeItem.Data.ToString())
            {
            //7th Change
            case "Agent_ListView":
                importManager.ImportData <Agent>(MaxImportedRecordsCount, Agent.CreateCoolAgentImportDataFromXmlFileDelegate(Application), null, lv, true);
                //Dennis: This line won't be executed unless you handle the exception thrown from the previus ImportData call.
                //ImportDataManager.ImportData<Person>(MaxImportedRecordsCount, ImportDataLogic.CreateDummyPersonImportDataDelegate(), ImportDataLogic.CreateDummyPersonValidateDataDelegate(), lv, true);
                break;

            case "Customer_ListView":
                //PropertyCollectionSource pcs = lv.CollectionSource as PropertyCollectionSource;
                //if (pcs != null)
                //{
                importManager.ImportData <Customer>(MaxImportedRecordsCount, Customer.CreateCoolCustomerImportDataFromXmlFileDelegate(Application), null, lv, true);
                //}
                break;

            case "Product_ListView":
                importManager.ImportData <Product>(MaxImportedRecordsCount, Product.CreateCoolProductImportDataFromXmlFileDelegate(Application), null, lv, true);
                //Dennis: This line won't be executed unless you handle the exception thrown from the previus ImportData call.
                //ImportDataManager.ImportData<Person>(MaxImportedRecordsCount, ImportDataLogic.CreateDummyPersonImportDataDelegate(), ImportDataLogic.CreateDummyPersonValidateDataDelegate(), lv, true);
                break;
            }
        }
Exemplo n.º 2
0
        private void ImportDataFromFile(ClientContext context, string filePath)
        {
            Log.Debug("Starting ImportDataFromFile");
            var listDataProvider = new FilePersistanceProvider <ShListData>(filePath);
            var listData         = listDataProvider.Load();

            var importDataManager = new ImportDataManager(context);

            if (listData.Type == "TaskList")
            {
                var taskListData = new FilePersistanceProvider <ShTaskListData>(filePath);
                importDataManager.ImportTaskListData(taskListData.Load());
            }
            else
            {
                importDataManager.ImportListData(listData);
            }
        }
Exemplo n.º 3
0
        protected virtual void ImportData(SingleChoiceActionExecuteEventArgs e)
        {
            ChoiceActionItem  activeItem    = e.SelectedChoiceActionItem;
            ListView          lv            = (ListView)View;
            ImportDataManager importManager = new ImportDataManager(Application);

            switch (activeItem.Data.ToString())
            {
            case "OwnScore_ListView":
                importManager.ImportData <OwnScore>(MaxImportedRecordsCount, ImportDataLogic.CreateCoolOwnScoreImportDataFromExcelDelegate(), null, lv, true);
                //Dennis: This line won't be executed unless you handle the exception thrown from the previus ImportData call.
                //ImportDataManager.ImportData<Person>(MaxImportedRecordsCount, ImportDataLogic.CreateDummyPersonImportDataDelegate(), ImportDataLogic.CreateDummyPersonValidateDataDelegate(), lv, true);
                break;
                //case "Party_PhoneNumbers_ListView":
                //    PropertyCollectionSource pcs = lv.CollectionSource as PropertyCollectionSource;
                //    if (pcs != null) {
                //        importManager.ImportData<PhoneNumber>(MaxImportedRecordsCount, ImportDataLogic.CreateDummyPhoneNumberImportDataDelegate(), ImportDataLogic.CreateDummyPhoneNumberValidateDataDelegate(), lv, true);
                //    }
                //    break;
            }
        }