protected override void InitializeCommonControlBinding() { base.InitializeCommonControlBinding(); CommodityAPIs commodityAPIs = new CommodityAPIs(CommonNinject.Kernel.Get <ICommodityAPIRepository>()); this.combexCommodityID.DataSource = commodityAPIs.GetCommodityBases(); this.combexCommodityID.DisplayMember = CommonExpressions.PropertyName <CommodityBase>(p => p.Code); this.combexCommodityID.ValueMember = CommonExpressions.PropertyName <CommodityBase>(p => p.CommodityID); this.bindingCommodityID = this.combexCommodityID.DataBindings.Add("SelectedValue", this.commoditySettingViewModel, CommonExpressions.PropertyName <CommoditySettingDTO>(p => p.CommodityID), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCommodityName = this.textexCommodityName.DataBindings.Add("Text", this.commoditySettingViewModel, CommonExpressions.PropertyName <CommoditySettingDTO>(p => p.CommodityName), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCommodityCategoryName = this.textexCommodityCategoryName.DataBindings.Add("Text", this.commoditySettingViewModel, CommonExpressions.PropertyName <CommoditySettingDTO>(p => p.CommodityCategoryName), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingPackageSize = this.textexPackageSize.DataBindings.Add("Text", this.commoditySettingViewModel, CommonExpressions.PropertyName <CommoditySettingDTO>(p => p.PackageSize), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingPackageVolume = this.numericPackageVolume.DataBindings.Add("Value", this.commoditySettingViewModel, CommonExpressions.PropertyName <CommoditySettingDTO>(p => p.PackageVolume), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingRemarks = this.textexRemarks.DataBindings.Add("Text", this.commoditySettingViewModel, CommonExpressions.PropertyName <CommoditySettingDTO>(p => p.Remarks), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCommodityID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCommodityName.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCommodityCategoryName.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingPackageSize.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingPackageVolume.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingRemarks.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.fastCommoditySettingIndex.AboutToCreateGroups += fastCommoditySettingIndex_AboutToCreateGroups; this.fastCommoditySettingIndex.ShowGroups = true; }
protected override void InitializeDataGridBinding() { base.InitializeDataGridBinding(); this.InitializeDataGridReadonlyColumns(this.gridexViewDetails); this.gridexViewDetails.AutoGenerateColumns = false; this.gridexViewDetails.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; this.bindingSourceViewDetails.DataSource = this.transferOrderViewModel.ViewDetails; this.gridexViewDetails.DataSource = this.bindingSourceViewDetails; this.bindingSourceViewDetails.AddingNew += bindingSourceViewDetails_AddingNew; this.transferOrderViewModel.ViewDetails.ListChanged += ViewDetails_ListChanged; this.gridexViewDetails.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(this.dataGridViewDetails_EditingControlShowing); this.gridexViewDetails.ReadOnlyChanged += new System.EventHandler(this.dataGrid_ReadOnlyChanged); DataGridViewComboBoxColumn comboBoxColumn; CommodityAPIs commodityAPIs = new CommodityAPIs(CommonNinject.Kernel.Get <ICommodityAPIRepository>()); comboBoxColumn = (DataGridViewComboBoxColumn)this.gridexViewDetails.Columns[CommonExpressions.PropertyName <TransferOrderDetailDTO>(p => p.CommodityID)]; comboBoxColumn.DataSource = commodityAPIs.GetCommodityBases(true); comboBoxColumn.DisplayMember = CommonExpressions.PropertyName <CommodityBase>(p => p.Code); comboBoxColumn.ValueMember = CommonExpressions.PropertyName <CommodityBase>(p => p.CommodityID); StackedHeaderDecorator stackedHeaderDecorator = new StackedHeaderDecorator(this.gridexViewDetails); }
protected override void InitializeCommonControlBinding() { base.InitializeCommonControlBinding(); this.bindingEntryDate = this.dateTimexEntryDate.DataBindings.Add("Value", this.batchViewModel, "EntryDate", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCode = this.textexCode.DataBindings.Add("Text", this.batchViewModel, "Code", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingNextPackNo = this.textexNextPackNo.DataBindings.Add("Text", this.batchViewModel, "NextPackNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingNextCartonNo = this.textexNextCartonNo.DataBindings.Add("Text", this.batchViewModel, "NextCartonNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingNextPalletNo = this.textexNextPalletNo.DataBindings.Add("Text", this.batchViewModel, "NextPalletNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingBatchPackNo = this.textexBatchPackNo.DataBindings.Add("Text", this.batchViewModel, "BatchPackNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingBatchCartonNo = this.textexBatchCartonNo.DataBindings.Add("Text", this.batchViewModel, "BatchCartonNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingBatchPalletNo = this.textexBatchPalletNo.DataBindings.Add("Text", this.batchViewModel, "BatchPalletNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingFinalCartonNo = this.textexFinalCartonNo.DataBindings.Add("Text", this.batchViewModel, "FinalCartonNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingAutoCarton = this.checkAutoCarton.DataBindings.Add("Checked", this.batchViewModel, "AutoCarton", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingAutoBarcode = this.checkAutoBarcode.DataBindings.Add("Checked", this.batchViewModel, "AutoBarcode", true, DataSourceUpdateMode.OnPropertyChanged); this.labelFinalCartonNo.DataBindings.Add("Visible", this.batchViewModel, "AutoBarcode", true, DataSourceUpdateMode.OnPropertyChanged); this.textexFinalCartonNo.DataBindings.Add("Visible", this.batchViewModel, "AutoBarcode", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingRemarks = this.textexRemarks.DataBindings.Add("Text", this.batchViewModel, "Remarks", true, DataSourceUpdateMode.OnPropertyChanged); this.textexCommodityName.DataBindings.Add("Text", this.batchViewModel, CommonExpressions.PropertyName <BatchViewModel>(p => p.CommodityName), true); this.textexCommodityAPICode.DataBindings.Add("Text", this.batchViewModel, CommonExpressions.PropertyName <BatchViewModel>(p => p.CommodityAPICode), true); CommodityAPIs commodityAPIs = new CommodityAPIs(CommonNinject.Kernel.Get <ICommodityAPIRepository>()); commodityAPIs.ImportCommodities(); //IMPORT Commodities FROM EXISTING SYSTEM this.combexCommodityID.DataSource = commodityAPIs.GetCommodityBases().Where(p => p.FillingLineIDs.Contains(((int)GlobalVariables.FillingLineID).ToString()) || GlobalVariables.ConfigID == (int)GlobalVariables.FillingLine.Import).ToList(); this.combexCommodityID.DisplayMember = CommonExpressions.PropertyName <CommodityBase>(p => p.DisplayCode); this.combexCommodityID.ValueMember = CommonExpressions.PropertyName <CommodityBase>(p => p.CommodityID); this.bindingCommodityID = this.combexCommodityID.DataBindings.Add("SelectedValue", this.batchViewModel, CommonExpressions.PropertyName <BatchViewModel>(p => p.CommodityID), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingEntryDate.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCode.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingNextPackNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingNextCartonNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingNextPalletNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingBatchPackNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingBatchCartonNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingBatchPalletNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingFinalCartonNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingAutoBarcode.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingAutoCarton.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingRemarks.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCommodityID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); }
protected override void InitializeCommonControlBinding() { base.InitializeCommonControlBinding(); this.bindingEntryDate = this.dateTimexEntryDate.DataBindings.Add("Value", this.batchViewModel, "EntryDate", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingCode = this.textexCode.DataBindings.Add("Text", this.batchViewModel, "Code", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingLotCode = this.textexLotCode.DataBindings.Add("Text", this.batchViewModel, "LotCode", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingNextPackNo = this.textexNextPackNo.DataBindings.Add("Text", this.batchViewModel, "NextPackNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingNextCartonNo = this.textexNextCartonNo.DataBindings.Add("Text", this.batchViewModel, "NextCartonNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingNextPalletNo = this.textexNextPalletNo.DataBindings.Add("Text", this.batchViewModel, "NextPalletNo", true, DataSourceUpdateMode.OnPropertyChanged); this.bindingRemarks = this.textexRemarks.DataBindings.Add("Text", this.batchViewModel, "Remarks", true, DataSourceUpdateMode.OnPropertyChanged); this.textexCommodityName.DataBindings.Add("Text", this.batchViewModel, CommonExpressions.PropertyName <BatchViewModel>(p => p.CommodityName), true); this.commodityAPIs = new CommodityAPIs(CommonNinject.Kernel.Get <ICommodityAPIRepository>()); this.combexCommodityID.DataSource = this.commodityAPIs.GetCommodityBases(); this.combexCommodityID.DisplayMember = CommonExpressions.PropertyName <CommodityBase>(p => p.CodeAPICode); this.combexCommodityID.ValueMember = CommonExpressions.PropertyName <CommodityBase>(p => p.CommodityID); this.bindingCommodityID = this.combexCommodityID.DataBindings.Add("SelectedValue", this.batchViewModel, CommonExpressions.PropertyName <BatchViewModel>(p => p.CommodityID), true, DataSourceUpdateMode.OnPropertyChanged); BatchTypeAPIs batchTypeAPIs = new BatchTypeAPIs(CommonNinject.Kernel.Get <IBatchTypeAPIRepository>()); this.combexBatchTypeID.DataSource = batchTypeAPIs.GetBatchTypeBases(); this.combexBatchTypeID.DisplayMember = CommonExpressions.PropertyName <BatchTypeBase>(p => p.CodeName); this.combexBatchTypeID.ValueMember = CommonExpressions.PropertyName <BatchTypeBase>(p => p.BatchTypeID); this.bindingBatchTypeID = this.combexBatchTypeID.DataBindings.Add("SelectedValue", this.batchViewModel, CommonExpressions.PropertyName <BatchViewModel>(p => p.BatchTypeID), true, DataSourceUpdateMode.OnPropertyChanged); this.bindingEntryDate.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCode.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingLotCode.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingNextPackNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingNextCartonNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingNextPalletNo.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingRemarks.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingCommodityID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.bindingBatchTypeID.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); this.fastBatchIndex.AboutToCreateGroups += fastBatchIndex_AboutToCreateGroups; this.fastBatchIndex.ShowGroups = true; this.buttonUnlock.Visible = !this.batchViewModel.AllowDataInput; this.buttonApply.Visible = this.batchViewModel.AllowDataInput; this.buttonDiscontinued.Visible = this.batchViewModel.AllowDataInput; this.separatorApply.Visible = this.batchViewModel.AllowDataInput; this.fastBatchIndex.DoubleClick += fastBatchIndex_DoubleClick; }
public Commodities() : base() { InitializeComponent(); this.toolstripChild = this.toolStripChildForm; this.fastListIndex = this.fastCommodityIndex; this.commodityAPIs = new CommodityAPIs(CommonNinject.Kernel.Get <ICommodityAPIRepository>()); this.commodityViewModel = CommonNinject.Kernel.Get <CommodityViewModel>(); this.commodityViewModel.PropertyChanged += new PropertyChangedEventHandler(ModelDTO_PropertyChanged); this.baseDTO = this.commodityViewModel; }
protected virtual void CalculateQuantityDetailDTO(IQuantityDetailDTO quantityDetailDTO, string propertyName, int?deliveryAdviceID, int?transferOrderID) { if (propertyName == CommonExpressions.PropertyName <IQuantityDetailDTO>(p => p.CommodityID)) { CommodityAPIs commodityAPIs = new CommodityAPIs(CommonNinject.Kernel.Get <ICommodityAPIRepository>()); //WE MUST USE ContextAttributes.User.LocationID, INSTEAD OF quantityDetailDTO.LocationID, BECAUSE AT FIRST quantityDetailDTO.LocationID = 0. WHEN SAVE: GenericService.PreSaveRoutines WILL UPDATE DTO.LocationID = ContextAttributes.User.LocationID. SEE GenericService.PreSaveRoutines FOR MORE INFORMATION!!! IList <SearchCommodity> searchCommodities = commodityAPIs.SearchCommodities(quantityDetailDTO.CommodityID, ContextAttributes.User.LocationID, null, deliveryAdviceID, transferOrderID); if (searchCommodities.Count > 0) { quantityDetailDTO.CommodityCode = searchCommodities[0].Code; quantityDetailDTO.CommodityName = searchCommodities[0].Name; quantityDetailDTO.Unit = searchCommodities[0].Unit; quantityDetailDTO.PackageSize = searchCommodities[0].PackageSize; quantityDetailDTO.Volume = searchCommodities[0].Volume; quantityDetailDTO.PackageVolume = searchCommodities[0].PackageVolume; IAvailableQuantityDetailDTO availableQuantityDetailDTO = quantityDetailDTO as IAvailableQuantityDetailDTO; if (availableQuantityDetailDTO != null) { availableQuantityDetailDTO.QuantityAvailable = searchCommodities[0].QuantityAvailable; availableQuantityDetailDTO.LineVolumeAvailable = searchCommodities[0].LineVolumeAvailable; } IBatchQuantityDetailDTO batchQuantityDetailDTO = quantityDetailDTO as IBatchQuantityDetailDTO; if (batchQuantityDetailDTO != null) { batchQuantityDetailDTO.BatchID = null; batchQuantityDetailDTO.BatchCode = null; batchQuantityDetailDTO.BatchEntryDate = null; batchQuantityDetailDTO.QuantityBatchAvailable = 0; batchQuantityDetailDTO.LineVolumeBatchAvailable = 0; } } } if (propertyName == CommonExpressions.PropertyName <IQuantityDetailDTO>(p => p.PackageVolume) || propertyName == CommonExpressions.PropertyName <IQuantityDetailDTO>(p => p.Quantity)) { quantityDetailDTO.LineVolume = quantityDetailDTO.Quantity * quantityDetailDTO.PackageVolume; } }
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 }); }