Example #1
0
        /// <summary>
        /// Gets the ReportConfig object for the Report collection.
        /// </summary>
        /// <returns>A ReportConfig object if successful. Otherwise null is returned.</returns>
        private ReportConfig GetReportConfiguration()
        {
            ReportConfig config = null;

            // Get the report configuration node.
            Node node = reportCollection.GetSingleNodeByType("Settings");

            if (node != null)
            {                                           // Get the settings property for the reporting.
                Property p = node.Properties.GetSingleProperty("iFolderSystemReportConfiguration");
                if (p != null)
                {
                    config = new ReportConfig(p.Value as String);
                }
                else
                {
                    log.Error("No configuration settings found on configuration node: {0}", reportConfigNodeID);
                }
            }
            else
            {
                log.Error("Cannot locate report configuration node: {0}", reportConfigNodeID);
            }

            return(config);
        }
Example #2
0
        //статический фабричный метод
        public static IDataTransformer CreateTransformer(ReportConfig config)
        {
            IDataTransformer service = new DataTransformer(config);

            if (config.WithData)
            {
                service = new WithDataReportTransformer(service);
            }

            if (config.VolumeSum)
            {
                service = new VolumeSumReportTransformer(service);
            }

            if (config.WeightSum)
            {
                service = new WeightSumReportTransfomer(service);
            }

            if (config.CostSum)
            {
                service = new CostSumReportTransformer(service);
            }

            if (config.CountSum)
            {
                service = new CountSumReportTransformer(service);
            }

            return(service);
        }
Example #3
0
        private Hashtable construtAllPlantsReportObj(int userid, int type, string dataitem)
        {
            Hashtable    table   = new Hashtable();
            DefineReport report1 = new DefineReport()
            {
                ReportType = type,
                ReportName = "All plants-" + DataReportType.getNameByCode(type),
                SaveTime   = DateTime.Now,
                dataitem   = dataitem,
                UserId     = userid
            };
            ReportConfig config1 = new ReportConfig()
            {
                tinterval  = "4",
                sendFormat = "html",
                sendMode   = "2",
                email      = "",
                reportId   = 0,
                plantId    = 0
            };

            table.Add(0, report1);
            table.Add(1, config1);
            return(table);
        }
Example #4
0
        /// <summary>
        /// 显示编辑页面
        /// </summary>
        /// <param name="id">报表Id</param>
        /// <param name="plantId">电站Id</param>
        /// <returns></returns>
        public ActionResult EditReport(string id, string plantId)
        {
            ViewData["id"] = id;
            DefineReport report = reportService.GetRunReportById(id);

            ViewData["pId"]          = plantId;
            ViewData["userId"]       = report.UserId;
            ViewData["dataItems"]    = report.dataitem;
            ViewData["reportTypeId"] = report.ReportType;
            //IList<DataItem> list=
            ReportConfig config = reportConfigService.GetReportConfigByReportId(int.Parse(id));

            if (string.IsNullOrEmpty(config.email) == false)
            {
                config.email = config.email.Replace(",", ";");
            }
            config.defineReport = report;
            if (string.IsNullOrEmpty(plantId) || "null".Equals(plantId))
            {
                base.FillAllPlantYears(report.user);
                ViewData["userId"] = report.user.id;
            }
            else
            {
                FillPlantYears(int.Parse(plantId));
            }
            return(View(config));
        }
Example #5
0
        /// <summary>
        /// Gets the report configuration from the server.
        /// </summary>
        private void GetReportConfiguration()
        {
            // Get the system information.
            iFolderSystem system = web.GetSystem();

            // If there are no report settings saved, use the default settings.
            string       settings = web.GetiFolderSetting(system.ReportiFolderID, ReportSettingName);
            ReportConfig rc       = (settings != null) ? new ReportConfig(settings) : new ReportConfig();

            // Set the web page selections.
            EnableReporting.Checked = Summary.Visible = rc.Enabled;

            FrequencyList.Enabled       = rc.Enabled;
            FrequencyList.SelectedIndex = ( int )rc.Frequency;

            ReportLocation.Enabled       = rc.Enabled;
            ReportLocation.SelectedIndex = rc.IsiFolder ? 0 : 1;

            DayOfMonthList.Enabled       = rc.Enabled;
            DayOfMonthList.SelectedIndex = rc.DayOfMonth - 1;

            DayOfWeekList.Enabled       = rc.Enabled;
            DayOfWeekList.SelectedIndex = ( int )rc.Weekday;

            TimeOfDayList.Enabled       = rc.Enabled;
            TimeOfDayList.SelectedIndex = ConvertTimeToIndex(rc.TimeOfDay);

            FormatList.Enabled       = rc.Enabled;
            FormatList.SelectedIndex = ( int )rc.Format;

            // Save the report settings in the ViewState.
            ReportID   = system.ReportiFolderID;
            ReportName = system.ReportiFolderName;
            ReportPath = system.ReportPath;
        }
