Current filter:
                                You should refresh the page.

                                XAF Project Management Application - Stage 4

                                0

                                This example contains the source code for the XAF Project Management Application - Stage 4. The complete description can be found in the XAF – Project Management Application #6 blog post.

                                You must  log in  or  register  to leave comments
                                Select file
                                • DumpDataController.cs
                                • Employee.cs
                                • Model.DesignedDiffs.xafml
                                • Model.DesignedDiffs.xafml
                                • Project.cs
                                • ProjectTests.cs
                                • TaskCategory.cs
                                • TaskProgreeBarControl.cs
                                • Team.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2012 vol 1.4 - v2012 vol 1.10
                                • v2011 vol 2.5 - v2011 vol 2.14
                                • v2011 vol 1.4 - v2011 vol 1.12
                                • v2010 vol 2.9 - v2010 vol 2.11
                                • v2010 vol 2.3 - v2010 vol 2.8
                                • v2010 vol 1.4 - v2010 vol 1.12
                                • v2009 vol 3.2 - v2009 vol 3.7
                                • v2009 vol 2.4 - v2009 vol 2.6
                                using System;
                                using System.Data;
                                using System.Windows.Forms;
                                using System.ComponentModel;
                                using System.Collections;
                                using System.Collections.Generic;
                                using System.Diagnostics;
                                using System.Text;
                                
                                using DevExpress.ExpressApp;
                                using DevExpress.ExpressApp.Xpo;
                                using DevExpress.ExpressApp.Actions;
                                using DevExpress.Persistent.Base;
                                
                                using DevExpress.Xpo;
                                using DevExpress.Xpo.DB;
                                using DevExpress.Xpo.Helpers;
                                
                                namespace XProject.Module.Win {
                                    public partial class DumpDataController : ViewController {
                                        public DumpDataController() {
                                            InitializeComponent();
                                            RegisterActions(components);
                                        }
                                
                                        private void LoadDumpFromXML_Execute(object sender, SimpleActionExecuteEventArgs e) {
                                            OpenFileDialog openFile = new OpenFileDialog();
                                            openFile.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
                                            if (openFile.ShowDialog() == DialogResult.OK) {
                                                LoadDumpFromFile(openFile.FileName);
                                            }
                                        }
                                        private void DumpToXML_Execute(object sender, SimpleActionExecuteEventArgs e) {
                                            OpenFileDialog openFile = new OpenFileDialog();
                                            openFile.CheckFileExists = false;
                                            openFile.FileName = View.ObjectTypeInfo.Name;
                                            openFile.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
                                            if (openFile.ShowDialog() == DialogResult.OK) {
                                                DumpToFile(openFile.FileName);
                                            }
                                        }
                                
                                        private void DumpToFile(string fileName) {
                                            Session sourceSession = ((XPObjectSpace)View.ObjectSpace).Session;
                                            DataSet dataSet = new DataSet();
                                            DataSetDataStore dataStore = new DataSetDataStore(dataSet, AutoCreateOption.DatabaseAndSchema);
                                            IDataLayer dataLayer = new SimpleDataLayer(sourceSession.Dictionary, dataStore);
                                            UnitOfWork destinationSession = new UnitOfWork(dataLayer);
                                            ClonerHelper.Clone(sourceSession, destinationSession, View.SelectedObjects);
                                            destinationSession.CommitChanges();
                                            dataSet.WriteXml(fileName, XmlWriteMode.WriteSchema);
                                        }
                                        private void LoadDumpFromFile(string fileName) {
                                            UnitOfWork destinationSession = ((XPObjectSpace)View.ObjectSpace).Session as UnitOfWork;
                                            if (destinationSession == null) return;
                                            DataSet dataSet = new DataSet();
                                            DataSetDataStore dataStore = new DataSetDataStore(dataSet, AutoCreateOption.DatabaseAndSchema);
                                            IDataLayer dataLayer = new SimpleDataLayer(destinationSession.Dictionary, dataStore);
                                            dataSet.ReadXml(fileName);
                                            UnitOfWork sourceSession = new UnitOfWork(dataLayer);
                                            ClonerHelper.Clone(sourceSession, destinationSession, View.ObjectTypeInfo.Type);
                                            destinationSession.CommitChanges();
                                        }
                                    }
                                }