private bool IsDataSatisfyByFilters(MkbClass mkb) { if (!mkb.MkbCode.Contains(textBoxFilterCode.Text)) { return(false); } if (!mkb.MkbName.ToLower().Contains(textBoxFilterName.Text.ToLower())) { return(false); } return(true); }
private void ShowMKBCodes() { if (checkBoxDoNotShowAll.Checked && string.IsNullOrEmpty(textBoxFilterCode.Text) && string.IsNullOrEmpty(textBoxFilterName.Text)) { MKBCodesList.Rows.Clear(); return; } MKBCodesList.Visible = false; int listCnt = 0; int mkbCodeCnt = 0; while (listCnt < MKBCodesList.Rows.Count && mkbCodeCnt < _dbEngine.MkbList.Count) { MkbClass mkb = _dbEngine.MkbList[mkbCodeCnt]; if (IsDataSatisfyByFilters(mkb)) { MKBCodesList.Rows[listCnt].Cells[0].Value = mkb.MkbCode; MKBCodesList.Rows[listCnt].Cells[1].Value = mkb.MkbName; listCnt++; } mkbCodeCnt++; } if (mkbCodeCnt == _dbEngine.MkbList.Count) { while (listCnt < MKBCodesList.Rows.Count) { MKBCodesList.Rows.RemoveAt(listCnt); } } else { while (mkbCodeCnt < _dbEngine.MkbList.Count) { if (IsDataSatisfyByFilters(_dbEngine.MkbList[mkbCodeCnt])) { MKBCodesList.Rows.Add(new object[] { _dbEngine.MkbList[mkbCodeCnt].MkbCode, _dbEngine.MkbList[mkbCodeCnt].MkbName }); } mkbCodeCnt++; } } MKBCodesList.Visible = true; }
/// <summary> /// Изменение кодов КГС и других зависимых данных при смене кода МКБ если не указано название услуги /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBoxMKB_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(comboBoxServiceName.Text)) { return; } textBoxServiceCode.Text = textBoxKsgCode.Text = textBoxKsgDecoding.Text = string.Empty; MkbClass mkbClass = GetMkbByCode(comboBoxMKB.Text); if (mkbClass == null) { return; } textBoxKsgCode.Text = mkbClass.KsgCode; textBoxKsgDecoding.Text = mkbClass.KsgName; }