Example #6
0
        public ActionResult UpdateReport(DefineReport report, ReportConfig rc)
        {
            if (report.PlantId == 0)
            {
                report.UserId = (UserUtil.getCurUser()).id;
            }
            rc.reportId = report.Id;

            if (string.IsNullOrEmpty(rc.email) == false)
            {
                rc.email = rc.email.Replace(";", ",");
            }


            reportConfigService.UpdateReportConfig(rc);
            reportService.EditReportById(report);

            if (report.PlantId == 0)
            {
                return(Redirect("/user/AllPlantsReport"));
            }
            else
            {
                return(RedirectToAction("PlantReport", "plant", new { @id = report.PlantId }));
            }
        }
Example #7
0
    {                                                                           //видим Посредника, который отделил объекты друг от друга, и содержит всю логику системы
        public static IDataTransformer CreateTransformer(ReportConfig config)
        {
            IDataTransformer service = new DataTransformer(config);

            if (config.WithData)                                            //вместо цеопчик If, лучше использовать цепочку обязанностей - Chain of Responsibility
            {
                service = new WithDataReportTransformer(service);           //причем тут можно использовать также и БИлдер,
            }                                                               // например StateBuilder, чтобы конструировать объект
                                                                            // по частям в этом месте
            if (config.VolumeSum)
            {
                service = new VolumeSumReportTransformer(service);          //также тут мы наблюдаем некий фасад, который предсавляет простой интерфейс к сложной подсистеме
            }

            if (config.WeightSum)
            {
                service = new WeightSumReportTransfomer(service);
            }

            if (config.CostSum)
            {
                service = new CostSumReportTransformer(service);
            }

            if (config.CountSum)
            {
                service = new CountSumReportTransformer(service);
            }

            return(service);
        }
        public static IDataTransformer CreateTransformer(ReportConfig config) //decorator, наследники ReportServiceTransformer - конкретные декораторы
        //Был написан билдер на декоратор, в планах можно маппить стринг из конфига в мтод билдера, чтобы удобнее добавлять команды
        {
            IDataTransformer service = new DataTransformer(config);

            DataTransformerBuilder builder = new DataTransformerBuilder();

            if (config.WithData)
            {
                builder = builder.WithData();
            }

            if (config.VolumeSum)
            {
                builder = builder.WithVolumeSum();
            }

            if (config.WeightSum)
            {
                builder = builder.WithWeightSum();
            }

            if (config.CostSum)
            {
                builder = builder.WithCostSum();
            }

            if (config.CountSum)
            {
                builder.WithCountSum();
            }

            return(builder.Build());
        }
Example #9
0
        public void ProduceReport(IReadOnlyList <Word> Words, ReportConfig Config)
        {
            if (Words == null || Words.Count == 0)
            {
                logger.LogInfo("Empty list of words provided in input. No report is generated.");
                return;
            }

            logger.LogInfo($"Start creating report for {Words.Count} words.");

            // sort the words
            IReadOnlyList <Word> sortedWords = wordSorter.Sort(Words);

            // create the report
            StringBuilder sbReport = new StringBuilder();

            reportWriter.Write(Config.ReportTitle);
            foreach (Word word in sortedWords)
            {
                sbReport.AppendLine(word.Counter + Config.Separator + word.Name);
            }

            // store
            reportWriter.Write(sbReport.ToString());

            logger.LogInfo("Finished creating report");
        }
Example #10
0
        public static IDataTransformer CreateTransformer(ReportConfig config)
        {
            IDataTransformer service = new DataTransformer(config);

            //далее идут декораторы
            //и тут лучше использовать chain of responsibility или лучше fluent bilder
            if (config.WithData)
            {
                service = new WithDataReportTransformer(service);
            }

            if (config.VolumeSum)
            {
                service = new VolumeSumReportTransformer(service);
            }

            if (config.WeightSum)
            {
                service = new WeightSumReportTransfomer(service);
            }

            if (config.CostSum)
            {
                service = new CostSumReportTransformer(service);
            }

            if (config.CountSum)
            {
                service = new CountSumReportTransformer(service);
            }

            return(service);
        }
Example #11
0
        public static IDataTransformer CreateTransformer(ReportConfig config)
        {
            var dataTransformerChain = new DataTransformerChain(config);

            return(dataTransformerChain.GetReportServiceTransformer());
//            IDataTransformer service = new DataTransformer(config);
//
//            if (config.WithData)
//            {
//                service = new WithDataReportTransformer(service);
//            }
//
//            if (config.VolumeSum)
//            {
//                service = new VolumeSumReportTransformer(service);
//            }
//
//            if (config.WeightSum)
//            {
//                service = new WeightSumReportTransfomer(service);
//            }
//
//            if (config.CostSum)
//            {
//                service = new CostSumReportTransformer(service);
//            }
//
//            if (config.CountSum)
//            {
//                service = new CountSumReportTransformer(service);
//            }
//
//            return service;
        }
        public ReadBuilder ParseConfig()
        {
            var config = new ReportConfig
            {
                Data = Args.Contains("-data"),

                WithIndex       = Args.Contains("-withIndex"),
                WithTotalVolume = Args.Contains("-withTotalVolume"),
                WithTotalWeight = Args.Contains("-withTotalWeight"),

                WithoutVolume = Args.Contains("-withoutVolume"),
                WithoutWeight = Args.Contains("-withoutWeight"),
                WithoutCost   = Args.Contains("-withoutCost"),
                WithoutCount  = Args.Contains("-withoutCount"),

                VolumeSum = Args.Contains("-volumeSum"),
                WeightSum = Args.Contains("-weightSum"),
                CostSum   = Args.Contains("-costSum"),
                CountSum  = Args.Contains("-countSum")
            };

            if (config.VolumeSum || config.WeightSum || config.CostSum || config.CountSum)
            {
                return(new ReadBuilder(Args[0], config));
            }
            throw new ArgumentException("Не указан ни один из обязательных флагов");
        }
Example #13
0
        private Hashtable construtPlantReportObj(int plantid, int type, string dataitem)
        {
            Hashtable    table     = new Hashtable();
            string       plantName = PlantService.GetInstance().GetPlantInfoById(plantid).name + " ";
            DefineReport report1   = new DefineReport()
            {
                ReportType = type,
                ReportName = plantName + "-" + DataReportType.getNameByCode(type),
                SaveTime   = DateTime.Now,
                dataitem   = dataitem,
                PlantId    = plantid
            };
            ReportConfig config1 = new ReportConfig()
            {
                sendFormat = "html",
                email      = "",
                sendMode   = "2",
                reportId   = 0,
                plantId    = plantid
            };

            table.Add(0, report1);
            table.Add(1, config1);
            return(table);
        }
Example #14
0
        /// <summary>
        /// 更新報表設定
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public bool Update_ReportConfig(ReportConfig config)
        {
            bool Flag = false;

            try
            {
                using (var conn = new MySqlConnection(scsb.ConnectionString))
                {
                    string sql = string.Empty;
                    sql = "UPDATE  ReportConfig  SET " +
                          "ElectricNo = @ElectricNo, " +
                          "ElectricitySalePeriod = @ElectricitySalePeriod, " +
                          "StartingDate = @StartingDate, " +
                          "OfficialPricingStartDate = @OfficialPricingStartDate, " +
                          "PricStartTime = @PricStartTime, " +
                          "PricEndTime = @PricEndTime, " +
                          "DeviceCapacity = @DeviceCapacity, " +
                          "PurchaseAndSaleCapacity = @PurchaseAndSaleCapacity, " +
                          "ElectricityPurchaseRate = @ElectricityPurchaseRate," +
                          "Ratio = @Ratio " +
                          "WHERE PK = @PK AND GatewayIndex = @GatewayIndex AND DeviceIndex = @DeviceIndex";
                    conn.Execute(sql, new { config.ElectricNo, config.ElectricitySalePeriod, config.StartingDate, config.OfficialPricingStartDate, config.PricStartTime, config.PricEndTime, config.DeviceCapacity, config.PurchaseAndSaleCapacity, config.ElectricityPurchaseRate, config.Ratio, config.PK, config.GatewayIndex, config.DeviceIndex });
                    Flag = true;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "報表設定失敗");
            }
            return(Flag);
        }
Example #15
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            ImageButton  button = (ImageButton)sender;
            ReportConfig config = (ReportConfig)button.DataContext;

            Model.Remove(config);
        }
