Пример #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
        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);
        }
Пример #3
0
 private void button22_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         UserGroup ug = new UserGroup();
         ug.ID     = data[comboBox1.SelectedIndex].ID;
         ug.Name   = textBox1.Text.Trim();
         ug.Remark = textBox2.Text;
         UserGroupLogic ul = UserGroupLogic.GetInstance();
         if (ul.ExistsNameOther(ug.Name, ug.ID))
         {
             if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
             {
                 if (ul.UpdateUserGroup(ug))
                 {
                     data[comboBox1.SelectedIndex].Name   = ug.Name;
                     data[comboBox1.SelectedIndex].Remark = ug.Remark;
                     RefreshInfo();
                     MessageBox.Show("修改成功!");
                 }
             }
             else
             {
                 textBox1.Focus();
                 textBox1.SelectAll();
             }
         }
         else
         {
             if (ul.UpdateUserGroup(ug))
             {
                 data[comboBox1.SelectedIndex].Name   = ug.Name;
                 data[comboBox1.SelectedIndex].Remark = ug.Remark;
                 RefreshInfo();
                 MessageBox.Show("修改成功!");
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的项目!");
     }
 }
Пример #4
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)
         {
             UserGroup ug = data[comboBox1.SelectedIndex];
             if (UserGroupLogic.GetInstance().DeleteUserGroup(ug))
             {
                 data.RemoveAt(comboBox1.SelectedIndex);
                 RefreshInfo();
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要删除的项目!");
     }
 }
Пример #5
0
        private void button11_Click(object sender, EventArgs e)
        {
            UserGroup ug = new UserGroup();

            ug.Name   = textBox1.Text.Trim();
            ug.Remark = textBox2.Text;
            UserGroupLogic ul = UserGroupLogic.GetInstance();

            if (ul.ExistsName(ug.Name))
            {
                if (MessageBox.Show("系统中已经存在该名称,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
                {
                    int id = ul.AddUserGroup(ug);
                    if (id > 0)
                    {
                        ug.ID = id;
                        data.Add(ug);
                        RefreshInfo();
                        MessageBox.Show("添加成功!");
                    }
                }
                else
                {
                    textBox1.Focus();
                    textBox1.SelectAll();
                }
            }
            else
            {
                int id = ul.AddUserGroup(ug);
                if (id > 0)
                {
                    ug.ID = id;
                    data.Add(ug);
                    RefreshInfo();
                    MessageBox.Show("添加成功!");
                }
            }
        }