コード例 #1
0
ファイル: LogPopupControl.ascx.cs プロジェクト: radtek/canon
        public int Bind()
        {
            CanonDataContext db = Cdb.Instance;
            int returnRes       = 0;

            //bind data
            switch (this.LogType)
            {
            case LogTypesEnum.ProductMappingHistory:
                var values = db.ProductsLogs.OrderByDescending(p => p.LogDate).Where(p =>
                                                                                     p.ChannelId == this.Parameters[0] && p.ProductId == this.Parameters[1]);
                gridLogRecords.DataSource = values;
                break;

            case LogTypesEnum.ChannelMonitoringHistory:
                var records = db.ImportLogs.OrderByDescending(p => p.LogDate).Where(p =>
                                                                                    p.ChannelId == this.Parameters[0]);
                gridLogRecords.DataSource = records;
                break;

            case LogTypesEnum.ProductImportHistory:
                var recs = db.GetProductImportLog();
                gridLogRecords.DataSource = recs;
                break;

            case LogTypesEnum.RecommendedPriceHistory:
                this.ReCreateColumns();
                var recoms = db.RecommendedLogs.Where(p => p.ProductId == this.Parameters[0]).OrderByDescending(d => d.RecomDate);
                gridLogRecords.DataSource = recoms;
                break;

            case LogTypesEnum.ChannelLog:
                var errors = db.ImportLogErrors.Where(p => p.MainLogId == this.Parameters[0]);
                gridLogRecords.DataSource = errors;
                returnRes = errors.ToList().Count;
                break;
            }
            gridLogRecords.DataBind();
            return(returnRes);
        }