コード例 #1
0
        internal bool UpgradeArchitectureToRemote(out Exception ex)
        {
            ex = null;
            int errCount = 0;

            try
            {
                Architecture           a     = this.CurrentArchitecture;
                List <KellRole.Action> atcs  = a.Acts;
                List <Department>      deps  = a.Deps;
                List <Module>          mods  = a.Mods;
                List <Permission>      perms = a.Pers;
                List <Role>            roles = a.Roles;
                List <UserGroup>       ugrps = a.Ugroups;
                List <User>            users = a.Users;
                ActionLogic.GetInstance().UpgradeList(atcs);
                DepartmentLogic.GetInstance().UpgradeList(deps);
                ModuleLogic.GetInstance().UpgradeList(mods);
                PermissionLogic.GetInstance().UpgradeList(perms);
                RoleLogic.GetInstance().UpgradeList(roles);
                UserGroupLogic.GetInstance().UpgradeList(ugrps);
                UserLogic.GetInstance().UpgradeList(users);
            }
            catch (Exception e)
            {
                errCount++;
                ex = e;
            }
            return(errCount == 0);
        }
コード例 #2
0
 public TimetableController()
 {
     _logic        = new TimetableLogic();
     _logicCourse  = new CourseLogic();
     _logicModule  = new ModuleLogic();
     _logicTeacher = new TeacherLogic();
     _repo         = new AttendanceRepository();
 }
コード例 #3
0
        private static Architecture GetRemoteArchitecture()
        {
            Architecture a = Architecture.Empty;

            a.Deps    = DepartmentLogic.GetInstance().GetAllDepartments();
            a.Ugroups = UserGroupLogic.GetInstance().GetAllUserGroups();
            a.Users   = UserLogic.GetInstance().GetAllUsers();
            a.Mods    = ModuleLogic.GetInstance().GetAllModules();
            a.Acts    = ActionLogic.GetInstance().GetAllActions();
            a.Pers    = PermissionLogic.GetInstance().GetAllPermissions();
            a.Roles   = RoleLogic.GetInstance().GetAllRoles();
            return(a);
        }
コード例 #4
0
        /// <summary>
        /// Crea el arbol de seleccion para un rol
        /// </summary>
        /// <param name="profileModules">Lista de IDs Modulos</param>
        /// <returns>Json Object</returns>
        public static string MakeTree(List <Module> rolModules)
        {
            List <long> moduleIDs = GetModuleIDs(rolModules);

            var menuModules = new ModuleLogic().GetAllActivos();

            List <TreeNode> tree = new List <TreeNode>();

            foreach (var menuModule in menuModules.Where(x => x.Parent == null))
            {
                bool hasChildren = false;

                if (menuModule.Children != null && menuModule.Children.Count > 0)
                {
                    hasChildren = true;
                }

                bool check = false;

                if (moduleIDs.Contains(menuModule.EntityID))
                {
                    check = true;
                }

                string label = menuModule.Name;

                if (menuModule.Type == ModulesType.ACTION)
                {
                    label = string.Format("{0}{1}", label, "<i></i>");
                }

                TreeNode fatherNode = new TreeNode(menuModule.EntityID, label, true, hasChildren, true, false, check);

                if (hasChildren)
                {
                    LoadChildrens(menuModule, ref fatherNode, moduleIDs);
                }

                tree.Add(fatherNode);
            }

            var jsonTree = JsonConvert.SerializeObject(tree, Formatting.None);

            if (!jsonTree.StartsWith("["))
            {
                jsonTree = string.Format("{0}{1}{2}", "[", jsonTree, "]");
            }

            return(jsonTree);
        }
コード例 #5
0
 private void btn_Modu_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         Module module = new Module();
         module.ID          = data[comboBox1.SelectedIndex].ID;
         module.Name        = textBox1.Text.Trim();
         module.FormName    = textBox3.Text.Trim();
         module.ControlName = textBox4.Text.Trim();
         module.Remark      = textBox2.Text;
         ModuleLogic ml = ModuleLogic.GetInstance();
         if (ml.ExistsNameOther(module.Name, module.ID))
         {
             if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
             {
                 if (ml.UpdateModule(module))
                 {
                     data[comboBox1.SelectedIndex].Name        = module.Name;
                     data[comboBox1.SelectedIndex].FormName    = module.FormName;
                     data[comboBox1.SelectedIndex].ControlName = module.ControlName;
                     data[comboBox1.SelectedIndex].Remark      = module.Remark;
                     RefreshInfo();
                     MessageBox.Show("修改成功!");
                 }
             }
             else
             {
                 textBox1.Focus();
                 textBox1.SelectAll();
             }
         }
         else
         {
             if (ml.UpdateModule(module))
             {
                 data[comboBox1.SelectedIndex].Name        = module.Name;
                 data[comboBox1.SelectedIndex].FormName    = module.FormName;
                 data[comboBox1.SelectedIndex].ControlName = module.ControlName;
                 data[comboBox1.SelectedIndex].Remark      = module.Remark;
                 RefreshInfo();
                 MessageBox.Show("修改成功!");
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的项目!");
     }
 }
