文章目录
- C# 循环遍历使用
- List + for + if
- List + fearch + if
- while + if
- switch
C# 循环遍历使用
List + for + if
List<PrintPDFCountsModel> printPDFCountsModels = _printPDFCountsService.GetPrintPrintPDFCountsListbypdfprint(printPDFCountsModel);
if (printPDFCountsModels != null && printPDFCountsModels.Count > 0)
{
for (int i = 0; i < printPDFCountsModels.Count; i++)
{
sampleReportViewModel.SpecialCheckAdviceTypeJS += jsyzlist[i].SpecialCheckAdviceType + " ";
}
if (printPDFCountsModels[0].pdfprint == "1")
{
PrintInfo += "印";
}
}
public List<PrintPDFCountsModel> GetPrintPrintPDFCountsListbypdfprint(PrintPDFCountsModel printPDFCountsModel)
{
return HttpService.Post<List<PrintPDFCountsModel>>(GetPrintPrintPDFCountsListbypdfprintUrl, printPDFCountsModel);
}
List + fearch + if
List<POCS.Frontend.ViewModel.CheckAdvices.CheckAdviceViewModel> list = checkAdvicesService.GetSpecialCheckAdviceDto(Convert.ToInt32(Id), check.CheckAdviceType);
foreach (var item in list)
{
if (item.CheckAdviceType == POCS.Frontend.ViewModel.CheckAdvices.CheckAdviceType.特检医嘱)
{
医嘱项目名称 += item.MarkerName + " ,";
}
}
while + if
string sentinel = Application.StartupPath + "\\PDF\\sentinel.txt";
int i_累计判断文件 = 0;
while (i_累计判断文件 < 10)
{
if (!File.Exists(sentinel))
{
i_累计判断文件++;
System.Threading.Thread.Sleep(500);
}
if (File.Exists(sentinel))
{
break;
}
}
switch
Model.xxxCommandModel model = new Model.病理医嘱CommandModel();
switch (申请类型)
{
case "xx":
model.pisid = "||1";
model.项目 = "";
model.类型 = "NORM";
model.状态 = "1";
model.数量 = "1";
break;
case "xx":
model.pisid = "||1";
model.项目 = "";
model.类型 = "NORM";
model.状态 = "1";
model.数量 = "1";
break;
}
return model;