private void fpIssueList_ButtonClicked(object sender, EditorNotifyEventArgs e) { NZString ItemCD = new NZString(null, shtIssueList.Cells[e.Row, (int)eColView.ITEM_CODE].Value); NZString LotNo = new NZString(null, shtIssueList.Cells[e.Row, (int)eColView.LOT_NO].Value); NZString LocCD = new NZString(cboFromLoc, cboFromLoc.SelectedValue); if (e.Column == (int)eColView.ITEM_CD_BTN) { ItemFindDialog dialog = new ItemFindDialog(eSqlOperator.In, null); dialog.ShowDialog(this); if (dialog.IsSelected) { shtIssueList.Cells[e.Row, (int)eColView.ITEM_CODE].Value = dialog.SelectedItem.ITEM_CD.Value; shtIssueList.Cells[e.Row, (int)eColView.ITEM_DESC].Value = dialog.SelectedItem.ITEM_DESC.Value; shtIssueList.Cells[e.Row, (int)eColView.LOT_NO].Value = null; shtIssueList.Cells[e.Row, (int)eColView.ISSUE_QTY].Value = null; } } else if (e.Column == (int)eColView.LOT_BTN) { NZString locCD = new NZString(null, cboFromLoc.SelectedValue); LotNoFindDialog dialog = new LotNoFindDialog(ItemCD, locCD); dialog.ShowDialog(this); if (dialog.IsSelected) { shtIssueList.Cells[e.Row, (int)eColView.LOT_NO].Value = dialog.SelectedLotNo.NVL(string.Empty); LotNo = new NZString(null, shtIssueList.Cells[e.Row, (int)eColView.LOT_NO].Value); shtIssueList.Cells[e.Row, (int)eColView.ONHAND_QTY].Value = GetOnhandQty(ItemCD, LocCD, LotNo); shtIssueList.Cells[e.Row, (int)eColView.ISSUE_QTY].Value = shtIssueList.Cells[e.Row, (int)eColView.ONHAND_QTY].Value; } } }
/// <summary> /// Set Default Value into selected cell, will be used when select Item Code. /// </summary> private void SetItemCDandItemDesc() { eItemType[] itemTypeEnum = { eItemType.All }; ItemFindDialog dialog = new ItemFindDialog(eSqlOperator.Equal, itemTypeEnum); dialog.ShowDialog(this); if (dialog.IsSelected) { shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value = dialog.SelectedItem.ITEM_CD.StrongValue; // set default into ItemCode, ItemDesc, Unit, InventoryU/M and Rate of unit. ErrorItem errItem = ValidateDupplicateItem(); if (errItem != null) { shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value = string.Empty; shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = string.Empty; ValidateException.ThrowErrorItem(errItem); } ValidateException.ThrowErrorItem(errItem); shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = dialog.SelectedItem.ITEM_DESC.StrongValue; //shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.UNIT].Value = dialog.SelectedItem.ORDER_UM_CLS.StrongValue; //shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.INV_UM].Value = dialog.SelectedItem.INV_UM_CLS.StrongValue; //shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.RATE].Value = dialog.SelectedItem.INV_UM_RATE.StrongValue / dialog.SelectedItem.ORDER_UM_RATE.StrongValue; } }
private string SearchItem() { eItemType[] eType = { eItemType.All }; ItemFindDialog dialog = new ItemFindDialog(eSqlOperator.Equal, eType); dialog.ShowDialog(this); if (dialog.IsSelected) { return(dialog.SelectedItem.ITEM_CD.ToString()); } return(string.Empty); }
private void fpView_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e) { try { eItemType[] itemTypeEnum = { eItemType.All }; ItemFindDialog dialog = new ItemFindDialog(eSqlOperator.Equal, itemTypeEnum); dialog.ShowDialog(this); if (dialog.IsSelected) { #region validateion int iRow = shtView.ActiveRowIndex; List <string> strItemCDList = new List <string>(); for (int i = 0; i < shtView.Rows.Count; i++) { if (i != iRow) { strItemCDList.Add(Convert.ToString(shtView.Cells[i, (int)eColumn.ITEM_CD].Value)); } } ValidateException.ThrowErrorItem(PurchaseOrderEntryValidation.CheckDupItem(dialog.SelectedItem.ITEM_CD, strItemCDList)); #endregion shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value = dialog.SelectedItem.ITEM_CD.ToString(); shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = dialog.SelectedItem.ITEM_DESC.ToString(); } } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (ValidateException err) { MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message); err.ErrorResults[0].FocusOnControl(); } }