Ejemplo n.º 1
0
        //void ToolStripButton1Click(object sender, EventArgs e)
        //{
        //    foreach (SynapseProfile_Control spc in objectListView1.Objects)
        //    {
        //        spc.save();
        //    }
        //    ComboBox1SelectedIndexChanged(this,e);
        //}

        void ComboBox3SelectedIndexChanged(object sender, EventArgs e)
        {
            cb_Form.Text = "";
            cb_Form.Items.Clear();
            foreach (SynapseControl C in AllControls)
            {
                if (!cb_Form.Items.Contains(C.FORM_NAME) && C.FK_MODULE_ID == ((SynapseModule)cb_Module.SelectedItem).ID)
                {
                    cb_Form.Items.Add(C.FORM_NAME);
                }
            }
            if (cb_Form.Items.Count > 0)
            {
                cb_Form.SelectedIndex = 0;
            }

            var ControlCollection = SynapseControl.Load("WHERE FORM_NAME='" + cb_Form.SelectedItem + "' AND FK_MODULE_ID=" + ((SynapseModule)cb_Module.SelectedItem).ID + " Order by CTRL_NAME");

            lst_ListOfControl.DataSource = ControlCollection.OrderBy(x => x.CTRL_NAME).ToList();

            var Groups = SynapseProfile.Load("WHERE FK_MODULEID=" + ((SynapseModule)cb_Module.SelectedItem).ID);

            cb_Profiles.DataSource    = Groups.OrderBy(x => x.TECHNICALNAME).ToList();
            cb_Profiles.DisplayMember = "TECHNICALNAME";
            cb_Profiles.ValueMember   = "ID";
            cb_Profiles.SelectedIndex = 0;
        }
Ejemplo n.º 2
0
 public static void CreateControlInDB(Int64 Module, string formName, string controlName, string controlType)
 {
     if (controlName != null && controlName.Length > 0)
     {
         SynapseControl SControl = new SynapseControl();
         SControl.CTRL_NAME    = controlName;
         SControl.FORM_NAME    = formName;
         SControl.CTRL_TYPE    = controlType;
         SControl.FK_MODULE_ID = Module;
         SynapseForm.SynapseLogger.Debug("Creating new control in DB : " + formName + "-" + controlName + "-" + controlType);
         SControl.save();
     }
 }
Ejemplo n.º 3
0
        private void Delete_Module(object sender, EventArgs e)
        {
            if (MessageBox.Show(GetLabel("Quest.0003"), GetLabel("Quest"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
            {
                SynapseModule _module = (SynapseModule)olvModules.SelectedObject;
                IList <SynapseProfile_Control> _profileControl = SynapseProfile_Control.LoadFromQuery("SELECT dbo.[Synapse_Security_Profile Control].* FROM dbo.[Synapse_Security_Profile Control] INNER JOIN dbo.Synapse_Security_Profile ON dbo.[Synapse_Security_Profile Control].FK_PROFILEID = dbo.Synapse_Security_Profile.ID INNER JOIN dbo.Synapse_Module ON dbo.Synapse_Security_Profile.FK_MODULEID = dbo.Synapse_Module.ID WHERE (dbo.Synapse_Module.ID = " + _module.ID + ")");
                IList <SynapseUser_Profile>    _userProfile    = SynapseUser_Profile.LoadFromQuery("SELECT dbo.[Synapse_Security_User Profile].* FROM dbo.[Synapse_Security_User Profile] INNER JOIN dbo.Synapse_Security_Profile ON dbo.[Synapse_Security_User Profile].FK_SECURITY_PROFILE = dbo.Synapse_Security_Profile.ID INNER JOIN dbo.Synapse_Module ON dbo.Synapse_Security_Profile.FK_MODULEID = dbo.Synapse_Module.ID WHERE (dbo.Synapse_Module.ID = " + _module.ID + ")");
                IList <SynapseProfile>         _profile        = SynapseProfile.LoadFromQuery("SELECT dbo.Synapse_Security_Profile.* FROM dbo.Synapse_Security_Profile INNER JOIN dbo.Synapse_Module ON dbo.Synapse_Security_Profile.FK_MODULEID = dbo.Synapse_Module.ID WHERE (dbo.Synapse_Module.ID = " + _module.ID + ")");
                IList <SynapseControl>         _control        = SynapseControl.Load("WHERE FK_MODULE_ID=" + _module.ID);

                SynapseCore.Database.DBFunction.StartTransaction();
                try
                {
                    foreach (SynapseProfile_Control obj in _profileControl)
                    {
                        obj.delete();
                    }
                    foreach (SynapseUser_Profile obj in _userProfile)
                    {
                        obj.delete();
                    }
                    foreach (SynapseProfile obj in _profile)
                    {
                        obj.delete();
                    }
                    foreach (SynapseControl obj in _control)
                    {
                        obj.delete();
                    }
                    foreach (SynapseLabel obj in ((SynapseModule)olvModules.SelectedObject).FriendlyName.Labels)
                    {
                        obj.delete();
                    }
                    foreach (SynapseLabel obj in ((SynapseModule)olvModules.SelectedObject).Description.Labels)
                    {
                        obj.delete();
                    }

                    _module.delete();

                    SynapseCore.Database.DBFunction.CommitTransaction();

                    listModule();
                }
                catch (Exception ex)
                {
                    SynapseCore.Database.DBFunction.RollbackTransaction();
                    MessageBox.Show("Data not deleted from Database:" + ex.Message, "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 4
0
        private void refreshControls()
        {
            var ControlCollection = SynapseControl.Load("WHERE FORM_NAME='" + cb_Form.SelectedItem + "' AND FK_MODULE_ID=" + ((SynapseModule)cb_Module.SelectedItem).ID + " Order by CTRL_NAME");

            if (ckNotAttributed.Checked)
            {
                foreach (SynapseProfile_Control c in objectListView1.Objects)
                {
                    // ControlCollection.Remove(SynapseControl.LoadByID(c.FK_CONTROLID));
                    ControlCollection.Remove(ControlCollection.Where(x => x.ID == c.FK_CONTROLID).FirstOrDefault());
                }
            }

            lst_ListOfControl.DataSource = ControlCollection.OrderBy(x => x.CTRL_NAME).ToList();
        }
Ejemplo n.º 5
0
        private void deleteControl(SynapseControl c)
        {
            if (MessageBox.Show(GetLabel("Quest.0004"), GetLabel("Quest"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                foreach (SynapseControl cs in lst_ListOfControl.SelectedItems)
                {
                    cs.delete();
                }
                refreshControls();

                if (lst_ListOfControl.Items.Count == 0)
                {
                    ComboBox3SelectedIndexChanged(this, null);
                }
            }
        }
Ejemplo n.º 6
0
        private void addControltoProfile(SynapseControl c)
        {
            SynapseProfile_Control spc = new SynapseProfile_Control();

            spc.FK_CONTROLID = c.ID;
            spc.FK_PROFILEID = (Int64)cb_Profiles.SelectedValue;
            spc.IS_ACTIVE    = false;
            spc.IS_VISIBLE   = false;

            objectListView1.AddObject(spc);

            spc.save();

            if (ckNotAttributed.Checked)
            {
                refreshControls();
            }
        }
Ejemplo n.º 7
0
        void SecurityEditLoad(object sender, EventArgs e)
        {
            tsbAddControl.Enabled    = false;
            tsbDeleteControl.Enabled = false;
            tsbRemoveControl.Enabled = false;

            AllControls = SynapseControl.Load();

            var Modules = SynapseModule.Load();

            cb_Module.DataSource    = Modules.OrderBy(x => x.FriendlyName.ToString()).ToList();
            cb_Module.ValueMember   = "ID";
            cb_Module.DisplayMember = "FriendlyName";
            cb_Module.SelectedIndex = 0;

            lst_ListOfControl.DisplayMember = "CTRL_NAME";
            lst_ListOfControl.ValueMember   = "ID";
        }
Ejemplo n.º 8
0
        private void btn_Sync_Click(object sender, EventArgs e)
        {
            AccToPrdID = ACCTOPRD.Load("WHERE PRDID<>0");
            Int64 UsersCount           = 0;
            Int64 ControlsCount        = 0;
            Int64 ProfilesCount        = 0;
            Int64 ProfileControlsCount = 0;
            Int64 UserAssignmentCount  = 0;

            richTextBox1.Clear();
            if (chk_SyncUser.Checked)
            {
                // ======= Create user in prod ========
                foreach (ACCSynapseUser A_user in from au in Acc_Users where au.PrdID(AccToPrdID) == 0 select au)
                {
                    if (chk_verbose.Checked)
                    {
                        richTextBox1.AppendText(A_user.GetType().Name + ": " + A_user.UserID + "\n");
                    }
                    SynapseUser user = new SynapseUser();
                    CopyProperties(user, A_user);
                    user.ID = 0;
                    if (chk_save.Checked)
                    {
                        user.save();
                    }
                    UsersCount++;
                    CreateLinkEntry(A_user, A_user.ID, user.ID);
                }
            }
            // ======= Create controls in prod ========
            foreach (ACCSynapseControl A_ctrl in from ac in Acc_Controls where ac.PrdID(AccToPrdID) == 0 select ac)
            {
                if (chk_verbose.Checked)
                {
                    richTextBox1.AppendText(A_ctrl.GetType().Name + ": " + A_ctrl.CTRL_NAME + "\n");
                }
                SynapseControl ctrl = new SynapseControl();
                CopyProperties(ctrl, A_ctrl);
                ctrl.ID = 0;
                if (chk_save.Checked)
                {
                    ctrl.save();
                }
                ControlsCount++;
                CreateLinkEntry(A_ctrl, A_ctrl.ID, ctrl.ID);
            }
            // ======= Create profiles in prod ========
            foreach (ACCSynapseProfile A_prof in from ap in Acc_Profiles where ap.PrdID(AccToPrdID) == 0 select ap)
            {
                if (chk_verbose.Checked)
                {
                    richTextBox1.AppendText(A_prof.GetType().Name + ": " + A_prof.TECHNICALNAME + "\n");
                }
                SynapseProfile prof = new SynapseProfile();
                CopyProperties(prof, A_prof);
                prof.ID = 0;
                if (chk_save.Checked)
                {
                    prof.save();
                }
                ProfilesCount++;
                CreateLinkEntry(A_prof, A_prof.ID, prof.ID);
            }
            // ======= Create link control-profile in prod ========
            foreach (ACCSynapseProfile_Control A_profControl in from apc in Acc_ProfileControls where apc.PrdID(AccToPrdID) == 0 select apc)
            {
                if (chk_verbose.Checked)
                {
                    richTextBox1.AppendText(A_profControl.GetType().Name + ": " + A_profControl.FK_PROFILEID + "=>" + A_profControl.FK_CONTROLID + "\n");
                }
                SynapseProfile_Control ProfControl = new SynapseProfile_Control();
                ProfControl.IS_ACTIVE  = A_profControl.IS_ACTIVE;
                ProfControl.IS_VISIBLE = A_profControl.IS_VISIBLE;
                try
                {
                    ProfControl.FK_CONTROLID = AccToPrdID.ConvertID(typeof(ACCSynapseControl), A_profControl.FK_CONTROLID);
                    ProfControl.FK_PROFILEID = AccToPrdID.ConvertID(typeof(ACCSynapseProfile), A_profControl.FK_PROFILEID);
                    if (chk_save.Checked)
                    {
                        ProfControl.save();
                    }
                    ProfileControlsCount++;
                    CreateLinkEntry(A_profControl, A_profControl.ID, ProfControl.ID);
                }
                catch (MissingFieldException ex)
                {
                    richTextBox1.AppendText("ERROR(" + ex.Message + "): " + A_profControl.GetType().Name + ": " + A_profControl.FK_PROFILEID + "=>" + A_profControl.FK_CONTROLID + "\n", Color.Red);
                    richTextBox1.ScrollToCaret();
                }
                catch (KeyNotFoundException ex)
                {
                    richTextBox1.AppendText("WARNING(" + ex.Message + "): " + A_profControl.GetType().Name + ": " + A_profControl.FK_PROFILEID + "=>" + A_profControl.FK_CONTROLID + "\n", Color.Orange);
                    richTextBox1.ScrollToCaret();
                }
            }
            if (chk_UserAssignment.Checked)
            {
                // ======= Create link user-profile in prod ========
                foreach (ACCSynapseUser_Profile A_userP in from aup in Acc_UserProfiles where aup.PrdID(AccToPrdID) == 0 select aup)
                {
                    if (chk_verbose.Checked)
                    {
                        richTextBox1.AppendText(A_userP.GetType().Name + ": " + A_userP.FK_SECURITY_PROFILE + "=>" + A_userP.FK_SECURITY_USER + "\n");
                    }
                    SynapseUser_Profile UserProf = new SynapseUser_Profile();
                    try
                    {
                        UserProf.FK_SECURITY_PROFILE = AccToPrdID.ConvertID(typeof(ACCSynapseProfile), A_userP.FK_SECURITY_PROFILE);
                        UserProf.FK_SECURITY_USER    = AccToPrdID.ConvertID(typeof(ACCSynapseUser), A_userP.FK_SECURITY_USER);
                        if (chk_save.Checked)
                        {
                            UserProf.save();
                        }
                        UserAssignmentCount++;
                        CreateLinkEntry(A_userP, A_userP.ID, UserProf.ID);
                    }
                    catch (MissingFieldException ex)
                    {
                        richTextBox1.AppendText("ERROR(" + ex.Message + "): " + A_userP.GetType().Name + ": " + A_userP.FK_SECURITY_PROFILE + "=>" + A_userP.FK_SECURITY_USER + "\n", Color.Red);
                        richTextBox1.ScrollToCaret();
                    }
                    catch (KeyNotFoundException ex)
                    {
                        richTextBox1.AppendText("WARNING(" + ex.Message + "): " + A_userP.GetType().Name + ": " + A_userP.FK_SECURITY_PROFILE + "=>" + A_userP.FK_SECURITY_USER + "\n", Color.Orange);
                        richTextBox1.ScrollToCaret();
                    }
                }
            }
            if (chk_save.Checked)
            {
                foreach (ACCTOPRD atp in from l in AccToPrdID where l.ID == 0 select l)
                {
                    atp.save();
                }
            }
            Int64 lnk = 0;

            richTextBox1.AppendText(UsersCount + " Users will be added", Color.Blue);
            lnk = AccToPrdID.Where(l => l.ID == 0 && l.OBJECTTYPE == typeof(ACCSynapseUser).Name).Count();
            richTextBox1.AppendText(" with " + lnk + " new links\n", UsersCount == lnk ? Color.Blue : Color.Red);

            richTextBox1.AppendText(ControlsCount + " Controls will be added", Color.Blue);
            lnk = AccToPrdID.Where(l => l.ID == 0 && l.OBJECTTYPE == typeof(ACCSynapseControl).Name).Count();
            richTextBox1.AppendText(" with " + lnk + " new links\n", ControlsCount == lnk ? Color.Blue : Color.Red);

            richTextBox1.AppendText(ProfilesCount + " Profiles will be added", Color.Blue);
            lnk = AccToPrdID.Where(l => l.ID == 0 && l.OBJECTTYPE == typeof(ACCSynapseProfile).Name).Count();
            richTextBox1.AppendText(" with " + lnk + " new links\n", ProfilesCount == lnk ? Color.Blue : Color.Red);

            richTextBox1.AppendText(ProfileControlsCount + " Profile-Control link will be added", Color.Blue);
            lnk = AccToPrdID.Where(l => l.ID == 0 && l.OBJECTTYPE == typeof(ACCSynapseProfile_Control).Name).Count();
            richTextBox1.AppendText(" with " + lnk + " new links\n", ProfileControlsCount == lnk ? Color.Blue : Color.Red);

            richTextBox1.AppendText(UserAssignmentCount + " Users assignments will be added", Color.Blue);
            lnk = AccToPrdID.Where(l => l.ID == 0 && l.OBJECTTYPE == typeof(ACCSynapseUser_Profile).Name).Count();
            richTextBox1.AppendText(" with " + lnk + " new links\n", UserAssignmentCount == lnk ? Color.Blue : Color.Red);

            richTextBox1.ScrollToCaret();
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        public static StringBuilder UpdateControlsInDB(System.Windows.Forms.Control.ControlCollection controlCollection, Int64 ModuleID, Hashtable Keys)
        {
            StringBuilder SB = new StringBuilder();

            if (Keys == null)
            {
                if (controlCollection.Count > 0)
                {
                    SB.AppendLine(controlCollection[0].FindForm().Name + "=" + controlCollection[0].FindForm().Text);
                }
                Keys = new Hashtable();
                var SControlCollection = SynapseControl.Load("WHERE FK_MODULE_ID = " + ModuleID.ToString());
                foreach (SynapseControl SC in SControlCollection)
                {
                    try
                    {
                        Keys.Add(SC.FORM_NAME + SC.CTRL_NAME + SC.CTRL_TYPE, SC);
                    }
                    // TODO: Catch more specific exception
                    catch (Exception ex)
                    {
                        SynapseForm.SynapseLogger.Error(ex.Message);
                    }
                }
            }
            foreach (Control C in controlCollection)
            {
                string formName    = C.FindForm().Name;
                string controlType = C.GetType().ToString();

                if (!Keys.ContainsKey(formName + C.Name + controlType))
                {
                    CreateControlInDB(ModuleID, formName, C.Name, controlType);
                }
                switch (controlType)
                {
                case "System.Windows.Forms.Label":
                    SB.AppendLine(C.FindForm().Name + "." + C.Name + "=" + C.Text);
                    break;

                case "System.Windows.Forms.Button":
                    SB.AppendLine(C.FindForm().Name + "." + C.Name + "=" + C.Text);
                    break;

                case "System.Windows.Forms.MenuStrip":
                    MenuStrip Menu = (MenuStrip)C;
                    SB.AppendLine(ListMenuStrip(Menu.Items, C.FindForm().Name, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.TextBox":
                    break;

                case "System.Windows.Forms.FlowLayoutPanel":
                    FlowLayoutPanel FP = (FlowLayoutPanel)C;
                    SB.AppendLine(UpdateControlsInDB(FP.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.GroupBox":
                    SB.AppendLine(C.FindForm().Name + "." + C.Name + "=" + C.Text);
                    GroupBox group = (GroupBox)C;
                    SB.AppendLine(UpdateControlsInDB(group.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.CheckedListBox":
                    break;

                case "System.Windows.Forms.CheckBox":
                    SB.AppendLine(C.FindForm().Name + "." + C.Name + "=" + C.Text);
                    break;

                case "System.Windows.Forms.ToolStrip":
                    ToolStrip Tool = (ToolStrip)C;
                    SB.AppendLine(ListMenuStrip(Tool.Items, C.FindForm().Name, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.StatusStrip":
                    StatusStrip Status = (StatusStrip)C;
                    SB.AppendLine(ListMenuStrip(Status.Items, C.FindForm().Name, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.ToolStripPanel":
                    ContainerControl mycontainer = (ContainerControl)C;
                    SB.AppendLine(UpdateControlsInDB(mycontainer.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.TabPage":
                    SB.AppendLine(C.FindForm().Name + "." + C.Name + "=" + C.Text);
                    Panel mytabpage = (Panel)C;
                    SB.AppendLine(UpdateControlsInDB(mytabpage.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.Panel":
                case "System.Windows.Forms.SplitterPanel":
                case "System.Windows.Forms.ToolStripContentPanel":
                    Panel myPanel = (Panel)C;
                    SB.AppendLine(UpdateControlsInDB(myPanel.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.ToolStripContainer":
                    System.Windows.Forms.ToolStripContainer tscontainer = (System.Windows.Forms.ToolStripContainer)C;
                    SB.AppendLine(UpdateControlsInDB(tscontainer.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.SplitContainer":
                    System.Windows.Forms.SplitContainer mysplit = (System.Windows.Forms.SplitContainer)C;
                    SB.AppendLine(UpdateControlsInDB(mysplit.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.TabControl":
                    TabControl tabControl = (TabControl)C;
                    SB.AppendLine(UpdateControlsInDB(tabControl.Controls, ModuleID, Keys).ToString());
                    break;

                case "System.Windows.Forms.ListView":
                    ListView liste = (ListView)C;
                    foreach (ColumnHeader Col in liste.Columns)
                    {
                        if (Col.Name != null && Col.Name != "")
                        {
                            SB.AppendLine(C.FindForm().Name + "." + C.Name + "." + Col.Name + "=" + Col.Text);
                            if (!Keys.ContainsKey(formName + C.Name + "." + Col.Name + Col.GetType().ToString()))
                            {
                                CreateControlInDB(ModuleID, formName, C.Name + "." + Col.Name, Col.GetType().ToString());
                            }
                        }
                        else
                        {
                            SynapseForm.SynapseLogger.Warn("Column with text '" + Col.Text + "' has no name or the default one");
                        }
                    }
                    break;

                case "SynapseAdvancedControls.ObjectListView":
                    ObjectListView oliste = (ObjectListView)C;
                    SB.AppendLine("ObjectListView.MenuLabelColumns=" + oliste.MenuLabelColumns);
                    SB.AppendLine("ObjectListView.MenuLabelGroupBy=" + oliste.MenuLabelGroupBy);
                    SB.AppendLine("ObjectListView.MenuLabelLockGroupingOn=" + oliste.MenuLabelLockGroupingOn);
                    SB.AppendLine("ObjectListView.MenuLabelSelectColumns=" + oliste.MenuLabelSelectColumns);
                    SB.AppendLine("ObjectListView.MenuLabelSortAscending=" + oliste.MenuLabelSortAscending);
                    SB.AppendLine("ObjectListView.MenuLabelSortDescending=" + oliste.MenuLabelSortDescending);
                    SB.AppendLine("ObjectListView.MenuLabelTurnOffGroups=" + oliste.MenuLabelTurnOffGroups);
                    SB.AppendLine("ObjectListView.MenuLabelUnlockGroupingOn=" + oliste.MenuLabelUnlockGroupingOn);
                    SB.AppendLine("ObjectListView.MenuLabelUnsort=" + oliste.MenuLabelUnsort);

                    foreach (OLVColumn Col in oliste.AllColumns)
                    {
                        if (Col.Text != null && Col.Text != "")
                        {
                            SB.AppendLine(C.FindForm().Name + "." + C.Name + "." + Col.Text.Replace(' ', '_').ToUpper() + "=" + Col.Text);
                            if (!Keys.ContainsKey(formName + C.Name + "." + Col.Text.Replace(' ', '_').ToUpper() + Col.GetType().ToString()))
                            {
                                CreateControlInDB(ModuleID, formName, C.Name + "." + Col.Text.Replace(' ', '_').ToUpper(), Col.GetType().ToString());
                            }
                        }
                        else
                        {
                            SynapseForm.SynapseLogger.Warn("Column with text '" + Col.Text + "' has no name or the default one");
                        }
                    }
                    break;

                case "SynapseCore.Controls.SynapseGraphic":
                    SynapseGraphic graph = (SynapseGraphic)C;
                    SB.AppendLine("SynapseGraphic.CopyMenu=" + graph.CopyMenu);
                    SB.AppendLine("SynapseGraphic.CurveOnlyMenu=" + graph.CurveOnlyMenu);
                    SB.AppendLine("SynapseGraphic.CurvesMenu=" + graph.CurvesMenu);
                    SB.AppendLine("SynapseGraphic.PageSetupMenu=" + graph.PageSetupMenu);
                    SB.AppendLine("SynapseGraphic.PrintMenu=" + graph.PrintMenu);
                    SB.AppendLine("SynapseGraphic.SaveAsMenu=" + graph.SaveAsMenu);
                    SB.AppendLine("SynapseGraphic.SetDefaultScaleMenu=" + graph.SetDefaultScaleMenu);
                    SB.AppendLine("SynapseGraphic.ShowAllCurvesMenu=" + graph.ShowAllCurvesMenu);
                    SB.AppendLine("SynapseGraphic.ShowHideCurveMenu=" + graph.ShowHideCurveMenu);
                    SB.AppendLine("SynapseGraphic.ShowHideLegendMenu=" + graph.ShowHideLegendMenu);
                    SB.AppendLine("SynapseGraphic.ShowPointValuesMenu=" + graph.ShowPointValuesMenu);
                    SB.AppendLine("SynapseGraphic.UndoAllZoomMenu=" + graph.UndoAllZoomMenu);
                    SB.AppendLine("SynapseGraphic.UnZoomMenu=" + graph.UnZoomMenu);

                    break;

                default:
                    if (C is UserControl)
                    {
                    }
                    break;
                }
                if (C.ContextMenuStrip != null)
                {
                    SynapseForm.SynapseLogger.Debug("Context menu found for control '" + C.Name + "' with menu name : '" + C.ContextMenuStrip.Name + "'");
                    controlType = C.ContextMenuStrip.GetType().ToString();
                    if (!Keys.ContainsKey(formName + C.ContextMenuStrip.Name + controlType))
                    {
                        CreateControlInDB(ModuleID, formName, C.ContextMenuStrip.Name, controlType);
                        Keys.Add(formName + C.ContextMenuStrip.Name + controlType, null);
                    }

                    SB.AppendLine(ListMenuStrip(C.ContextMenuStrip.Items, C.FindForm().Name, ModuleID, Keys).ToString());
                }
            }
            return(SB);
        }
Ejemplo n.º 11
0
        void ObjectListView1DragDrop(object sender, DragEventArgs e)
        {
            SynapseControl c = (SynapseControl)e.Data.GetData(typeof(SynapseControl));

            addControltoProfile(c);
        }