private void WizardMaster_Load(object sender, EventArgs e) { try { this.salesOrderViewModel.PropertyChanged += salesOrderDetailDTO_PropertyChanged; CustomerAPIs customerAPIs = new CustomerAPIs(CommonNinject.Kernel.Get <ICustomerAPIRepository>()); this.combexCustomerID.DataSource = customerAPIs.GetCustomerBases(); this.combexCustomerID.DisplayMember = CommonExpressions.PropertyName <CustomerBase>(p => p.Code); this.combexCustomerID.ValueMember = CommonExpressions.PropertyName <CustomerBase>(p => p.CustomerID); this.bindingCustomerID = this.combexCustomerID.DataBindings.Add("SelectedValue", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.CustomerID), true, DataSourceUpdateMode.OnPropertyChanged); CustomerAPIs receiverAPIs = new CustomerAPIs(CommonNinject.Kernel.Get <ICustomerAPIRepository>()); this.combexReceiverID.DataSource = receiverAPIs.GetCustomerBases(); this.combexReceiverID.DisplayMember = CommonExpressions.PropertyName <CustomerBase>(p => p.Code); this.combexReceiverID.ValueMember = CommonExpressions.PropertyName <CustomerBase>(p => p.CustomerID); this.bindingReceiverID = this.combexReceiverID.DataBindings.Add("SelectedValue", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.ReceiverID), true, DataSourceUpdateMode.OnPropertyChanged); EmployeeAPIs employeeAPIs = new EmployeeAPIs(CommonNinject.Kernel.Get <IEmployeeAPIRepository>()); this.combexSalespersonID.DataSource = employeeAPIs.GetEmployeeBases(ContextAttributes.User.UserID, (int)this.salesOrderViewModel.NMVNTaskID, (int)GlobalEnums.RoleID.Saleperson); this.combexSalespersonID.DisplayMember = CommonExpressions.PropertyName <EmployeeBase>(p => p.Name); this.combexSalespersonID.ValueMember = CommonExpressions.PropertyName <EmployeeBase>(p => p.EmployeeID); this.bindingStorekeeperID = this.combexSalespersonID.DataBindings.Add("SelectedValue", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.SalespersonID), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingVoucherCode = this.textexVoucherCode.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.VoucherCode), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingEntryDate = this.dateTimexEntryDate.DataBindings.Add("Value", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.EntryDate), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingDeliveryDate = this.dateTimexDeliveryDate.DataBindings.Add("Value", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.DeliveryDate), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCustomerName = this.textexCustomerName.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.CustomerName), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingContactInfo = this.textexContactInfo.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.ContactInfo), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingReceiverName = this.textexReceiverName.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.ReceiverName), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingShippingAddress = this.textexShippingAddress.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.ShippingAddress), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingRemarks = this.textexRemarks.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.Remarks), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCustomerID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingReceiverID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingStorekeeperID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingVoucherCode.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingEntryDate.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingDeliveryDate.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCustomerName.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingContactInfo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingReceiverName.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingShippingAddress.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingRemarks.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.errorProviderMaster.DataSource = this.salesOrderViewModel; } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
protected override void InitializeCommonControlBinding() { base.InitializeCommonControlBinding(); this.bindingEntryDate = this.dateTimexEntryDate.DataBindings.Add("Value", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.EntryDate), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingReference = this.textexReference.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.Reference), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingVoucherCode = this.textexVoucherCode.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.VoucherCode), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingDeliveryDate = this.dateTimexDeliveryDate.DataBindings.Add("Value", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.DeliveryDate), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingContactInfo = this.textexContactInfo.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.ContactInfo), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingDeliveryAddress = this.textexDeliveryAddress.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.ShippingAddress), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingDescription = this.textexDescription.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.Description), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingRemarks = this.textexRemarks.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.Remarks), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCaption = this.labelCaption.DataBindings.Add("Text", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderDTO>(p => p.Caption)); CustomerAPIs customerAPIs = new CustomerAPIs(CommonNinject.Kernel.Get <ICustomerAPIRepository>()); this.combexCustomerID.DataSource = customerAPIs.GetCustomerBases(); this.combexCustomerID.DisplayMember = CommonExpressions.PropertyName <CustomerBase>(p => p.Name); this.combexCustomerID.ValueMember = CommonExpressions.PropertyName <CustomerBase>(p => p.CustomerID); this.bindingCustomerID = this.combexCustomerID.DataBindings.Add("SelectedValue", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.CustomerID), true, DataSourceUpdateMode.OnPropertyChanged); CustomerAPIs receiverAPIs = new CustomerAPIs(CommonNinject.Kernel.Get <ICustomerAPIRepository>()); this.combexReceiverID.DataSource = receiverAPIs.GetCustomerBases(); this.combexReceiverID.DisplayMember = CommonExpressions.PropertyName <CustomerBase>(p => p.Name); this.combexReceiverID.ValueMember = CommonExpressions.PropertyName <CustomerBase>(p => p.CustomerID); this.bindingReceiverID = this.combexReceiverID.DataBindings.Add("SelectedValue", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.ReceiverID), true, DataSourceUpdateMode.OnPropertyChanged); EmployeeAPIs employeeAPIs = new EmployeeAPIs(CommonNinject.Kernel.Get <IEmployeeAPIRepository>()); this.combexSalespersonID.DataSource = employeeAPIs.GetEmployeeBases(ContextAttributes.User.UserID, (int)this.salesOrderViewModel.NMVNTaskID, (int)GlobalEnums.RoleID.Saleperson); this.combexSalespersonID.DisplayMember = CommonExpressions.PropertyName <EmployeeBase>(p => p.Name); this.combexSalespersonID.ValueMember = CommonExpressions.PropertyName <EmployeeBase>(p => p.EmployeeID); this.bindingSalespersonID = this.combexSalespersonID.DataBindings.Add("SelectedValue", this.salesOrderViewModel, CommonExpressions.PropertyName <SalesOrderViewModel>(p => p.SalespersonID), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingEntryDate.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingReference.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingVoucherCode.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingDeliveryDate.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingContactInfo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingDeliveryAddress.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingDescription.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingRemarks.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCaption.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCustomerID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingReceiverID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingSalespersonID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.fastSalesOrderIndex.AboutToCreateGroups += fastSalesOrderIndex_AboutToCreateGroups; this.fastSalesOrderIndex.ShowGroups = true; this.olvApproved.Renderer = new MappedImageRenderer(new Object[] { 1, Resources.Placeholder16, 2, Resources.Void_16 }); this.naviGroupDetails.ExpandedHeight = this.naviGroupDetails.Size.Height; }
public Customers() : base() { InitializeComponent(); this.toolstripChild = this.toolStripChildForm; this.fastListIndex = this.fastCustomerIndex; this.customerAPIs = new CustomerAPIs(CommonNinject.Kernel.Get <ICustomerAPIRepository>()); this.customerViewModel = CommonNinject.Kernel.Get <CustomerViewModel>(); this.customerViewModel.PropertyChanged += new PropertyChangedEventHandler(ModelDTO_PropertyChanged); this.baseDTO = this.customerViewModel; }
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 }); }