public HttpResponseMessage Get_tblEQIA_R_ItemSTD(Get_tblEQIA_R_ItemSTD_Info info) { string result = string.Empty; try { using (EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { List <EMCMIS.Model.tblEQIA_R_ItemSTD> list = new List <EMCMIS.Model.tblEQIA_R_ItemSTD>(); list = (from x in db.tblEQIA_R_ItemSTD 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_ALLSection(Get_Eqiw_R_Section_byYearAndAttribute_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 x.fldYear == info.fldYear 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_DX_Section() { string result = string.Empty; try { List <EMCMIS.Model.tbleqiw_dx_Section> list = new List <EMCMIS.Model.tbleqiw_dx_Section>(); using (EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { list = (from x in db.tbleqiw_dx_Section 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 GetEqiw_R_byRName(GetEqiw_R_byRName_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>(); if (info.fldRName == null) { list = (from x in db.tblEQIW_R_Section where info.fldYear == x.fldYear && info.fldSTCode.Contains(x.fldSTCode + "." + x.fldRCode + "." + x.fldRSCode) select x).ToList(); } else { list = (from x in db.tblEQIW_R_Section where info.fldRName.Contains(x.fldRName) && x.fldYear == info.fldYear 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_tblEQIW_R_StagePropTar(Get_tblEQIW_R_StagePropTar_Info info) { string result = string.Empty; try { using (EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { List <EMCMIS.Model.tblEQIW_R_StagePropTar> list = new List <EMCMIS.Model.tblEQIW_R_StagePropTar>(); if (info.fldValleyName == null) { list = (from x in db.tblEQIW_R_StagePropTar where info.fldYear.Contains(x.fldYear) select x).ToList(); } else { list = (from x in db.tblEQIW_R_StagePropTar where info.fldYear.Contains(x.fldYear) && info.fldValleyName.Contains(x.fldValleyName) 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_tblEQIW_R_Section_Auto_All(Get_tblEQIW_R_Section_Auto_All_Info info) { string result = string.Empty; try { List <EMCMIS.Model.tblEQIW_R_Section_Auto> list = new List <EMCMIS.Model.tblEQIW_R_Section_Auto>(); using (EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { list = (from x in db.tblEQIW_R_Section_Auto select x).ToList(); } 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") }); }
public HttpResponseMessage Geteqiw_r_item() { string result = string.Empty; try { List <tblEQIW_R_Item_Auto> list = new List <tblEQIW_R_Item_Auto>(); using (EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { list = (from x in db.tblEQIW_R_Item_Auto select x).ToList(); result = rule.JsonStr("ok", "", list); } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage ItemSave(eqiw_dsavedata data) { string result = string.Empty; int result2 = 0; try { List <EMCMIS.Model.tblEQIW_R_Basedata_Pre_Auto> list = new List <EMCMIS.Model.tblEQIW_R_Basedata_Pre_Auto>(); var query = from x in data.fldItemData select x; DateTime time = DateTime.Parse(data.BeginDate); foreach (var item in query) { var tbl = new EMCMIS.Model.tblEQIW_R_Basedata_Pre_Auto() { fldItemCode = item.itemcode, fldItemValue = Decimal.Parse(item.itemvalue), fldYear = time.Year, fldMonth = time.Month, fldDay = time.Day, fldHour = time.Hour, fldMinute = time.Minute, fldUserID = int.Parse(data.fldUserID), fldCityID_Operate = int.Parse(data.fldCityID_Operate), fldCityID_Submit = data.fldCityID_Submit, fldSTCode = data.CheckCode, fldRCode = data.fldRCode, fldRSCode = data.fldRSCode, fldRSC = data.fldRSC, fldFlag = 0, fldImport = 0, fldSAMPH = "0", fldSAMPR = "0", fldDate_Operate = DateTime.Now, fldSource = 1, fldBatch = "0", fldDeleteState = 0 }; list.Add(tbl); } using (EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { db.tblEQIW_R_Basedata_Pre_Auto.AddRange(list); result2 = db.SaveChanges(); } if (result2 > 0) { result = rule.JsonStr("ok", "保存成功!", ""); } else { result = rule.JsonStr("no", "保存失败!", ""); } } 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") }); }
public HttpResponseMessage Get_Eqiw_R_Section_byRiverStream(Get_Eqiw_R_Section_byRiverStream_Info info) { string result = string.Empty; try { using (EMCMIS.Model.EntityContext db = new EMCMIS.Model.EntityContext()) { List <EMCMIS.Model.tblEQIW_R_Section> list = new List <EMCMIS.Model.tblEQIW_R_Section>(); List <string> list_Point = new List <string>(); if (info.fldRiverStream != null && info.fldRiverStream != "") { list = (from x in db.tblEQIW_R_Section where info.fldRiverStream.Contains(x.fldRiverStream) && x.fldYear == info.fldYear select x).ToList(); } if (info.fldkhscategory != null) { foreach (var item in info.fldkhscategory) { var query = (from x in db.tblEQIW_R_Section where item == x.fldkhscategory && x.fldYear == info.fldYear select x).ToList(); list.AddRange(query); } } if (info.RetrunType == "1") { list_Point = (from x in list select x.fldSTCode + "." + x.fldRCode + "." + x.fldRSCode).ToList(); string point = ""; foreach (var item in list_Point) { point += item + ","; } point = point.TrimEnd(','); if (list_Point.Count > 0) { result = rule.JsonStr("ok", "", point); } else { result = rule.JsonStr("nodata", "没有数据", ""); } } else { if (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") }); }