/// <summary> /// binds datasource /// </summary> /// <param name="outVo"></param> private void BindDataSource(List <MoldItemVo> outVo) { MoldItem_dgv.AutoGenerateColumns = false; BindingSource bindingSource1 = new BindingSource(outVo, null); if (bindingSource1 != null && bindingSource1.Count > 0) { MoldItem_dgv.DataSource = bindingSource1; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); //"Department" logger.Info(messageData); popUpMessage.Information(messageData, Text); } MoldItem_dgv.ClearSelection(); }
/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind(MoldItemVo conditionInVo) { MoldItem_dgv.DataSource = null; MoldItemVo inVo = new MoldItemVo(); if (Mold_cmb.SelectedIndex > -1) { inVo.MoldId = Convert.ToInt32(Mold_cmb.SelectedValue); } if (SapItem_cmb.SelectedIndex > -1) { inVo.GlobalItemId = Convert.ToInt32(SapItem_cmb.SelectedValue); } try { ValueObjectList <MoldItemVo> outVo = (ValueObjectList <MoldItemVo>)base.InvokeCbm(new GetMoldItemCbm(), inVo, false); MoldItem_dgv.AutoGenerateColumns = false; if (outVo == null || outVo.GetList() == null || outVo.GetList().Count == 0) { messageData = new MessageData("mmce00027", Properties.Resources.mmce00027); logger.Info(messageData, new NullReferenceException()); popUpMessage.Information(messageData, Text); return; } outVo.GetList().ForEach(t => { t.IsExists = t.GlobalItemCode != null ? "True" : "False"; t.StdCycleTime = t.StdCycleTime.Equals(DBNull.Value) ? default(decimal) : Convert.ToDecimal(t.StdCycleTime.ToString("N2")); }); BindingSource bindingSource1 = new BindingSource(outVo.GetList(), null); if (bindingSource1.Count > 0) { MoldItem_dgv.DataSource = bindingSource1; if (MoldItem_dgv.Rows.Count > 0) { foreach (DataGridViewRow row in MoldItem_dgv.Rows) { if ((bool)row.Cells["colSelect"].FormattedValue) { row.Cells["clmstdcycletime"].ReadOnly = false; } else { row.Cells["clmstdcycletime"].ReadOnly = true; } } } //Update_btn.Enabled = true; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); //Line machine logger.Info(messageData); popUpMessage.Information(messageData, Text); } MoldItem_dgv.ClearSelection(); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }