Пример #1
0
        public void AddParameter(CustomParamViewModel model)
        {
            CustomParam param = new CustomParam
            {
                CustomParamTypeID = model.CustomParamTypeID,
                CustomReportID    = model.CustomReportID,
                DisplayOrder      = model.DisplayOrder,
                DropSQL           = model.DropSQL,
                ParamName         = model.ParamName,
                ParamTitle        = model.ParamTitle,
                ParamWidth        = model.ParamWidth
            };

            ContextPerRequest.CurrentData.CustomParams.Add(param);
            ContextPerRequest.CurrentData.SaveChanges();
        }
Пример #2
0
        public void EditParamter(CustomParamViewModel model)
        {
            var data = (from param in ContextPerRequest.CurrentData.CustomParams
                        where param.CustomParamID == model.CustomParamID
                        select param).FirstOrDefault();

            if (data != null)
            {
                data.CustomParamTypeID = model.CustomParamTypeID;
                data.CustomReportID    = model.CustomReportID;
                data.DisplayOrder      = model.DisplayOrder;
                data.DropSQL           = model.DropSQL;
                data.ParamName         = model.ParamName;
                data.ParamTitle        = model.ParamTitle;
                data.ParamWidth        = model.ParamWidth;

                ContextPerRequest.CurrentData.SaveChanges();
            }
        }
Пример #3
0
        public CustomReportsViewModel GetCustomReport(int customReportId)
        {
            var data = (from custom in ContextPerRequest.CurrentData.CustomReports
                        where custom.CustomReportID == customReportId
                        select new CustomReportsViewModel
            {
                CustomReportID = custom.CustomReportID,
                DateCreated = custom.DateCreated,
                DateDeleted = custom.DateDeleted,
                ReportName = custom.ReportName,
                ReportQuery = custom.ReportQuery,
                IsActive = custom.IsActive,
                CustomReportTypeID = custom.CustomReportTypeID ?? 0
            }
                        ).FirstOrDefault();
            CustomParamViewModel modelParam = new CustomParamViewModel();

            data.ParamGridList = modelParam.GetParamGridList(customReportId);
            data.ParamList     = modelParam.GetParamList(customReportId);

            return(data);
        }