private void btnOk_Click(object sender, EventArgs e)
 {
     if (mode == TransMode.EditRecord && ApplicationDomain != null)
     {
         ApplicationDomain.Title       = txtTitle.Text;
         ApplicationDomain.IsLocked    = chkLock.Checked;
         ApplicationDomain.IsEnabled   = chkEnable.Checked;
         ApplicationDomain.LoginTypeId = (short)cmbLoginType.SelectedValue;
         DialogResult = System.Windows.Forms.DialogResult.OK;
         this.ParentForm.Close();
     }
     if (mode == TransMode.NewRecord)
     {
         ApplicationDomainDto newDto = new ApplicationDomainDto()
         {
             Title       = txtTitle.Text,
             IsLocked    = chkLock.Checked,
             IsEnabled   = chkEnable.Checked,
             LoginTypeId = (short)cmbLoginType.SelectedValue
         };
         ApplicationDomain = newDto;
         DialogResult      = System.Windows.Forms.DialogResult.OK;
         this.ParentForm.Close();
     }
 }
Esempio n. 2
0
        RadTreeNode CreateApplicationNode(ApplicationDomainDto appDomain)
        {
            var         image = ISE.SM.Client.Properties.Resources.application2;
            RadTreeNode node  = new RadTreeNode(appDomain.Title);

            node.Image = image;
            return(node);
        }
