public void Save(List<WidgetSettings> settings, Guid widgetID, Guid userID)
        {
            if (widgetID.Equals(BirthdayReminderWidget.WidgetID))
            {
                var widgetSettings = SettingsManager.Instance.LoadSettingsFor<BirthdayReminderWidgetSettings>(userID);
                var data = settings[0].ConvertToNumber();
                widgetSettings.DaysBeforeBirthday = data.Value;
                SettingsManager.Instance.SaveSettingsFor<BirthdayReminderWidgetSettings>(widgetSettings, userID);
            }

            else if (widgetID.Equals(ProductActivity.WidgetID))
            {
                var widgetSettings = SettingsManager.Instance.LoadSettingsFor<ProductActivityWidgetSettings>(userID);
                var data = settings[0].ConvertToNumber();
                widgetSettings.CountActivities = data.Value;
                SettingsManager.Instance.SaveSettingsFor<ProductActivityWidgetSettings>(widgetSettings, userID);
            }

            else if (widgetID.Equals(NewEmployeeWidget.WidgetID))
            {
                var widgetSettings = SettingsManager.Instance.LoadSettingsFor<NewEmployeeWidgetSettings>(userID);
                var data = settings[0].ConvertToNumber();
                widgetSettings.NewWorkerCount = data.Value;
                SettingsManager.Instance.SaveSettingsFor<NewEmployeeWidgetSettings>(widgetSettings, userID);
            }
        }
        private object GetService( Guid guid )
        {
            if ( serviceProvider == null )
                return null;

            // short circuit if possible
            if ( guid.Equals( Guid.Empty ) )
                return null;
            else if ( guid.Equals( typeof( IOleServiceProvider ).GUID ) )
                return serviceProvider;

            var service = IntPtr.Zero;
            var iid = IUnknownInterfaceId;

            // query visual studio provider for service
            if ( ( serviceProvider.QueryService( ref guid, ref iid, out service ) < 0 ) || ( service == IntPtr.Zero ) )
                return null;

            try
            {
                // unwrap unmanaged IUnknown to System.Object
                return Marshal.GetObjectForIUnknown( service );
            }
            finally
            {
                // always release unmanaged resource
                Marshal.Release( service );
            }
        }
Example #3
0
 public static bool IsValidGuidScheme(Guid guid)
 {
     if (!guid.Equals(InstallReferenceGuid.UninstallSubkeyGuid) && !guid.Equals(InstallReferenceGuid.FilePathGuid) && !guid.Equals(InstallReferenceGuid.OpaqueGuid))
         return guid.Equals(Guid.Empty);
     else
         return true;
 }
Example #4
0
 public static bool IsValidInstallGuidScheme(Guid guid)
 {
     return (guid.Equals(UninstallSubkeyGuid) ||
             guid.Equals(FilePathGuid) ||
             guid.Equals(OpaqueGuid) ||
             guid.Equals(Guid.Empty));
 }
        private static void LogCommand(LogCommandSource logCommandSource, Guid pguidCmdGroup, uint nCmdID)
        {
#if DEBUG
            string commandName = nCmdID.ToString();
            string commandType = "unknown";
            //if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.CSharpGroup_guid))
            //{
            //} 
            //else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.ShellMainMenu_guid))
            //{
            //}
            //else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.SolutionExplorerPivotList_guid))
            //{
            //}
            if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet11_guid))
            {
                var cmd = (Microsoft.VisualStudio.VSConstants.VSStd11CmdID)nCmdID;
                commandName = cmd.ToString();
                commandType = cmd.GetType().ToString();
            }
            else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet12_guid))
            {
                var cmd = (Microsoft.VisualStudio.VSConstants.VSStd12CmdID)nCmdID;
                commandName = cmd.ToString();
                commandType = cmd.GetType().ToString();
            }
            else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet2010_guid))
            {
                var cmd = (Microsoft.VisualStudio.VSConstants.VSStd2010CmdID)nCmdID;
                commandName = cmd.ToString();
                commandType = cmd.GetType().ToString();
            }
            else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet2K_guid))
            {
                var cmd = (Microsoft.VisualStudio.VSConstants.VSStd2KCmdID)nCmdID;
                commandName = cmd.ToString();
                commandType = cmd.GetType().ToString();
            }
            else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.StandardCommandSet97_guid))
            {
                var cmd = (Microsoft.VisualStudio.VSConstants.VSStd97CmdID)nCmdID;
                commandName = cmd.ToString();
                commandType = cmd.GetType().ToString();
            }
            else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.UIHierarchyWindowCommandSet_guid))
            {
                var cmd = (Microsoft.VisualStudio.VSConstants.VsUIHierarchyWindowCmdIds)nCmdID;
                commandName = cmd.ToString();
                commandType = cmd.GetType().ToString();
            }
            //else if (pguidCmdGroup.Equals(Microsoft.VisualStudio.VSConstants.CMDSETID.VsDocOutlinePackageCommandSet_guid))
            //{
            //}

            Trace.WriteLine(String.Format("~~~* {0}: {1}{2}", logCommandSource.ToString(), commandType, commandName));
#endif
        }
 public bool CheckPermissions(Guid shortcutID, string currentUrl)
 {
     if (shortcutID.Equals(new Guid("98DB8D88-EDF2-4f82-B3AF-B95E87E3EE5C")) || 
         shortcutID.Equals(new Guid("20673DF0-665E-4fc8-9B44-D48B2A783508")))
     {
         return ASC.Core.SecurityContext.CheckPermissions(new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(
             SecurityContext.CurrentAccount.ID)), ASC.Blogs.Core.Constants.Action_AddPost);
     }            
     
     return false;
 }
        public static bool CheckPermissions(Guid shortcutID)
        {
            if (shortcutID.Equals(new Guid("A04A7DBF-6B73-4579-BECE-3F6E346133DB")))
            {
                return ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null);
            }
            else if (shortcutID.Equals(new Guid("87A6B7FC-E872-49db-A327-CEA9CBA59CCC")))
            {
                return ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessTagEditor, null);
            }
            else if (shortcutID.Equals(new Guid("24CD48B2-C40F-43ec-B3A6-3212C51B8D34")) || shortcutID.Equals(new Guid("84DF7BE7-315B-4ba3-9BE1-1E348F6697A5")))
            {
                var ispool = shortcutID.Equals(new Guid("84DF7BE7-315B-4ba3-9BE1-1E348F6697A5"));
                if (ForumManager.Instance.CurrentPage.Page == ForumPage.TopicList || ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost)
                {
                    var threadID = GetThreadID();
                    if (threadID != 0)
                    {
                        return ValidateCreateTopicOrPoll(ispool, new Thread { ID = threadID });
                    }
                    if (ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost)
                    {

                        var topicID = GetTopicID();
                        if (topicID != 0)
                        {
                            return ValidateCreateTopicOrPoll(ispool, new Topic { ID = topicID });
                        }
                    }
                }
                else if (ForumManager.Instance.CurrentPage.Page == ForumPage.PostList || ForumManager.Instance.CurrentPage.Page == ForumPage.EditTopic)
                {
                    var topicID = GetTopicID();
                    if (topicID != 0)
                    {
                        return ValidateCreateTopicOrPoll(ispool, new Topic { ID = topicID });
                    }
                }
                return ValidateCreateTopicOrPoll(ispool);
            }
            else if (shortcutID.Equals(new Guid("FA5C4BD5-25E7-41c8-A0DC-64DC2A977391")))
            {
                if (ForumManager.Instance.CurrentPage.Page == ForumPage.PostList || ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost || ForumManager.Instance.CurrentPage.Page == ForumPage.EditTopic)
                {
                    var topicID = GetTopicID();
                    if (topicID != 0)
                    {
                        return ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.PostCreate, new Topic { ID = topicID });
                    }
                }
            }
            return false;
        }
Example #8
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Call Equals with self instance");

        try
        {
            Guid guid = Guid.Empty;

            if (!guid.Equals(guid))
            {
                TestLibrary.TestFramework.LogError("001.1", "Calling Equals with self instance returns false");
                retVal = false;
            }

            // double check
            if (!guid.Equals(guid))
            {
                TestLibrary.TestFramework.LogError("001.2", "Calling Equals with self instance returns false");
                retVal = false;
            }
            
            byte[] bytes = new byte[c_GUID_BYTE_ARRAY_SIZE];
            TestLibrary.Generator.GetBytes(-55, bytes);
            guid = new Guid(bytes);
            
            if (!guid.Equals(guid))
            {
                TestLibrary.TestFramework.LogError("001.3", "Calling Equals with self instance returns false");
                TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLES] guid = " + guid);
                retVal = false;
            }

            // double check
            if (!guid.Equals(guid))
            {
                TestLibrary.TestFramework.LogError("001.4", "Calling Equals with self instance returns false");
                TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLES] guid = " + guid);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
        public bool Check(List<WidgetSettings> settings, Guid widgetID, Guid userID, out string errorMessage)
        {
            errorMessage = "";

            //bithdays
            if (widgetID.Equals(BirthdayReminderWidget.WidgetID))
            {
                if (settings == null || settings.Count != 1)
                    return false;

                var data = settings[0].ConvertToNumber();
                if (data.Value > 0 && data.Value <= 30)
                    return true;


                errorMessage = Resources.Resource.ErrorNotCorrectDaysBeforeBirthdaySettings;
                return false;
            }

            //user activity
            else if (widgetID.Equals(ProductActivity.WidgetID))
            {
                if (settings == null || settings.Count != 1)
                    return false;

                var data = settings[0].ConvertToNumber();
                if (data.Value > 0 && data.Value <= 30)
                    return true;


                errorMessage = Resources.Resource.ErrorNotCorrectCountActivities;
                return false;
            }

             //new employees
            else if (widgetID.Equals(NewEmployeeWidget.WidgetID))
            {
                if (settings == null || settings.Count != 1)
                    return false;

                var data = settings[0].ConvertToNumber();
                if (data.Value > 0 && data.Value <= 20)
                    return true;

                errorMessage = Resources.Resource.ErrorNotCorrectNewWorkerCountSettings;
                return false;
            }

            return false;
        }
        protected void BindDictionaryBranch(JsonTreeNode branch, Guid parentDict)
        {
            using (DictionaryProvider provider = new DictionaryProvider())
            {
                List<DictionaryTree> dicts = provider.GetDictionaryTreeList(parentDict, this.Roles);

                foreach (DictionaryTree dict in dicts)
                {
                    JsonTreeNode tempNode = new JsonTreeNode(dict.Name);
                    branch.children.Add(tempNode);
                    BindDictionaryBranch(tempNode, dict.ID);
                }
                if (!parentDict.Equals(Guid.Empty))
                {
                    DictionaryTree entity = provider.DictionaryTrees.SingleOrDefault(d => d.ID == parentDict);
                    List<DictionaryProperty> source = provider.GetAvailableDictionaryProperties(this.Roles, entity.DictionaryID);

                    foreach (DictionaryProperty prop in source)
                    {
                        JsonTreeNode tempNode = new JsonTreeNode(prop.Name);
                        tempNode.uid = String.Format("{0}_{1}", prop.Dictionary.TableName, prop.ColumnName);
                        tempNode.leaf = true;
                        branch.children.Add(tempNode);
                    }
                }
            }
        }
        public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (pguidCmdGroup.Equals(Constants.guidStandardCommandSet2K) && nCmdID == (uint)VSConstants.VSStd2KCmdID.INCLUDEINPROJECT)
                return IncludeItem();

            return VSConstants.S_OK;
        }
        public JObject UploadFile(Guid documentId, string filename, string revision, string changeReason, DocumentCheckInState checkInState, List<KeyValuePair<string, string>> indexFields, byte[] file)
        {
            if (documentId.Equals(Guid.Empty))
            {
                throw new ArgumentException("DocumentId is required but was an empty Guid", "documentId");
            }

            if (string.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentException("filename is required but was empty", "filename");
            }
            var jobject = new JObject();
            foreach (var indexField in indexFields)
            {
                jobject.Add(new JProperty(indexField.Key, indexField.Value));
            }
            var jobjectString = JsonConvert.SerializeObject(jobject);

            var postData = new List<KeyValuePair<string, string>>
            {       
                new KeyValuePair<string, string>("documentId", documentId.ToString()),
                new KeyValuePair<string, string>("filename", filename),
                new KeyValuePair<string, string>("revision", revision),
                new KeyValuePair<string, string>("changeReason", changeReason),
                new KeyValuePair<string, string>("checkInDocumentState", checkInState.ToString()),
                new KeyValuePair<string, string>("indexFields", jobjectString)
            };

            return HttpHelper.PostMultiPart(GlobalConfiguration.Routes.Files, "", GetUrlParts(), this.ApiTokens, postData, filename, file);
        }
Example #13
0
        public void Delete(Guid id)
        {
            if (id.Equals(Guid.Empty))
                throw new ArgumentException("Employee id cannot be empty!");

            try
            {
                using (OpenPOSDbEntities ctx = new OpenPOSDbEntities())
                {
                    var entity = GetEmployeeById(id);

                    if (entity != null)
                    {
                        ctx.Employees.Attach(entity);
                        ctx.Employees.DeleteObject(entity);
                        ctx.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.Error("Error while deleting Employee", ex);
                throw ex;
            }
        }
        /// <summary>
        /// create a new document
        /// </summary>
        /// <param name="folderId"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="revision"></param>
        /// <param name="documentState"></param>
        /// <returns></returns>
        public Document CreateDocument(Guid folderId, string name, string description, string revision, DocumentState documentState)
        {
            if (folderId.Equals(Guid.Empty))
            {
                throw new ArgumentException("FolderId is required but was an empty Guid", "folderId");
            }

            dynamic postData = new ExpandoObject();
            postData.folderId = folderId;

            if (!String.IsNullOrWhiteSpace(name))
            {
                postData.Name = name;
            }
            if (!String.IsNullOrWhiteSpace(description))
            {
                postData.Description = description;
            }
            if (!String.IsNullOrWhiteSpace(revision))
            {
                postData.Revision = revision;
            }
            postData.documentState = documentState;

            return HttpHelper.Post<Document>(GlobalConfiguration.Routes.Documents, string.Empty, GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData);
        }
Example #15
0
 public Node FindNode(Guid guid)
 {
     foreach (Node node in Nodes)
         if (guid.Equals(node.Id))
             return node;
     return null;
 }
        public List<DocumentShare> ShareDocument(Guid dlId, List<Guid> usIdList, string message = "", RoleType linkRole = RoleType.Viewer)
        {
            if (dlId.Equals(Guid.Empty))
            {
                throw new ArgumentException("dlId is required but was an empty Guid", "dlId");
            }

            switch (linkRole)
            {
                case RoleType.Owner:
                case RoleType.Editor:
                    linkRole = RoleType.Editor;
                    break;
                default:
                    linkRole = RoleType.Viewer;
                    break;
            }

            var jarray = new JArray();
            foreach (var usId in usIdList)
            {
                jarray.Add(new JObject(new JProperty("id", usId)));
            }
            var jobjectString = JsonConvert.SerializeObject(jarray);

            dynamic postData = new ExpandoObject();
            postData.users = jobjectString;
            postData.message = message;
            postData.baseUrl = ShareUrl;
            postData.isPublic = "true";
            postData.linkRole = linkRole.ToString().ToLower();

            return HttpHelper.PutListResult<DocumentShare>(VVRestApi.GlobalConfiguration.Routes.DocumentsIdShares, "", GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData, dlId);
        }
Example #17
0
        public static Guid OrgID; //全局组织ID

        #endregion Fields

        #region Methods

        /// <summary>
        /// 右键 添加角色
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult AddNewRole(Guid id)
        {
            MemberRole oMemberRole = new MemberRole
            {
                Name = NewResource(ModelEnum.ResourceType.STRING,OrgID)
            };
            if (id.Equals(Guid.Empty))
            {
                oMemberRole.aParent = null;
            }
            else
            {
                MemberRole oParentRole = (from o in dbEntity.MemberRoles where (o.Gid == id) select o).Single();
                oMemberRole.aParent = id;
                oMemberRole.Parent = oParentRole;
            }
            var oRoleType = (from o in dbEntity.GeneralStandardCategorys.Include("Name") where (o.Deleted == false && o.Ctype == 2) select o).ToList();
            int noRoleType = oRoleType.Count;
            List<SelectListItem> list = new List<SelectListItem>();
            for (int i = 0; i < noRoleType; i++)
            {
                SelectListItem item = new SelectListItem
                {
                    Text = oRoleType[i].Name.GetResource(CurrentSession.Culture),
                    Value = oRoleType[i].Gid.ToString()

                };
                list.Add(item);
            }
            ViewBag.olist = list;
            return View("MemberRoleAdd",oMemberRole);
        }
        public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (pguidCmdGroup.Equals(Constants.guidStandardCommandSet2K) && prgCmds[0].cmdID == (uint)VSConstants.VSStd2KCmdID.INCLUDEINPROJECT)
                prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;

            return VSConstants.S_OK;
        }
        public static object ReturnNullIfEmpty(Guid value)
        {
            if (value.Equals(Guid.Empty))
                return null;

            return value;
        }
Example #20
0
        public FLPreview(string xomlFile, string ruleFile, Guid flInstanceId, object[] _clientInfo, string _currentAcitivity, DataSet hostDataSet, string _roleID, string _orgKind, object[] keyValues)
        {
            clientInfo = _clientInfo;
            currentAcitivity = _currentAcitivity;
            role = _roleID;
            // orgKind = _orgKind;
            //create or find instance

            if (flInstanceId.Equals(Guid.Empty))
            {
                instance = Global.FLRuntime.CreateFLInstance(flInstanceId, xomlFile, ruleFile, _clientInfo, role, hostDataSet, _orgKind);
                currentAcitivity = instance.RootFLActivity.ChildFLActivities[0].Name;
            }
            else
            {
                instance = Global.FLRuntime.GetFLInstance(flInstanceId, _clientInfo);
                xomlFile = instance.FLDefinitionFile;
            }
            instance.SetKeyValues(keyValues);
            instance._hostDataSet = HostTable.GetHostDataSet(instance, keyValues, _clientInfo);
            if (instance._hostDataSet.Tables[0].Rows.Count == 0)
            {
                instance._hostDataSet = hostDataSet;//设置host表
            }

            message = SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(_clientInfo[0]))[0]), "FLDesigner", "FLDesigner", "FLPreview");
            Document.Load(xomlFile); //载入xoml

            //add subflow

            InsertSubFlow(Document.DocumentElement);
        }
Example #21
0
        public void Create(Guid blogId, string title)
        {
            Contract.Requires(!blogId.Equals(Guid.Empty));
            Contract.Requires(!string.IsNullOrEmpty(title));

            Apply(new BlogPostCreated(Id, blogId, title));
        }
Example #22
0
		public void Etag_guid_comparision()
		{
			var etag = new Raven.Abstractions.Data.Etag("01234567-8901-2345-6789-012345678901");
			var guid = new Guid("01234567-8901-2345-6789-012345678901");
			Assert.True(etag.Equals(guid));
			Assert.True(guid.Equals(etag));
		}
        public SalesOrder GetSalesOrder(Guid orderId)
        {
            if(orderId.Equals(Guid.Empty)) return null;

            int cByte = ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.ORDER_ID;
            byte[] sendByte = new byte[cByte];
            int byteOffset = 0;
            Array.Copy(BitConverter.GetBytes((int)Command.ID_GET_SALESORDER), sendByte, BasicTypeLength.INT32);
            byteOffset = BasicTypeLength.INT32;
            Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32);
            byteOffset += BasicTypeLength.INT32;

            //orderID
            byte[] tempByte = Encoding.UTF8.GetBytes(orderId.ToString());
            Array.Copy(tempByte, 0, sendByte, byteOffset, tempByte.Length);
            byteOffset += ParamFieldLength.ORDER_ID;

            Int32 operCode = 0;
            SalesOrder salesOrder = null;
            using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port))
            {
                Byte[] receiveData = null;
                operCode = socket.SendReceive(sendByte, out receiveData);
                if (operCode == (int)RET_VALUE.SUCCEEDED)
                {
                    string strReceive = Encoding.UTF8.GetString(receiveData, ParamFieldLength.PACKAGE_HEAD, receiveData.Length - ParamFieldLength.PACKAGE_HEAD);
                    salesOrder = JsonConvert.DeserializeObject<SalesOrder>(strReceive);
                }
                socket.Close();
            }
            return salesOrder;
        }
        public DocumentShare ShareDocument(Guid dlId, Guid usId, string message = "", RoleType linkRole = RoleType.Viewer)
        {
            if (dlId.Equals(Guid.Empty))
            {
                throw new ArgumentException("dlId is required but was an empty Guid", "dlId");
            }
            if (usId.Equals(Guid.Empty))
            {
                throw new ArgumentException("dlId is required but was an empty Guid", "usId");
            }

            switch (linkRole)
            {
                case RoleType.Owner:
                case RoleType.Editor:
                    linkRole = RoleType.Editor;
                    break;
                default:
                    linkRole = RoleType.Viewer;
                    break;
            }

            dynamic postData = new ExpandoObject();
            postData.users = usId;
            postData.message = message;
            postData.baseUrl = ShareUrl;
            postData.isPublic = "true";
            postData.linkRole = linkRole.ToString().ToLower();

            return HttpHelper.Put<DocumentShare>(VVRestApi.GlobalConfiguration.Routes.DocumentsIdShares, "", GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData, dlId, usId);
        }
		public bool CheckPermissions(Guid shortcutID, string currentUrl)
		{
			if (shortcutID.Equals(new Guid("499FCB8B-F715-45b2-A112-E99826F4B401")))//News
			{
				return SecurityContext.CheckPermissions(NewsConst.Action_Edit);
			}
			return true;
		}
		public string GetAbsoluteWebPathForShortcut(Guid shortcutID, string currentUrl)
		{
			if (shortcutID.Equals(new Guid("499FCB8B-F715-45b2-A112-E99826F4B401")))//News
			{
				return FeedUrls.EditNewsUrl;
			}
			return string.Empty;
		}
Example #27
0
 void IMoniker.BindToStorage(IBindCtx pbc, IMoniker pmkToLeft, ref Guid riid, out object ppvObj)
 {
     ppvObj = null;
     if (riid.Equals(Iid_Clsids.IID_IStream))
     {
         ppvObj = this.m_stream;
     }
 }
Example #28
0
        /// <summary>
        /// GUID をデバイスのイベント種別に変換します。
        /// </summary>
        /// <param name="guid">GUID。</param>
        /// <returns>イベント種別。</returns>
        public static WpdEventType GuidToEventType( Guid guid )
        {
            if(      guid.Equals( WpdGuids.WPD_EVENT_DEVICE_CAPABILITIES_UPDATED ) ) { return WpdEventType.DeviceCapabilitiesUpdated; }
            else if( guid.Equals( WpdGuids.WPD_EVENT_DEVICE_REMOVED              ) ) { return WpdEventType.DeviceRemoved;             }
            else if( guid.Equals( WpdGuids.WPD_EVENT_DEVICE_RESET                ) ) { return WpdEventType.DeviceReset;               }
            else if( guid.Equals( WpdGuids.WPD_EVENT_NOTIFICATION                ) ) { return WpdEventType.Notification;              }
            else if( guid.Equals( WpdGuids.WPD_EVENT_OBJECT_ADDED                ) ) { return WpdEventType.ObjectAdded;               }
            else if( guid.Equals( WpdGuids.WPD_EVENT_OBJECT_REMOVED              ) ) { return WpdEventType.ObjectRemoved;             }
            else if( guid.Equals( WpdGuids.WPD_EVENT_OBJECT_TRANSFER_REQUESTED   ) ) { return WpdEventType.ObjectTransferRequested;   }
            else if( guid.Equals( WpdGuids.WPD_EVENT_OBJECT_UPDATED              ) ) { return WpdEventType.ObjectUpdated;             }
            else if( guid.Equals( WpdGuids.WPD_EVENT_STORAGE_FORMAT              ) ) { return WpdEventType.StorageFormat;             }

            return WpdEventType.Unknown;
        }
        public static string GetAbsoluteWebPathForShortcut(Guid shortcutID)
        {
            if (shortcutID.Equals(new Guid("24CD48B2-C40F-43ec-B3A6-3212C51B8D34")) || shortcutID.Equals(new Guid("84DF7BE7-315B-4ba3-9BE1-1E348F6697A5")))
            {
                var ispool = shortcutID.Equals(new Guid("84DF7BE7-315B-4ba3-9BE1-1E348F6697A5"));
                if (ForumManager.Instance.CurrentPage.Page == ForumPage.TopicList || ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost)
                {
                    var threadID = GetThreadID();
                    if (threadID != -1)
                    {
                        return GetUrl(threadID, ispool);
                    }
                    if (ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost)
                    {
                        var topic = GetTopicByID();
                        if (topic != null)
                        {
                            return GetUrl(topic.ThreadID, ispool);
                        }
                    }
                }
                else if (ForumManager.Instance.CurrentPage.Page == ForumPage.PostList || ForumManager.Instance.CurrentPage.Page == ForumPage.EditTopic)
                {
                    var topic = GetTopicByID();
                    if (topic != null)
                    {
                        return GetUrl(topic.ThreadID, ispool);
                    }
                }
                return GetUrl(0, ispool);
            }

            else if (shortcutID.Equals(new Guid("FA5C4BD5-25E7-41c8-A0DC-64DC2A977391")))
            {
                if (ForumManager.Instance.CurrentPage.Page == ForumPage.PostList || ForumManager.Instance.CurrentPage.Page == ForumPage.NewPost || ForumManager.Instance.CurrentPage.Page == ForumPage.EditTopic)
                {
                    int topicID = GetTopicID();
                    if (topicID != -1)
                    {
                        return VirtualPathUtility.ToAbsolute(ForumManager.BaseVirtualPath + "/newpost.aspx") + "?t=" + topicID;
                    }
                }
            }
            return string.Empty;
        }
 int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
 {
     if (pguidCmdGroup.Equals(Guids.guidProjectExtenderCmdSet) && prgCmds[0].cmdID == (uint)PkgCmdIDList.cmdidProjectExtender)
     {
         prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_INVISIBLE;
         return VSConstants.S_OK;
     }
     return innerTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
 }