Beispiel #1
0
        /// <summary>
        /// 更新Task的状态到数据库
        /// </summary>
        /// <param name="taskID"></param>
        /// <param name="taskState"></param>
        /// <returns></returns>
        public static bool UpdateTaskState(string taskID, enumTaskState taskState)
        {
            if (taskState == enumTaskState.PartlyExcuted)
            {
                return(true);
            }

            string strSQL = string.Format("Update LR_ModelTask set ExeState={0} where TaskID='{1}'", (int)taskState, taskID);

            return(AdoDbHelper.ExecuteSql(SysDbHelper.GetSysDbConnection(), strSQL));
        }
Beispiel #2
0
        public override bool Check(ref List <Error> checkResult)
        {
            //System.Diagnostics.Stopwatch MyWatch = new System.Diagnostics.Stopwatch();
            //MyWatch.Start();
            System.Data.OleDb.OleDbDataReader reader = null;
            try
            {
                DataTable pRecordset = new DataTable();

                if (m_structPara.strScript == "行政区层中行政区代码与行政区名称不匹配")
                {
                    string strTemp = "select objectid,BSM,xzqdm, xzqmc,qsdwmc from(select a2.objectid,a2.BSM,a2.xzqdm,a2.xzqmc, a1.qsdwdm,a1.qsdwmc from qsdmb a1 inner join xzq a2 on left(a1.qsdwdm,12)=left(a2.xzqdm,12) where mid(qsdwdm,12,1)<>'0'  and right(qsdwdm,7)='0000000') where Trim(a2.xzqmc)<>Trim(a1.qsdwmc)";
                    pRecordset = AdoDbHelper.GetDataTable(base.m_QueryConnection, strTemp);
                    if (pRecordset == null || pRecordset.Rows.Count == 0)
                    {
                        string strLog = "当前规则的SQL查询语句设置有误,无法执行多表关系检查!";
                        SendMessage(enumMessageType.RuleError, strLog);
                        return(false);
                    }
                }
                else if (m_structPara.strScript.Contains("权属代码表不一致") ||
                         m_structPara.strScript.Contains("权属单位代码表不一致"))
                {
                    reader = AdoDbHelper.GetQueryReader(base.m_QueryConnection, m_structPara.strClause) as OleDbDataReader;
                    if (reader == null)
                    {
                        string strLog = "当前规则的SQL查询语句设置有误,无法执行多表关系检查!";
                        SendMessage(enumMessageType.RuleError, strLog);
                        return(false);
                    }
                    pRecordset.Load(reader);
                }
                else
                {
                    pRecordset = AdoDbHelper.GetDataTable(base.m_QueryConnection, m_structPara.strClause);
                    if (pRecordset == null || pRecordset.Rows.Count == 0)
                    {
                        string strLog = "当前规则的SQL查询语句设置有误,无法执行多表关系检查!";
                        SendMessage(enumMessageType.RuleError, strLog);
                        return(false);
                    }
                }

                string strSql = "";
                bool   bTable = false;

                if (FtName1.Contains("表") || FtName2.Contains("表"))
                {
                    if (m_structPara.strFtName2.Equals("qsdmb", StringComparison.OrdinalIgnoreCase))
                    {
                        strSql = "update LR_ResultEntryRule set TargetFeatClass1= '" + FtName1 + "',TargetFeatClass2='" +
                                 FtName2 + "|' where RuleInstID='" + base.m_InstanceID + "'";
                    }
                    else
                    {
                        strSql = "update LR_ResultEntryRule set TargetFeatClass1= '" + COMMONCONST.TABLENAME +
                                 "',TargetFeatClass2='|' where RuleInstID='" + base.m_InstanceID + "'";
                        bTable = true;
                    }
                }
                else
                {
                    strSql = "update LR_ResultEntryRule set TargetFeatClass1= '" + FtName1 + "',TargetFeatClass2='" +
                             FtName2 + "|' where RuleInstID='" + base.m_InstanceID + "'";
                }
                AdoDbHelper.ExecuteSql(m_ResultConnection, strSql);

                //获取需要特殊处理的规则别名
                Hashtable hashtable = GetEnumHash();
                if (hashtable.Contains(m_structPara.strAlias))
                {
                    if (m_structPara.strAlias.Equals("省级上报田坎系数与上报数据中田坎系数是否一致检查"))
                    {
                        checkResult = GetTKXSResult(pRecordset);
                    }
                    else
                    {
                        checkResult = GetAttrResult(pRecordset);
                    }
                }
                else
                {
                    checkResult = GetResult(pRecordset, bTable);
                }
                if (pRecordset != null)
                {
                    pRecordset.Dispose();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                SendMessage(enumMessageType.RuleError, string.Format("意外失败,信息:{0}", ex.Message));
                SendMessage(enumMessageType.Exception, ex.ToString());
                return(false);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                    reader.Close();
                    GC.Collect();
                }
            }
            //MyWatch.Stop();
            //System.Windows.Forms.MessageBox.Show("时间:" + MyWatch.ElapsedMilliseconds.ToString() + "毫秒");
            return(true);
        }
Beispiel #3
0
        //public static bool DeleteTask(TaskInfo task)
        //{
        //    return false;
        //}

        /// <summary>
        /// 指删除数据库记录
        /// </summary>
        /// <param name="taskID"></param>
        /// <returns></returns>
        public static bool DeleteTask(string taskID)
        {
            IDbConnection sysConnection = SysDbHelper.GetSysDbConnection();

            return(AdoDbHelper.ExecuteSql(sysConnection, string.Format("delete from LR_ModelTask where TaskID='{0}'", taskID)));
        }