Esempio n. 3
0
        public bool Remove(ApplicationDomainDto appDomain)
        {
            ResponseDto response = AppDomainServiceAdapter.Execute(s => s.Delete(appDomain));

            if (response.Response.HasException)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        public bool RemoveAppDomain(ApplicationDomainDto appDomain)
        {
            AppDomainPresenter appPresenter = new AppDomainPresenter();

            if (appPresenter.Remove(appDomain))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        public ApplicationDomainDto Insert(ApplicationDomainDto appDomain)
        {
            ApplicationDomainDto result = (ApplicationDomainDto)AppDomainServiceAdapter.Execute(s => s.Insert(appDomain));

            if (result.Response.HasException)
            {
                return(null);
            }
            appDomain.ApplicationDomainId = result.ApplicationDomainId;
            return(appDomain);
        }
Esempio n. 6
0
        public bool InsertAppDomain(ApplicationDomainDto appDomain)
        {
            AppDomainPresenter appPresenter = new AppDomainPresenter();

            if (appPresenter.Insert(appDomain) != null)
            {
                AppDomainList.Add(appDomain);
                return(true);
            }
            return(false);
        }
        public UCAppDomainEntry(TransMode mode, ApplicationDomainDto appDomain, ResourceView view)
        {
            DialogResult = System.Windows.Forms.DialogResult.None;
            this.view    = view;
            InitializeComponent();
            this.mode = mode;
            this.ApplicationDomain = appDomain;
            var loginTypes = view.GetLoginTypes();

            cmbLoginType.DataSource    = loginTypes;
            cmbLoginType.DisplayMember = AssemblyReflector.GetMemberName((LoginTypeDto m) => m.Title);
            cmbLoginType.ValueMember   = AssemblyReflector.GetMemberName((LoginTypeDto m) => m.LoginTypeId);
            if (mode == TransMode.EditRecord || mode == TransMode.ViewRecord)
            {
                txtTitle.Text     = appDomain.Title;
                chkEnable.Checked = appDomain.IsEnabled;
                chkLock.Checked   = appDomain.IsLocked;
                if (appDomain.LoginTypeId != null)
                {
                    cmbLoginType.SelectedValue = appDomain.LoginTypeId;
                }
            }
        }
Esempio n. 8
0
        private void RadMenuItemClicked(object sender, EventArgs e)
        {
            var name = ((Telerik.WinControls.RadItem)(sender)).AccessibleDescription;

            if (name == "DeleteApp")
            {
                if (ISE.Framework.Client.Win.Viewer.MessageViewer.ShowAlert("آیا از حذف دامنه مطمئن هستی؟") != DialogResult.OK)
                {
                    return;
                }
                var node = this.radTreeViewResource.SelectedNode;
                ApplicationDomainDto app = (ApplicationDomainDto)node.Value;
                if (node.Nodes.Count == 0)
                {
                    if (view.RemoveAppDomain(app))
                    {
                        this.radTreeViewResource.Nodes.Remove(node);
                    }
                }
                else
                {
                    ISE.Framework.Client.Win.Viewer.MessageViewer.ShowException("غیر قابل حذف می باشد!");
                }
            }
            else if (name == "EditApp")
            {
                var node = this.radTreeViewResource.SelectedNode;
                ApplicationDomainDto app   = (ApplicationDomainDto)node.Value;
                UCAppDomainEntry     entry = new UCAppDomainEntry(TransMode.EditRecord, app, view);
                ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "دامنه", FormBorderStyle.FixedDialog);
                if (entry.DialogResult != DialogResult.OK)
                {
                    return;
                }
                if (view.UpdateAppDomain(app))
                {
                    node.Text = app.Title;
                }
            }
            else if (name == "AddAppDomain")
            {
                UCAppDomainEntry entry = new UCAppDomainEntry(view);
                ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "دامنه", FormBorderStyle.FixedDialog);
                if (entry.DialogResult != DialogResult.OK)
                {
                    return;
                }
                if (view.InsertAppDomain(entry.ApplicationDomain))
                {
                    var appNode = CreateApplicationNode(entry.ApplicationDomain);
                    appNode.Value = entry.ApplicationDomain;
                    addContextMenu(appNode, MenuType.AppDomain);
                    this.radTreeViewResource.Nodes.Add(appNode);
                }
            }
            else if (name == "CreateSubmenu")
            {
                var            node  = this.radTreeViewResource.SelectedNode;
                UCSubMenuEntry entry = new UCSubMenuEntry();
                ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "زیر منو", FormBorderStyle.FixedDialog);
                if (entry.DialogResult != DialogResult.OK)
                {
                    return;
                }
                if (node.Value is ApplicationDomainDto)
                {
                    var val = (ApplicationDomainDto)node.Value;
                    entry.SecurityResource.AppDomainId = val.ApplicationDomainId;
                }
                else if (node.Value is SecurityResourceDto)
                {
                    var val = (SecurityResourceDto)node.Value;
                    entry.SecurityResource.AppDomainId = val.AppDomainId;
                    entry.SecurityResource.ParentId    = val.SecurityResourceId;
                }
                if (view.Insert(entry.SecurityResource))
                {
                    var resources   = view.LoadResources(0);
                    var submenuNode = CreateSubmenuTree(entry.SecurityResource, resources);
                    addContextMenu(submenuNode, (MenuType)entry.SecurityResource.ResourceTypeId);
                    if (submenuNode != null)
                    {
                        submenuNode.Value = entry.SecurityResource;

                        node.Nodes.Add(submenuNode);
                        node.Expand();
                    }
                }
            }
            else if (name == "EditSubmenu")
            {
                var node = this.radTreeViewResource.SelectedNode;
                SecurityResourceDto subMenu = (SecurityResourceDto)node.Value;
                UCSubMenuEntry      entry   = new UCSubMenuEntry(TransMode.EditRecord, subMenu);
                ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "زیر منو", FormBorderStyle.FixedDialog);
                if (entry.DialogResult != DialogResult.OK)
                {
                    return;
                }
                if (view.Update(subMenu))
                {
                    node.Text = subMenu.DisplayName;
                }
            }
            else if (name == "DeleteSubmenu")
            {
                if (ISE.Framework.Client.Win.Viewer.MessageViewer.ShowAlert("آیا از حذف زیر منو مطمئن هستید؟") != DialogResult.OK)
                {
                    return;
                }
                var node   = this.radTreeViewResource.SelectedNode;
                var parent = node.Parent;
                SecurityResourceDto subMenu = (SecurityResourceDto)node.Value;
                if (node.Nodes.Count == 0)
                {
                    if (view.Remove(subMenu))
                    {
                        parent.Nodes.Remove(node);
                    }
                }
                else
                {
                    ISE.Framework.Client.Win.Viewer.MessageViewer.ShowException("غیر قابل حذف می باشد!");
                }
            }
            else if (name == "CreateResource")
            {
                UCResourceEntry entry = new UCResourceEntry();
                ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "زیر منو", FormBorderStyle.FixedDialog);
                if (entry.DialogResult != DialogResult.OK)
                {
                    return;
                }
                var node = this.radTreeViewResource.SelectedNode;

                SecurityResourceDto subMenu = (SecurityResourceDto)node.Value;
                entry.SecurityResource.AppDomainId = subMenu.AppDomainId;
                entry.SecurityResource.ParentId    = subMenu.SecurityResourceId;
                if (view.Insert(entry.SecurityResource))
                {
                    var resources = view.LoadResources(0);
                    var newNode   = CreateSubmenuTree(entry.SecurityResource, resources);
                    node.Nodes.Add(newNode);
                }
            }
            else if (name == "EditResource")
            {
                var node = this.radTreeViewResource.SelectedNode;
                SecurityResourceDto subMenu = (SecurityResourceDto)node.Value;
                UCResourceEntry     entry   = new UCResourceEntry(TransMode.EditRecord, subMenu);
                ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "زیر منو", FormBorderStyle.FixedDialog);
                if (entry.DialogResult != DialogResult.OK)
                {
                    return;
                }
                if (view.Update(entry.SecurityResource))
                {
                    node.Text = subMenu.DisplayName;
                }
            }
            else if (name == "DeleteResource")
            {
                if (ISE.Framework.Client.Win.Viewer.MessageViewer.ShowAlert("آیا از حذف منبع مطمئن هستید؟") != DialogResult.OK)
                {
                    return;
                }
                var node   = this.radTreeViewResource.SelectedNode;
                var parent = node.Parent;
                SecurityResourceDto subMenu = (SecurityResourceDto)node.Value;
                if (node.Nodes.Count == 0)
                {
                    if (view.Remove(subMenu))
                    {
                        parent.Nodes.Remove(node);
                    }
                }
                else
                {
                    ISE.Framework.Client.Win.Viewer.MessageViewer.ShowException("غیر قابل حذف می باشد!");
                }
            }
            else if (name == "AddOperation")
            {
                var node = this.radTreeViewResource.SelectedNode;
                SecurityResourceDto subMenu = (SecurityResourceDto)node.Value;
                UCSelectOperation   entry   = new UCSelectOperation();
                ISE.UILibrary.Utils.UIUtils.SetFrmTrans(entry, "افزودن عملیات", FormBorderStyle.FixedDialog);
                if (entry.DialogResult != DialogResult.OK)
                {
                    return;
                }
                ResourcePresenter presenter = new ResourcePresenter();
                var container = presenter.AddOperatins(subMenu, entry.SelectedOperations);
                if (container != null)
                {
                    foreach (var item in container.PermissionDtoList)
                    {
                        var operation = entry.SelectedOperations.FirstOrDefault(it => it.OperationId == item.OperationId);
                        CreateOperationNode(operation, node);
                    }
                }
            }
            else if (name == "deleteOperation")
            {
                if (ISE.Framework.Client.Win.Viewer.MessageViewer.ShowAlert("آیا از حذف عملیات مطمئن هستید؟") != DialogResult.OK)
                {
                    return;
                }
                ResourcePresenter presenter = new ResourcePresenter();
                var node   = this.radTreeViewResource.SelectedNode;
                var parent = node.Parent;
                SecurityResourceDto resource  = (SecurityResourceDto)parent.Value;
                OperationDto        operation = (OperationDto)node.Value;

                if (presenter.RemoveOperatin(resource, operation) != null)
                {
                    parent.Nodes.Remove(node);
                }
                else
                {
                    ISE.Framework.Client.Win.Viewer.MessageViewer.ShowException("غیر قابل حذف می باشد!");
                }
            }
        }