Exemple #1
0
        protected List <T> IdenticalMatch(SqlParameter[] parameters)
        {
            StringBuilder builder = new StringBuilder();

            if (parameters.Length > 0)
            {
                for (int i = 0; i < parameters.Length; i++)
                {
                    builder.AppendFormat("{0} = @{0}", parameters[i].ParameterName.Substring(1));

                    if (i < parameters.Length - 1)
                    {
                        builder.Append(" AND ");
                    }
                }
            }
            else
            {
                builder.AppendFormat("1 = 1");
            }

            string        condition = builder.ToString();
            string        statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);
            SqlDataReader reader    = executer.ExecuteSelectStatement(statement, parameters);

            if (reader == null)
            {
                return(new List <T>());
            }

            return(ReadAllRecords(reader));
        }
Exemple #2
0
        private List <DocumentVO> ExactFindByStringColumn(string title, string columnName)
        {
            string        condition = string.Format("{0} like '{1}'", columnName, title);
            string        statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);
            SqlDataReader reader    = executer.ExecuteSelectStatement(statement, null);

            return(ReadAllRecords(reader));
        }
Exemple #3
0
        public List <DocumentVO> GetDocumentsOfFolder(FolderVO folder)
        {
            string        condition = string.Format("{0}={1}", documentFolderId, folder.Id);
            string        statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);
            SqlDataReader reader    = executer.ExecuteSelectStatement(statement, null);

            return(ReadAllRecords(reader));
        }
        public List <FileVO> GetFilesOfDocument(DocumentVO document)
        {
            string        condition = string.Format("{0}={1}", fileDocumentId, document.Id);
            string        statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);
            SqlDataReader reader    = executer.ExecuteSelectStatement(statement, null);

            return(ReadAllRecords(reader));
        }
        public List <LogEntryVO> Find(Common.Search.DateRange range, OperationVO operation, UserVO user)
        {
            SqlParameter[] parameters = GetParameters(range);
            string         condition  = GetCondition(range, operation, user);
            string         statement  = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);
            SqlDataReader  reader     = executer.ExecuteSelectStatement(statement, parameters);

            return(ReadAllRecords(reader));
        }
Exemple #6
0
        public virtual List <T> GetAll()
        {
            string        statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, "1=1");
            SqlDataReader reader    = executer.ExecuteSelectStatement(statement, null);

            if (reader == null)
            {
                return(new List <T>());
            }

            return(ReadAllRecords(reader));
        }
Exemple #7
0
        private List <DocumentVO> FindByIntegerColumn(int value, string columnName)
        {
            string condition = string.Format("{0} = {1}", columnName, value);
            string statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);

            SqlDataReader     reader = executer.ExecuteSelectStatement(statement, null);
            List <DocumentVO> result = ReadAllRecords(reader);

            FullLoadList(result);

            return(result);
        }
Exemple #8
0
        private List <DocumentVO> GetItemsInRange(List <int> ids)
        {
            if (ids == null || ids.Count == 0)
            {
                return(new List <DocumentVO>());
            }

            string cond      = string.Format("{0} in {1}", idColumnName, MakeCommaSeparatedValues(ids));
            string statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, cond);

            SqlDataReader reader = executer.ExecuteSelectStatement(statement, null);

            return(ReadAllRecords(reader));
        }
        public List <FileVO> FindFilesByArchivingDate(DateRange range)
        {
            string rStart = "rangeStart";
            string rEnd   = "rEnd";

            string condition = string.Format("{0} >= @{1} and {0} < @{2}", fileAdditionDate, rStart, rEnd);
            string statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);

            SqlParameter[] paramters = new SqlParameter[]
            {
                MakeSqlParameter(rStart, range.Start, SqlDbType.DateTime),
                MakeSqlParameter(rEnd, range.End, SqlDbType.DateTime)
            };

            SqlDataReader reader = executer.ExecuteSelectStatement(statement, paramters);
            List <FileVO> result = ReadAllRecords(reader);

            return(result);
        }
Exemple #10
0
        private List <int> GetAssociationsOfTable(VO tableElement, string providedTableColumnName, string requiredTableColumnName)
        {
            List <int> result    = new List <int>();
            string     condition = string.Format("{0} = @{0}", providedTableColumnName);
            string     statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);

            SqlParameter[] parameters = new SqlParameter[] { MakeSqlParameter(providedTableColumnName, tableElement.Id) };
            SqlDataReader  reader     = executer.ExecuteSelectStatement(statement, parameters);

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    result.Add(reader.GetInt32(reader.GetOrdinal(requiredTableColumnName)));
                }
            }

            reader.Close();
            return(result);
        }
Exemple #11
0
        private List <DocumentVO> FindByDateRangeColumn(DateRange range, string columName)
        {
            string rStart = "rangeStart";
            string rEnd   = "rEnd";

            string condition = string.Format("{0} >= @{1} and {0} < @{2}", columName, rStart, rEnd);
            string statement = SqlStatememtGenerator.Select_ReadAllColumnsByCondition(tableName, condition);

            SqlParameter[] paramters = new SqlParameter[]
            {
                MakeSqlParameter(rStart, range.Start, SqlDbType.DateTime),
                MakeSqlParameter(rEnd, range.End, SqlDbType.DateTime)
            };

            SqlDataReader     reader = executer.ExecuteSelectStatement(statement, paramters);
            List <DocumentVO> result = ReadAllRecords(reader);

            FullLoadList(result);

            return(result);
        }