Example #16
0
 public FrmParameterReports(string ReportName, ReportConfig rc)
 {
     _reportName = ReportName;
     InitializeComponent();
     _rc = rc;
     LoadParameters();
 }
Example #17
0
        //pattern  factory method. not much to say.
        public static IDataTransformer CreateTransformer(ReportConfig config)
        {
            IDataTransformer service = new DataTransformer(config);

            //pattern decorator. new data transformer wraps previous one around
            if (config.WithData)
            {
                service = new WithDataReportTransformer(service);
            }

            if (config.VolumeSum)
            {
                service = new VolumeSumReportTransformer(service);
            }

            if (config.WeightSum)
            {
                service = new WeightSumReportTransfomer(service);
            }

            if (config.CostSum)
            {
                service = new CostSumReportTransformer(service);
            }

            if (config.CountSum)
            {
                service = new CountSumReportTransformer(service);
            }

            return(service);
        }
Example #18
0
        public static IDataTransformer CreateTransformer(ReportConfig config)
        {
            // TODO Найден паттерн: ChainOfResponsibility
            // Теперь мы можем навесить кучу обработчиков, при этом создавая эту цепочку динамически
            // Простое добавление новых агрегирующих функций

            IDataTransformer service = new DataTransformer(config);

            if (config.WithData)
            {
                service = new WithDataReportTransformer(service);
            }

            if (config.VolumeSum)
            {
                service = new VolumeSumReportTransformer(service);
            }

            if (config.WeightSum)
            {
                service = new WeightSumReportTransformer(service);
            }

            if (config.CostSum)
            {
                service = new CostSumReportTransformer(service);
            }

            if (config.CountSum)
            {
                service = new CountSumReportTransformer(service);
            }

            return(service);
        }
 public ReportReceiverController(IMessageQueueProvider queueProvider, IAdoNetUnitOfWork unitOfWork,
                                 IConfiguration <ReportConfig> reportConfig, IWhitelistService whitelistService)
 {
     _unitOfWork       = unitOfWork;
     _reportConfig     = reportConfig.Value;
     _whitelistService = whitelistService;
     _messageQueue     = queueProvider.Open("ErrorReports");
 }
