Exemplo n.º 1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Menues.Add("Menu");
            PushOutPut("");
            frmConnectionString frm = new frmConnectionString();

            frm.ShowDialog();
            var cstr = frm.ConnectionString;

            if (cstr != "")
            {
                Tables = DB.FetchDBSchema(cstr);
                pr     = new NgProject2();
                NgMenu2 mn = new NgMenu2("Menu");
                pr = SetTreeView1(mn, Tables);
                pr.NetProject.DataBaseConnectionString = cstr;
                SetTreeView();
            }
            Menues = CommonFunctions.ProcessMenues(pr);

            foreach (var s in pr.Menues)
            {
                foreach (var ss in s.Submenues)
                {
                    ss.TabNameList = CommonFunctions.ProcessTabs(ss);
                }
            }
        }
Exemplo n.º 2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            level = e.Node.Level;
            if (level == 0)
            {
                selectedMenuName = e.Node.Text;
                var mn = CommonFunctions.GetMenu(selectedMenuName, pr);
                selectedMenu = mn;
            }
            if (level == 1)
            {
                selectedFormName = e.Node.Text;
                selectedMenuName = e.Node.Parent.Text;
                Menues           = pr.MenuesList;
                var fr = CommonFunctions.GetForm(selectedMenuName, selectedFormName, pr);
                selectedForm = fr;
                fr.refF      = this;

                this.propertyGrid1.SelectedObject = fr;
            }
            if (level == 2)
            {
                selectedFormName  = e.Node.Parent.Text;
                selectedMenuName  = e.Node.Parent.Parent.Text;
                selectedFieldName = e.Node.Text;
                var fl = CommonFunctions.GetField(selectedMenuName, selectedFormName, selectedFieldName, pr);
                selectedField                = fl;
                fl.refF                      = this;
                Tabs                         = selectedForm.TabNameList;
                ComboService                 = pr.ComboServiceList;
                RadioButtonService           = pr.RadioButtonServiceList;
                propertyGrid1.SelectedObject = fl;
            }
        }
        public static NgMenu2 GetMenu(string strMenu, NgProject2 pr)
        {
            NgMenu2 res = new NgMenu2("");

            foreach (var mn in pr.Menues)
            {
                if (mn.Name == strMenu)
                {
                    res = mn;
                    return(res);
                }
            }
            return(res);
        }
