Ejemplo n.º 1
0
        private void DoDelete(IEnumerable <string> keys)
        {
            try
            {
                Util.EnsureOperationSafe();
                DbUtil.GetEffectiveObject(this.AppObject);

                var actor        = SCObjectOperations.InstanceWithPermissions;
                var adapter      = SchemaObjectAdapter.Instance;
                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                var objects = DbUtil.LoadAndCheckObjects("角色", errorAdapter, keys.ToArray());

                foreach (SCRole role in objects)
                {
                    try
                    {
                        actor.DeleteRole(role);
                    }
                    catch (Exception ex)
                    {
                        this.notice.AddErrorInfo(string.Format("删除角色 {0} 时出错:{1}", role.DisplayName, ex.Message));
                        MCS.Web.Library.WebUtility.ShowClientError(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 2
0
        protected void AddExistMembers(object sender, EventArgs e)
        {
            try
            {
                Util.EnsureOperationSafe();

                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                SCOrganization parent = (SCOrganization)DbUtil.GetEffectiveObject(this.ParentOrganization);
                this.ParentOrganization = parent.ToSimpleObject();

                var users = DbUtil.LoadAndCheckObjects("人员", errorAdapter, this.GetPostedKeys());
                foreach (SCUser user in users)
                {
                    try
                    {
                        SCObjectOperations.InstanceWithPermissions.AddUserToOrganization(user, parent);
                    }
                    catch (Exception ex)
                    {
                        this.notice.AddErrorInfo(string.Format("无法添加人员 {0} :{1}", user.DisplayName, ex.Message));
                        WebUtility.ShowClientError(ex);
                    }
                }

                this.InnerRefreshList();
            }
            catch (Exception ex)
            {
                WebUtility.ShowClientError(ex);
                this.notice.AddErrorInfo(ex);
            }
        }
Ejemplo n.º 3
0
        private void DoDelete(IEnumerable <string> keys)
        {
            try
            {
                Util.EnsureOperationSafe();
                var grp = (SCGroup)DbUtil.GetEffectiveObject(this.GroupObject);

                var actor        = SCObjectOperations.InstanceWithPermissions;
                var adapter      = SchemaObjectAdapter.Instance;
                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys.ToArray());

                foreach (SCUser user in objects)
                {
                    try
                    {
                        actor.RemoveUserFromGroup(user, grp);
                    }
                    catch (Exception ex)
                    {
                        this.notice.AddErrorInfo(string.Format("替群组移除人员 {0} 时出错:{1}", user.DisplayName, ex.Message));
                        MCS.Web.Library.WebUtility.ShowClientError(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 4
0
        private void DoDelete(string[] funKeys)
        {
            try
            {
                Util.EnsureOperationSafe();
                DbUtil.GetEffectiveObject(this.AppObject);

                var actor   = SCObjectOperations.InstanceWithPermissions;
                var adapter = SchemaObjectAdapter.Instance;

                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                var objects = DbUtil.LoadAndCheckObjects("功能", errorAdapter, funKeys);

                foreach (SCPermission permission in objects)
                {
                    try
                    {
                        actor.DeletePermission(permission);
                    }
                    catch (Exception ex)
                    {
                        this.notice.AddErrorInfo(string.Format("删除功能 {0} 时出错:{1}", permission.DisplayName, ex.Message));
                        MCS.Web.Library.WebUtility.ShowClientError(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 5
0
        private void DoDelete(string[] keys)
        {
            try
            {
                Util.EnsureOperationSafe();

                var actor        = SCObjectOperations.InstanceWithPermissions;
                var adapter      = SchemaObjectAdapter.Instance;
                var errorAdapter = new ListErrorAdapter(this.notice.Errors);
                var root         = SCOrganization.GetRoot();

                var objects = DbUtil.LoadAndCheckObjects("组织", errorAdapter, keys);

                try
                {
                    actor.DeleteObjectsRecursively(objects, root);
                }
                catch (Exception ex)
                {
                    this.notice.AddErrorInfo(ex.Message);
                    MCS.Web.Library.WebUtility.ShowClientError(ex);
                }

                this.InnerRefreshList();
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }
        }
Ejemplo n.º 6
0
        private void DoDelete(IEnumerable <string> keys)
        {
            try
            {
                Util.EnsureOperationSafe();
                var mySelf = (SCUser)DbUtil.GetEffectiveObject(this.UserObject);

                var actor   = SCObjectOperations.InstanceWithPermissions;
                var adapter = SchemaObjectAdapter.Instance;
                ISecretaryAction executor = this.GetAction();
                var errorAdapter          = new ListErrorAdapter(this.notice.Errors);

                var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys.ToArray());

                foreach (SCUser user in objects)
                {
                    try
                    {
                        executor.DoRemove(user, mySelf);
                    }
                    catch (Exception ex)
                    {
                        this.notice.AddErrorInfo(string.Format("指定秘书/上司关系人员 {0} 时出错:{1}", user.DisplayName, ex.Message));
                        MCS.Web.Library.WebUtility.ShowClientError(ex);
                    }

                    this.InnerRefreshList();
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }
        }
Ejemplo n.º 7
0
        protected void BatchAddToOrg(object sender, EventArgs e)
        {
            try
            {
                Util.EnsureOperationSafe();
                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                SchemaObjectCollection orgs  = DbUtil.LoadAndCheckObjects("组织", errorAdapter, this.GetPostKeys());
                SchemaObjectCollection users = DbUtil.LoadAndCheckObjects("人员", errorAdapter, this.CurrentGrid.SelectedKeys.ToArray());

                this.AddUsersToOrgs(users, orgs);
            }
            catch (Exception ex)
            {
                WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 8
0
        protected void HandleAddUser(object sender, EventArgs e)
        {
            string[] keys = this.GetPostedKeys();

            if (keys.Length > 0)
            {
                try
                {
                    Util.EnsureOperationSafe();
                    var adapter      = SchemaObjectAdapter.Instance;
                    var myself       = (SCUser)DbUtil.GetEffectiveObject(this.UserObject);
                    var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                    ISecretaryAction executor = this.GetAction();

                    foreach (SCUser user in DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys))
                    {
                        try
                        {
                            executor.DoAdd(user, myself);
                        }
                        catch (Exception ex)
                        {
                            this.notice.AddErrorInfo(ex);
                            MCS.Web.Library.WebUtility.ShowClientError(ex);
                        }
                    }

                    this.InnerRefreshList();
                }
                catch (Exception ex)
                {
                    this.notice.AddErrorInfo(ex);
                    MCS.Web.Library.WebUtility.ShowClientError(ex);
                }
            }
            else
            {
                this.notice.Text       = "在执行操作前至少应选择一个项目";
                this.notice.RenderType = WebControls.NoticeType.Info;
            }
        }
Ejemplo n.º 9
0
        protected void HandleAddUser(object sender, EventArgs e)
        {
            try
            {
                string[] keys = this.GetPostedKeys();
                if (keys.Length > 0)
                {
                    var adapter  = SchemaObjectAdapter.Instance;
                    var executor = SCObjectOperations.InstanceWithPermissions;

                    var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                    Util.EnsureOperationSafe();
                    var group = (SCGroup)DbUtil.GetEffectiveObject(this.GroupObject);

                    var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys);

                    foreach (SCUser user in objects)
                    {
                        try
                        {
                            executor.AddUserToGroup(user, group);
                        }
                        catch (Exception ex)
                        {
                            this.notice.AddErrorInfo(string.Format("向群组添加人员 {0} 时发生错误:{1}", user.DisplayName, ex.Message));
                            MCS.Web.Library.WebUtility.ShowClientError(ex);
                        }
                    }

                    this.InnerRefreshList();
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex.Message);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }
        }
Ejemplo n.º 10
0
        private void DoDelete(IEnumerable <string> keys)
        {
            try
            {
                Util.EnsureOperationSafe();

                var actor        = SCObjectOperations.InstanceWithPermissions;
                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys.ToArray());

                foreach (SCUser user in objects)
                {
                    actor.DeleteUser(user, null, false);
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 11
0
        private void DoDelete(IEnumerable <string> keys)
        {
            try
            {
                Util.EnsureOperationSafe();
                var role         = (SCRole)DbUtil.GetEffectiveObject(this.RoleAndAppObject.RoleID, null);
                var actor        = SCObjectOperations.InstanceWithPermissions;
                var errorAdapter = new ListErrorAdapter(this.notice1.Errors);

                var objects = DbUtil.LoadAndCheckObjects("应用", errorAdapter, keys.ToArray());

                foreach (SCBase obj in objects)
                {
                    actor.RemoveMemberFromRole(obj, role);
                }
            }
            catch (Exception ex)
            {
                this.notice1.Errors.Add(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 12
0
        private void DoDelete(string[] keys)
        {
            try
            {
                Util.EnsureOperationSafe();

                var actor        = SCObjectOperations.InstanceWithPermissions;
                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                var objects = DbUtil.LoadAndCheckObjects("群组", errorAdapter, keys);

                foreach (PC.SCGroup group in objects)
                {
                    actor.DeleteGroup(group, null, false);
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 13
0
        private void DoDelete(string[] keys)
        {
            try
            {
                Util.EnsureOperationSafe();

                var actor = SCObjectOperations.InstanceWithPermissions;

                var errorAdapter = new ListErrorAdapter(this.notice.Errors);

                var objects = DbUtil.LoadAndCheckObjects("应用", errorAdapter, keys);

                foreach (SCApplication app in objects)
                {
                    if (app.Status == SchemaObjectStatus.Normal)
                    {
                        var subObjects = PC.Adapters.SCMemberRelationAdapter.Instance.LoadByContainerID(app.ID).FilterByStatus(SchemaObjectStatusFilterTypes.Normal);

                        try
                        {
                            bool anySubObjectsDeleted = false;

                            foreach (var item in subObjects)
                            {
                                var member = item.Member;
                                if (member != null && member.Status == SchemaObjectStatus.Normal)
                                {
                                    if (member is SCRole)
                                    {
                                        PC.Executors.SCObjectOperations.InstanceWithPermissions.DeleteRole((SCRole)member);
                                        this.notice.AddErrorInfo(string.Format("已删除应用 {0} 中的角色 {1}", app.ToDescription(), ((SCRole)member).ToDescription()));
                                        anySubObjectsDeleted = true;
                                    }
                                    else if (member is SCPermission)
                                    {
                                        PC.Executors.SCObjectOperations.InstanceWithPermissions.DeletePermission((SCPermission)member);
                                        this.notice.AddErrorInfo(string.Format("已删除应用 {0} 中的功能 {1}", app.ToDescription(), ((SCPermission)member).ToDescription()));
                                        anySubObjectsDeleted = true;
                                    }
                                }
                            }

                            actor.DeleteApplication(app);

                            if (anySubObjectsDeleted)
                            {
                                this.notice.Errors.Add(string.Format("已删除应用 {0}。", app.ToDescription()));
                            }
                        }
                        catch (Exception ex)
                        {
                            this.notice.Errors.Add(string.Format("因为出现了异常,因此未能删除应用 {0},异常原因参考下一个消息。", app.ToDescription()));
                            this.notice.Errors.Add(ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.notice.AddErrorInfo(ex);
                MCS.Web.Library.WebUtility.ShowClientError(ex);
            }

            this.InnerRefreshList();
        }
Ejemplo n.º 14
0
		private void DoDelete(string[] keys)
		{
			try
			{
				Util.EnsureOperationSafe();

				var actor = SCObjectOperations.InstanceWithPermissions;

				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				var objects = DbUtil.LoadAndCheckObjects("应用", errorAdapter, keys);

				foreach (SCApplication app in objects)
				{
					if (app.Status == SchemaObjectStatus.Normal)
					{
						var subObjects = PC.Adapters.SCMemberRelationAdapter.Instance.LoadByContainerID(app.ID).FilterByStatus(SchemaObjectStatusFilterTypes.Normal);

						try
						{
							bool anySubObjectsDeleted = false;

							foreach (var item in subObjects)
							{
								var member = item.Member;
								if (member != null && member.Status == SchemaObjectStatus.Normal)
								{
									if (member is SCRole)
									{
										PC.Executors.SCObjectOperations.InstanceWithPermissions.DeleteRole((SCRole)member);
										this.notice.AddErrorInfo(string.Format("已删除应用 {0} 中的角色 {1}", app.ToDescription(), ((SCRole)member).ToDescription()));
										anySubObjectsDeleted = true;
									}
									else if (member is SCPermission)
									{
										PC.Executors.SCObjectOperations.InstanceWithPermissions.DeletePermission((SCPermission)member);
										this.notice.AddErrorInfo(string.Format("已删除应用 {0} 中的功能 {1}", app.ToDescription(), ((SCPermission)member).ToDescription()));
										anySubObjectsDeleted = true;
									}
								}
							}

							actor.DeleteApplication(app);

							if (anySubObjectsDeleted)
							{
								this.notice.Errors.Add(string.Format("已删除应用 {0}。", app.ToDescription()));
							}
						}
						catch (Exception ex)
						{
							this.notice.Errors.Add(string.Format("因为出现了异常,因此未能删除应用 {0},异常原因参考下一个消息。", app.ToDescription()));
							this.notice.Errors.Add(ex);
						}
					}
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
Ejemplo n.º 15
0
		private void DoDelete(string[] funKeys)
		{
			try
			{
				Util.EnsureOperationSafe();
				DbUtil.GetEffectiveObject(this.AppObject);

				var actor = SCObjectOperations.InstanceWithPermissions;
				var adapter = SchemaObjectAdapter.Instance;

				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				var objects = DbUtil.LoadAndCheckObjects("功能", errorAdapter, funKeys);

				foreach (SCPermission permission in objects)
				{
					try
					{
						actor.DeletePermission(permission);
					}
					catch (Exception ex)
					{
						this.notice.AddErrorInfo(string.Format("删除功能 {0} 时出错:{1}", permission.DisplayName, ex.Message));
						MCS.Web.Library.WebUtility.ShowClientError(ex);
					}
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
Ejemplo n.º 16
0
		private void DoDelete(IEnumerable<string> keys)
		{
			try
			{
				Util.EnsureOperationSafe();
				var mySelf = (SCUser)DbUtil.GetEffectiveObject(this.UserObject);

				var actor = SCObjectOperations.InstanceWithPermissions;
				var adapter = SchemaObjectAdapter.Instance;
				ISecretaryAction executor = this.GetAction();
				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys.ToArray());

				foreach (SCUser user in objects)
				{
					try
					{
						executor.DoRemove(user, mySelf);
					}
					catch (Exception ex)
					{
						this.notice.AddErrorInfo(string.Format("指定秘书/上司关系人员 {0} 时出错:{1}", user.DisplayName, ex.Message));
						MCS.Web.Library.WebUtility.ShowClientError(ex);
					}

					this.InnerRefreshList();
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}
		}
Ejemplo n.º 17
0
		protected void HandleAddUser(object sender, EventArgs e)
		{
			string[] keys = this.GetPostedKeys();

			if (keys.Length > 0)
			{
				try
				{
					Util.EnsureOperationSafe();
					var adapter = SchemaObjectAdapter.Instance;
					var myself = (SCUser)DbUtil.GetEffectiveObject(this.UserObject);
					var errorAdapter = new ListErrorAdapter(this.notice.Errors);

					ISecretaryAction executor = this.GetAction();

					foreach (SCUser user in DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys))
					{
						try
						{
							executor.DoAdd(user, myself);
						}
						catch (Exception ex)
						{
							this.notice.AddErrorInfo(ex);
							MCS.Web.Library.WebUtility.ShowClientError(ex);
						}
					}

					this.InnerRefreshList();
				}
				catch (Exception ex)
				{
					this.notice.AddErrorInfo(ex);
					MCS.Web.Library.WebUtility.ShowClientError(ex);
				}
			}
			else
			{
				this.notice.Text = "在执行操作前至少应选择一个项目";
				this.notice.RenderType = WebControls.NoticeType.Info;
			}
		}
Ejemplo n.º 18
0
		private void DoDelete(IEnumerable<string> keys)
		{
			try
			{
				Util.EnsureOperationSafe();

				var actor = SCObjectOperations.InstanceWithPermissions;
				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys.ToArray());

				foreach (SCUser user in objects)
				{
					actor.DeleteUser(user, null, false);
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
Ejemplo n.º 19
0
		protected void BatchAddToOrg(object sender, EventArgs e)
		{
			try
			{
				Util.EnsureOperationSafe();
				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				SchemaObjectCollection orgs = DbUtil.LoadAndCheckObjects("组织", errorAdapter, this.GetPostKeys());
				SchemaObjectCollection users = DbUtil.LoadAndCheckObjects("人员", errorAdapter, this.CurrentGrid.SelectedKeys.ToArray());

				this.AddUsersToOrgs(users, orgs);
			}
			catch (Exception ex)
			{
				WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
		protected void HandleAddUser(object sender, EventArgs e)
		{
			try
			{
				string[] keys = this.GetPostedKeys();
				if (keys.Length > 0)
				{
					var adapter = SchemaObjectAdapter.Instance;
					var executor = SCObjectOperations.InstanceWithPermissions;

					var errorAdapter = new ListErrorAdapter(this.notice.Errors);

					Util.EnsureOperationSafe();
					var group = (SCGroup)DbUtil.GetEffectiveObject(this.GroupObject);

					var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys);

					foreach (SCUser user in objects)
					{
						try
						{
							executor.AddUserToGroup(user, group);
						}
						catch (Exception ex)
						{
							this.notice.AddErrorInfo(string.Format("向群组添加人员 {0} 时发生错误:{1}", user.DisplayName, ex.Message));
							MCS.Web.Library.WebUtility.ShowClientError(ex);
						}
					}

					this.InnerRefreshList();
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex.Message);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}
		}
Ejemplo n.º 21
0
		private void DoDelete(IEnumerable<string> keys)
		{
			try
			{
				Util.EnsureOperationSafe();
				var role = (SCRole)DbUtil.GetEffectiveObject(this.RoleAndAppObject.RoleID, null);
				var actor = SCObjectOperations.InstanceWithPermissions;
				var errorAdapter = new ListErrorAdapter(this.notice1.Errors);

				var objects = DbUtil.LoadAndCheckObjects("应用", errorAdapter, keys.ToArray());

				foreach (SCBase obj in objects)
				{
					actor.RemoveMemberFromRole(obj, role);
				}
			}
			catch (Exception ex)
			{
				this.notice1.Errors.Add(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
Ejemplo n.º 22
0
		private void DoDelete(string[] keys)
		{
			try
			{
				Util.EnsureOperationSafe();

				var actor = SCObjectOperations.InstanceWithPermissions;
				var adapter = SchemaObjectAdapter.Instance;
				var errorAdapter = new ListErrorAdapter(this.notice.Errors);
				var root = SCOrganization.GetRoot();

				var objects = DbUtil.LoadAndCheckObjects("组织", errorAdapter, keys);

				try
				{
					actor.DeleteObjectsRecursively(objects, root);
				}
				catch (Exception ex)
				{
					this.notice.AddErrorInfo(ex.Message);
					MCS.Web.Library.WebUtility.ShowClientError(ex);
				}

				this.InnerRefreshList();
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}
		}
		private void DoDelete(IEnumerable<string> keys)
		{
			try
			{
				Util.EnsureOperationSafe();
				var grp = (SCGroup)DbUtil.GetEffectiveObject(this.GroupObject);

				var actor = SCObjectOperations.InstanceWithPermissions;
				var adapter = SchemaObjectAdapter.Instance;
				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				var objects = DbUtil.LoadAndCheckObjects("人员", errorAdapter, keys.ToArray());

				foreach (SCUser user in objects)
				{
					try
					{
						actor.RemoveUserFromGroup(user, grp);
					}
					catch (Exception ex)
					{
						this.notice.AddErrorInfo(string.Format("替群组移除人员 {0} 时出错:{1}", user.DisplayName, ex.Message));
						MCS.Web.Library.WebUtility.ShowClientError(ex);
					}
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
Ejemplo n.º 24
0
		private void DoDelete(string[] keys)
		{
			try
			{
				Util.EnsureOperationSafe();

				var actor = SCObjectOperations.InstanceWithPermissions;
				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				var objects = DbUtil.LoadAndCheckObjects("群组", errorAdapter, keys);

				foreach (PC.SCGroup group in objects)
				{
					actor.DeleteGroup(group, null, false);
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
Ejemplo n.º 25
0
		private void DoDelete(IEnumerable<string> keys)
		{
			try
			{
				Util.EnsureOperationSafe();
				DbUtil.GetEffectiveObject(this.AppObject);

				var actor = SCObjectOperations.InstanceWithPermissions;
				var adapter = SchemaObjectAdapter.Instance;
				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				var objects = DbUtil.LoadAndCheckObjects("角色", errorAdapter, keys.ToArray());

				foreach (SCRole role in objects)
				{
					try
					{
						actor.DeleteRole(role);
					}
					catch (Exception ex)
					{
						this.notice.AddErrorInfo(string.Format("删除角色 {0} 时出错:{1}", role.DisplayName, ex.Message));
						MCS.Web.Library.WebUtility.ShowClientError(ex);
					}
				}
			}
			catch (Exception ex)
			{
				this.notice.AddErrorInfo(ex);
				MCS.Web.Library.WebUtility.ShowClientError(ex);
			}

			this.InnerRefreshList();
		}
Ejemplo n.º 26
0
		protected void AddExistMembers(object sender, EventArgs e)
		{
			try
			{
				Util.EnsureOperationSafe();

				var errorAdapter = new ListErrorAdapter(this.notice.Errors);

				SCOrganization parent = (SCOrganization)DbUtil.GetEffectiveObject(this.ParentOrganization);
				this.ParentOrganization = parent.ToSimpleObject();

				var users = DbUtil.LoadAndCheckObjects("人员", errorAdapter, this.GetPostedKeys());
				foreach (SCUser user in users)
				{
					try
					{
						SCObjectOperations.InstanceWithPermissions.AddUserToOrganization(user, parent);
					}
					catch (Exception ex)
					{
						this.notice.AddErrorInfo(string.Format("无法添加人员 {0} :{1}", user.DisplayName, ex.Message));
						WebUtility.ShowClientError(ex);
					}
				}

				this.InnerRefreshList();
			}
			catch (Exception ex)
			{
				WebUtility.ShowClientError(ex);
				this.notice.AddErrorInfo(ex);
			}
		}