Example #20
0
 public DataTransformerChain(ReportConfig config)
 {
     _handler = new WithDataHandler(null, config);
     _handler = new VolumeSumHandler(_handler, config);
     _handler = new WeightSumHandler(_handler, config);
     _handler = new CostSumHandler(_handler, config);
     _handler = new CountSumHandler(_handler, config);
 }
 private void CheckForWarning(ReportConfig config)
 {
     if ((config.WithIndex || config.WithTotalVolume || config.WithTotalWeight) && !config.WithData)
     {
         Console.ForegroundColor = ConsoleColor.Yellow;
         Console.WriteLine("WARNING");
         Console.ForegroundColor = ConsoleColor.Gray;
     }
 }
Example #22
0
 /*
  * Вообще не нравится реализация, т.к. для каждой новой функциональности нужно будет:
  * 1. Создавать новый класс, реализующий функциональность
  * 2. Добавлять в классе ReportConfig новое булевское поле
  * 3. Проверять на наличие данного ключа во входных аргументах.
  * 4. Не забыть добавить конструкцию if в DataTransformerCreator
  *
  * Предлагаю:
  * 1. В ReportConfig создать одно поле -
  *      public List<string> ArgsAgregateFunctions, в который поместим все агрументы запуска, кроме названия файла и начинающихся с "-with..."
  *      public List<string> ArgsHeaderAndRows, в который поместим все агрументы запуска начинающихся с "-with..."
  *      и фабричный метод GetServiceTransformer, возвращающий service после декорирования
  * 2. В классе DataTransformerCreator пробегаться по списку ArgsAgregateFunctions (см. пункт 1),
  *      вызывать метод GetServiceTransformer для каждого аргумента из списка
  *
  * То есть теперь нам нужно только в ReportConfig.GetServiceTransformer объявить соответствие реалзиации с ключем
  *
  * Что не нравится еще: ключи (константы на весь проект) прописаны где-то в коде, что их не быстро найдешь
  * Исправление:
  * 1. Вынести все эти константы в отдельный статический класс с названием ArgsConst
  * 2. Производить обращение к этим ключам через созданный статический класс
  */
 private ReportConfig ParseConfig()
 {
     return(new ReportConfig
     {
         Data = _args.Contains(ArgsConst.Data),
         ArgsAgregateFunctions = ReportConfig.TakeArgsWithoutHeaderAndRows(_args),
         ArgsAddColumns = ReportConfig.TakeArgsWithHeaderAndRows(_args)
     });
 }
        public Report CreateReport(ReportConfig config, string fileName)
        {
            var dataTransformer = DataTransformerCreator.CreateTransformer(config);

            var text = File.ReadAllText(fileName);
            var data = GetDataRows(text);

            return(dataTransformer.TransformData(data));
        }
