1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using LeaRun.Application.Entity.DMAManage;
- using LeaRun.Data;
- using LeaRun.Util;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LeaRun.Application.Service.DMAManage
- {
- /// <summary>
- /// 分区绘制
- /// </summary>
- public class PartitionDrawService
- {
- SqlHelper sqlHelper = new SqlHelper("DMADb");
- #region 获取所有分区的数据
- /// <summary>
- /// 获取所有分区的数据
- /// </summary>
- /// <returns></returns>
- public List<DMAEntity> GetAllPartitions()
- {
- string sql = "select * from DMA where DeleteMark = 0 and EnabledMark = 1";
- try
- {
- DataTable dt = sqlHelper.ExecuteDataTable(sql, CommandType.Text, null);
- return dt.Rows.Count > 0 ? DataHelper.DataTableToT<DMAEntity>(dt) : new List<DMAEntity>();
- }
- catch (Exception)
- {
- throw;
- }
- }
- #endregion
- #region 保存坐标数据
- /// <summary>
- /// 保存坐标数据
- /// </summary>
- /// <returns></returns>
- public int SavePoints(string datas)
- {
- try
- {
- List<PointsEntity> values = Json.ToList<PointsEntity>(datas);
- foreach (PointsEntity item in values)
- {
- StringBuilder sb = new StringBuilder("update DMA set");
- sb.Append(" DMACoordinate = '" + item.points + "',");
- sb.Append(" FillColor = '" + item.color + "' where DMACode = '");
- sb.Append(item.DMACode + "'");
- sqlHelper.ExecuteNonQuery(sb.ToString(), CommandType.Text, null);
- }
- return 0;
- }
- catch (Exception)
- {
- return 1;
- }
- }
- #endregion
- }
- }
|