コード例 #1
0
ファイル: MFilesUtil.cs プロジェクト: weijx-xa/test
 /// <summary>
 /// 根据ID获取MFiles对象
 /// </summary>
 /// <param name="vault">库</param>
 /// <param name="objType">对象类型</param>
 /// <param name="objId">对象ID</param>
 /// <returns></returns>
 public static ObjectVersionAndProperties GetVerAndProperties(MFilesAPI.Vault vault, int objType, int objId)
 {
     try
     {
         var obj = new ObjID();
         obj.SetIDs(objType, objId);
         return(vault.ObjectOperations.GetLatestObjectVersionAndProperties(obj, false, false));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
ファイル: AccountController.cs プロジェクト: weijx-xa/test
        private bool CheckTaskInOneVault(MFilesAPI.Vault vault, long currentuserid)
        {
            try
            {
                var loginName = _userService.GetUserById(currentuserid).GetAccountName();
                var mfuserid  = MfUserUtils.GetUserAccount(vault, loginName);
                //var ClassTaskApprove =
                //    vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass,
                //        "ClassTaskApprove");
                var ClassNotification =
                    vault.GetMetadataStructureItemIDByAlias(MFMetadataStructureItem.MFMetadataStructureItemClass,
                                                            MfilesAliasConfig.ClassNotification);
                var pos = vault.Name.LastIndexOf('-');
                if (pos < 1)
                {
                    pos = vault.Name.Length;
                }
                //  var tasktitle = vault.Name.Substring(0, pos) + "-";
                if (mfuserid != null)
                {
                    //{
                    //    var scs = new SearchConditions();
                    //    {
                    //        var sc = new SearchCondition();
                    //        sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                    //        sc.Expression.DataPropertyValuePropertyDef =
                    //            (int) MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                    //        sc.TypedValue.SetValueToLookup(new Lookup
                    //        {
                    //            Item = (int) MFBuiltInObjectClass.MFBuiltInObjectClassGenericAssignment
                    //        });
                    //        scs.Add(-1, sc);
                    //    }
                    //    {
                    //        var sc = new SearchCondition();
                    //        sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                    //        sc.Expression.DataPropertyValuePropertyDef =
                    //            (int) MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
                    //        sc.TypedValue.SetValueToLookup(new Lookup {Item = (int) mfuserid});
                    //        scs.Add(-1, sc);
                    //    }
                    //    var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
                    //        MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions.Count;
                    //    if (ovs > 0) return true;
                    //}
                    {
                        var scs = new SearchConditions();
                        {
                            var sc = new SearchCondition();
                            sc.ConditionType = MFConditionType.MFConditionTypeNotEqual;
                            sc.Expression.DataPropertyValuePropertyDef =
                                (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                            sc.TypedValue.SetValueToLookup(new Lookup {
                                Item = ClassNotification
                            });
                            scs.Add(-1, sc);
                        }
                        {
                            var sc = new SearchCondition();
                            sc.ConditionType = MFConditionType.MFConditionTypeEqual;
                            sc.Expression.DataPropertyValuePropertyDef =
                                (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
                            sc.TypedValue.SetValueToLookup(new Lookup {
                                Item = (int)mfuserid
                            });
                            scs.Add(-1, sc);
                        }
                        var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
                                                                                              MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions.Count;
                        if (ovs > 0)
                        {
                            return(true);
                        }
                    }
//                    {
////工作流任务

//                        var scs = new SearchConditions();
//                        {
//                            var sc = new SearchCondition();
//                            sc.ConditionType = MFConditionType.MFConditionTypeNotEqual;
//                            sc.Expression.SetStatusValueExpression(MFStatusType.MFStatusTypeObjectTypeID);

//                            sc.TypedValue.SetValueToLookup(new Lookup
//                            {
//                                Item = (int) MFBuiltInObjectType.MFBuiltInObjectTypeAssignment
//                            });
//                            scs.Add(-1, sc);
//                        }
//                        {
//                            var sc = new SearchCondition();
//                            sc.ConditionType = MFConditionType.MFConditionTypeEqual;
//                            sc.Expression.DataPropertyValuePropertyDef =
//                                (int) MFBuiltInPropertyDef.MFBuiltInPropertyDefAssignedTo;
//                            sc.TypedValue.SetValueToLookup(new Lookup {Item = (int) mfuserid});
//                            scs.Add(-1, sc);
//                        }
//                        var ovs = vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(scs,
//                            MFSearchFlags.MFSearchFlagNone, false, 0, 0).ObjectVersions.Count;
//                        if (ovs > 0) return true;
//                    }
                }
            }
            catch (Exception ex)
            {
                Log.Info(string.Format("CheckTaskInOneVault {0},{1} error:{2}", vault.Name, currentuserid, ex.Message));
            }
            return(false);
        }