Example #24
0
        public static bool StartEditing(Window owner, ReportConfig items)
        {
            ReportConfigEditor editor = new ReportConfigEditor();

            editor.Model       = items;
            editor.DataContext = items;
            editor.Owner       = owner;
            editor.ShowDialog();

            return(editor.ApplyChanges);
        }
Example #25
0
        private void BtnMoveDown_Click(object sender, RoutedEventArgs e)
        {
            ImageButton  button = (ImageButton)sender;
            ReportConfig config = (ReportConfig)button.DataContext;
            int          index  = Model.IndexOf(config);

            if (index < Model.Count - 1)
            {
                Model.Move(index, index + 1);
            }
        }
Example #26
0
        /*
         * Здесь применяется паттерн Декоратор.
         * То есть мы добавляем функциональность нашему сервису в соответствии с ранее полученными настойками
         *
         * Что плохого в коде: для декорирования используются if'ы.
         * А значит при большем числе настроек, нужно будет не забывать их прописывать здесь.
         *
         * Изменения:
         * 1. Теперь мы просто пробегаемся по списку с ключами
         * 2. Вызываем метод (Factory Method), который оборачивает service в декоратор, соответствующий параметру arg
         *
         * Плюсы: не нужно для каждой новой реализации лезть в этот класс и добавлять новый if.
         *
         * Минусы: приходится хранить в списке строковые ключи, а уже потом по ним использовать тот или иной декоратор.
         *
         * Пытался применить такое решение для исправления минуса:
         * Создать Dictionary<string, class>, у которого ключом был бы arg, а class - классы реализации функциональности аргументов
         * То есть по ключу словарь должен был бы возвращать новый экземпляр объекта соответствующей функциональности..
         * Но я не нашел, как это делается в c#. В Python такой трюк проходит на ура =)
         */
        public static IDataTransformer CreateTransformer(ReportConfig config)
        {
            IDataTransformer service = new DataTransformer(config);

            foreach (var arg in config.ArgsAgregateFunctions)
            {
                service = config.GetServiceTransformer(arg, service);
            }

            return(service);
        }
Example #27
0
        private void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            ImageButton  button = (ImageButton)sender;
            ReportConfig config = (ReportConfig)button.DataContext;
            ReportConfig clone  = ReportConfigSerializer.Clone(config);

            if (ReportConfigEditor.StartEditing(this, clone))
            {
                int index = Model.IndexOf(config);
                Model[index] = clone;
            }
        }
Example #28
0
        /// <summary>
        /// 回填事件报表
        /// </summary>
        /// <param name="id">电站Id</param>
        /// <returns></returns>
        public ActionResult EventReport(int id)
        {
            ViewData["plantId"] = id;
            ReportConfig eventConfig = reportConfigService.GetEventReportConfigByIdAndReportId(id);

            if (eventConfig != null && string.IsNullOrEmpty(eventConfig.email) == false)
            {
                eventConfig.email = eventConfig.email.Replace(",", ";");
            }
            ViewData["config"] = eventConfig;
            return(View(eventConfig));
        }
