Пример #1
0
        private bool CheckNoWhereFields(OleDbConnection connection)
        {
            var reader = ADOSQLHelper.ExecuteReader(connection,
                                                    string.IsNullOrEmpty(WhereCaluse) ?
                                                    (
                                                        LocationFields == null ?
                                                        string.Format("Select {0},{1} from {2}", string.Join(",", CheckFields), Key, TableName)
                 : string.Format("Select {0},{1},{2} from {3}", string.Join(",", CheckFields), Key, string.Join(",", LocationFields), TableName)
                                                    )
                : (
                                                        LocationFields == null ?
                                                        string.Format("Select {0},{1} from {2} where {3}", string.Join(",", CheckFields), Key, TableName, WhereCaluse)
                : string.Format("Select {0},{1},{2} from {3} where {4}", string.Join(",", CheckFields), Key, string.Join(",", LocationFields), TableName, WhereCaluse)
                                                        )

                                                    );

            if (reader != null)
            {
                var str  = string.Empty;
                var info = string.Empty;
                while (reader.Read())
                {
                    str = string.Empty;
                    for (var i = 0; i < CheckFields.Count(); i++)
                    {
                        var a = reader[i].ToString().Trim();
                        if (Is_Nullable ^ string.IsNullOrEmpty(a))//异或  Is_NULLable  ture 为空  字段不为空或者 Is_NULLable false 必填 字段为空 矛盾
                        {
                            str += CheckFields[i] + ",";
                        }
                    }
                    if (!string.IsNullOrEmpty(str))
                    {
                        info = string.Format("{0}对应的字段:{1}与要求的{2}不符", reader[CheckFields.Count()], str, Is_Nullable ? "为空" : "必填");
                        _questions.Add(
                            new Question
                        {
                            Code              = "5101",
                            Name              = Name,
                            Project           = CheckProject.图层内属性一致性,
                            TableName         = TableName,
                            BSM               = reader[CheckFields.Count()].ToString(),
                            Description       = info,
                            RelationClassName = RelationName,
                            ShowType          = ShowType.Space,
                            WhereClause       =
                                LocationFields == null ?
                                string.Format("[{0}] ='{1}'", Key, reader[CheckFields.Count()].ToString())
                                : ADOSQLHelper.GetWhereClause(LocationFields, ADOSQLHelper.GetValues(reader, 1 + CheckFields.Length, LocationFields.Length))
                        });
                        Messages.Add(info);
                    }
                }
                QuestionManager.AddRange(_questions);
                return(true);
            }
            return(false);
        }
Пример #2
0
        private bool CheckWhere(OleDbConnection connection)
        {
            var reader = ADOSQLHelper.ExecuteReader(connection,
                                                    LocationFields == null ?
                                                    string.Format("Select {0},{1},{2} from {3}", CheckFieldName, Key, string.Join(",", WhereFields), TableName)
                : string.Format("Select {0},{1},{2},{3} from {4}", CheckFieldName, Key, string.Join(",", WhereFields), string.Join(",", LocationFields), TableName)
                                                    );

            if (reader != null)
            {
                var str   = string.Empty;
                var error = string.Empty;
                var array = new string[WhereFields.Length];
                while (reader.Read())
                {
                    str = reader[0].ToString().Trim();
                    for (var i = 0; i < WhereFields.Length; i++)
                    {
                        array[i] = reader[i + 2].ToString();
                    }
                    var key = string.Join(Split, array);
                    if (WhereList.Contains(key))
                    {
                        if (!Values.Contains(str))
                        {
                            error = string.Format("{0}对应的‘{1}’不正确", reader[1].ToString(), str);
                            _questions.Add(
                                new Question
                            {
                                Code              = "3201",
                                Name              = Name,
                                Project           = CheckProject.值符合性,
                                TableName         = TableName,
                                BSM               = reader[1].ToString(),
                                Description       = error,
                                ShowType          = ShowType.Space,
                                RelationClassName = RelationName,
                                WhereClause       =
                                    LocationFields == null?
                                    string.Format("[{0}] = '{1}'", Key, reader[1].ToString())
                                    :ADOSQLHelper.GetWhereClause(LocationFields, ADOSQLHelper.GetValues(reader, WhereFields.Length + 2, LocationFields.Length))
                            });
                        }
                    }
                }
                return(true);
            }
            return(false);
        }
        private bool CheckNoWhereField(OleDbConnection connection)
        {
            var reader = ADOSQLHelper.ExecuteReader(connection,
                                                    LocationFields == null?
                                                    string.Format("Select {0} from {1}", CheckFieldName, TableName)
                :string.Format("Select {0},{1} from {2}", CheckFieldName, string.Join(",", LocationFields), TableName)
                                                    );

            if (reader != null)
            {
                var temp = new List <string>();
                var str  = string.Empty;
                var info = string.Empty;
                while (reader.Read())
                {
                    str = string.Format("{0}:{1}", CheckFieldName, reader[0].ToString());
                    if (temp.Contains(str))
                    {
                        info = string.Format("{0}  存在重复", str);
                        Messages.Add(info);
                        _questions.Add(
                            new Question
                        {
                            Code              = Code,
                            Name              = Name,
                            Project           = CheckProject.属性正确性,
                            TableName         = TableName,
                            BSM               = CheckFieldName,
                            Description       = info,
                            RelationClassName = RelationName,
                            ShowType          = ShowType.Space,
                            WhereClause       =
                                LocationFields == null ?
                                string.Empty
                                : ADOSQLHelper.GetWhereClause(LocationFields, ADOSQLHelper.GetValues(reader, 1, LocationFields.Length))
                        });
                    }
                    else
                    {
                        temp.Add(str);
                    }
                }
                QuestionManager.AddRange(_questions);
                return(true);
            }

            return(false);
        }
