private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Exception) { ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } if (sender.Equals(this.bindingWarehouseID)) { if (this.combexWarehouseID.SelectedItem != null) { WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseID.SelectedItem; this.warehouseAdjustmentViewModel.WarehouseName = warehouseBase.Name; } } if (sender.Equals(this.bindingWarehouseReceiptID)) { if (this.combexWarehouseReceiptID.SelectedItem != null) { WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseReceiptID.SelectedItem; this.warehouseAdjustmentViewModel.WarehouseReceiptName = warehouseBase.Name; } } if (sender.Equals(this.bindingWarehouseAdjustmentTypeID)) { if (this.combexWarehouseAdjustmentTypeID.SelectedItem != null) { WarehouseAdjustmentTypeBase warehouseAdjustmentTypeBase = (WarehouseAdjustmentTypeBase)this.combexWarehouseAdjustmentTypeID.SelectedItem; this.warehouseAdjustmentViewModel.WarehouseAdjustmentTypeName = warehouseAdjustmentTypeBase.Name; } } }
protected override DialogResult wizardMaster() { if (this.optionDictionary != null) { //WHEN IMPORT, this.optionDictionary WILL BE != null object objectValue; DateTime entryDate; if (this.optionDictionary.TryGetValue("EntryDate", out objectValue) && DateTime.TryParse(objectValue.ToString(), out entryDate)) { this.forecastViewModel.EntryDate = entryDate; } this.optionDictionary = null; if (this.excelDataTable != null && this.excelDataTable.Rows.Count > 0 && this.excelDataTable.Rows[0]["WarehouseCode"].ToString().Trim() != "") { WarehouseBase warehouseBase = this.warehouseAPIs.GetWarehouseBase(this.excelDataTable.Rows[0]["WarehouseCode"].ToString().Trim()); if (warehouseBase != null) { this.forecastViewModel.ForecastLocationID = warehouseBase.LocationID; } } } WizardMaster wizardMaster = new WizardMaster(this.forecastViewModel); DialogResult dialogResult = wizardMaster.ShowDialog(); wizardMaster.Dispose(); return(dialogResult); }
protected override void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { base.CommonControl_BindingComplete(sender, e); if (this.EditableMode) { if (sender.Equals(this.bindingWarehouseReceiptID)) { if (this.combexWarehouseReceiptID.SelectedItem != null) { WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseReceiptID.SelectedItem; this.transferOrderViewModel.WarehouseReceiptName = warehouseBase.Name; } } } }
private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Exception) { ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } if (sender.Equals(this.bindingWarehouseID)) { if (this.combexWarehouseID.SelectedItem != null) { WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseID.SelectedItem; this.pickupViewModel.WarehouseName = warehouseBase.Name; } } else if (sender.Equals(this.bindingFillingLineID)) { if (this.combexFillingLineID.SelectedItem != null) { FillingLineBase fillingLineBase = (FillingLineBase)this.combexFillingLineID.SelectedItem; this.pickupViewModel.FillingLineName = fillingLineBase.Name; this.pickupViewModel.FillingLineNickName = fillingLineBase.NickName; } } }
private void btn_Mat_Click(object sender, EventArgs e) { this.txt_Mat.Text = ""; this.txt_Mat.Tag = ""; WarehouseBase.SelectMaterialInfo(base.AppInformation, base.UserInformation, new WareBaseMS.DoSelMaterialEvent(this.doSelectMatInfo)); }
protected override void wizardDetail() { try { ExceptionTable exceptionTable = new ExceptionTable(new string[2, 2] { { "ExceptionCategory", "System.String" }, { "Description", "System.String" } }); decimal decimalValue; if (this.excelDataTable != null && this.excelDataTable.Rows.Count > 0) { this.forecastViewModel.ViewDetails.RaiseListChangedEvents = false; foreach (DataRow excelDataRow in this.excelDataTable.Rows) { if (excelDataRow["WarehouseCode"] != null && excelDataRow["WarehouseCode"].ToString().Trim() != "") { WarehouseBase warehouseBase = this.warehouseAPIs.GetWarehouseBase(excelDataRow["WarehouseCode"].ToString().Trim()); if (warehouseBase != null && warehouseBase.LocationID == this.forecastViewModel.ForecastLocationID) { CommodityBase commodityBase = this.commodityAPIs.GetCommodityBase(excelDataRow["CommodityCode"].ToString()); if (commodityBase != null) { ForecastDetailDTO forecastDetailDTO = new ForecastDetailDTO(); forecastDetailDTO.CommodityID = commodityBase.CommodityID; forecastDetailDTO.CommodityCode = commodityBase.Code; forecastDetailDTO.CommodityName = commodityBase.Name; forecastDetailDTO.CommodityCategoryName = commodityBase.CommodityCategoryName; if (decimal.TryParse(excelDataRow["CurrentMonth"].ToString(), out decimalValue)) { if (this.forecastViewModel.QuantityVersusVolume == 0) { forecastDetailDTO.Quantity = decimalValue; } else { forecastDetailDTO.LineVolume = decimalValue; } } else { exceptionTable.AddException(new string[] { "Type mismatch; number value required", "Column current month: " + excelDataRow["CurrentMonth"].ToString() }); } if (decimal.TryParse(excelDataRow["NextMonth"].ToString(), out decimalValue)) { if (this.forecastViewModel.QuantityVersusVolume == 0) { forecastDetailDTO.QuantityM1 = decimalValue; } else { forecastDetailDTO.LineVolumeM1 = decimalValue; } } else { exceptionTable.AddException(new string[] { "Type mismatch; number value required", "Column next month: " + excelDataRow["NextMonth"].ToString() }); } if (decimal.TryParse(excelDataRow["NextTwoMonth"].ToString(), out decimalValue)) { if (this.forecastViewModel.QuantityVersusVolume == 0) { forecastDetailDTO.QuantityM2 = decimalValue; } else { forecastDetailDTO.LineVolumeM2 = decimalValue; } } else { exceptionTable.AddException(new string[] { "Type mismatch; number value required", "Column next two month: " + excelDataRow["NextTwoMonth"].ToString() }); } if (decimal.TryParse(excelDataRow["NextThreeMonth"].ToString(), out decimalValue)) { if (this.forecastViewModel.QuantityVersusVolume == 0) { forecastDetailDTO.QuantityM3 = decimalValue; } else { forecastDetailDTO.LineVolumeM3 = decimalValue; } } else { exceptionTable.AddException(new string[] { "Type mismatch; number value required", "Column next three month: " + excelDataRow["NextThreeMonth"].ToString() }); } if (forecastDetailDTO.Quantity != 0 || forecastDetailDTO.QuantityM1 != 0 || forecastDetailDTO.QuantityM2 != 0 || forecastDetailDTO.QuantityM3 != 0 || forecastDetailDTO.LineVolume != 0 || forecastDetailDTO.LineVolumeM1 != 0 || forecastDetailDTO.LineVolumeM2 != 0 || forecastDetailDTO.LineVolumeM3 != 0) { this.forecastViewModel.ViewDetails.Add(forecastDetailDTO); } } else { exceptionTable.AddException(new string[] { "Item not found", "Item: " + excelDataRow["CommodityCode"].ToString() }); } } else { exceptionTable.AddException(new string[] { "Warehouse does not match", "Warehouse: " + excelDataRow["WarehouseCode"].ToString() }); } } } } if (exceptionTable.Table.Rows.Count > 0) { throw new CustomException("Lỗi import file excel. Vui lòng xem danh sách đính kèm. Click vào từng nội dung để xem chi tiết.", exceptionTable.Table); } } catch (System.Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } finally { this.forecastViewModel.ViewDetails.RaiseListChangedEvents = true; this.forecastViewModel.ViewDetails.ResetBindings(); } }