コード例 #6
0
ファイル: ModuleHolder.cs プロジェクト: newbienewbie/scada-v6
        /// <summary>
        /// Adds the specified module to the lists.
        /// </summary>
        public void AddModule(ModuleLogic moduleLogic)
        {
            if (moduleLogic == null)
            {
                throw new ArgumentNullException(nameof(moduleLogic));
            }

            modules.Add(moduleLogic);
            moduleMap[moduleLogic.Code] = moduleLogic;

            if (moduleLogic.ModulePurposes.HasFlag(ModulePurposes.Logic))
            {
                logicModules.Add(moduleLogic);
            }
        }
コード例 #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (MessageBox.Show("确定要删除该项目?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
         {
             Module module = data[comboBox1.SelectedIndex];
             if (ModuleLogic.GetInstance().DeleteModule(module))
             {
                 data.RemoveAt(comboBox1.SelectedIndex);
                 RefreshInfo();
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要删除的项目!");
     }
 }
コード例 #8
0
        /// <summary>
        /// Adds the specified module to the lists.
        /// </summary>
        public void AddModule(ModuleLogic moduleLogic)
        {
            if (moduleLogic == null)
            {
                throw new ArgumentNullException(nameof(moduleLogic));
            }

            if (moduleMap.ContainsKey(moduleLogic.Code))
            {
                throw new ScadaException("Module already exists.");
            }

            modules.Add(moduleLogic);
            moduleMap.Add(moduleLogic.Code, moduleLogic);

            if (moduleLogic.ModulePurposes.HasFlag(ModulePurposes.Logic))
            {
                logicModules.Add(moduleLogic);
            }
        }
コード例 #9
0
        private void button18_Click(object sender, EventArgs e)
        {
            Module module = new Module();

            module.Name        = textBox1.Text.Trim();
            module.FormName    = textBox3.Text.Trim();
            module.ControlName = textBox4.Text.Trim();
            module.Remark      = textBox2.Text;
            ModuleLogic ml = ModuleLogic.GetInstance();

            if (ml.ExistsName(module.Name))
            {
                if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                {
                    int id = ml.AddModule(module);
                    if (id > 0)
                    {
                        module.ID = id;
                        data.Add(module);
                        RefreshInfo();
                        MessageBox.Show("添加成功!");
                    }
                }
                else
                {
                    textBox1.Focus();
                    textBox1.SelectAll();
                }
            }
            else
            {
                int id = ml.AddModule(module);
                if (id > 0)
                {
                    module.ID = id;
                    data.Add(module);
                    RefreshInfo();
                    MessageBox.Show("添加成功!");
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// Crea el arbol de seleccion y setea un elemento
        /// </summary>
        /// <param name="checkedModuleID">ID Module (Checked)</param>
        /// <returns>Json Object</returns>
        public static string MakeTree(long checkedModuleID)
        {
            var menuModules = new ModuleLogic().GetAllActivos()
                              .Where(x => (x.Type == ModulesType.MENU_ACTION || x.Type == ModulesType.MENU_ITEM) && x.Parent == null).ToList();

            List <TreeNode> tree = new List <TreeNode>();

            foreach (var menuModule in menuModules.Where(x => x.Parent == null))
            {
                bool hasChildren = false;

                if (menuModule.Children != null && menuModule.Children.Where(x => x.Type == ModulesType.MENU_ACTION || x.Type == ModulesType.MENU_ITEM).ToList().Count > 0)
                {
                    hasChildren = true;
                }

                bool check = false;

                if (menuModule.EntityID == checkedModuleID)
                {
                    check = true;
                }

                TreeNode fatherNode = new TreeNode(menuModule.EntityID, menuModule.Name, true, hasChildren, false, true, check);

                if (hasChildren)
                {
                    LoadChildrens(menuModule, ref fatherNode, checkedModuleID);
                }

                tree.Add(fatherNode);
            }
            var jsonTree = JsonConvert.SerializeObject(tree, Formatting.None);

            if (!jsonTree.StartsWith("["))
            {
                jsonTree = string.Format("{0}{1}{2}", "[", jsonTree, "]");
            }

            return(jsonTree);
        }
コード例 #11
0
 /// <summary>
 /// Gets the module by code.
 /// </summary>
 public bool GetModule(string moduleCode, out ModuleLogic moduleLogic)
 {
     return(moduleMap.TryGetValue(moduleCode, out moduleLogic));
 }
コード例 #12
0
 public ModuleController()
 {
     _logic          = new ModuleLogic();
     _logicCourse    = new CourseLogic();
     _attendanceRepo = new AttendanceRepository();
 }
コード例 #13
0
 public ModulesWindow(ModuleLogic logic)
 {
     InitializeComponent();
     _logic = logic;
 }
コード例 #14
0
 public StudentModuleMappingController()
 {
     _logic        = new StudentModuleLogic();
     _logicModule  = new ModuleLogic();
     _logicStudent = new StudentLogic();
 }