Example #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();
                }
            }
        }
Example #2
0
        private void btn_SyncAcc_Click(object sender, EventArgs e)
        {
            SynapseModule             mod = SynapseModule.LoadByID((long)comboBox1.SelectedValue);
            IList <ACCSynapseProfile> Ap  = ACCSynapseProfile.Load("WHERE FK_MODULEID = " + mod.ID);
            IList <SynapseProfile>    Pp  = SynapseProfile.Load("WHERE FK_MODULEID = " + mod.ID);

            if (Ap.Count != Pp.Count)
            {
                MessageBox.Show("ERROR : Sync before");
                return;
            }
            IList <ACCTOPRD> links = ACCTOPRD.Load("WHERE OBJECTTYPE = 'ACCSynapseProfile'");

            foreach (ACCSynapseProfile aprof in Ap)
            {
                if (links.Where(l => l.ACCID == aprof.ID).Count() == 0)
                {
                    ACCTOPRD atop = new ACCTOPRD();
                    atop.ACCID      = aprof.ID;
                    atop.PRDID      = Pp.Where(p => p.TECHNICALNAME == aprof.TECHNICALNAME).FirstOrDefault().ID;
                    atop.OBJECTTYPE = typeof(ACCSynapseProfile).Name;
                    if (atop.ACCID != 0 && atop.PRDID != 0)
                    {
                        atop.save();
                    }
                }
            }
            links = ACCTOPRD.Load("WHERE OBJECTTYPE = 'ACCSynapseProfile'");
            foreach (ACCSynapseUser u in olv_ACCUSERS.CheckedObjects)
            {
                SynapseUser pu = SynapseUser.LoadByUserID(u.UserID);
                IList <ACCSynapseUser_Profile> AccRoles = ACCSynapseUser_Profile.Load("WHERE [FK_SECURITY_USER] = " + u.ID + " AND [FK_SECURITY_PROFILE] in (" + string.Join(",", Ap.Select(a => a.ID.ToString()).ToArray()) + ")");
                IList <SynapseUser_Profile>    PrdRoles = SynapseUser_Profile.Load("WHERE [FK_SECURITY_USER] = " + pu.ID + " AND [FK_SECURITY_PROFILE] in (" + string.Join(",", Pp.Select(a => a.ID.ToString()).ToArray()) + ")");
                foreach (ACCSynapseUser_Profile Aup in AccRoles)
                {
                    if (PrdRoles.Where(pr => pr.FK_SECURITY_PROFILE == Ap.Where(a => a.ID == Aup.FK_SECURITY_PROFILE).FirstOrDefault().PrdID(links)).Count() == 0)
                    {
                        SynapseUser_Profile pup = new SynapseUser_Profile();
                        pup.FK_SECURITY_USER    = pu.ID;
                        pup.FK_SECURITY_PROFILE = Ap.Where(a => a.ID == Aup.FK_SECURITY_PROFILE).FirstOrDefault().PrdID(links);
                        if (MessageBox.Show("Add Group " + Ap.Where(a => a.ID == Aup.FK_SECURITY_PROFILE).FirstOrDefault().TECHNICALNAME + " to user " + pu.LASTNAME + " " + pu.FIRSTNAME, "Modify ?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            pup.save();
                        }
                    }
                }
            }
        }
Example #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     foreach (ACCSynapseModule amod in Acc_Modules)
     {
         SynapseModule pmod = SynapseModule.LoadByID(amod.ID);
         if (amod.TECHNICALNAME == pmod.TECHNICALNAME)
         {
             pmod.DEVSOURCE      = amod.DEVSOURCE;
             pmod.PRODSOURCE     = amod.PRODSOURCE;
             pmod.MODULECATEGORY = amod.MODULECATEGORY;
             pmod.PATH           = amod.PATH;
             pmod.save();
         }
     }
     LoadModules();
 }
