Beispiel #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            string str_id = comboBox2.SelectedValue.ToString();

            Acc_Controls = ACCSynapseControl.Load("WHERE FK_MODULE_ID in (" + str_id + ")");
            ResControls  = new List <ResourcesControl>();
            richTextBox2.Clear();
            string[] resfiles = Directory.GetFiles(textBox1.Text, "*.SynapseResource");
            foreach (string rf in resfiles)
            {
                string[] reslines = File.ReadAllLines(rf);
                foreach (string rl in reslines)
                {
                    MatchCollection coll = Regex.Matches(rl, @"(?<Form>.*)\x2E(?<Control>.*)=(?<Text>.*)");
                    foreach (Match match in coll)
                    {
                        ResControls.Add(new ResourcesControl {
                            controlName = match.Groups["Control"].Value, formName = match.Groups["Form"].Value
                        });
                    }
                }
            }
            richTextBox2.AppendText(string.Format("Forms found in resources:{0}\n", ResControls.Select(rc => rc.formName).Distinct().Count()));
            richTextBox2.AppendText(string.Format("Controls found in resources:{0}\n", ResControls.Select(rc => rc.formName + "." + rc.controlName).Distinct().Count()));
            richTextBox2.AppendText(string.Format("Forms found in database:{0}\n", Acc_Controls.Select(dc => dc.FORM_NAME).Distinct().Count()));
            richTextBox2.AppendText(string.Format("Controls found in database:{0}\n", Acc_Controls.Select(dc => dc.FORM_NAME + "." + dc.CTRL_NAME).Distinct().Count()));

            var deadctrl = (from c in Acc_Controls where !ResControls.Select(rc => rc.formName + "." + rc.controlName).Distinct().Contains(c.FORM_NAME + "." + c.CTRL_NAME) select c).ToList();

            objectListView1.SetObjects(deadctrl);
        }
Beispiel #2
0
        private void btn_analyse_Click(object sender, EventArgs e)
        {
            Presentation.Clear();
            string[] ids    = (from id in olv_Modules.CheckedObjects.Cast <SynapseModule>() select id.ID.ToString()).ToArray();
            string   str_id = string.Join(",", ids);

            Prd_Users = SynapseUser.Load();
            Acc_Users = ACCSynapseUser.Load();
            obj_sync pr = new obj_sync();

            pr.Name   = typeof(SynapseUser).FullName;
            pr.PrdCnt = Prd_Users.Count;
            pr.AccCnt = Acc_Users.Count;
            pr.Link   = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseUser).Name select l).Count();
            Presentation.Add(pr);

            Prd_Profiles = SynapseProfile.Load("WHERE FK_MODULEID in (" + str_id + ")");
            Acc_Profiles = ACCSynapseProfile.Load("WHERE FK_MODULEID in (" + str_id + ")");
            pr           = new obj_sync();
            pr.Name      = typeof(SynapseProfile).FullName;
            pr.PrdCnt    = Prd_Profiles.Count;
            pr.AccCnt    = Acc_Profiles.Count;
            IList <Int64> Acc_Profiles_IDs = (from i in Acc_Profiles select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseProfile).Name && Acc_Profiles_IDs.Contains(l.ACCID) select l).Count();
            Presentation.Add(pr);
            string Prd_ProfilesID = string.Join(",", (from p in Prd_Profiles select p.ID.ToString()).ToArray());
            string Acc_ProfilesID = string.Join(",", (from p in Acc_Profiles select p.ID.ToString()).ToArray());

            Prd_Controls = SynapseControl.Load("WHERE FK_MODULE_ID in (" + str_id + ")");
            Acc_Controls = ACCSynapseControl.Load("WHERE FK_MODULE_ID in (" + str_id + ")");
            pr           = new obj_sync();
            pr.Name      = typeof(SynapseControl).FullName;
            pr.PrdCnt    = Prd_Controls.Count;
            pr.AccCnt    = Acc_Controls.Count;
            IList <Int64> Acc_Controls_IDs = (from i in Acc_Controls select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseControl).Name && Acc_Controls_IDs.Contains(l.ACCID) select l).Count();
            Presentation.Add(pr);
            string Prd_ControlsID = string.Join(",", (from c in Prd_Controls select c.ID.ToString()).ToArray());
            string Acc_ControlsID = string.Join(",", (from c in Acc_Controls select c.ID.ToString()).ToArray());

            if (Prd_ControlsID.Length <= 0)
            {
                Prd_ProfileControls = new List <SynapseProfile_Control>();
            }
            else
            {
                Prd_ProfileControls = SynapseProfile_Control.Load("WHERE FK_CONTROLID in (" + Prd_ControlsID + ")");
            }

            try
            {
                Acc_ProfileControls = ACCSynapseProfile_Control.Load("WHERE FK_CONTROLID in (" + Acc_ControlsID + ")");
            }
            catch
            {
                Acc_ProfileControls = new List <ACCSynapseProfile_Control>();
            }
            pr        = new obj_sync();
            pr.Name   = typeof(SynapseProfile_Control).FullName;
            pr.PrdCnt = Prd_ProfileControls.Count;
            pr.AccCnt = Acc_ProfileControls.Count;
            IList <Int64> Acc_ProfileControls_IDs = (from i in Acc_ProfileControls select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseProfile_Control).Name && Acc_ProfileControls_IDs.Contains(l.ACCID)  select l).Count();
            Presentation.Add(pr);

            if (Prd_ProfilesID.Length <= 0)
            {
                Prd_UserProfiles = new List <SynapseUser_Profile>();
            }
            else
            {
                Prd_UserProfiles = SynapseUser_Profile.Load("WHERE FK_SECURITY_PROFILE in (" + Prd_ProfilesID + ")");
            }

            Acc_UserProfiles = ACCSynapseUser_Profile.Load("WHERE FK_SECURITY_PROFILE in (" + Acc_ProfilesID + ")");
            pr        = new obj_sync();
            pr.Name   = typeof(SynapseUser_Profile).FullName;
            pr.PrdCnt = Prd_UserProfiles.Count;
            pr.AccCnt = Acc_UserProfiles.Count;
            IList <Int64> Acc_UserProfiles_IDs = (from i in Acc_UserProfiles select i.ID).ToList();

            pr.Link = (from l in AccToPrdID where l.OBJECTTYPE == typeof(ACCSynapseUser_Profile).Name && Acc_UserProfiles_IDs.Contains(l.ACCID) select l).Count();
            Presentation.Add(pr);

            olv_analyse.SetObjects(Presentation);
        }