コード例 #1
0
        public void SimpleViewTest()
        {
            _rootPanel.Children.Add(new ModalViewModel(_rootPanel)
            {
                Type = "int", FieldInDb = "field1", RuDescription = "Комент", ControlIdView = "lb1"
            });
            PanelViewModel panelViewModel = new PanelViewModel(_rootPanel)
            {
                RuDescription = "Комент", FieldInDb = "Id1"
            };

            _rootPanel.Children.Add(panelViewModel);
            panelViewModel.Children.Add(new ModalViewModel(_rootPanel)
            {
                Type = "varchar", FieldInDb = "field2", RuDescription = "Комент", ControlIdView = "lb2"
            });
            _helper.Visability = 1;
            string result = "DECLARE @id int;\n";

            //field1
            result += "--field1\n";
            result +=
                "INSERT INTO [ut_MenuField] (idpage,fld, idparent, fldbd, tabbd, isNotEdited, nam) VALUES (100, 'lb1', null, 'field1', null, 0, 'ru-RU:Комент;en-EN:Some text;');\n";
            result += "set @id  = scope_identity();\n";
            result += "insert into [ut_RoleField] (idrole, idfld,visability)\nvalues\n";
            result += "(3,@id,1)\n";
            //clId1
            result += "--Id1\n";
            result +=
                "INSERT INTO [ut_MenuField] (idpage,fld, idparent, fldbd, tabbd, isNotEdited, nam) VALUES (100, 'cpId1', null, 'Id1', null, 0, 'ru-RU:Комент;en-EN:Some text;');\n";
            result += "set @id  = scope_identity();\n";
            result += "insert into [ut_RoleField] (idrole, idfld,visability)\nvalues\n";
            result += "(3,@id,1)\n";
            //field2
            result += "--field2\n";
            result +=
                "INSERT INTO [ut_MenuField] (idpage,fld, idparent, fldbd, tabbd, isNotEdited, nam) VALUES (100, 'lb2', null, 'field2', null, 0, 'ru-RU:Комент;en-EN:Some text;');\n";
            result += "set @id  = scope_identity();\n";
            result += "insert into [ut_RoleField] (idrole, idfld,visability)\nvalues\n";
            result += "(3,@id,1)\n";
            _helper.Constructor(_rootPanel.Children, false, 100, 3);
            Assert.AreEqual(result, _helper.ToString());
        }
コード例 #2
0
        /// <summary>
        /// Получить скрипт для редактирования
        /// </summary>
        public void GetPageScript(string param)
        {
            bool           isEdit = param == "e";
            ModalView      window = new ModalView();
            RolesViewModel model  = new RolesViewModel {
                Roles = _dal.GetGlobalRoles()
            };

            window.DataContext = model;
            if (window.ShowDialog() == true)
            {
                ScriptConstructorHelper helper = new ScriptConstructorHelper {
                    Visability = 3
                };
                helper.Constructor(_constructorViewModel.Properties, isEdit, CurrentMenuPageView.Id, model.SelectRoles.Select(i => i.Id));
                Clipboard.SetText(helper.ToString());
                _aggregator.PublishOnUIThread("[Инфо]:Скопированно в буфер");
            }
        }