public HttpResponseMessage Get_Eqiw_R_Item(Get_Eqiw_R_Section_byRSCodeAndYear_Info info) { string result = string.Empty; try { List <EMCMIS.Model.tblEQIW_R_Item> list = new List <EMCMIS.Model.tblEQIW_R_Item>(); using (EMCMIS.Model.EntityContext db = new Model.EntityContext()) { list = (from x in db.tblEQIW_R_Item select x).ToList(); } if (list != null && list.Count > 0) { result = rule.JsonStr("ok", "", list); } else { result = rule.JsonStr("nodata", "没有数据", ""); } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage Get_Eqiw_R_Section_byRSCodeAndYear(Get_Eqiw_R_Section_byRSCodeAndYear_Info info) { string result = string.Empty; try { using (EMCControls_EMCMIS.EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { List <EMCMIS.Model.tblEQIW_R_Section> list = new List <EMCMIS.Model.tblEQIW_R_Section>(); list = (from x in db.tblEQIW_R_Section where info.fldYear == x.fldYear select x).ToList(); if (info.fldRCode != null) { list = (from x in list where info.fldRCode.Contains(x.fldRCode) select x).ToList(); } if (info.fldRSCode != null) { list = (from x in list where info.fldRSCode.Contains(x.fldRSCode) select x).ToList(); } if (info.StaLodAndStaLad == "1") { foreach (var item in list) { if (item.fldLOD == "" || item.fldLOD == null) { item.fldLOD = "0"; } if (item.fldLOM.ToString() == "" || item.fldLOD == null) { item.fldLOM = 0.0M; } if (item.fldLOS.ToString() == "" || item.fldLOS == null) { item.fldLOS = 0.0M; } if (item.fldLAD == "" || item.fldLAD == null) { item.fldLAD = "0"; } if (item.fldLAM.ToString() == "" || item.fldLAM == null) { item.fldLAM = 0.0M; } if (item.fldLAS.ToString() == "" || item.fldLAS == null) { item.fldLAS = 0.0M; } } foreach (var item in list) { item.fldStaLod = (double.Parse(item.fldLOD) + double.Parse(item.fldLOM.ToString()) / 60 + double.Parse(item.fldLOS.ToString()) / 3600).ToString(); item.fldStaLad = (double.Parse(item.fldLAD) + double.Parse(item.fldLAM.ToString()) / 60 + double.Parse(item.fldLAS.ToString()) / 3600).ToString(); } } if (list != null && list.Count > 0) { result = rule.JsonStr("ok", "", list); } else { result = rule.JsonStr("nodata", "没有河流数据", ""); } } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }