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);
            }
        }
Пример #2
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;
 }
        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 );
            }
        }
Пример #4
0
 public static bool IsValidInstallGuidScheme(Guid guid)
 {
     return (guid.Equals(UninstallSubkeyGuid) ||
             guid.Equals(FilePathGuid) ||
             guid.Equals(OpaqueGuid) ||
             guid.Equals(Guid.Empty));
 }
Пример #5
0
        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;
 }
Пример #7
0
        public int MapLogicalView(ref System.Guid rguidLogicalView, out string pbstrPhysicalView)
        {
            int retval = VSConstants.E_NOTIMPL;

            pbstrPhysicalView = null;   // We support only one view.
            if (rguidLogicalView.Equals(VSConstants.LOGVIEWID_Designer) ||
                rguidLogicalView.Equals(VSConstants.LOGVIEWID_Primary))
            {
                retval = VSConstants.S_OK;
            }
            return(retval);
        }
        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;
        }
Пример #9
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;
        }
Пример #11
0
 public Node FindNode(Guid guid)
 {
     foreach (Node node in Nodes)
         if (guid.Equals(node.Id))
             return node;
     return null;
 }
Пример #12
0
        public static object ReturnNullIfEmpty(Guid value)
        {
            if (value.Equals(Guid.Empty))
                return null;

            return value;
        }
Пример #13
0
        /// <summary>
        /// Add an array of 3-D points to the document
        /// </summary>
        public object AddPoints(object pointsObj)
        {
            List <Rhino.Geometry.Point3d> points = new List <Rhino.Geometry.Point3d>();

            if (SampleRhinoHelpers.ConvertToPoint3dList(pointsObj, ref points))
            {
                Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
                if (null != doc)
                {
                    ArrayList objectIds = new ArrayList();
                    for (int i = 0; i < points.Count(); i++)
                    {
                        System.Guid objectId = doc.Objects.AddPoint(points[i]);
                        if (!objectId.Equals(System.Guid.Empty))
                        {
                            objectIds.Add(objectId.ToString());
                        }
                    }
                    if (objectIds.Count > 0)
                    {
                        doc.Views.Redraw();
                        return(objectIds.ToArray());
                    }
                }
            }
            return(null);
        }
Пример #14
0
        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 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);
        }
Пример #16
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);
        }
Пример #17
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));
        }
        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);
        }
Пример #19
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));
		}
Пример #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);
        }
Пример #21
0
        protected bool BindSocket(GoSocket socket, System.Guid uniqueId)
        {
            // make sure that the socket is not in use.
            if (socket.BoundToModule)
            {
                return(false);
            }

            // if we were passed a uniqueId, make sure that the module matches.
            if (!uniqueId.Equals(Guid.Empty))
            {
                // validate the module's GUID
                if (GoBus.GoHub.RootHub.GetModuleUniqueId(socket).Equals(uniqueId) == false)
                {
                    return(false);
                }
            }

            GoBus.GoHub.RootHub.SetSocketLedState((int)socket, true);
            socket.BoundToModule = true;
            _socket        = socket;
            _boundToSocket = true;

            return(true);
        }
Пример #22
0
        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;
        }
Пример #23
0
        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);
                    }
                }
            }
        }
        /// <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);
        }
Пример #25
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>
 /// Returns a value indicating whether this instance and a
 /// specified Object represent the same type and value.
 /// </summary>
 /// <param name="obj">The object to compare</param>
 /// <returns></returns>
 public override bool Equals(object obj)
 {
     if (obj is ShortGuid)
     {
         return(_guid.Equals(((ShortGuid)obj)._guid));
     }
     if (obj is System.Guid)
     {
         return(_guid.Equals((System.Guid)obj));
     }
     if (obj is string)
     {
         return(_guid.Equals(((ShortGuid)obj)._guid));
     }
     return(false);
 }
Пример #27
0
        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);
        }
Пример #29
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;
     }
 }
Пример #30
0
		public string GetAbsoluteWebPathForShortcut(Guid shortcutID, string currentUrl)
		{
			if (shortcutID.Equals(new Guid("499FCB8B-F715-45b2-A112-E99826F4B401")))//News
			{
				return FeedUrls.EditNewsUrl;
			}
			return string.Empty;
		}
Пример #31
0
		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;
		}
Пример #32
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;
        }
Пример #33
0
        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;
        }
Пример #34
0
 public Object ReadObject(long position)
 {
     Seek(position);
     System.Guid id = ReadGuid();
     if (id.Equals(Guid.AsfFilePropertiesObject))
     {
         return(new FilePropertiesObject(this, position));
     }
     if (id.Equals(Guid.AsfStreamPropertiesObject))
     {
         return(new StreamPropertiesObject(this, position));
     }
     if (id.Equals(Guid.AsfContentDescriptionObject))
     {
         return(new ContentDescriptionObject(this, position));
     }
     if (id.Equals(Guid.AsfExtendedContentDescriptionObject))
     {
         return(new ExtendedContentDescriptionObject(this, position));
     }
     if (id.Equals(Guid.AsfPaddingObject))
     {
         return(new PaddingObject(this, position));
     }
     if (id.Equals(Guid.AsfHeaderExtensionObject))
     {
         return(new HeaderExtensionObject(this, position));
     }
     if (id.Equals(Guid.AsfMetadataLibraryObject))
     {
         return(new MetadataLibraryObject(this, position));
     }
     return(new UnknownObject(this, position));
 }
Пример #35
0
 /// <summary>
 /// 更新Job运行信息
 /// </summary>
 /// <param name="BackgroundJobId">Job ID</param>
 /// <param name="JobName">Job名称</param>
 /// <param name="LastRunTime">最后运行时间</param>
 /// <param name="NextRunTime">下次运行时间</param>
 /// <param name="ExecutionDuration">运行时长</param>
 /// <param name="RunLog">日志</param>
 public void UpdateBackgroundJobStatus(System.Guid BackgroundJobId, string JobName, DateTime LastRunTime, DateTime NextRunTime, double ExecutionDuration, string RunLog)
 {
     UpdateBackgroundJobStatus(BackgroundJobId, LastRunTime, NextRunTime);
     //Job管理器不用写入记录日志
     if (!(JobName == "Job管理器" || BackgroundJobId.Equals(Guid.Parse("EC464D8F-D873-4393-BED1-70B3219C2BB2"))))
     {
         WriteBackgroundJoLog(BackgroundJobId, JobName, LastRunTime, ExecutionDuration, RunLog);
     }
 }
 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);
 }
Пример #37
0
 public static object NullIfGuidEmpty(System.Guid G)
 {
     if (G.Equals(Guid.Empty))
     {
         return(DBNull.Value);
     }
     else
     {
         return(G);
     }
 }
Пример #38
0
 private System.Data.DataRowView GetMessageObject(System.String uid)
 {
     System.Guid guid = this.getGuid(uid);
     if (!guid.Equals(System.Guid.Empty))
     {
         return(this.GetMessageObject(new System.Guid(uid)));
     }
     else if (log.IsErrorEnabled)
     {
         log.Error("Error parsing UID");
     }
     return(null);
 }
Пример #39
0
        protected void AddGuidParameter(SqlCommand command, string parameterName, System.Guid parameterValue)
        {
            IDbDataParameter param = command.CreateParameter();

            param.ParameterName = parameterName;
            param.DbType        = DbType.Guid;
            if (parameterValue.Equals(Guid.Empty) == true)
            {
                param.Value = DBNull.Value;
            }
            else
            {
                param.Value = parameterValue;
            } // end if
            command.Parameters.Add(param);
        }
Пример #40
0
 /// <summary>
 /// Add a 3-D point to the document
 /// </summary>
 public object AddPoint(object pointObj)
 {
     Rhino.Geometry.Point3d point = new Rhino.Geometry.Point3d();
     if (SampleRhinoHelpers.ConvertToPoint3d(pointObj, ref point))
     {
         Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
         if (null != doc)
         {
             System.Guid objectId = doc.Objects.AddPoint(point);
             if (!objectId.Equals(System.Guid.Empty))
             {
                 doc.Views.Redraw();
                 return(objectId.ToString());
             }
         }
     }
     return(null);
 }
Пример #41
0
    public TreeViewItem GetItemByGuid(TreeViewItem in_item, System.Guid in_guid)
    {
        System.Guid itemGuid = new System.Guid((in_item.DataContext as AkWwiseTreeView.AkTreeInfo).Guid);

        if (itemGuid.Equals(in_guid))
        {
            return(in_item);
        }

        for (int i = 0; i < in_item.Items.Count; i++)
        {
            TreeViewItem item = GetItemByGuid(in_item.Items[i], in_guid);

            if (item != null)
            {
                return(item);
            }
        }

        return(null);
    }
Пример #42
0
    private void SelectClick(UnitStateManager manager)
    {
        //This means unit is currently not within the selection box, check to see if it is being clicked on.
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo))
        {
            GameObject obj      = hitInfo.collider.gameObject;
            Vector3    center   = obj.transform.position + new Vector3(0f, 0.5f, 0f);
            float      distance = Vector3.Distance(hitInfo.point, center);
            if (!obj.name.Equals("Floor"))
            {
                System.Guid identity = obj.GetComponent <UnitSelectable>().identity;
                if (distance <= 1f && identity.Equals(this.identity))
                {
                    manager.selectFlag = true;
                }
            }
        }
    }
Пример #43
0
        static StackObject *Equals_8(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Guid @g = (System.Guid) typeof(System.Guid).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Guid instance_of_this_method = (System.Guid) typeof(System.Guid).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.Equals(@g);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Пример #44
0
 bool IEquatable <clsCharacter> .Equals(clsCharacter character)
 {
     return(ID.Equals(character.ID));
 }
Пример #45
0
 public bool IsSameAs(Unit other)
 {
     return(id.Equals(other.id));
 }
Пример #46
0
 public bool Equals(ExecutionId other)
 {
     return(value.Equals(other.value));
 }