예제 #1
0
        public IList<File> Fill(IList<CY.GFive.Utility.Extend.QueryColumn> lscol)
        {
            if (lscol.Count == 0)
            {
                return GetAllFile();
            }
            else
            {

                SqlServerUtility sql = new SqlServerUtility();

                StringBuilder strBuilder = new StringBuilder();

                strBuilder.Append(SqlGetAllFile);

                strBuilder.Append(" where 1=1 ");

                for (int i = 0; i < lscol.Count; i++)
                {
                    strBuilder.Append(" " + lscol[i].Column + " " + lscol[i].Op + " " + lscol[i].Arg);
                    sql.AddParameter(lscol[i].Arg, lscol[i].ColumnType, lscol[i].ColumnSize);
                }

                List<CY.GFive.Core.Business.File> lsFile = new List<CY.GFive.Core.Business.File>();

                SqlDataReader reader = sql.ExecuteSqlReader(strBuilder.ToString());

                if (reader != null && !reader.IsClosed)
                {
                    CY.GFive.Core.Business.File file;
                    while (reader.Read())
                    {
                        file = new CY.GFive.Core.Business.File();

                        if (!reader.IsDBNull(0)) file.Id = reader.GetInt32(0);
                        if (!reader.IsDBNull(1)) file.UpLoadDate = reader.GetDateTime(1);
                        if (!reader.IsDBNull(2)) file.FileName = reader.GetString(2);
                        if (!reader.IsDBNull(3)) file.FileCode = reader.GetString(3);
                        if (!reader.IsDBNull(4)) file.FileCate = reader.GetString(4);
                        if (!reader.IsDBNull(5)) file.UserCode = reader.GetString(5);
                        if (!reader.IsDBNull(6)) file.DepartCode = reader.GetString(6);

                        file.MarkOld();

                        lsFile.Add(file);

                    }
                    reader.Close();
                }

                return lsFile;
            }
        }
예제 #2
0
        public IList<File> Fill(string param)
        {
            if (String.IsNullOrEmpty(param))
            {
                return GetAllFile();
            }
            else
            {
                List<CY.GFive.Core.Business.File> lsFile = new List<CY.GFive.Core.Business.File>();

                SqlServerUtility sql = new SqlServerUtility();

                StringBuilder strBuilder = new StringBuilder();

                strBuilder.Append(SqlGetAllFile + param);

                SqlDataReader reader = sql.ExecuteSqlReader(strBuilder.ToString());

                if (reader != null && !reader.IsClosed)
                {
                    CY.GFive.Core.Business.File file;
                    while (reader.Read())
                    {
                        file = new CY.GFive.Core.Business.File();

                        if (!reader.IsDBNull(0)) file.Id = reader.GetInt32(0);
                        if (!reader.IsDBNull(1)) file.UpLoadDate = reader.GetDateTime(1);
                        if (!reader.IsDBNull(2)) file.FileName = reader.GetString(2);
                        if (!reader.IsDBNull(3)) file.FileCode = reader.GetString(3);
                        if (!reader.IsDBNull(4)) file.FileCate = reader.GetString(4);
                        if (!reader.IsDBNull(5)) file.UserCode = reader.GetString(5);
                        if (!reader.IsDBNull(6)) file.DepartCode = reader.GetString(6);

                        file.MarkOld();

                        lsFile.Add(file);

                    }

                    reader.Close();
                }

                return lsFile;
            }
        }