Exemplo n.º 4
0
        private NgProject2 SetTreeView1(NgMenu2 mn, List <NgTable> tables)
        {
            mn.Index = 1;
            NgProject2 pr1 = new NgProject2();

            foreach (var t in tables)
            {
                var s = CommonFunctions.AttachSubMenu(t);
                mn.Submenues.Add(s);
            }
            pr1.Menues.Add(mn);

            return(pr1);
        }
        public static NgProject2 ToNgProgect2(NgProject ng1)
        {
            NgProject2 ng = new NgProject2();

            if (ng1.Name == null || ng1.Name.Trim().Length == 0)
            {
                ng.Name = "Tables";
            }
            else
            {
                ng.Name = ng1.Name;
            }
            ng.Name = ng1.Name;
            ng.Path = ng1.Path;
            ng.MenuesList.Clear();
            ng.NetProject.DataBaseConnectionString = ng1.NetProject.DataBaseConnectionString;


            foreach (var ss in ng1.RadiosList)
            {
                NgRadio ch = new NgRadio();
                ch.Name = ss.Name;
                foreach (var op in ss.Options)
                {
                    NGOPT op1 = new NGOPT();
                    op1.Key   = op.Key;
                    op1.Value = op.Value;
                    ch.Options.Add(op1);
                }
                ng.RadiosList.Add(ch);
            }

            foreach (var ss in ng1.CombosList)
            {
                NGCombo cb = new NGCombo();
                cb.ServiceName = ss.ServiceName;
                cb.IsFixed     = ss.IsFixed;
                cb.Name        = ss.Name;
                cb.Key         = ss.Key;
                cb.Value       = ss.Value;
                foreach (var op in ss.Options)
                {
                    NGOPT op1 = new NGOPT();
                    op1.Key   = op.Key;
                    op1.Value = op.Value;
                    cb.Options.Add(op1);
                }
                ng.CombosList.Add(cb);
            }

            foreach (string ss in ng1.MenuesList)
            {
                ng.MenuesList.Add(ss);
            }
            foreach (var mn1 in ng1.Menues)
            {
                NgMenu2 mn = new NgMenu2();
                mn.Index = mn1.Index;
                mn.Name  = mn1.Name;
                foreach (var s1 in mn1.Submenues)
                {
                    NgSubMenu2 s = new NgSubMenu2();
                    foreach (var ts in s1.TabNameList)
                    {
                        s.TabNameList.Add(ts);
                    }
                    s.NetClassName       = s1.NetClassName;
                    s.CreateThisForm     = s1.CreateThisForm;
                    s.AllowAddNewFeature = s1.AllowAddNewFeature;
                    s.AllowEditFeature   = s1.AllowEditFeature;
                    s.AllowMultiDelete   = s1.AllowMultiDelete;
                    s.AllowDelete        = s1.AllowDelete;
                    s.DeleteFormMessage  = s1.DeleteFormMessage;
                    s.DeleteFormTitle    = s1.DeleteFormTitle;
                    s.DisplayName        = s1.DisplayName;
                    s.Index    = s1.Index;
                    s.IsTabbed = s1.IsTabbed;
                    s.Menues   = s1.Menues;

                    s.Name = s1.Name;
                    s.NumberOfRowsInPaging = s1.NumberOfRowsInPaging;
                    s.Tabs = ProcessTabs(s1);
                    NgFileProp2 m1 = new NgFileProp2();
                    m1.Name = s1.Model.Name;

                    foreach (var f1 in s1.Model.Fields)
                    {
                        NgField2 f = new NgField2();
                        f.IsIdentity           = f1.IsIdentity;
                        f.DisplayName          = f1.DisplayName;
                        f.ErrorMessage         = f1.ErrorMessage;
                        f.IncludeInSearch      = f1.IncludeInSearch;
                        f.SearchCondition      = f1.SearchCondition;
                        f.Index                = f1.Index;
                        f.IsValidationRequired = f1.IsValidationRequired;
                        f.OriginalName         = f1.OriginalName;
                        f.TabName              = f1.TabName;
                        f.TabsRequired         = f1.TabsRequired;
                        f.ToDisplayInControls  = f1.ToDisplayInControls;
                        f.ToDisplayInGrid      = f1.ToDisplayInGrid;
                        f.Type           = f1.Type;
                        f.Length         = f1.Length;
                        f.NetType        = f1.NetType;
                        f.ComboBoxSource = f1.ComboBoxSource;
                        f.RadioBoxSource = f1.RadioBoxSource;
                        f.ControlType    = f1.ControlType;
                        f.IsPrimaryKey   = f1.IsPrimaryKey;
                        m1.Fields.Add(f);
                    }
                    s.Model = m1;

                    mn.Submenues.Add(s);
                }
                ng.Menues.Add(mn);
            }
            return(ng);
        }
Exemplo n.º 6
0
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            var pr3    = new NgProject2();
            var constr = CommonFunctions.GetFromReg(Constants.CONNECTIONSTRING);

            if (constr != "")
            {
                var     NewTables = DB.FetchDBSchema(constr);
                var     pr2       = new NgProject2();
                NgMenu2 mn        = new NgMenu2("Tables");
                mn.Name        = "Tables";
                pr2            = SetTreeView1(mn, NewTables);
                pr3.RadiosList = pr.RadiosList;
                pr3.CombosList = pr.CombosList;
                pr3.NetProject.DataBaseConnectionString = pr.NetProject.DataBaseConnectionString;

                foreach (var xx in pr2.Menues)
                {
                    var mn1 = new NgMenu2();
                    mn1.Name  = Constants.MENUNAME;
                    mn1.Index = xx.Index;

                    foreach (var yy in xx.Submenues)
                    {
                        var sub1 = new NgSubMenu2();
                        var sub  = CommonFunctions.GetSubMenu(pr, yy.Name);
                        if (sub != null)
                        {
                            CommonFunctions.CopySubMenu(sub, sub1);
                            var cf = 0;
                            foreach (var zz in yy.Model.Fields)
                            {
                                cf++;
                                var zz1 = CommonFunctions.GetField(sub, zz.OriginalName);
                                if (zz1 != null)
                                {
                                    zz1.Length = zz.Length;
                                    sub1.Model.Fields.Add(zz1);
                                }
                                else
                                {
                                    sub1.Model.Fields.Add(zz);
                                }
                            }
                            mn1.Submenues.Add(sub1);
                        }
                        else
                        {
                            CommonFunctions.CopySubMenu(yy, sub1);
                            foreach (var zz in yy.Model.Fields)
                            {
                                var zz1 = new NgField2();
                                CommonFunctions.CopyField(zz, zz1);
                                zz1.Length = zz.Length;
                                sub1.Model.Fields.Add(zz1);
                            }
                            mn1.Submenues.Add(sub1);
                        }
                    }
                    pr3.Menues.Add(mn1);
                }
            }

            pr = pr3;
            SetTreeView();
            MessageBox.Show("Done");
        }