Exemple #1
0
        protected List<T> IdenticalMatch(SqlCeParameter[] 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);
            SqlCeDataReader reader = executer.ExecuteSelectStatement(statement, parameters);

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

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

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

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

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

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

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

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

            FullLoadList(result);

            return(result);
        }
        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);

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

            return(ReadAllRecords(reader));
        }
Exemple #8
0
        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);

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

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

            return(result);
        }
        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);

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

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

            FullLoadList(result);

            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);

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

            try
            {
                while (reader.Read())
                {
                    result.Add(reader.GetInt32(reader.GetOrdinal(requiredTableColumnName)));
                }
            }
            catch
            { }

            reader.Close();
            return(result);
        }