Exemplo n.º 1
0
        private void GridBind()
        {
            AssetDetails_dgv.DataSource = null;
            try
            {
                AssetVo vo = new AssetVo
                {
                    AssetCode = AssetCode_txt.Text,
                    AssetName = AssetName_txt.Text
                };

                ValueObjectList <AssetVo> volist = (ValueObjectList <AssetVo>)DefaultCbmInvoker.Invoke(new GetAssetCbm(), vo);
                if (volist.GetList() != null && volist.GetList().Count > 0)
                {
                    AssetDetails_dgv.AutoGenerateColumns = false;
                    BindingSource bindingsource = new BindingSource(volist.GetList(), null);
                    AssetDetails_dgv.DataSource = bindingsource;
                }
                else
                {
                    messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }
                AssetDetails_dgv.ClearSelection();
                Update_btn.Enabled = false;
                Delete_btn.Enabled = false;
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
Exemplo n.º 2
0
        private void GridBind()
        {
            AssetDetails_dgv.DataSource = null;
            try
            {
                AssetVo vo = new AssetVo
                {
                    AssetCode = AssetCode_txt.Text,
                    AssetName = AssetName_txt.Text,
                    AssetNo   = 10000, //ne vao trong gia tri o, nen chuyen database lai voi asset_no string  Long
                };

                ValueObjectList <AssetVo> volist = (ValueObjectList <AssetVo>)DefaultCbmInvoker.Invoke(new GetAssetCbm(), vo);
                if (volist.GetList() != null && volist.GetList().Count > 0)
                {
                    BindingSource bindingsource = new BindingSource(volist.GetList(), null);
                    AssetDetails_dgv.DataSource = bindingsource;

                    AssetDetails_dgv.Columns["colAssetCode"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                }
                else
                {
                    messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }
                AssetDetails_dgv.ClearSelection();
                setColor();
                Update_btn.Enabled = false;
                Delete_btn.Enabled = false;
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }