예제 #1
0
        private void treeReport_DoubleClick(object sender, EventArgs e)
        {
            if (treeReport.SelectedObject != null)
            {
                if (treeReport.SelectedObject is Category)
                {
                    if (treeReport.IsExpanded(treeReport.SelectedObject))
                    {
                        treeReport.Collapse(treeReport.SelectedObject);
                    }
                    else
                    {
                        treeReport.Expand(treeReport.SelectedObject);
                    }
                }
                else
                {
                    Definition _report = (Definition)treeReport.SelectedObject;

                    // If the Report List is mixed between Modue & Interface, reset the origin for each report
                    if (_InterfaceID != 0)
                    {
                        if (_report.FK_INTERFACE != 0)
                        {
                            ReportOrigin.setTo(SynapseInterface.LoadByID(_report.FK_INTERFACE));
                        }
                        else
                        {
                            ReportOrigin.setTo(SynapseModule.LoadByID(_report.FK_MODULE));
                        }
                    }

                    string pageTitle = string.Empty;

                    if (_report.ADDCATEGORY)
                    {
                        pageTitle = Category.LoadByID(_report.FK_CATEGORY).LABEL.ToString() + " - " + _report.LABEL.ToString();
                    }
                    else
                    {
                        pageTitle = _report.LABEL.ToString();
                    }

                    TabPage       _page = new TabPage(pageTitle);
                    reportControl _rep  = new reportControl();
                    _rep.ReportId    = _report.ID;
                    _rep.IsForDesign = false;
                    _rep.Dock        = DockStyle.Fill;
                    _rep.Load();
                    _page.Controls.Add(_rep);
                    tabControl1.TabPages.Add(_page);
                    _page.ImageKey            = "report";
                    tabControl1.SelectedIndex = tabControl1.TabPages.Count - 1;
                    tabControl1.Visible       = true;

                    _rep.Focus();
                }
            }
        }
예제 #2
0
        public void Terminate(ReportOrigin origin, int tenantId, Guid userId)
        {
            lock (Locker)
            {
                var result = tasks.GetTasks().Where(Predicate(origin, tenantId, userId));

                foreach (var t in result)
                {
                    tasks.CancelTask(t.Id);
                }
            }
        }
예제 #3
0
        public static void Terminate(ReportOrigin origin)
        {
            lock (Locker)
            {
                var result = tasks.GetTasks().Where(Predicate(origin));

                foreach (var t in result)
                {
                    tasks.CancelTask(t.Id);
                }
            }
        }
예제 #4
0
 public ReportStateData(string fileName, string tmpFileName, string script, int reportType, ReportOrigin origin,
                        Action <ReportState, string> saveFileAction, object obj,
                        int tenantId, Guid userId)
 {
     FileName       = fileName;
     TmpFileName    = tmpFileName;
     Script         = script;
     ReportType     = reportType;
     Origin         = origin;
     SaveFileAction = saveFileAction;
     Obj            = obj;
     TenantId       = tenantId;
     UserId         = userId;
 }
예제 #5
0
        public ReportState(string fileName, string tmpFileName, string script, int reportType, ReportOrigin origin, Action <ReportState, string> saveFileAction, object obj)
        {
            Id             = DocbuilderReportsUtility.GetCacheKey(origin);
            Origin         = origin;
            FileName       = fileName;
            TmpFileName    = tmpFileName;
            Script         = script;
            ReportType     = reportType;
            SaveFileAction = saveFileAction;
            TaskInfo       = new DistributedTask();
            TenantId       = TenantProvider.CurrentTenantID;
            UserId         = SecurityContext.CurrentAccount.ID;
            ContextUrl     = HttpContext.Current != null?HttpContext.Current.Request.GetUrlRewriter().ToString() : null;

            Obj = obj;
        }
예제 #6
0
        public static ReportState Status(ReportOrigin origin)
        {
            lock (Locker)
            {
                var task = tasks.GetTasks().LastOrDefault(Predicate(origin));
                if (task == null)
                {
                    return(null);
                }

                var result = ReportState.FromTask(task);
                if ((int)result.Status > 1)
                {
                    tasks.RemoveTask(task.Id);
                }

                return(result);
            }
        }
예제 #7
0
        public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode)
        {
            base.initForm(Mode);

            var Modules    = FormUser.Modules;
            var Interfaces = SynapseInterface.LoadAvailable();

            if (Modules.Count > 1 || Interfaces.Count > 1)
            {
                cb_Module.Items.Clear();
                foreach (SynapseModule Mod in Modules)
                {
                    cb_Module.Items.Add(Mod);
                }
                foreach (SynapseInterface Interf in Interfaces)
                {
                    cb_Module.Items.Add(Interf);
                }

                cb_Module.DisplayMember = "FriendlyName";
                //cb_Module.DisplayMember = "TECHNICALNAME";
                cb_Module.ValueMember  = "ID";
                cb_Module.SelectedItem = cb_Module.Items[0];
            }
            else
            {
                if (Modules.Count == 1)
                {
                    ReportOrigin.setTo(Modules[0]);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                if (Interfaces.Count == 1)
                {
                    ReportOrigin.setTo(Interfaces[0]);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
        }
예제 #8
0
        public ReportState Status(ReportOrigin origin, IHttpContextAccessor httpContextAccessor, int tenantId, Guid userId)
        {
            lock (Locker)
            {
                var task = tasks.GetTasks().LastOrDefault(Predicate(origin, tenantId, userId));
                if (task == null)
                {
                    return(null);
                }

                var result = ReportState.FromTask(task, httpContextAccessor, tenantId, userId);
                var status = task.GetProperty <ReportStatus>("status");
                var id     = task.GetProperty <ReportStatus>("status");

                if ((int)status > 1)
                {
                    tasks.RemoveTask(task.Id);
                }

                return(result);
            }
        }
예제 #9
0
        private static void startForModule(string ModuleAndInterface)
        {
            Int64 ModuleID    = 0;
            Int64 InterfaceID = 0;

            string[] param = ModuleAndInterface.Split(',');
            if (param.Length > 1)
            {
                ModuleID    = long.Parse(param[0]);
                InterfaceID = long.Parse(param[1]);
            }
            else
            {
                ModuleID = long.Parse(param[0]);
            }

            ReportOrigin.setTo(SynapseModule.LoadByID(ModuleID));
            frmReport fReport = new frmReport(true);

            fReport.InterfaceID = InterfaceID;
            fReport.ShowMenu    = true;
            Application.Run(fReport);
        }
예제 #10
0
 public ReportState Status(ReportOrigin origin)
 {
     return(DocbuilderReportsUtility.Status(origin, HttpContextAccessor, TenantId, UserId));
 }
예제 #11
0
 public void Terminate(ReportOrigin origin)
 {
     DocbuilderReportsUtility.Terminate(origin, TenantId, UserId);
 }
예제 #12
0
 internal static string GetCacheKey(ReportOrigin origin, int tenantId, Guid userId)
 {
     return($"{tenantId}_{userId}_{(int)origin}");
 }
예제 #13
0
 private static Func <DistributedTask, bool> Predicate(ReportOrigin origin, int tenantId, Guid userId)
 {
     return(t => t.GetProperty <string>("id") == GetCacheKey(origin, tenantId, userId));
 }
예제 #14
0
 internal static string GetCacheKey(ReportOrigin origin)
 {
     return(string.Format("{0}_{1}_{2}", TenantProvider.CurrentTenantID, SecurityContext.CurrentAccount.ID, (int)origin));
 }
예제 #15
0
 private static Func <DistributedTask, bool> Predicate(ReportOrigin origin)
 {
     return(t => t.GetProperty <string>("id") == GetCacheKey(origin));
 }
예제 #16
0
 private void button1_Click(object sender, EventArgs e)
 {
     this.DialogResult = DialogResult.OK;
     ReportOrigin.setTo(cb_Module.SelectedItem);
     this.Close();
 }