Exemplo n.º 1
0
        private void WizardMaster_Load(object sender, EventArgs e)
        {
            try
            {
                this.warehouseAdjustmentViewModel.PropertyChanged += warehouseAdjustmentDetailDTO_PropertyChanged;

                WarehouseAPIs warehouseAPIs = new WarehouseAPIs(CommonNinject.Kernel.Get <IWarehouseAPIRepository>());
                this.combexWarehouseID.DataSource    = warehouseAPIs.GetWarehouseBases();
                this.combexWarehouseID.DisplayMember = CommonExpressions.PropertyName <WarehouseBase>(p => p.Name);
                this.combexWarehouseID.ValueMember   = CommonExpressions.PropertyName <WarehouseBase>(p => p.WarehouseID);
                this.bindingWarehouseID = this.combexWarehouseID.DataBindings.Add("SelectedValue", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.WarehouseID), true, DataSourceUpdateMode.OnPropertyChanged);

                WarehouseAPIs warehouseReceiptAPIs = new WarehouseAPIs(CommonNinject.Kernel.Get <IWarehouseAPIRepository>());
                this.combexWarehouseReceiptID.DataSource    = warehouseReceiptAPIs.GetWarehouseBases();
                this.combexWarehouseReceiptID.DisplayMember = CommonExpressions.PropertyName <WarehouseBase>(p => p.Name);
                this.combexWarehouseReceiptID.ValueMember   = CommonExpressions.PropertyName <WarehouseBase>(p => p.WarehouseID);
                this.bindingWarehouseReceiptID = this.combexWarehouseReceiptID.DataBindings.Add("SelectedValue", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.WarehouseReceiptID), true, DataSourceUpdateMode.OnPropertyChanged);
                this.combexWarehouseReceiptID.DataBindings.Add("Enabled", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.WarehouseReceiptEnabled), true, DataSourceUpdateMode.OnPropertyChanged);

                WarehouseAdjustmentTypeAPIs warehouseAdjustmentTypeAPIs = new WarehouseAdjustmentTypeAPIs(CommonNinject.Kernel.Get <IWarehouseAdjustmentTypeAPIRepository>());

                this.combexWarehouseAdjustmentTypeID.DataSource    = warehouseAdjustmentTypeAPIs.GetWarehouseAdjustmentTypeBases();
                this.combexWarehouseAdjustmentTypeID.DisplayMember = CommonExpressions.PropertyName <WarehouseAdjustmentTypeBase>(p => p.Name);
                this.combexWarehouseAdjustmentTypeID.ValueMember   = CommonExpressions.PropertyName <WarehouseAdjustmentTypeBase>(p => p.WarehouseAdjustmentTypeID);
                this.bindingWarehouseAdjustmentTypeID = this.combexWarehouseAdjustmentTypeID.DataBindings.Add("SelectedValue", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.WarehouseAdjustmentTypeID), true, DataSourceUpdateMode.OnPropertyChanged);

                EmployeeAPIs employeeAPIs = new EmployeeAPIs(CommonNinject.Kernel.Get <IEmployeeAPIRepository>());

                this.combexStorekeeperID.DataSource    = employeeAPIs.GetEmployeeBases(ContextAttributes.User.UserID, (int)this.warehouseAdjustmentViewModel.NMVNTaskID, (int)GlobalEnums.RoleID.Logistic);
                this.combexStorekeeperID.DisplayMember = CommonExpressions.PropertyName <EmployeeBase>(p => p.Name);
                this.combexStorekeeperID.ValueMember   = CommonExpressions.PropertyName <EmployeeBase>(p => p.EmployeeID);
                this.bindingStorekeeperID = this.combexStorekeeperID.DataBindings.Add("SelectedValue", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.StorekeeperID), true, DataSourceUpdateMode.OnPropertyChanged);

                this.bindingAdjustmentJobs = this.textexAdjustmentJobs.DataBindings.Add("Text", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.AdjustmentJobs), true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingDescription    = this.textexDescription.DataBindings.Add("Text", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.Description), true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingRemarks        = this.textexRemarks.DataBindings.Add("Text", this.warehouseAdjustmentViewModel, CommonExpressions.PropertyName <WarehouseAdjustmentViewModel>(p => p.Remarks), true, DataSourceUpdateMode.OnPropertyChanged);

                this.bindingWarehouseID.BindingComplete               += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingWarehouseReceiptID.BindingComplete        += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingWarehouseAdjustmentTypeID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingStorekeeperID.BindingComplete             += new BindingCompleteEventHandler(CommonControl_BindingComplete);

                this.bindingAdjustmentJobs.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingDescription.BindingComplete    += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingRemarks.BindingComplete        += new BindingCompleteEventHandler(CommonControl_BindingComplete);

                this.errorProviderMaster.DataSource = this.warehouseAdjustmentViewModel;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Exemplo n.º 2