Example #29
0
        // TODO вынесли парсинг конфига в другое место. Теперь конфиг передается в качестве аргумента
        public Report CreateReport(ReportConfig config)
        {
            // TODO найден паттерн: TemplateMethod
            // Мы делегируем парсинг DataRow соответствующим классам, которые непосредственно реализуют работу с конкретными форматами
            // Тем самым, внедрение поддержки новых форматов упрощается

            var dataTransformer = DataTransformerCreator.CreateTransformer(config);
            var text            = File.ReadAllText(config.FileName);
            var data            = GetDataRows(text);

            return(dataTransformer.TransformData(data));
        }
Example #30
0
        // "Files/table.txt" -data -weightSum -costSum -withIndex -withTotalVolume
        public static void Main(string[] args)
        {
            ReportConfig config  = ConfigParser.Parse(args);
            var          service = GetReportService(config);
            var          report  = service.CreateReport(config);

            PrintReport(report);

            Console.WriteLine("");
            Console.WriteLine("Press enter...");
            Console.ReadLine();
        }
Example #31
0
        private void btnCreateBlankView_Click(object sender, EventArgs e)
        {
            if (!IsSaved) {
                if (MessageBox.Show("Do you want to save changes to the current view?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    btnSaveConfig_Click(null, null);
                else
                    IsSaved = true;
            }

            WaitDialog.Show(ParentForm, "Loading Data Views...");
            m_ConfigGrid = new ReportConfig() {
                Complete = false,
                OnEditMode = true // create new blank view is always on edit mode.
            };
            m_ConfigLayout = new ReportConfig() {
                Complete = false,
                OnEditMode = false
            };
            m_ConfigParameter = new ReportConfig() {
                Complete = false,
                OnEditMode = false
            };

            m_LoadedParameters = false;
            m_LoadedLayout = false;
            m_LoadedConfig = false; // means this is not a loaded existing view config

            tbpgeGridConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;
            tbpgeLayoutConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;
            btnEditReportTemplate.Image = ManagerApplication.Properties.Resources.view_config_incomplete;
            tbpgeParameterConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;

            m_GoDefault = true;
            tcViewConfig.SelectedTabPage = tbpgeGridConfig;

            lookUpEditViewList.EditValue = null;
            lookUpEditViewList.Properties.ReadOnly = true;
            lookUpEditSubcampaign.Properties.ReadOnly = true;

            //lcgHeaderControls.Enabled = true;
            lcgLeft.Enabled = true;
            lcgRight.Enabled = true;
            tcViewConfig.Enabled = true;
            //txtViewName.Text = "";

            BindGridAvailableColumns();
            BindGridColumnsInView();
            //var objSen = sender as SimpleButton;
            //if (objSen != null) objSen.Enabled = false;
            btnCreateBlankView.Enabled = false;
            btnCancel.Enabled = true;
            btnLoadView.Enabled = false;
            btnDeleteView.Enabled = false;
            btnLoadLayoutTemplateToReport.Enabled = false;
            //btnDuplicateView.Enabled = false;
            btnShowXmlViewConfig.Enabled = true;
            IsNewConfig = true;
            m_efoViewConfig = null;
            WaitDialog.Close();

            //CreateBlankView _control = new CreateBlankView(true);
            //_control.AfterSave += new CreateBlankView.AfterSaveEventHandler(_control_AfterSave);

            //PopupDialog _dlg = new PopupDialog() {
            //    FormBorderStyle = FormBorderStyle.FixedSingle,
            //    MinimizeBox = false,
            //    MaximizeBox = false,
            //    StartPosition = FormStartPosition.CenterScreen,
            //    Text = "New View"
            //};
            //_dlg.Controls.Add(_control);
            //_dlg.ClientSize = new Size(_control.Width + 2, _control.Height + 2);
            //_dlg.ShowDialog(this.ParentForm);

            //if (!IsSaved) {
            //    if (MessageBox.Show("Do you want to save changes to the current view?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
            //        btnSaveConfig_Click(null, null);
            //    }
            //    else {
            //        IsSaved = true;
            //    }
            //}

            //lookUpEditViewList.EditValue = null;
            //lookUpEditViewList.Properties.ReadOnly = true;
            //lookUpEditSubcampaign.Properties.ReadOnly = true;

            //WaitDialog.Show(ParentForm, "Loading Data Views...");
            ////lcgHeaderControls.Enabled = true;
            //lcgLeft.Enabled = true;
            //lcgRight.Enabled = true;
            ////txtViewName.Text = "";
            //BindGridAvailableColumns();
            //BindGridColumnsInView();
            //var objSen = sender as SimpleButton;
            //if (objSen != null) objSen.Enabled = false;
            //btnLoadView.Enabled = false;
            //btnDeleteView.Enabled = false;
            ////btnDuplicateView.Enabled = false;
            //btnShowXmlViewConfig.Enabled = true;
            //IsNewConfig = true;
            //viewConfig = null;
            //WaitDialog.Close();
        }
Example #32
0
        private void btnLoadView_Click(object sender, EventArgs e)
        {
            if (!IsSaved) {
                if (MessageBox.Show("Do you want to save changes to the current view?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
                    btnSaveConfig_Click(null, null);
                } else {
                    IsSaved = true;
                }
            }

            WaitDialog.Show(ParentForm, "Loading data view ...");

            /**
             * set default icons and flags first.
             */
            m_ConfigGrid = new ReportConfig() {
                Complete = false,
                OnEditMode = false
            };
            m_ConfigLayout = new ReportConfig() {
                Complete = false,
                OnEditMode = false
            };
            m_ConfigParameter = new ReportConfig() {
                Complete = false,
                OnEditMode = false
            };

            m_LoadedParameters = false;
            m_LoadedLayout = false;
            m_LoadedConfig = true;
            m_IsNew = false;
            IsNewConfig = false;

            tbpgeLayoutConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;
            btnEditReportTemplate.Image = ManagerApplication.Properties.Resources.view_config_incomplete;
            tbpgeParameterConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;

            gcAvailableColumns.DataSource = null;
            gcColumnView.DataSource = null;
            this.BindGridAvailableColumns();
            this.BindGridColumnsInView();

            btnShowXmlViewConfig.Enabled = true;
            lookUpEditSubcampaign.Properties.ReadOnly = true;
            lcgLeft.Enabled = true;
            lcgRight.Enabled = true;
            tcViewConfig.Enabled = true;
            btnDeleteView.Enabled = true;
            btnCancel.Enabled = true;
            btnLoadLayoutTemplateToReport.Enabled = true;
            //btnPreviewView.Enabled = true;

            var objSender = lookUpEditViewList;
            if (objSender != null) {
                var val = objSender.EditValue;
                if (val != null) {
                    int configId = (int)val;
                    if (configId > 0) {
                        m_efoViewConfig = m_efDbContext.view_configuration.FirstOrDefault(x => x.id == configId);
                        if (m_efoViewConfig != null) {
                            this.LoadXML(m_efoViewConfig.xml_config);
                            m_ViewName = m_efoViewConfig.name;

                            /**
                             * grid config.
                             */
                            m_ConfigGrid.OnEditMode = true;
                            if (!string.IsNullOrEmpty(m_efoViewConfig.xml_config)) {
                                m_ConfigGrid.Complete = true;
                                tbpgeGridConfig.Image = ManagerApplication.Properties.Resources.save_ok;
                            }
                            else
                                tbpgeGridConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;

                            /**
                             * layout config.
                             */
                            if (!string.IsNullOrEmpty(m_efoViewConfig.report_layout_config)) {
                                m_ConfigLayout.Complete = true;
                                tbpgeLayoutConfig.Image = ManagerApplication.Properties.Resources.save_ok;
                                btnEditReportTemplate.Image = ManagerApplication.Properties.Resources.view_config_completed;
                            }
                            else {
                                tbpgeLayoutConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;
                                btnEditReportTemplate.Image = ManagerApplication.Properties.Resources.view_config_incomplete;
                            }

                            /**
                             * parameter config.
                             */
                            if (!string.IsNullOrEmpty(m_efoViewConfig.report_data_config)) {
                                m_ConfigParameter.Complete = true;
                                tbpgeParameterConfig.Image = ManagerApplication.Properties.Resources.save_ok;
                            }
                            else
                                tbpgeParameterConfig.Image = ManagerApplication.Properties.Resources.incomplete_on_edit;
                        }
                    }

                }
            }
            this.SetPreviewReport();
            WaitDialog.Close();
        }
Example #33
0
        /// <summary>
        /// Allows various configurations to be applied to the report file
        /// </summary>
        /// <returns>ReportConfig object</returns>
        public ReportConfig Config()
        {
            if (config == null)
            {
                if (reportInstance == null)
                {
                    throw new Exception("Cannot apply config before ExtentReports is initialized");
                }

                config = new ReportConfig(reportInstance);
            }

            return config;
        }