using System; using BP.DA; using BP.En; using BP.Sys; using System.Data; namespace BP.WF.DTS { /// /// 根据坐标排序字段 /// public class ResetSortMapAttr : Method { /// /// 根据坐标排序字段 /// public ResetSortMapAttr() { this.Title = "根据坐标排序MapAttr字段-用于手机端"; this.Help = "重置MapAttr表中Idx字段,根据坐标y,x排序"; } /// /// 设置执行变量 /// /// public override void Init() { } /// /// 当前的操纵员是否可以执行这个方法 /// public override bool IsCanDo { get { return true; } } /// /// 执行 /// /// 返回执行结果 public override object Do() { try { string sql = "select NO from Sys_MapData where No not in(select No from Sys_MapDtl) and No not like '%Rpt'"; DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt != null) { foreach (DataRow row in dt.Rows) { MapAttrs mattrs = new MapAttrs(); QueryObject qo = new QueryObject(mattrs); qo.AddWhere(MapAttrAttr.FK_MapData, row["NO"].ToString()); qo.addAnd(); qo.AddWhere(MapAttrAttr.UIVisible, true); //qo.addOrderBy(MapAttrAttr.Y, MapAttrAttr.X); qo.DoQuery(); int rowIdx = 0; foreach (MapAttr mapAttr in mattrs) { mapAttr.Idx = rowIdx; mapAttr.DirectUpdate(); rowIdx++; } } } return "执行成功..."; } catch (Exception ex) { } return "执行失败..."; } } }