Пример #1
0
        private void LoadItemDesc(int iRow)
        {
            try
            {
                #region validateion
                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));
                    }
                }
                ErrorItem errItem = PurchaseOrderEntryValidation.CheckDupItem
                                        (new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value), strItemCDList);
                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);
                }
                #endregion

                ItemBIZ bizItem = new ItemBIZ();
                ItemDTO dtoItem = bizItem.LoadItem((NZString)Convert.ToString(shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_CD].Value));

                if (dtoItem != null)
                {
                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = Convert.ToString(dtoItem.ITEM_DESC);
                }
                else
                {
                    shtView.Cells[shtView.ActiveRowIndex, (int)eColumn.ITEM_DESC].Value = string.Empty;
                }
            }
            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();
            }
        }
Пример #2
0
        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();
            }
        }