Exemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parentForm"> A reference to the parent form</param>
        /// <param name="salesManagementDataModel">A reference to the sales management data model</param>
        /// <param name="selectedTabIndex">Index of the tab to initialize the form with</param>
        public frmSalesManagement(
            frmProductsOverview parentForm, SalesManagement salesManagement, int selectedTabIndex)
        {
            using (var context = new ArrboraDatabase())
            {
                var data = context.SalesManagements.ToList();
                var selectedSalesManagement = data.Where(p => p.SalesManagementID == salesManagement.SalesManagementID).First();
            }
            using (var context1 = new ArrboraDatabase())
            {
                var s = context1.Payments.ToList();
                var y = context1.SellingPrices.ToList();
            }
            _dbContext = new ArrboraDatabase();
            InitializeComponent();
            _salesManagement = _dbContext.SalesManagements.Where(
                p => p.SalesManagementID == salesManagement.SalesManagementID).First();
            _paymentUnits = _dbContext.PaymentUnits.Where(
                p => p.PaymentID == salesManagement.PaymentID).ToList();

            _parentForm = parentForm;

            //UpdateDataModels();
            UpdateSalesManagementForm(DataState.WriteToUI);

            saleManagementTabControl.SelectedIndex = selectedTabIndex;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parentForm"> A reference to the parent form</param>
        /// <param name="salesManagementDataModel">A reference to the sales management data model</param>
        /// <param name="selectedTabIndex">Index of the tab to initialize the form with</param>
        public frmSalesManagement(
            frmProductsOverview parentForm, SalesManagementDataModel salesManagementDataModel, int selectedTabIndex)
        {
            InitializeComponent();
            _parentForm = parentForm;
            _salesManagementDataModel = salesManagementDataModel;

            _salesManagementService = new SalesManagementService(salesManagementDataModel);
            _paymentService         = new PaymentService();
            _paymentUnitService     = new PaymentUnitService();
            _productService         = new ProductService();
            _productDeliveryService = new ProductDeliveryService();
            _purchasePriceService   = new PurchasePriceService();
            _sellingPriceService    = new SellingPriceService();

            UpdateDataModels();
            UpdateSalesManagementForm(DataState.WriteToUI);

            saleManagementTabControl.SelectedIndex = selectedTabIndex;
        }