/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind(SapItemSearchVo conditionInVo) { Item_dgv.DataSource = null; try { ValueObjectList <SapItemSearchVo> outVo = (ValueObjectList <SapItemSearchVo>)base.InvokeCbm(new GetSapItemSearchCbm(), conditionInVo, false); Item_dgv.AutoGenerateColumns = false; if (outVo != null && outVo.GetList() != null && outVo.GetList().Count > 0) { BindingSource buildingSource = new BindingSource(outVo.GetList(), null); Item_dgv.DataSource = buildingSource; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } Item_dgv.ClearSelection(); Ok_btn.Enabled = false; } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind() { Item_dgv.DataSource = null; SapItemSearchVo inVo = new SapItemSearchVo(); //List<SapItemSearchVo> outNewVo = null; if (!string.IsNullOrWhiteSpace(ItemCode_txt.Text)) { inVo.SapItemCode = ItemCode_txt.Text; } if (!string.IsNullOrWhiteSpace(ItemName_txt.Text)) { inVo.SapItemName = ItemName_txt.Text; } try { ValueObjectList <SapItemSearchVo> outVo = (ValueObjectList <SapItemSearchVo>)DefaultCbmInvoker.Invoke(new GetSapItemSearchCbm(), inVo); Item_dgv.AutoGenerateColumns = false; if (outVo == null || outVo.GetList() == null || outVo.GetList().Count == 0) { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); return; } BindingSource buildingSource; //if (sapItemSearchVo != null && sapItemSearchVo.GetList() != null && sapItemSearchVo.GetList().Count > 0) //{ // outVo.GetList().AddRange(sapItemSearchVo.GetList()); // outNewVo = outVo.GetList().Where(x => !String.IsNullOrWhiteSpace(x.SapItemCode)) // .Select(x => new SapItemSearchVo { SapItemCode = x.SapItemCode, SapItemName = x.SapItemName }) // .GroupBy(x => x.SapItemCode).Select(x => x.FirstOrDefault()).Distinct().ToList(); // buildingSource = new BindingSource(outNewVo, null); //} //else //{ // buildingSource = new BindingSource(outVo.GetList(), null); //} buildingSource = new BindingSource(outVo.GetList(), null); Item_dgv.DataSource = buildingSource; Item_dgv.ClearSelection(); if (sapItemSearchVo != null && sapItemSearchVo.GetList() != null && sapItemSearchVo.GetList().Count > 0) { checkComboItems(); } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }