/// <summary>
        /// Returns true if WorkerOfferedEvent instances are equal
        /// </summary>
        /// <param name="other">Instance of WorkerOfferedEvent to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(WorkerOfferedEvent other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ObjectType == other.ObjectType ||
                     ObjectType != null &&
                     ObjectType.Equals(other.ObjectType)
                     ) &&
                 (
                     BookingRequestId == other.BookingRequestId ||
                     BookingRequestId != null &&
                     BookingRequestId.Equals(other.BookingRequestId)
                 ) &&
                 (
                     Agency == other.Agency ||
                     Agency != null &&
                     Agency.Equals(other.Agency)
                 ));
        }
 public bool Compare(Action action)
 {
     if (ObjectType.Equals(action.ObjectType) && MotionType.Equals(action.MotionType) && Name.Equals(action.Name))
     {
         return(true);
     }
     return(false);
 }
예제 #3
0
파일: Object.cs 프로젝트: rpwjanzen/robin
        public override bool Equals(object obj)
        {
            var other = obj as HashKey;

            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) && Value.Equals(other.Value));
        }
예제 #4
0
        public int GetSpaceForItem(ObjectType @object)
        {
            var emptySlots = InventorySlots.Count(slot => slot.ObjectType == null);
            var freeSpace  = emptySlots * @object.StackSize;

            foreach (var filled in InventorySlots.Where(slot => @object.Equals(slot.ObjectType)))
            {
                freeSpace += @object.StackSize - filled.Amount;
            }
            return(freeSpace);
        }
예제 #5
0
        private void RemoveItem(ObjectType @object)
        {
            var slot = InventorySlots.Where(sl => sl.ObjectType != null && @object.Equals(sl.ObjectType))
                       .OrderBy(sl => sl.Amount).First();

            slot.Amount--;
            if (slot.Amount == 0)
            {
                slot.ObjectType = null;
            }
        }
        private List <string> Update(ObjectType objectType, string fileName, DTO.DbObjectDefinition dbObjectDefinition)
        {
            List <string> objectUpdated          = new List <string>();
            List <string> objectDefinitionLocal  = System.IO.File.ReadLines(fileName, Util.GetEncoding(fileName)).ToList();
            string        objectTypeLocal        = GetObjectTypeFromDefinition(string.Join(Environment.NewLine, objectDefinitionLocal));
            List <string> objectDefinitionRemote = dbObjectDefinition != null?dbObjectDefinition.Definition.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).ToList() : new List <string>();

            string objectName = fileName.Split('\\').Last();

            try
            {
                //Check if object type should be updated
                var objectTypeList = objectType.GetValue();
                if (objectType.Equals(ObjectType.All) || objectTypeList.Contains(objectTypeLocal))
                {
                    //Clean up objects before compare
                    objectDefinitionLocal  = CleanObjectDefinition(objectDefinitionLocal);
                    objectDefinitionRemote = CleanObjectDefinition(objectDefinitionRemote);

                    //Update when necessary
                    if (dbObjectDefinition == null || !AreObjectsEquals(objectName, objectDefinitionLocal, objectDefinitionRemote, objectTypeLocal))
                    {
                        CompareNameToDefinitionName(System.IO.Path.GetFileNameWithoutExtension(fileName), objectDefinitionLocal);
                        string[] queries = string.Join(Environment.NewLine, objectDefinitionLocal).Split(new string[] { CREATE_INDEX }, StringSplitOptions.None);
                        KeyValuePair <string, string> keyValuePair = GetReplaceString(objectTypeLocal);

                        for (int i = 0; i < queries.Length; i++)
                        {
                            //Remove Encryptation if exists
                            queries[i] = Regex.Replace(queries[i], "WITH ENCRYPTION*([^\\s]+)", string.Empty, RegexOptions.IgnoreCase);

                            Console.WriteLine(string.Format("Updating object {0} query {1} of {2}.", objectName, i + 1, queries.Length));
                            Console.WriteLine("");
                            if (ExecuteNonQuery(dbObjectDefinition != null ? Regex.Replace(queries[i], keyValuePair.Key, keyValuePair.Value, RegexOptions.IgnoreCase) : queries[i], commandType: CommandType.Text) != 0)
                            {
                                if (i == queries.Length - 1) //Wait until execute the last instruction
                                {
                                    objectUpdated.Add(objectName);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex, $"Filename: {fileName }");
                throw;
            }

            return(objectUpdated);
        }
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is SalesforceObjectTypeLayout))
            {
                return(false);
            }
            var salesforceObject = (SalesforceObjectTypeLayout)obj;

            if (ObjectType == null || !ObjectType.Equals(salesforceObject.ObjectType))
            {
                return(false);
            }
            return(CompareColumns(salesforceObject));
        }
예제 #8
0
        private PriorityValue createCommandValue(Encodable value)
        {
            if (value is Null)
            {
                return(new PriorityValue((Null)value));
            }

            ObjectType type = (ObjectType)getProperty(PropertyIdentifier.ObjectType);

            if (type.Equals(ObjectType.AccessDoor))
            {
                return(new PriorityValue((BaseType)value));
            }
            if (type.Equals(ObjectType.AnalogOutput) || type.Equals(ObjectType.AnalogValue))
            {
                return(new PriorityValue((Real)value));
            }
            if (type.Equals(ObjectType.BinaryOutput) || type.Equals(ObjectType.BinaryValue))
            {
                return(new PriorityValue((BinaryPV)value));
            }
            return(new PriorityValue((UnsignedInteger)value));
        }
        /// <summary>
        /// Determines if the current object is equal to the <paramref name="obj"/>
        /// </summary>
        /// <param name="obj">The object to compare</param>
        /// <returns>true, if the two instances are equal</returns>
        public override bool Equals(object obj)
        {
            if (!(obj is ProfilerEvent))
            {
                return(false);
            }

            ProfilerEvent other = (ProfilerEvent)obj;

            return(Type.Equals(other.Type) &&
                   SessionId.Equals(other.SessionId) &&
                   ObjectType.Equals(other.ObjectType) &&
                   ObjectId.Equals(other.ObjectId) && LineNumber.Equals(other.LineNumber) &&
                   StatementName.Equals(other.StatementName) &&
                   TimeStampRelativeMSec.Equals(other.TimeStampRelativeMSec));
        }
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is SalesforceObject))
            {
                return(false);
            }
            var salesforceObject = obj as SalesforceObject;

            if (ObjectId == null || !ObjectId.Equals(salesforceObject.ObjectId))
            {
                return(false);
            }
            if (Name == null || !Name.Equals(salesforceObject.Name))
            {
                return(false);
            }
            if (ObjectType == null ||
                !ObjectType.Equals(salesforceObject.ObjectType))
            {
                return(false);
            }
            return(true);
        }
예제 #11
0
 public int GetItemCount(ObjectType @object)
 {
     return(InventorySlots.Where(sl => @object.Equals(sl.ObjectType)).Sum(sl => sl.Amount));
 }
예제 #12
0
 public int InsertItems(ObjectType @object, int amount)
 {
     foreach (var filled in InventorySlots.Where(sl => sl.ObjectType != null && @object.Equals(sl.ObjectType))
              .OrderByDescending(sl => sl.Amount).ToArray())
     {
         amount = InsertIntoSlot(@object, amount, filled);
         if (amount == 0)
         {
             return(0);
         }
     }
     foreach (var inventorySlot in InventorySlots.Where(slot => slot.ObjectType == null))
     {
         amount = InsertIntoSlot(@object, amount, inventorySlot);
         if (amount == 0)
         {
             return(0);
         }
     }
     return(amount);
 }
예제 #13
0
        private void Customize()
        {
            this.ProfilComboBox.SelectionChanged      += OnSelectProfil;
            this.RightsGroupHeader.DeleteButton.Click += OnDelete;

            if (!string.IsNullOrWhiteSpace(ObjectType))
            {
                if (ObjectType.Equals(SubjectType.INPUT_TABLE.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit Table", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Edit Cell", RightType.EDIT_CELL));
                    AddCheckBox(new RightCheckBox("Edit Allocation", RightType.EDIT_ALLOCATION));
                    AddCheckBox(new RightCheckBox("Edit Excel only", RightType.EDIT_EXCEL));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Load", RightType.LOAD));
                    AddCheckBox(new RightCheckBox("Clear", RightType.CLEAR));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
                else if (ObjectType.Equals(SubjectType.REPORT.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit Report", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Edit Cell", RightType.EDIT_CELL));
                    AddCheckBox(new RightCheckBox("Edit Excel only", RightType.EDIT_EXCEL));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Run", RightType.LOAD));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
                else if (ObjectType.Equals(SubjectType.INPUT_GRID.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit Grid", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Edit Line", RightType.EDIT_CELL));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
                else if (ObjectType.Equals(SubjectType.TRANSFORMATION_TREE.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Load", RightType.LOAD));
                    AddCheckBox(new RightCheckBox("Clear", RightType.CLEAR));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
                else if (ObjectType.Equals(SubjectType.COMBINED_TRANSFORMATION_TREE.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Load", RightType.LOAD));
                    AddCheckBox(new RightCheckBox("Clear", RightType.CLEAR));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
                else if (ObjectType.Equals(SubjectType.TARGET.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
                else if (ObjectType.Equals(SubjectType.DESIGN.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
                else if (ObjectType.Equals(SubjectType.RECONCILIATION_FILTER.label))
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit write off", RightType.EDIT_WRITE_OFF));
                    AddCheckBox(new RightCheckBox("Reset reconciliation", RightType.RESET_RECONCILIATION));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                }
                else
                {
                    AddCheckBox(new RightCheckBox("View", RightType.VIEW));
                    AddCheckBox(new RightCheckBox("Edit", RightType.EDIT));
                    AddCheckBox(new RightCheckBox("Delete", RightType.DELETE));
                    AddCheckBox(new RightCheckBox("Save as", RightType.SAVE_AS));
                }
            }
        }