Пример #4
0
        private bool CheckNoWhere(OleDbConnection connection)
        {
            var reader = ADOSQLHelper.ExecuteReader(connection,
                                                    LocationFields == null ?
                                                    string.Format("select {0},{1} from {2}", CheckFieldName, Key, TableName)
                : string.Format("select {0},{1},{2} from {3}", CheckFieldName, Key, string.Join(",", LocationFields), TableName)
                                                    );

            if (reader != null)
            {
                var str   = string.Empty;
                var error = string.Empty;
                Messages = new List <string>();
                while (reader.Read())
                {
                    str = reader[0].ToString().Trim();
                    if (Values.Contains(str))
                    {
                        continue;
                    }
                    else
                    {
                        error = string.Format("{0}对应的‘{1}’值不正确", reader[1].ToString(), str);
                        Messages.Add(error);
                        _questions.Add(
                            new Question()
                        {
                            Code              = "3201",
                            Name              = Name,
                            Project           = CheckProject.值符合性,
                            TableName         = TableName,
                            BSM               = reader[1].ToString(),
                            Description       = error,
                            ShowType          = ShowType.Space,
                            RelationClassName = RelationName,
                            WhereClause       =
                                LocationFields == null ?
                                string.Format("[{0}] ='{1}'", Key, reader[1].ToString())
                                : ADOSQLHelper.GetWhereClause(LocationFields, ADOSQLHelper.GetValues(reader, 2, LocationFields.Length))
                        });
                    }
                }
                QuestionManager.AddRange(_questions);
                return(true);
            }
            return(false);
        }
Пример #5
0
        private bool CheckWhereFields(OleDbConnection connection)
        {
            var reader = ADOSQLHelper.ExecuteReader(connection,
                                                    string.IsNullOrEmpty(WhereCaluse) ?
                                                    (
                                                        LocationFields == null ?
                                                        string.Format("Select {0},{1},{2} from {3}", Key, string.Join(",", CheckFields), string.Join(",", WhereFields), TableName)
                 : string.Format("Select {0},{1},{2},{3} from {4}", Key, string.Join(",", CheckFields), string.Join(",", WhereFields), string.Join(",", LocationFields), TableName)
                                                    )
                : (
                                                        LocationFields == null ?
                                                        string.Format("Select {0},{1},{2} from {3} where {4}", Key, string.Join(",", CheckFields), string.Join(",", WhereFields), TableName, WhereCaluse)
                 : string.Format("Select {0},{1},{2},{3} from {4} where {5}", Key, string.Join(",", CheckFields), string.Join(",", WhereFields), string.Join(",", LocationFields), TableName, WhereCaluse)
                                                        )

                                                    );

            if (reader != null)
            {
                var array = new string[WhereFields.Length];
                var str   = string.Empty;
                var info  = string.Empty;
                while (reader.Read())
                {
                    for (var i = 0; i < WhereFields.Length; i++)
                    {
                        array[i] = reader[i + 1 + CheckFields.Length].ToString();
                    }
                    var key = string.Join(Split, array);
                    if (WhereList.Contains(key))
                    {
                        str = string.Empty;
                        for (var i = 0; i < CheckFields.Length; i++)
                        {
                            var a = reader[i + 1].ToString().Trim();
                            if (Is_Nullable ^ string.IsNullOrEmpty(a))
                            {
                                str += CheckFields[i] + ",";
                            }
                        }
                        if (!string.IsNullOrEmpty(str))
                        {
                            info = string.Format("{0}对应的字段:{1}与要求的{2}不符,图斑信息:行政村代码:【{3}】图斑编号:【{4}】", reader[0].ToString().Trim(), str, Is_Nullable ? "为空" : "必填", array[0], array[1]);
                            _questions.Add(
                                new Question
                            {
                                Code              = "5101",
                                Name              = Name,
                                Project           = CheckProject.图层内属性一致性,
                                TableName         = TableName,
                                BSM               = reader[0].ToString(),
                                Description       = info,
                                RelationClassName = RelationName,
                                ShowType          = ShowType.Space,
                                WhereClause       =
                                    LocationFields == null ?
                                    string.Format("[{0}] ='{1}'", Key, reader[0].ToString())
                                    : ADOSQLHelper.GetWhereClause(LocationFields, ADOSQLHelper.GetValues(reader, 1 + CheckFields.Length + WhereFields.Length, LocationFields.Length))
                            });
                            Messages.Add(info);
                        }
                    }
                }
                QuestionManager.AddRange(_questions);

                return(true);
            }
            return(false);
        }