0
        protected override void InitializeCommonControlBinding()
        {
            base.InitializeCommonControlBinding();

            this.treeWarehouseID.RootKeyValue               = 0;
            this.treeCommodityID.RootKeyValue               = 0;
            this.treeCommodityTypeID.RootKeyValue           = 0;
            this.treeCustomerID.RootKeyValue                = 0;
            this.treeEmployeeID.RootKeyValue                = 0;
            this.treeWarehouseIssueID.RootKeyValue          = 0;
            this.treeWarehouseReceiptID.RootKeyValue        = 0;
            this.treeWarehouseAdjustmentTypeID.RootKeyValue = 0;

            WarehouseAPIs warehouseAPIs = new WarehouseAPIs(CommonNinject.Kernel.Get <IWarehouseAPIRepository>());

            this.warehouseTrees             = warehouseAPIs.GetWarehouseTrees(ContextAttributes.User.LocationID);
            this.treeWarehouseID.DataSource = new BindingSource(this.warehouseTrees, "");

            this.warehouseIssueTrees             = warehouseAPIs.GetWarehouseTrees(null);
            this.treeWarehouseIssueID.DataSource = new BindingSource(this.warehouseIssueTrees, "");

            this.warehouseReceiptTrees             = warehouseAPIs.GetWarehouseTrees(null);
            this.treeWarehouseReceiptID.DataSource = new BindingSource(this.warehouseReceiptTrees, "");

            WarehouseAdjustmentTypeAPIs warehouseAdjustmentTypeAPIs = new WarehouseAdjustmentTypeAPIs(CommonNinject.Kernel.Get <IWarehouseAdjustmentTypeAPIRepository>());

            this.warehouseAdjustmentTypeTrees             = warehouseAdjustmentTypeAPIs.GetWarehouseAdjustmentTypeTrees();
            this.treeWarehouseAdjustmentTypeID.DataSource = new BindingSource(this.warehouseAdjustmentTypeTrees, "");

            CommodityAPIs commodityAPIs = new CommodityAPIs(CommonNinject.Kernel.Get <ICommodityAPIRepository>());

            this.commodityTrees             = commodityAPIs.GetCommodityTrees();
            this.treeCommodityID.DataSource = new BindingSource(this.commodityTrees, "");

            CommodityTypeAPIs commodityTypeAPIs = new CommodityTypeAPIs(CommonNinject.Kernel.Get <ICommodityTypeAPIRepository>());

            this.commodityTypeTrees             = commodityTypeAPIs.GetCommodityTypeTrees();
            this.treeCommodityTypeID.DataSource = new BindingSource(this.commodityTypeTrees, "");

            CustomerAPIs customerAPIs = new CustomerAPIs(CommonNinject.Kernel.Get <ICustomerAPIRepository>());

            this.customerTrees             = customerAPIs.GetCustomerTrees();
            this.treeCustomerID.DataSource = new BindingSource(this.customerTrees, "");

            EmployeeAPIs employeeAPIs = new EmployeeAPIs(CommonNinject.Kernel.Get <IEmployeeAPIRepository>());

            this.employeeTrees             = employeeAPIs.GetEmployeeTrees();
            this.treeEmployeeID.DataSource = new BindingSource(this.employeeTrees, "");

            this.comboSummaryVersusDetail.ComboBox.Items.AddRange(new string[] { "Summary only", "Show detail" });
            this.comboSummaryVersusDetail.ComboBox.SelectedIndex = 0;

            this.comboQuantityVersusVolume.ComboBox.Items.AddRange(new string[] { "By quantity", "By volume" });
            this.comboQuantityVersusVolume.ComboBox.SelectedIndex = 1;

            this.comboDateVersusMonth.ComboBox.Items.AddRange(new string[] { "Daily summary", "Monthly summary" });
            this.comboDateVersusMonth.ComboBox.SelectedIndex = 1;

            this.comboSalesVersusPromotion.ComboBox.Items.AddRange(new string[] { "Sales & promotions", "Sales only", "Promotions only" });
            this.comboSalesVersusPromotion.ComboBox.SelectedIndex = 0;

            this.comboForecastFilters.ComboBox.Items.AddRange(new string[] { "[All Items in Stock]", "[Current Stock + In Transit] > 0", "[Current Stock + In Transit] = 0", "[Current Stock + In Transit] < 0", "[Current Stock + In Transit] Between Low-High Level", "[Current Stock + In Transit] Out of Range Low-High Level", "[Current Stock + In Transit] Under Low-Level", "[Current Stock + In Transit] Over High-Level" });
            this.comboForecastFilters.ComboBox.SelectedIndex = 0;

            this.comboSlowMoving.Items.AddRange(new string[] { "Regardless forecast", "And without forecast" });
            this.comboSlowMoving.SelectedIndex = 0;

            UserControlAPIs userControlAPIs = new UserControlAPIs(CommonNinject.Kernel.Get <IUserControlAPIRepository>());

            this.comboUserName.ComboBox.Items.Add("[All users]");
            this.comboUserName.ComboBox.Items.AddRange(Array.ConvertAll(userControlAPIs.GetUserControlIndexes(GlobalEnums.ActiveOption.Both).ToArray(), u => u.UserName));
            this.comboUserName.ComboBox.SelectedIndex = 0;

            this.dateTimexFromDate.DataBindings.Add("Value", GlobalEnums.GlobalOptionSetting, CommonExpressions.PropertyName <OptionSetting>(p => p.FromDate), true, DataSourceUpdateMode.OnPropertyChanged);
            this.dateTimexToDate.DataBindings.Add("Value", GlobalEnums.GlobalOptionSetting, CommonExpressions.PropertyName <OptionSetting>(p => p.ToDate), true, DataSourceUpdateMode.OnPropertyChanged);

            this.fastReportIndex.AboutToCreateGroups += fastReportIndex_AboutToCreateGroups;
            this.fastReportIndex.ShowGroups           = true;
            //this.olvApproved.Renderer = new MappedImageRenderer(new Object[] { 1, Resources.Placeholder16, 2, Resources.Void_16 });
        }