Example #4
0
        private void syncToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ACCSynapseModule mod = null;

            if (olv_Acc_Modules.SelectedObject != null)
            {
                mod = (ACCSynapseModule)olv_Acc_Modules.SelectedObject;
            }
            if (mod != null)
            {
                ACCSynapseModule amod = (ACCSynapseModule)olv_Acc_Modules.SelectedObject;
                SynapseModule    pmod = SynapseModule.LoadByID(amod.ID);
                if (pmod != null)
                {
                    pmod.MODULECATEGORY = amod.MODULECATEGORY;
                    pmod.PATH           = amod.PATH;
                    pmod.VERSION        = amod.VERSION;
                    pmod.VERSIONDATE    = amod.VERSIONDATE;
                    pmod.TECHNICALNAME  = amod.TECHNICALNAME;
                    pmod.DEVSOURCE      = amod.DEVSOURCE;
                    pmod.PRODSOURCE     = amod.PRODSOURCE;
                    pmod.IS_ACTIVE      = amod.IS_ACTIVE;
                    pmod.save();
                }

                if (mod.DEVSOURCE != mod.PRODSOURCE)
                {
                    GenInstaller.Installer.DoInstall(new System.IO.DirectoryInfo(mod.DEVSOURCE), new System.IO.DirectoryInfo(mod.PRODSOURCE), GenInstaller.InstallOptions.Normal);
                    try
                    {
                        GenInstaller.Installer.ChangeTextInFiles("XS006726", "sql-gen-prd.electrabel.be", new System.IO.DirectoryInfo(mod.PRODSOURCE).GetFiles("*.config", System.IO.SearchOption.TopDirectoryOnly));
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            LoadModules();
        }
Example #5
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);
        }
Example #6
0
        public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode)
        {
            base.initForm(Mode);

            switch (_action)
            {
            case "NEW":
                this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Create");

                _module.ID = 0;

                txPath.Text           = "";
                txTechnicalName.Text  = "";
                txVersion.Text        = "";
                txVersionDate.Text    = "";
                txCategory.Text       = "";
                txDevSources.Text     = "";
                txProdSources.Text    = "";
                ckActive.Checked      = true;
                ckRequestable.Checked = false;

                _module.FriendlyName        = new LabelBag();
                _module.FriendlyName.Labels = new List <SynapseLabel>();
                _module.Description         = new LabelBag();
                _module.Description.Labels  = new List <SynapseLabel>();
                foreach (SynapseLanguage lang in languages)
                {
                    SynapseLabel newFriendlyName = new SynapseLabel();
                    newFriendlyName.LABELID  = 0;
                    newFriendlyName.LANGUAGE = lang.CODE;
                    newFriendlyName.TEXT     = "";
                    _module.FriendlyName.Labels.Add(newFriendlyName);

                    SynapseLabel newDescription = new SynapseLabel();
                    newDescription.LABELID  = 0;
                    newDescription.LANGUAGE = lang.CODE;
                    newDescription.TEXT     = "";
                    _module.Description.Labels.Add(newDescription);
                }
                break;

            case "EDIT":
                this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Edit");
                _module   = SynapseModule.LoadByID(_moduleID);

                txPath.Text           = _module.PATH;
                txTechnicalName.Text  = _module.TECHNICALNAME;
                txVersion.Text        = _module.VERSION;
                txVersionDate.Text    = _module.VERSIONDATE;
                txCategory.Text       = _module.MODULECATEGORY;
                txDevSources.Text     = _module.DEVSOURCE;
                txProdSources.Text    = _module.PRODSOURCE;
                ckActive.Checked      = _module.IS_ACTIVE;
                ckRequestable.Checked = _module.IS_REQUESTABLE;

                if (_module.FriendlyName.Labels.Count < languages.Count)
                {
                    foreach (SynapseLanguage lang in languages)
                    {
                        if (_module.FriendlyName.GetLabel(lang.CODE) == null)
                        {
                            SynapseLabel newlabel = new SynapseLabel();
                            newlabel.LABELID  = _module.FriendlyName.GetLabelID();
                            newlabel.LANGUAGE = lang.CODE;
                            newlabel.TEXT     = "";
                            newlabel.save();
                            _module.FriendlyName.Labels.Add(newlabel);
                        }
                    }
                }
                if (_module.Description.Labels.Count < languages.Count)
                {
                    foreach (SynapseLanguage lang in languages)
                    {
                        if (_module.Description.GetLabel(lang.CODE) == null)
                        {
                            SynapseLabel newlabel = new SynapseLabel();
                            newlabel.LABELID  = _module.Description.GetLabelID();
                            newlabel.LANGUAGE = lang.CODE;
                            newlabel.TEXT     = "";
                            newlabel.save();
                            _module.Description.Labels.Add(newlabel);
                        }
                    }
                }
                break;
            }
            bagName.FieldName = GetLabel("frmModule.gbFiendlyName");
            bagName.LblBag    = _module.FriendlyName;
            bagName.Visible   = true;
            bagName.Dock      = DockStyle.Fill;
            flowLayoutPanel1.Controls.Add(bagName);

            bagDescription.FieldName = GetLabel("frmModule.gbDescription");
            bagDescription.LblBag    = _module.Description;
            bagDescription.Visible   = true;
            bagDescription.Dock      = DockStyle.Fill;
            flowLayoutPanel1.Controls.Add(bagDescription);
        }