using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Threading.Tasks;
using System.Data;
using LeaRun.Application.Entity.WaterWellManage;
using LeaRun.Util;
using LeaRun.Data;
namespace LeaRun.Application.Service.WaterWellManage
{
public class DeviceService
{
SqlHelper sqlHelper = new SqlHelper("BaseDb");
///
/// 获取根节点
///
///
///
public IEnumerable GetList(string parentId)
{
try
{
var strSql = "SELECT * FROM Base_Organize WHERE ParentId='" + parentId + "'";
DataTable dtResult = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
var modelList = new List();
for (int rowIndex = 0; rowIndex < dtResult.Rows.Count; rowIndex++)
{
DeviceEntity model = new DeviceEntity();
model.OrganizeId = dtResult.Rows[rowIndex]["OrganizeId"].ToString();
model.ShortName = dtResult.Rows[rowIndex]["ShortName"].ToString();
model.ParentId = dtResult.Rows[rowIndex]["ParentId"].ToString();
model.EnCode = dtResult.Rows[rowIndex]["EnCode"].ToString();
modelList.Add(model);
}
return modelList;
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 获取根节点
///
///
public string GetAllList()
{
try
{
var strSql = "SELECT * FROM Base_Organize";
DataTable dtResult = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
var modelList = new List();
for (int rowIndex = 0; rowIndex < dtResult.Rows.Count; rowIndex++)
{
DeviceEntity model = new DeviceEntity();
model.OrganizeId = dtResult.Rows[rowIndex]["OrganizeId"].ToString();
model.ShortName = dtResult.Rows[rowIndex]["ShortName"].ToString();
model.ParentId = dtResult.Rows[rowIndex]["ParentId"].ToString();
model.EnCode = dtResult.Rows[rowIndex]["EnCode"].ToString();
modelList.Add(model);
}
return Json.ToJson(modelList);
}
catch (Exception e)
{
throw e;
}
}
}
}