예제 #1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected WfProcess(SerializationInfo info, StreamingContext context)
		{
			this._ID = info.GetString("ID");
			this._ResourceID = info.GetString("ResourceID");
			this._Activities = (WfActivityCollection)info.GetValue("Activities", typeof(WfActivityCollection));
			this._Context = (WfProcessContext)info.GetValue("Context", typeof(WfProcessContext));

			this._Status = (WfProcessStatus)info.GetValue("Status", typeof(WfProcessStatus));
			this._StartTime = info.GetDateTime("StartTime");
			this._EndTime = info.GetDateTime("EndTime");
			this._Creator = (IUser)info.GetValue("Creator", typeof(IUser));
			this._OwnerDepartment = (IOrganization)info.GetValue("OwnerDepartment", typeof(IOrganization));

			this._EntryInfo = (WfBranchProcessInfo)info.GetValue("EntryInfo", typeof(WfBranchProcessInfo));
			this._LoadingType = (DataLoadingType)info.GetValue("LoadingType", typeof(DataLoadingType));

			WfProcessContextCache.Instance[this._ID] = this;
		}
        /// <summary>
        /// Method which is called to get value of a field.
        /// </summary>
        /// <param name="fieldName">The name of the custom field.</param>
        /// <returns>Value of the field</returns>
        public static string GetFieldValue(string packageName, string fieldName, IOrganization _OrgRecord)
        {
            string value = "";
            IList <ICustomAttribute> orgCustomAttributes = _OrgRecord.CustomAttributes;

            foreach (ICustomAttribute val in orgCustomAttributes)
            {
                if (val.PackageName == packageName)                             //if package name matches
                {
                    if (val.GenericField.Name == packageName + "$" + fieldName) //if field matches
                    {
                        if (val.GenericField.DataValue.Value != null)
                        {
                            value = val.GenericField.DataValue.Value.ToString();
                            break;
                        }
                    }
                }
            }
            return(value);
        }
예제 #3
0
        public void WfDepartmentResourceDescriptorConveterTest()
        {
            WfConverterHelper.RegisterConverters();

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;

            IOrganization orga = user.Parent;
            WfDepartmentResourceDescriptor deptResuDesp = new WfDepartmentResourceDescriptor(orga);

            string result = JSONSerializerExecute.Serialize(deptResuDesp);

            Console.WriteLine(result);

            WfDepartmentResourceDescriptor deserializedDeptDesp = JSONSerializerExecute.Deserialize <WfDepartmentResourceDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(deserializedDeptDesp);

            Assert.AreEqual(result, reSerialized);

            ResourceConverterTest(deptResuDesp);
        }
예제 #4
0
        /// <summary>
        /// 根据机构过滤人员的兼职信息。如果同一集合中含有多个人员信息,那么根据传入的机构进行筛选,如果还剩下多条记录,根据主职进行调整。
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public OguObjectCollection <IUser> FilterUniqueSidelineUsers(IOrganization parent)
        {
            Dictionary <string, List <T> > groupedData = GroupOguObjects(this);

            MakeUniqueUserInGroup(groupedData, parent);

            List <IUser> resultList = new List <IUser>();

            foreach (KeyValuePair <string, List <T> > kp in groupedData)
            {
                foreach (T obj in kp.Value)
                {
                    if (obj is IUser)
                    {
                        resultList.Add((IUser)obj);
                    }
                }
            }

            return(new OguObjectCollection <IUser>(resultList));
        }
예제 #5
0
        /// <summary>
        /// Creates a new instance of the <see cref="MemberSearch"/> object and performs the search.
        /// </summary>
        /// <param name="query">The query.</param>
        /// <param name="limit">(Optional) The result limit.  Can be a value from 1 to 20. The default is 8.</param>
        /// <param name="board">(Optional) A board to which the search should be limited.</param>
        /// <param name="organization">(Optional) An organization to which the search should be limited.</param>
        /// <param name="restrictToOrganization">(Optional) Restricts the search to only organization members.</param>
        /// <param name="auth">(Optional) Custom authorization parameters. When not provided,
        /// <see cref="TrelloAuthorization.Default"/> will be used.</param>
        public MemberSearch(string query, int?limit = null, IBoard board = null, IOrganization organization = null, bool?restrictToOrganization = null, TrelloAuthorization auth = null)
        {
            _context = new MemberSearchContext(auth);

            _board = new Field <Board>(_context, nameof(Board));
            _limit = new Field <int?>(_context, nameof(Limit));
            _limit.AddRule(NullableHasValueRule <int> .Instance);
            _limit.AddRule(new NumericRule <int> {
                Min = 1, Max = 20
            });
            _organization = new Field <Organization>(_context, nameof(Organization));
            _query        = new Field <string>(_context, nameof(Query));
            _query.AddRule(NotNullOrWhiteSpaceRule.Instance);
            _restrictToOrganization = new Field <bool?>(_context, nameof(RestrictToOrganization));
            _results = new Field <IEnumerable <MemberSearchResult> >(_context, nameof(Results));

            Query                  = query;
            Limit                  = limit;
            Board                  = board;
            Organization           = organization;
            RestrictToOrganization = restrictToOrganization;
        }
예제 #6
0
        IOrganization Update(int id, string name, ITariff tariff)
        {
            IOrganization organization = Repository.Organizations.Get(id);

            bool isFree = tariff.IsFree();

            if (!organization.IsFree && isFree)
            {
                // при изменении тарифа на бесплатный
                // нужно проверять, состоят ли сотрудники в других бесплатных организациях
                Repository.Organizations.GetUsers(id)
                .ToList()
                .ForEach(x => CheckOneFree(x.UserId));
            }

            organization.Name     = name;
            organization.TariffId = tariff.Id;
            organization.IsFree   = isFree;
            Repository.SubmitChanges();

            return(organization);
        }
예제 #7
0
        private static string Get1C77_UKTZED(this COMObject doc, IOrganization org)
        {
            switch (doc.GLOBAL.Connection.ConfigType)
            {
            case E1CConfigType.Uaservice:
            case E1CConfigType.PUB:
            case E1CConfigType.Inforce:
            case E1CConfigType.Buch:
                COMObject temp = doc.GetPropertyObject("КодУКТВЭД");
                if (!doc.GLOBAL.EmptyValue(temp))
                {
                    return(temp.GetPropertyString("Код"));
                }
                else
                {
                    return(null);
                }

            default:
                return(null);
            }
        }
예제 #8
0
        /// <summary>
        /// Opens dialog to specify JSON file name where organization will be serialized,
        /// and serializes organization
        /// </summary>
        /// <param name="org">Organization to serialize</param>
        public void Serialize(IOrganization org)
        {
            IRetrieve Get = org as IRetrieve;

            // Configure save file dialog box
            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.FileName   = Get.RootDepartment().DeptName;   // Default file name
            dlg.DefaultExt = ".json";                         // Default file extension
            dlg.Filter     = "JSON documents (.json)|*.json"; // Filter files by extension

            // Show save file dialog box
            bool?result = dlg.ShowDialog();

            // Process save file dialog box results
            if (result != true)
            {
                return;
            }

            // Save document
            JsonBE.Serialize(dlg.FileName, org);
        }
예제 #9
0
        private IOrganization GetTopOUFromMapping(string mappedPath)
        {
            IOrganization dept = null;

            if (this.fullPath.IndexOf(mappedPath, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (ObjectType == SchemaType.Organizations)
                {
                    dept = (IOrganization)this;
                }
                else
                {
                    dept = this.Parent;
                }

                while (dept != null)
                {
                    if (string.Compare(dept.FullPath, mappedPath, true) == 0)
                    {
                        break;
                    }

                    dept = dept.Parent;
                }
            }
            else
            {
                OguObjectCollection <IOrganization> objs = OguMechanismFactory.GetMechanism().GetObjects <IOrganization>(
                    SearchOUIDType.FullPath,
                    mappedPath);

                ExceptionHelper.FalseThrow(objs.Count > 0, Resource.CanNotFindObject, mappedPath);

                dept = objs[0];
            }

            return(dept);
        }
예제 #10
0
        /// <summary>
        /// 在子对象进行查询(所有级别深度)
        /// </summary>
        /// <typeparam name="T">期望的类型</typeparam>
        /// <param name="parent">父机构对象</param>
        /// <param name="matchString">模糊查询的字符串</param>
        /// <param name="includeSideLine">是否包含兼职的人员</param>
        /// <param name="level">查询的深度</param>
        /// <param name="returnCount">返回的记录数</param>
        /// <returns>得到查询的子对象</returns>
        public OguObjectCollection <T> QueryChildren <T>(IOrganization parent, string matchString, bool includeSideLine, SearchLevel level, int returnCount) where T : IOguObject
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(parent != null, "parent");
            //ExceptionHelper.CheckStringIsNullOrEmpty(matchString, "matchString");

            SchemaType objType = OguObjectHelper.GetSchemaTypeFromInterface <T>();

            if (includeSideLine)
            {
                objType |= SchemaType.Sideline;
            }

            int nDep = 0;

            if (level == SearchLevel.OneLevel)
            {
                nDep = 1;
            }

            DataTable table = OguReaderServiceBroker.Instance.QueryOGUByCondition3(
                parent.ID,
                (int)SearchOUIDType.Guid,
                matchString,
                true,
                Common.DefaultAttrs,
                (int)objType,
                (int)ServiceBrokerContext.Current.ListObjectCondition,
                nDep,
                string.Empty,
                returnCount).Tables[0];

            if ((objType & SchemaType.Organizations) == SchemaType.Organizations)
            {
                RemoveParentDeptRow(table.Rows, parent);
            }

            return(new OguObjectCollection <T>(Common.BuildObjectsFromTable <T>(table, parent)));
        }
예제 #11
0
        private static Organization Map(IOrganization source)
        {
            Organization org = new Organization
            {
                OrgCode            = source.OrgCode,
                OrgName            = source.OrgName,
                OrgType            = source.OrgType,
                ParentCode         = source.ParentCode,
                Remark             = source.Remark,
                Sequence           = source.Sequence,
                UnitCode           = source.UnitCode,
                UnitName           = source.UnitName,
                Left               = source.Left,
                Right              = source.Right,
                LastModifyTime     = source.LastModifyTime,
                LastModifyUserId   = source.LastModifyUserId,
                LastModifyUserName = source.LastModifyUserName
            };



            return(org);
        }
예제 #12
0
        public void BuiltClaimsContainUserOrganizations()
        {
            const string userAccountName        = "user";
            const string firstOrganizationName  = "org";
            const string secondOrganizationName = "another org";

            IOrganization firstOrganization  = CreateOrganizationMock(firstOrganizationName);
            IOrganization secondOrganization = CreateOrganizationMock(secondOrganizationName);
            IUser         user = Substitute.For <IUser>();

            user.Organizations.Returns(new List <IOrganization> {
                firstOrganization, firstOrganization, secondOrganization
            });
            userService.GetUser(userAccountName, accountType).Returns(user);

            ClaimsIdentity identity = sut.Build("type", userAccountName, accountType);

            List <Claim> organizationClaims = identity.Claims.Where(c => c.Type.Equals(ClaimType.Organization)).ToList();

            Assert.AreEqual(2, organizationClaims.Count);
            Assert.IsTrue(organizationClaims.Any(c => c.Value.Equals(firstOrganizationName)));
            Assert.IsTrue(organizationClaims.Any(c => c.Value.Equals(secondOrganizationName)));
        }
예제 #13
0
        public OguObjectCollection <T> QueryDescendants <T>(SchemaType type, IOrganization parent, string prefix, int maxCount) where T : IOguObject
        {
            List <string> schemas = new List <string>(8);

            if ((type & SchemaType.Users) == SchemaType.Users)
            {
                schemas.Add("Users");
            }

            if ((type & SchemaType.Groups) == SchemaType.Groups)
            {
                schemas.Add("Groups");
            }

            if ((type & SchemaType.Organizations) == SchemaType.Organizations)
            {
                schemas.Add("Organizations");
            }

            var result = this.QueryDescendants <T>(parent, prefix, maxCount, schemas.ToArray());

            return(result);
        }
        private void EnsureRootOU(IOrganization startOrg)
        {
            if (SynchronizeContext.Current.IsIncluded(startOrg) == false)
            {
                throw new InvalidOperationException("同步根不在同步范围内");
            }

            List <string> parentPaths = SynchronizeHelper.GetAllParentPaths(startOrg.FullPath);

            if (parentPaths.Count > 0)
            {
                foreach (string path in parentPaths)
                {
                    if (path == SynchronizeContext.Current.SourceRootPath)
                    {
                        continue;                         // 根节点不应该被处理
                    }
                    var curOrg = OguMechanismFactory.GetMechanism().GetObjects <IOrganization>(SearchOUIDType.FullPath, path).FirstOrDefault();
                    if (SynchronizeContext.Current.IsIncluded(curOrg))
                    {
                        ADObjectWrapper adObject = ADObjectFinder.Find(curOrg, true);

                        if (adObject == null)                         //这里判断找不到的情况,则加到变更列表
                        {
                            SynchronizeContext.Current.PrepareAndAddModifiedItem(curOrg, adObject, ObjectModifyType.Add);
                        }
                        else                        //否则需要比较一下路径对不对,有可能按ID找到了,但路径变了
                        {
                            if (!ObjectComparerHelper.ArePathEqaul(curOrg, adObject))
                            {
                                SynchronizeContext.Current.PrepareAndAddModifiedItem(curOrg, adObject, ObjectModifyType.PropertyModified);
                            }
                        }
                    }
                }
            }
        }
예제 #15
0
        /// <summary>
        /// 是否是某个机构的子成员
        /// </summary>
        /// <param name="parent">机构</param>
        /// <param name="includeSideline">是否判断兼职信息</param>
        /// <returns>是否是某个机构的子成员</returns>
        public bool IsChildrenOf(IOrganization parent, bool includeSideline)
        {
            bool result = false;

            ExceptionHelper.FalseThrow <ArgumentNullException>(parent != null, "parent");

            if (includeSideline == false)
            {
                result = IsChildrenOf(parent);
            }
            else
            {
                foreach (IUser user in AllRelativeUserInfo)
                {
                    if (user.IsChildrenOf(parent))
                    {
                        result = true;
                        break;
                    }
                }
            }

            return(result);
        }
예제 #16
0
        /// <summary>
        /// Создание пользователя
        /// </summary>
        /// <exception cref="TariffException"></exception>
        public IUser Add(string nick, string password, string login, TimeSpan timeZone, string inviteCode, RegistrationType type)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                string email = login.IsValidEmail() ? login : "";
                IUser  user  = Repository.Users.Add(nick, login, CodePassword(password, login), email, timeZone, type);

                if (!inviteCode.IsNullOrEmpty())
                {
                    // Пользователь был приглашен кем-то через имейл
                    IUsersInvite invite = Repository.Invites.GetInvite(inviteCode);
                    if (invite != null && invite.EMail.ToUpper() == login.ToUpper())
                    {
                        // Инвайт верный, добавляем в организацию
                        IOrganization organization = Utility.Organizations.Get(invite.OrganizationId);
                        Utility.Organizations.AddUser(organization, user, EmployeeRole.Employee, true);
                    }
                    else
                    {
                        // приглашение через ссылку
                        IOrganization organization = Utility.Organizations.GetByInviteCode(inviteCode);
                        if (organization != null)
                        {
                            Utility.Organizations.AddUser(organization, user);
                        }
                    }
                }

                // Первая доска, рабочее время и тп создаются при активации (Activate)
                OnCreate.Invoke(new EventArgs <IUser>(user));

                scope.Complete();

                return(user);
            }
        }
예제 #17
0
 public new void Click()
 {
     try
     {
         OrgRecord = RecordContext.GetWorkspaceRecord(WorkspaceRecordType.Organization) as IOrganization;
         IList <IOrgAddr> list = OrgRecord.Oaddr;
         if (list != null)
         {
             foreach (IOrgAddr ad in list)
             {
                 if (ad.OatID == 1)
                 {
                     Init();
                     MessageBox.Show(getIsoCode(Convert.ToInt32(ad.AddrCountryID)));
                     MessageBox.Show(getEstado(Convert.ToInt32(ad.AddrCountryID), Convert.ToInt32(ad.AddrProvID)));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error en Click" + ex.Message);
     }
 }
예제 #18
0
        public PartialViewResult List(int id)
        {
            // Настройки пользователей на доске
            List <UserSettings> userSettingses = Utility.Boards.GetParticipants(id);

            ViewData.Model = userSettingses;

            // Остальные сотрудники организации
            IBoard board = Utility.Boards.Get(id);

            if (board.OrganizationId.HasValue)
            {
                List <EmployeeSettings> employees = Utility.Organizations
                                                    .GetEmployees(board.OrganizationId.Value)
                                                    .Where(x => !userSettingses.Any(y => y.User.Id == x.User.Id))
                                                    .ToList();
                ViewData.Add("employees", employees);

                IOrganization organization = Utility.Organizations.Get(board.OrganizationId.Value);
                ViewData.Add("organization", organization);
            }

            return(PartialView("List"));
        }
예제 #19
0
        /// <summary>
        /// 初始化祖先的OUs
        /// </summary>
        /// <param name="current"></param>
        public void InitAncestorOUs(IOguObject current)
        {
            IList <IOrganization> ancestorOUs = null;

            if (current.FullPath.IsNotEmpty())
            {
                ancestorOUs = InitAncestorOUsByFullPath(current);
            }
            else
            {
                ancestorOUs = InitAncestorOUsByParentID(current);
            }

            for (int i = ancestorOUs.Count - 1; i >= 0; i--)
            {
                IOrganization org = ancestorOUs[i];

                if (org.DepartmentType != DepartmentTypeDefine.XuNiJiGou)
                {
                    ((IOguPropertyAccessible)current).Parent = org;
                    current = ((IOguPropertyAccessible)current).Parent;
                }
            }
        }
예제 #20
0
        public void SimpleProcessDescriptorWithDeptResSerializeTest()
        {
            WfConverterHelper.RegisterConverters();

            WfProcessDescriptor processDesp = (WfProcessDescriptor)WfProcessTestCommon.CreateSimpleProcessDescriptor();

            IUser         user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;
            IOrganization orga = user.Parent;
            WfDepartmentResourceDescriptor deptResuDesp = new WfDepartmentResourceDescriptor(orga);

            processDesp.InitialActivity.Resources.Add(deptResuDesp);

            string result = JSONSerializerExecute.Serialize(processDesp);

            processDesp = JSONSerializerExecute.Deserialize <WfProcessDescriptor>(result);

            XElementFormatter formatter = new XElementFormatter();

            XElement root = formatter.Serialize(processDesp);

            Console.WriteLine(root.ToString());

            IWfProcessDescriptor clonedProcessDesp = (IWfProcessDescriptor)formatter.Deserialize(root);
        }
예제 #21
0
        /// <summary>
        /// Добавлени нового сотрудника в организацию
        /// пользователь должен подтвердить добавление
        /// </summary>
        /// <returns>
        /// true - добавлен
        /// false - уже был добавлен
        /// </returns>
        /// <exception cref="CanBeOnlyOneFreeException"></exception>
        /// <exception cref="TariffException"></exception>
        public bool AddUser(IOrganization organization, IUser user, EmployeeRole role = EmployeeRole.Employee, bool isApproved = false)
        {
            List <EmployeeSettings> organizations = GetByUser(user.Id);

            if (organization.IsFree)
            {
                CheckOneFree(organizations);
            }

            if (organizations.Any(x => x.Organization.Id == organization.Id))
            {
                return(false);
            }

            int?usersCount = Utility.Tariffs.GetAvailableUsersCount(organization);

            if (usersCount.HasValue && usersCount.Value <= 0)
            {
                string message =
                    "Пользователь " + user.Nick
                    + " не может быть добавлен в огранизацию " + organization.Name + "." + Environment.NewLine
                    + "Превышен лимит количества пользователей в огранизации.";
                throw new TariffException(message);
            }

            using (TransactionScope scope = new TransactionScope())
            {
                IOrganizationUser organizationUser = Repository.Organizations.AddUser(organization.Id, user.Id, role, isApproved);

                OnAddEmployee.Invoke(new EventArgs <IOrganizationUser>(organizationUser));

                scope.Complete();
            }

            return(true);
        }
 public DetaillapmoiController(ICommon common, IDetail_lapmoi detail_lapmoi, IOrganization organization)
 {
     m_common        = common;
     m_detail_lapmoi = detail_lapmoi;
     m_organization  = organization;
 }
        Task<IOrganization> ITenantActions.CreateOrganizationAsync(IOrganization organization, IOrganizationCreationOptions creationOptions, CancellationToken cancellationToken)
        {
            if (organization == null)
            {
                throw new ArgumentNullException(nameof(organization));
            }

            return this.GetInternalAsyncDataStore().CreateAsync(OrganizationsPropertyName, organization, creationOptions, cancellationToken);
        }
예제 #24
0
 public bool IsChildrenOf(IOrganization parent, bool includeSideline)
 {
     throw new NotImplementedException();
 }
예제 #25
0
        protected virtual Control BuildOrganzationAnchor(IOrganization org)
        {
            HtmlAnchor anchor = new HtmlAnchor();

            if (this.LinkCssClass.IsNotEmpty())
                anchor.Attributes["class"] = this.LinkCssClass;

            anchor.InnerText = org.DisplayName.IsNotEmpty() ? org.DisplayName : org.Name;
            anchor.HRef = this.BuildUrl(org);
            anchor.Target = this.Target;

            string dataTag = this.LinkDataTag;
            string clickScript = this.OnClientLinkClick;

            if (string.IsNullOrEmpty(dataTag) == false)
            {
                anchor.Attributes.Add(dataTag, org.ID);
            }

            if (string.IsNullOrEmpty(clickScript) == false)
            {
                anchor.Attributes.Add("onclick", clickScript);
            }

            RenderControlEventArgs e = new RenderControlEventArgs(anchor, org);

            this.OnBuildingAnchor(e);

            return anchor;
        }
        IOrganization ITenantActionsSync.CreateOrganization(IOrganization organization, Action<OrganizationCreationOptionsBuilder> creationOptionsAction)
        {
            var builder = new OrganizationCreationOptionsBuilder();
            creationOptionsAction(builder);
            var options = builder.Build();

            return this.CreateOrganization(organization, options);
        }
        IOrganization ITenantActionsSync.CreateOrganization(IOrganization organization, IOrganizationCreationOptions creationOptions)
        {
            if (organization == null)
            {
                throw new ArgumentNullException(nameof(organization));
            }

            return this.GetInternalSyncDataStore().Create(OrganizationsPropertyName, organization, creationOptions);
        }
예제 #28
0
		private IUser FindFirstUserInDepartment(IEnumerable<IUser> users, IOrganization dept)
		{
			IUser result = null;

			foreach (IUser user in users)
			{
				try
				{
					if (user.IsChildrenOf(dept))
					{
						if (result != null)
						{
							if (user.Levels < result.Levels)
								result = user;
						}
						else
							result = user;
					}
				}
				catch (System.Exception)
				{
				}
			}

			return result;
		}
예제 #29
0
 public OguOrganization(IOrganization organization)
     : base(organization, SchemaType.Organizations)
 {
 }
 /// <summary>
 /// Synchronously creates a new <see cref="IOrganization">Organization</see> resource in the Tenant.
 /// </summary>
 /// <param name="tenantActions">The object supporting the <see cref="ITenantActions"/> interface.</param>
 /// <param name="organization">The Organization to create.</param>
 /// <param name="creationOptions">A <see cref="IDirectoryCreationOptions"/> instance to use when sending the request.</param>
 /// <returns>The created <see cref="IOrganization">Organization</see>.</returns>
 /// <exception cref="Error.ResourceException">There was a problem creating the Organization.</exception>
 public static IOrganization CreateOrganization(this ITenantActions tenantActions, IOrganization organization, IOrganizationCreationOptions creationOptions)
     => (tenantActions as ITenantActionsSync).CreateOrganization(organization, creationOptions);
 /// <summary>
 /// Synchronously creates a new <see cref="IOrganization">Organization</see> resource in the Tenant.
 /// </summary>
 /// <param name="tenantActions">The object supporting the <see cref="ITenantActions"/> interface.</param>
 /// <param name="organization">The Organization to create.</param>
 /// <param name="creationOptionsAction">An inline builder for an instance of <see cref="IDirectoryCreationOptions"/>,
 /// which will be used when sending the request.</param>
 /// <returns>The created <see cref="IOrganization">Organization</see>.</returns>
 /// <exception cref="Error.ResourceException">There was a problem creating the Organization.</exception>
 public static IOrganization CreateOrganization(this ITenantActions tenantActions, IOrganization organization, Action<OrganizationCreationOptionsBuilder> creationOptionsAction)
     => (tenantActions as ITenantActionsSync).CreateOrganization(organization, creationOptionsAction);
        IOrganization ITenantActionsSync.CreateOrganization(IOrganization organization, Action<OrganizationCreationOptionsBuilder> creationOptionsAction)
        {
            this.EnsureTenant();

            return this.tenant.CreateOrganization(organization, creationOptionsAction);
        }
        IOrganization ITenantActionsSync.CreateOrganization(IOrganization directory)
        {
            this.EnsureTenant();

            return this.tenant.CreateOrganization(directory);
        }
        IOrganization ITenantActionsSync.CreateOrganization(IOrganization organization, IOrganizationCreationOptions creationOptions)
        {
            this.EnsureTenant();

            return this.tenant.CreateOrganization(organization, creationOptions);
        }
		/// <summary>
		/// Hydrates the add organization view model with the organization that is 
		/// to be edited and sets its mode to edit mode from save.
		/// </summary>
		/// <param name="organization">The organization to 
		/// be edited</param>
		public void EditExistingOrganization(IOrganization organization)
		{
			this.OrganizationPreview = new OrganizationViewModel(organization);
			this.OrganizationName = OrganizationPreview.OrgName;
			this.Caption = ViewNames.EDIT_ORGANIZATION;
		}
예제 #36
0
        /// <summary>
        /// Получаем данные из БД для записи в шаблон
        /// </summary>
        public Dictionary<string, string> GetExaminationData(IExamination examination, IOrganization organization)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            AddText("DEVICE", "", dictionary);//DEVICE

            ExaminationSoftType softType = examination.ExaminationSoftType;
            if (softType != null)
            {
                AddText("EXAMINATION_SOFT_TYPE", softType.Name, dictionary);//ExaminationSoftType
            }

            FileSystemStoreObject examilationFile = examination.ExaminationFile;
            if (examilationFile != null)
            {
                AddText("FILE_NAME", examilationFile.FileName, dictionary);//FILE_NAME
            }

            IPatient patient = examination.Patient;
            if (patient != null)
            {
                //AddText("пациент_полное_имя", CommonData.RTFData.GetRTFString(patient.FullName), dictionary);//PATIENT_FULLNAME
                AddText("PATIENT_CODE", RTFData.GetRTFString(patient.RegCode), dictionary);//PATIENT_CODE
                AddText("PATIENT_FULLNAME", RTFData.GetRTFString(patient.FullName), dictionary);//PATIENT_FULLNAME
                AddText("DOB", RTFData.GetRTFString(patient.Birthday.ToString("dd/MM/yyyy")), dictionary);//DOB

                EnumDescriptor descriptor = new EnumDescriptor(typeof(DomainComponents.Common.Gender));
                string gender = descriptor.GetCaption(patient.Gender);
                AddText("GENDER", RTFData.GetRTFString(gender), dictionary);//GENDER

                AddText("ADDRESS", RTFData.GetRTFString(patient.RegistrationAddress.Address), dictionary);//ADDRESS

                AddText("PHONE", RTFData.GetRTFString(patient.MainPhone), dictionary);//PHONE
                AddText("JOB", RTFData.GetRTFString(patient.JobTitle), dictionary);//JOB

                AddText("DOCUMENT", RTFData.GetRTFString(patient.IdentifyCardInfo), dictionary);//DOCUMENT
                AddText("HISTORY", RTFData.GetRTFString(patient.DiseaseHistory), dictionary);//HISTORY

                AddText("AGE", RTFData.GetRTFString(patient.Age), dictionary);//AGE

                AddPicture("PHOTO_PICTURE", patient.Photo, dictionary); // PHOTO
            }

            AddText("REG_DATE", RTFData.GetRTFString(examination.RegDate.ToString("dd.MM.yyyy")), dictionary);//DATE
            AddText("REG_TIME", RTFData.GetRTFString(examination.RegDate.ToString("HH:mm")), dictionary);//TIME
            AddText("DIAGNOSIS", RTFData.GetRTFString(examination.Diagnosis), dictionary);//DIAGNOSIS
            AddText("EXAMINER_FULLNAME", RTFData.GetRTFString(examination.Examiner.UserName), dictionary);//EXAMINER

            if (organization != null)
            {
                AddPicture("LOGO_PICTURE", organization.Logo, dictionary); //LOGO
                AddText("ORGANIZATION_NAME", organization.OrganizationName, dictionary);//ORGANIZATION_NAME
            }

            Employee currentUser = SecuritySystem.CurrentUser as Employee;
            if (currentUser != null)
            {
                AddText("CURRENT_USER", RTFData.GetRTFString(currentUser.UserName), dictionary);// CURRENT_USER
            }

            AddText("DATETIME_NOW", RTFData.GetRTFString(DateTime.Now.ToString("dd.MM.yyyy HH:mm")), dictionary); //DATETIME_NOW

            return dictionary;
        }
예제 #37
0
        private string BuildUrl(IOrganization org)
        {
            string urlFormat = this.NavigateUrlFormat;

            if (urlFormat.IsNotEmpty())
            {
                urlFormat = this.ResolveUrl(string.Format(urlFormat, this.Page.Server.UrlEncode(org.ID)));
            }

            return urlFormat;
        }
예제 #38
0
 public bool IsChildrenOf(IOrganization parent, bool includeSideline)
 {
     throw new NotImplementedException();
 }
예제 #39
0
        private OguDataCollection<IOguObject> QueryChildrenBySelectMask(IOrganization dept, string searchString)
        {
            ServiceBrokerContext.Current.SaveContextStates();
            var SelectMask = UserControlObjectMask.All;
            var MaxQueryCount = 15;

            try
            {
                ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;

                OguDataCollection<IOguObject> result = new OguDataCollection<IOguObject>();

                if (SelectMask == UserControlObjectMask.Organization)
                {
                    OguObjectCollection<IOrganization> orgs = dept.QueryChildren<IOrganization>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IOrganization org in orgs)
                        result.Add(org);
                }
                else
                    if (SelectMask == UserControlObjectMask.Group)
                    {
                        OguObjectCollection<IGroup> groups = dept.QueryChildren<IGroup>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                        foreach (IOrganization group in groups)
                            result.Add(group);
                    }
                    else
                        if (SelectMask == UserControlObjectMask.User || SelectMask == (UserControlObjectMask.User | UserControlObjectMask.Sideline))
                        {
                            OguObjectCollection<IUser> users = dept.QueryChildren<IUser>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                            foreach (IUser user in users)
                                result.Add(user);
                        }
                        else
                        {
                            if ((int)(SelectMask & (UserControlObjectMask.Group | UserControlObjectMask.User | UserControlObjectMask.Organization)) != 0)
                            {
                                OguObjectCollection<IOguObject> objs = dept.QueryChildren<IOguObject>(searchString, true, SearchLevel.SubTree, MaxQueryCount);

                                foreach (IOguObject obj in objs)
                                    result.Add(obj);
                            }
                        }

                return result;
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
        Task<IOrganization> ITenantActions.CreateOrganizationAsync(IOrganization organization, Action<OrganizationCreationOptionsBuilder> creationOptionsAction, CancellationToken cancellationToken)
        {
            var builder = new OrganizationCreationOptionsBuilder();
            creationOptionsAction(builder);
            var options = builder.Build();

            return this.AsInterface.CreateOrganizationAsync(organization, options, cancellationToken);
        }
 IOrganization ITenantActionsSync.CreateOrganization(IOrganization organization)
     => this.GetInternalSyncDataStore().Create(OrganizationsPropertyName, organization);
 public OrganizationController(IOrganization organization)
 {
     this.organization = organization;
 }
예제 #43
0
 public static IList<IDepartment> Get_Departments(IOrganization organization, IObjectSpace objectSpace)
 {
     var criteria = CriteriaOperator.Parse("[Department] = ?", organization);
     return objectSpace.GetObjects<IDepartment>(criteria);
 }
		/// <summary>
		/// Creasts an instance of the <see cref="OrganizationViewModel"/> class.
		/// </summary>
		/// <param name="organization">
		/// Organization being wrapped
		/// </param>
		public OrganizationViewModel(IOrganization organization)
		{
			this.Organization = organization;
		}
예제 #45
0
 public bool IsChildrenOf(IOrganization parent)
 {
     throw new NotImplementedException();
 }
예제 #46
0
        /// <summary>
        /// 产生文件版本
        /// </summary>
        /// <param name="resourceID">新表单ID</param>
        /// <param name="wfProcessID">新工作流ID</param>
        /// <param name="wfActivityID">新工作流节点ID</param>
        /// <param name="wfActivityName">新工作流节点名称</param>
        /// <param name="department">产生的副本所在的部门</param>
        /// <returns>生成的副本</returns>
        public MaterialList GenerateOtherVersion(string resourceID, string wfProcessID, string wfActivityID, string wfActivityName, IOrganization department)
        {
            ExceptionHelper.TrueThrow <ArgumentNullException>(this == null, "this");
            ExceptionHelper.CheckStringIsNullOrEmpty(resourceID, "resourceID");
            ExceptionHelper.CheckStringIsNullOrEmpty(wfProcessID, "wfProcessID");
            ExceptionHelper.CheckStringIsNullOrEmpty(wfActivityID, "wfActivityID");

            MaterialList materialList = new MaterialList();

            foreach (Material material in this)
            {
                materialList.Add(material.GenerateOtherVersion(resourceID, wfProcessID, wfActivityID, wfActivityName, department));
            }

            return(materialList);
        }
예제 #47
0
 public static void OnDeleting(IOrganization organization)
 {
     throw new UserFriendlyException("This object cannot be deleted.");
 }
 Task<IOrganization> ITenantActions.CreateOrganizationAsync(IOrganization organization, CancellationToken cancellationToken)
     => this.GetInternalAsyncDataStore().CreateAsync(OrganizationsPropertyName, organization, cancellationToken);
예제 #49
0
		/// <summary>
		/// 判断对象是否是人家的子对象
		/// </summary>
		/// <param name="parent"></param>
		/// <returns></returns>
		public bool IsChildrenOf(IOrganization parent)
		{
			bool result = false;

			if (Ogu != null)
				result = Ogu.IsChildrenOf(parent);

			return result;
		}
예제 #50
0
		/// <summary>
		/// 判断当前用户是否在这个机构中
		/// </summary>
		/// <param name="parent"></param>
		/// <param name="includeSideline"></param>
		/// <returns></returns>
		public bool IsChildrenOf(IOrganization parent, bool includeSideline)
		{
			bool result = false;

			if (Ogu != null)
				result = BaseUser.IsChildrenOf(parent, includeSideline);

			return result;
		}
예제 #51
0
 /// <summary>
 ///     The PersonController
 /// </summary>
 /// <param name="clusterClient"></param>
 /// <param name="organization"></param>
 public PersonController(IClusterClient clusterClient, IOrganization organization)
 {
     this.clusterClient = clusterClient;
     this.organization  = organization;
 }
예제 #52
0
        private OguDataCollection <IOguObject> InnerCheckInputOuUser(string chkString)
        {
            ServiceBrokerContext.Current.Timeout = QueryUserTimeout;

            IOrganization root = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath);

            OguDataCollection <IOguObject> users       = QueryChildrenBySelectMask(root, chkString);
            OguDataCollection <IOguObject> forSelected = new OguDataCollection <IOguObject>();

            for (int i = 0; i < users.Count; i++)
            {
                if (((int)users[i].ObjectType & (int)this.SelectMask) != 0)
                {
                    forSelected.Add(OguBase.CreateWrapperObject(users[i]));
                }
            }

            if (this.CanSelectRoot)
            {
                if (root.DisplayName.IndexOf(chkString) == 0)
                {
                    forSelected.Add(OguBase.CreateWrapperObject(root));
                }
            }

            //沈峥添加,修饰一下Description
            //IOrganization root = OguMechanismFactory.GetMechanism().GetRoot();

            foreach (OguBase obj in forSelected)
            {
                string path = string.Empty;
                if (obj.Parent != null)
                {
                    path = obj.Parent.FullPath;
                }

                if (path.IndexOf(root.FullPath) == 0)
                {
                    path = path.Substring(root.FullPath.Length);
                    path = path.Trim('\\');
                }

                if (obj is OguBase)
                {
                    //v-weirf changed, for Description setable,obj must be OguBase
                    if (obj is IUser)
                    {
                        ((OguBase)obj).Description = string.Format("{0} {1}", ((IUser)obj).Occupation, path);
                    }
                    else if (obj is IOrganization)
                    {
                        ((OguBase)obj).Description = path;
                    }
                    else
                    {
                        ((OguBase)obj).Description = path;
                    }
                }
            }

            return(forSelected);
        }
예제 #53
0
 public OrganizationService(IOrganization dao)
 {
     this.dao = dao;
 }
예제 #54
0
		/// <summary>
		/// 产生文件版本
		/// </summary>
		/// <param name="rootPath">文件夹所在根目录路径</param>
		/// <param name="resourceID">新表单ID</param>
		/// <param name="wfProcessID">新工作流ID</param>
		/// <param name="wfActivityID">新工作流节点ID</param>
		/// <param name="wfActivityName">新工作流节点名称</param>
		/// <param name="department">产生的副本所在的部门</param>
		/// <returns>生成的版本</returns>
		public Material GenerateOtherVersion(string resourceID, string wfProcessID, string wfActivityID, string wfActivityName, IOrganization department)
		{
			ExceptionHelper.TrueThrow<ArgumentNullException>(this == null, "this");
			ExceptionHelper.CheckStringIsNullOrEmpty(resourceID, "resourceID");
			ExceptionHelper.CheckStringIsNullOrEmpty(wfProcessID, "wfProcessID");
			ExceptionHelper.CheckStringIsNullOrEmpty(wfActivityID, "wfActivityID");

			Material material = new Material();

			material.id = Guid.NewGuid().ToString();
			material.Department = department;
			material.resourceID = resourceID;
			material.sortID = this.sortID;
			material.materialClass = this.materialClass;
			material.title = this.title;
			material.pageQuantity = this.pageQuantity;
			material.relativeFilePath = this.relativeFilePath.Replace(this.id, material.ID);
			material.originalName = this.originalName;
			material.creator = this.creator;
			material.lastUploadTag = this.lastUploadTag;
			material.createDateTime = this.createDateTime;
			material.modifyTime = this.modifyTime;
			material.wfProcessID = wfProcessID;
			material.wfActivityID = wfActivityID;
			material.wfActivityName = wfActivityName;
			material.parentID = this.id;
			material.sourceMaterial = this;
			material.versionType = MaterialVersionType.Normal;
			material.extraData = this.extraData;
			material.showFileUrl = this.showFileUrl;

			return material;
		}
예제 #55
0
 public PlanProcuringEntity(IOrganization organization)
     : base(organization)
 {
     Kind = (organization as IProcuringEntity)?.Kind;
 }
예제 #56
0
        private void RestoreConclusionFromTemplate(IExamination examination, IOrganization organization, bool PopulateRequired = true)
        {
            FileSystemStoreObject template = organization.ConclusionTemplate;
            if (template != null)
            {
                try
                {
                    ////CopyToStoreObject(template.RealFileName, examination.ConclusionFile);
                    //CopyToFile(template.RealFileName, examination.ConclusionFile.RealFileName);

                    if (PopulateRequired == true)
                    {// если требуется заполнить восстановленый шаблон
                        Dictionary<string, string> dictionary = GetExaminationData(examination, organization);
                        DocumentServer.RestoreFromTemplate(template.RealFileName, examination.ConclusionFile.RealFileName, dictionary, examination.Patient.FullName);
                        examination.IsPopulatedConclusion = true;
                    }
                    else
                    {
                        DocumentServer.RestoreFromTemplate(template.RealFileName, examination.ConclusionFile.RealFileName, examination.Patient.FullName);

                        examination.IsPopulatedConclusion = false;
                    }
                    //View.ObjectSpace.CommitChanges();
                }
                catch (IOException)
                {
                    string message = CaptionHelper.GetLocalizedText("Exceptions\\FileProcessing", "FileOpenInExternalProgram");

                    XtraMessageBox.Show(message, Application.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception)
                {
                    string message = CaptionHelper.GetLocalizedText("Exceptions\\FileProcessing", "UnknownFileProcessingError");
                    XtraMessageBox.Show(message, Application.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error);

                }
            }
        }
예제 #57
0
        public async Task <int> SaveOrgInfo(IOrganization entity, int type, string viewRootCode)
        {
            int ret = -1;

            using (var scope = this._repo.BeginTransScope())
            {
                bool inView = await CheckOrgCodeInView(entity.ParentCode, viewRootCode);

                if (!inView)
                {
                    throw new BizException("没有相应的权限");
                }
                if (type == 1) // 新增
                {
                    // 校验
                    bool result = await this._repo.CheckOrgCode(entity.OrgCode);

                    if (!result)
                    {
                        return(-1);
                    }
                    if (string.IsNullOrEmpty(entity.ParentCode))  // 根组织
                    {
                        entity.UnitCode = entity.OrgCode;
                        entity.UnitName = entity.OrgName;

                        int maxPos = await _repo.GetMaxOrgPoint();

                        entity.Left  = maxPos + 1;
                        entity.Right = entity.Left + 1;
                    }
                    else
                    {
                        IOrganization pOrg = await _repo.GetOrgInfoAsync(entity.ParentCode);

                        if (pOrg == null)
                        {
                            throw new BizException("父组织不存在,请检查后重新保存");
                        }

                        if (entity.OrgType == (sbyte)OrgType.Division || entity.OrgType == (sbyte)OrgType.Company)
                        {
                            entity.UnitCode = entity.OrgCode;
                            entity.UnitName = entity.OrgName;
                        }
                        else
                        {
                            entity.UnitCode = pOrg.UnitCode;
                            entity.UnitName = pOrg.UnitName;
                        }
                        // 为新的节点腾出空间来
                        await _repo.UpdateOrgPoint(pOrg.Right);

                        entity.Left  = pOrg.Right;
                        entity.Right = entity.Left + 1;
                    }
                    await this._repo.AddOrg(entity);

                    ret = 1;
                }
                else
                {
                    ret = await this._repo.UpdateOrg(entity);
                }
                scope.Complete();
            }
            return(ret);
        }
 public WfDepartmentResourceDescriptor(IOrganization org)
 {
     this._Department = (IOrganization)OguOrganization.CreateWrapperObject(org);
 }
예제 #59
0
 public bool IsChildrenOf(IOrganization parent)
 {
     throw new NotImplementedException();
 }
예제 #60
0
		private OguDataCollection<IOguObject> QueryChildrenBySelectMask(IOrganization dept, string searchString)
		{
			ServiceBrokerContext.Current.SaveContextStates();
			try
			{
				var queryImpl = UserOUControlSettings.GetConfig().UserOUControlQuery;

				ServiceBrokerContext.Current.ListObjectCondition = ShowDeletedObjects ? ListObjectMask.All : ListObjectMask.Common;

				OguDataCollection<IOguObject> result = new OguDataCollection<IOguObject>();

				if (SelectMask == UserControlObjectMask.Organization)
				{
					OguObjectCollection<IOrganization> orgs = queryImpl.QueryDescendants<IOrganization>(SchemaQueryType.Organizations, dept, searchString, MaxQueryCount);  //dept.QueryChildren<IOrganization>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
					foreach (IOrganization org in orgs)
						result.Add(org);
				}
				else
					if (SelectMask == UserControlObjectMask.Group)
					{
						OguObjectCollection<IGroup> groups = queryImpl.QueryDescendants<IGroup>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount); // dept.QueryChildren<IGroup>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
						foreach (IGroup group in groups)
							result.Add(group);
					}
					else
						if (SelectMask == UserControlObjectMask.User || SelectMask == (UserControlObjectMask.User | UserControlObjectMask.Sideline))
						{
							OguObjectCollection<IUser> users = queryImpl.QueryDescendants<IUser>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount); //dept.QueryChildren<IUser>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
							foreach (IUser user in users)
								result.Add(user);
						}
						else
						{
							if ((int)(SelectMask & (UserControlObjectMask.Group | UserControlObjectMask.User | UserControlObjectMask.Organization)) != 0)
							{
								OguObjectCollection<IOguObject> objs = queryImpl.QueryDescendants<IOguObject>(SchemaQueryType.Users | SchemaQueryType.Groups | SchemaQueryType.Organizations, dept, searchString, MaxQueryCount); //dept.QueryChildren<IOguObject>(searchString, true, SearchLevel.SubTree, MaxQueryCount);

								foreach (IOguObject obj in objs)
									result.Add(obj);
							}
						}

				return result;
			}
			finally
			{
				ServiceBrokerContext.Current.RestoreSavedStates();
			}
		}