Exemple #1
0
        /// <summary>
        /// Load the form using table 'CustomerDemographics' PrimaryKey
        /// </summary>
        public void LoadForm(string CustomerTypeID)
        {
            string error = null;

            CustomerDemographicsDataContext = dataConnection.GetDataContext(CustomerTypeID, out error);
            DataContext = CustomerDemographicsDataContext;
        }
Exemple #2
0
        /// <summary>
        /// Alternative contructor. Creates the Form and also load it's data using table '' Primary key.
        /// </summary>
        public FormWPFCustomerDemographics(WPFConfig config, string CustomerTypeID, Frame mainFrame)
        {
            this.config          = config;
            this.FrameMainWindow = mainFrame;
            dataConnection       = new WPFCustomerDemographicsDB(config);
            string error = null;

            CustomerDemographicsDataContext = dataConnection.GetDataContext(CustomerTypeID, out error);
            DataContext = CustomerDemographicsDataContext;
            InitializeComponent();
        }
Exemple #3
0
        public void LoadGrid(Func <ModelNotifiedForCustomerDemographics, bool> filter = null)
        {
            this.DataGridCustomerDemographics.ItemsSource = null;

            //Saving current language
            WPFMessageAndLabelForList currentLanguage = new WPFMessageAndLabelForList();

            if (this.CustomerDemographicsDataContext != null)
            {
                currentLanguage = this.CustomerDemographicsDataContext.WPFMessageAndLabelForList;
            }
            string error = null;

            this.CustomerDemographicsDataContext = dataConnection.GetDataContext(out error);
            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show(error);
                return;
            }

            //Setting language messages
            this.CustomerDemographicsDataContext.WPFMessageAndLabelForList = currentLanguage;

            this.DataContext = CustomerDemographicsDataContext;

            List <ModelNotifiedForCustomerDemographics> filteredList;

            if (filter == null)
            {
                filteredList = CustomerDemographicsDataContext.modelNotifiedForCustomerDemographicsMain;
            }
            else
            {
                filteredList = CustomerDemographicsDataContext.modelNotifiedForCustomerDemographicsMain.Where(filter).ToList();
            }

            //Bind data
            SetGridData(filteredList);

            //Load detail forms/lists in master/detail
            if (CustomerDemographicsDataContext.modelNotifiedForCustomerDemographicsMain.Count != 0)
            {
                this.LoadDetail(CustomerDemographicsDataContext.modelNotifiedForCustomerDemographicsMain[0]);
            }
        }