private void SearchLossDesc(string lossDesc) { grcLossDesc.DataSource = null; List <LossDescDto> list = new List <LossDescDto>(); if (!string.IsNullOrEmpty(lossDesc)) { string[] strList = lossDesc.Split(';'); for (int i = 0; i < strList.Length; i++) { if (!string.IsNullOrEmpty(strList[i])) { LossDescDto loss = new LossDescDto(); loss.LossCode = (i + 1); loss.LossName = strList[i]; list.Add(loss); } } grcLossDesc.DataSource = list; } }
private void btnAddLossDesc_Click(object sender, EventArgs e) { DataSet ds = service.SearchSalesConsultanExistsChk(CommonHandler.GetComboBoxSelectedValue(cboProject).ToString(), _shopCode, txtSubjectCode.Text, Convert.ToString(_fatherSeqNO)); if (ds.Tables[0].Rows.Count == 0) { CommonHandler.ShowMessage(MessageType.Information, "请先保存销售信息"); return; } if (string.IsNullOrEmpty(txtLossDesc.Text)) { CommonHandler.ShowMessage(MessageType.Information, "请选择失分说明"); return; } LossDescDto loss = new LossDescDto(); List <LossDescDto> inspectionList = grcLossDesc.DataSource as List <LossDescDto>; int lossCode = 0; if (inspectionList == null || inspectionList.Count == 0) { loss.LossCode = 1; } else { foreach (LossDescDto inp in inspectionList) { if (Convert.ToInt32(inp.LossCode) > lossCode) { lossCode = inp.LossCode; } } loss.LossCode = lossCode + 1; } loss.LossName = txtLossDesc.Text.Trim(); dataHandler1.AddRow(loss); }