本文整理汇总了C#中BLL.Dictionary.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Clear方法的具体用法?C# Dictionary.Clear怎么用?C# Dictionary.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLL.Dictionary
的用法示例。
在下文中一共展示了Dictionary.Clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOPListForSpecimensByLocalDateFileToDic
/// <summary>
/// 根据本地Date文件获取医院数据并将数据转换成字典集合
/// </summary>
/// <returns>字典集合</returns>
private List<Dictionary<string, string>> GetOPListForSpecimensByLocalDateFileToDic()
{
//创建病人字典集合。
List<Dictionary<string, string>> oPListForSpecimensDicList = new List<Dictionary<string, string>>();
string oPListForSpecimenStr = HospitalXmlStrHelper.HospitalXmlFileToXmlStr("configXML\\WS.ForCenterLabServiceByDate.xml");
XmlDocument getDataFromHospitalXml = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(oPListForSpecimenStr);
if (getDataFromHospitalXml != null)//有数据并且能转换成xml文档
{
if (getDataFromHospitalXml.HasChildNodes)
{
XmlNode xmlNode = getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultCode");
//创建临时集合保存多个人的数据
Dictionary<string, string> oPListForSpecimenTempDic = new Dictionary<string, string>();
if (xmlNode.InnerText == "0") //获取数据成功
{
//OPListForSpecimens/OPListForSpecimen
XmlNodeList xmlNodeList = getDataFromHospitalXml.SelectNodes("//OPListForSpecimens/*");
foreach (XmlNode item in xmlNodeList)
{
string tempOPListForSpecimenXml = item.OuterXml;
oPListForSpecimenTempDic = ConvertOPListForSpecimenStrToDic(tempOPListForSpecimenXml);
oPListForSpecimensDicList.Add(oPListForSpecimenTempDic);
}
}
else //获取数据失败
{
oPListForSpecimenTempDic.Clear();
oPListForSpecimenTempDic.Add("OPListForSpecimenRt", getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultContent").InnerText);
oPListForSpecimensDicList.Add(oPListForSpecimenTempDic);
}
}
}
return oPListForSpecimensDicList;
}
示例2: GetOPInfoListForSpecimenByTimeRangeAndToDicList
//根据日期和调用webservice查询数据
/// <summary>
/// 根据日期和调用webservice查询数据
/// </summary>
/// <param name="dateBegin">开始时间</param>
/// <param name="dateEnd">结束时间</param>
/// <returns>OPInfoListForSpecimen数据字典集合</returns>
private List<Dictionary<string, string>> GetOPInfoListForSpecimenByTimeRangeAndToDicList(string dateBegin, string dateEnd)
{
//创建病人字典集合。
List<Dictionary<string, string>> oPListForSpecimensDicList = new List<Dictionary<string, string>>();
RuRo.BLL.WebService.ForCenterLabService centerLabServiceSoapClient = new RuRo.BLL.WebService.ForCenterLabService();
try
{
string oPInfoListForSpecimenStr = centerLabServiceSoapClient.GetOPInfoListForSpecimen(dateBegin, dateEnd);
if (oPInfoListForSpecimenStr != null && oPInfoListForSpecimenStr != "")//有数据并且不为null
{
//02.将数据转换成xml数据
XmlDocument getDataFromHospitalXml = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(oPInfoListForSpecimenStr);
if (getDataFromHospitalXml != null)//有数据并且能转换成xml文档
{
if (getDataFromHospitalXml.HasChildNodes)
{
XmlNode xmlNode = getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultCode");
//创建临时集合保存多个人的数据
Dictionary<string, string> oPListForSpecimenTempDic = new Dictionary<string, string>();
if (xmlNode.InnerText == "0") //获取数据成功
{
//OPListForSpecimens/OPListForSpecimen
XmlNodeList xmlNodeList = getDataFromHospitalXml.SelectNodes("//OPListForSpecimens/*");
foreach (XmlNode item in xmlNodeList)
{
string tempOPListForSpecimenXml = item.OuterXml;
oPListForSpecimenTempDic = ConvertOPListForSpecimenStrToDic(tempOPListForSpecimenXml);
oPListForSpecimensDicList.Add(oPListForSpecimenTempDic);
}
}
else if (xmlNode.InnerText == "-1")
//获取数据失败
{
oPListForSpecimenTempDic.Clear();
oPListForSpecimenTempDic.Add("OPListForSpecimenRt", FpJsonHelper.SerializationStr(getDataFromHospitalXml.SelectSingleNode("/OPListForSpecimenRt/ResultContent").InnerText));
oPListForSpecimensDicList.Add(oPListForSpecimenTempDic);
}
}
}
}
}
catch (Exception)
{
oPListForSpecimensDicList.Clear();
}
return oPListForSpecimensDicList;
}
示例3: GetOPListForSpecimenByBarcodeAndToDic
/// <summary>
/// 根据条码号获取医院数据并将数据转换成字典
/// </summary>
/// <param name="barcode">条码</param>
/// <returns>数据字典</returns>
private Dictionary<string, string> GetOPListForSpecimenByBarcodeAndToDic(string barcode)
{
//01.创建字典
Dictionary<string, string> hospitalDic = new Dictionary<string, string>();
//02.创建webservice获取数据
RuRo.BLL.WebService.ForCenterLabService centerLabServiceSoapClient = new RuRo.BLL.WebService.ForCenterLabService();
try
{
//02.1 根据条码号调用GetPatientInfoSpecimen方法获取单个人的数据
string getDataFromHospitalStr = centerLabServiceSoapClient.GetPatientInfoSpecimen(barcode);
// string getDataFromHospitalStr = GetOPListForSpecimenByLocalBracodeFileToJsonStr();//调用本地数据
if (getDataFromHospitalStr != null && getDataFromHospitalStr != "")//有数据并且不为null
{
//03.将数据转换成xml数据有数据并且能转换成xml文档
XmlDocument getDataFromHospitalXml = new XmlDocument();
//转换失败时返回null
getDataFromHospitalXml = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(getDataFromHospitalStr);
//转换成功
if (getDataFromHospitalXml != null)
{
//有子元素
if (getDataFromHospitalXml.HasChildNodes)
{
////获取OPListForSpecimen下的所有子节点
//XmlNodeList xmlnodelist = getDataFromHospitalXml.SelectNodes("/OPListForSpecimen/*");
////有子节点返回节点数据
//if (xmlnodelist.Count > 0)
//{
hospitalDic = ConvertOPListForSpecimenStrToDic(getDataFromHospitalStr);
//}
}
}
}
else //没数据返回
{
hospitalDic.Clear();
}
}
catch (Exception ex)
{
hospitalDic.Clear();
}
return hospitalDic;
}
示例4: ConvertOPListForSpecimenStrToDic
/// <summary>
/// 将传入的OPListForSpecimen xml字符串信息转换成字段信息字典,数据传入时已经做了筛选包含OPListForSpecimen节点且有子节点
/// </summary>
/// <param name="oPListForSpecimenStr">xml格式的字符串</param>
/// <returns>字段信息字典</returns>
private Dictionary<string, string> ConvertOPListForSpecimenStrToDic(string oPListForSpecimenStr)
{
//OPListForSpecimen字典
Dictionary<string, string> oPListForSpecimenDic = new Dictionary<string, string>();
//将OPListForSpecimen XML格式的数据转换成XML文档
XmlDocument oPListForSpecimenXmlDoc = new XmlDocument();
oPListForSpecimenXmlDoc = HospitalXmlStrHelper.HospitalXmlStrToXmlDoc(oPListForSpecimenStr);
//能转换成xml文档
if (oPListForSpecimenXmlDoc != null)
{
//获取文档下的OPListForSpecimen下的子节点集合
XmlNodeList oPListForSpecimenNodeList = oPListForSpecimenXmlDoc.SelectNodes("/OPListForSpecimen/*");
//有子节点
if (oPListForSpecimenNodeList.Count > 0)
{
//循环节点
foreach (XmlNode item in oPListForSpecimenNodeList)
{
//字典中不包含当前节点name就加入到节点中
if (!oPListForSpecimenDic.Keys.Contains(item.Name))
{
oPListForSpecimenDic.Add(item.Name, item.InnerText);
}
}
}
//OPListForSpecimen下面没有子节点,获取当前节点的值
else if (oPListForSpecimenNodeList.Count == 0)
{
try
{
XmlNode xd = oPListForSpecimenXmlDoc.SelectSingleNode("/OPListForSpecimen");
oPListForSpecimenDic.Add(xd.Name, FpJsonHelper.SerializationStr(xd.InnerText));
}
catch (Exception)
{
oPListForSpecimenDic.Clear();
}
}
}
else
{
//xml文档为null
oPListForSpecimenDic.Clear();
}
return oPListForSpecimenDic;
}