Beispiel #1
0
        IView CreateView()
        {
            XtraUserControl1 control = new XtraUserControl1();
            string           str     = "ViewCaption" + DateTime.Now.ToLongTimeString();

            Core.SDK.Composite.UI.View view = new Core.SDK.Composite.UI.View(control, str, (closeType) => { return(true); }, (isActive) => { });
            return(view);
        }
Beispiel #2
0
        private void Init()
        {
            _logger.Debug("Init");

            _userList         = new EntityList <UserEntity>();
            _userList.Caption = "Довідник користувачів";
            _userControl      = new UserListControl();
            _userView         = new Core.SDK.Composite.UI.View(_userControl, _userList.Caption, (state) =>
            {
                _userList.Current = _userControl.UserEntityList.Current;
                if (state != true)
                {
                    return(true);
                }
                try
                {
                    BindingCollection <UserEntity> forAdd = EntityList <UserEntity> .DiffTwoListAndGetNew(_userList, _userControl.UserEntityList);
                    BindingCollection <UserEntity> forUpd = EntityList <UserEntity> .DiffTwoListAndGetUpd(_userList, _userControl.UserEntityList);
                    BindingCollection <UserEntity> forDel = EntityList <UserEntity> .DiffTwoListAndGetDel(_userList, _userControl.UserEntityList);

                    if (forAdd.Count == 0 && forUpd.Count == 0 && forDel.Count == 0)
                    {
                        return(true);
                    }

                    _nsiDbAccessor.ProccessUserChanges(forAdd, forUpd, forDel);
                    _userList = _userControl.UserEntityList;
                    return(true);
                }
                catch (Exception ex)
                {
                    _messageBoxMgr.ShowErrorWithDetail("Помилка під час роботи з довідником користувачів.", ex);
                    return(false);
                }
            });
            _userView.Image = Properties.Resources.NsiUser;

            _appList         = new EntityList <AppEntity>();
            _appList.Caption = "Довідник додатків";
            _appControl      = new AppListControl();
            _appView         = new Core.SDK.Composite.UI.View(_appControl, _appList.Caption, (state) =>
            {
                _appList.Current = _appControl.AppEntityList.Current;
                if (state != true)
                {
                    return(true);
                }
                try
                {
                    BindingCollection <AppEntity> forAdd = EntityList <AppEntity> .DiffTwoListAndGetNew(_appList, _appControl.AppEntityList);
                    BindingCollection <AppEntity> forUpd = EntityList <AppEntity> .DiffTwoListAndGetUpd(_appList, _appControl.AppEntityList);
                    BindingCollection <AppEntity> forDel = EntityList <AppEntity> .DiffTwoListAndGetDel(_appList, _appControl.AppEntityList);

                    if (forAdd.Count == 0 && forUpd.Count == 0 && forDel.Count == 0)
                    {
                        return(true);
                    }

                    _nsiDbAccessor.ProccessAppChanges(forAdd, forUpd, forDel);
                    _appList = _appControl.AppEntityList;
                    return(true);
                }
                catch (Exception ex)
                {
                    _messageBoxMgr.ShowErrorWithDetail("Помилка під час роботи з довідником програмних систем.", ex);
                    return(false);
                }
            });
            _appView.Image = Properties.Resources.NsiGeneral;

            _orgList         = new EntityList <OrgEntity>();
            _orgList.Caption = "Довідник організацій";
            _orgControl      = new OrgListControl();
            _orgView         = new Core.SDK.Composite.UI.View(_orgControl, _orgList.Caption, (state) =>
            {
                _orgList.Current = _orgControl.OrgEntityList.Current;
                if (state != true)
                {
                    return(true);
                }
                try
                {
                    BindingCollection <OrgEntity> forAdd = EntityList <OrgEntity> .DiffTwoListAndGetNew(_orgList, _orgControl.OrgEntityList);
                    BindingCollection <OrgEntity> forUpd = EntityList <OrgEntity> .DiffTwoListAndGetUpd(_orgList, _orgControl.OrgEntityList);
                    BindingCollection <OrgEntity> forDel = EntityList <OrgEntity> .DiffTwoListAndGetDel(_orgList, _orgControl.OrgEntityList);

                    if (forAdd.Count == 0 && forUpd.Count == 0 && forDel.Count == 0)
                    {
                        return(true);
                    }

                    _nsiDbAccessor.ProccessOrgChanges(forAdd, forUpd, forDel);
                    _orgList = _orgControl.OrgEntityList;
                    return(true);
                }
                catch (Exception ex)
                {
                    _messageBoxMgr.ShowErrorWithDetail("Помилка під час роботи з довідником організацій.", ex);
                    return(false);
                }
            });
            _orgView.Image = Properties.Resources.NsiGeneral;

            _tagControl      = new TagListControl();
            _tagList         = new EntityList <TagEntity>();
            _tagList.Caption = "Довідник тегів";
            _tagView         = new Core.SDK.Composite.UI.View(_tagControl, _tagList.Caption, (state) =>
            {
                _tagList.Current = _tagControl.TagEntityList.Current;
                if (state != true)
                {
                    return(true);
                }
                try
                {
                    BindingCollection <TagEntity> forAdd = EntityList <TagEntity> .DiffTwoListAndGetNew(_tagList, _tagControl.TagEntityList);
                    BindingCollection <TagEntity> forUpd = EntityList <TagEntity> .DiffTwoListAndGetUpd(_tagList, _tagControl.TagEntityList);
                    BindingCollection <TagEntity> forDel = EntityList <TagEntity> .DiffTwoListAndGetDel(_tagList, _tagControl.TagEntityList);

                    if (forAdd.Count == 0 && forUpd.Count == 0 && forDel.Count == 0)
                    {
                        return(true);
                    }

                    _nsiDbAccessor.ProccessTagChanges(forAdd, forUpd, forDel);
                    _tagList = _tagControl.TagEntityList;
                    return(true);
                }
                catch (Exception ex)
                {
                    _messageBoxMgr.ShowErrorWithDetail("Помилка під час роботи з довідником тегів.", ex);
                    return(false);
                }
            });
            _tagView.Image = Properties.Resources.NsiGeneral;

            _infoSourceTypesDict = new Dictionary <InfoSourceType, string>();
            _infoSourceTypesDict.Add(InfoSourceType.Call, Properties.Resources.PhoneInfoSourceType);
            _infoSourceTypesDict.Add(InfoSourceType.Email, Properties.Resources.MailInfoSourceType);
            _infoSourceTypesDict.Add(InfoSourceType.Forum, Properties.Resources.ForumInfoSourceType);
            _infoSourceTypesDict.Add(InfoSourceType.Jabber, Properties.Resources.JabberSourceType);
            _infoSourceTypesDict.Add(InfoSourceType.Letter, Properties.Resources.LetterInfoSourceType);
        }