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

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     CountryCallingCode == other.CountryCallingCode ||
                     CountryCallingCode != null &&
                     CountryCallingCode.Equals(other.CountryCallingCode)
                 ) &&
                 (
                     AreaCode == other.AreaCode ||
                     AreaCode != null &&
                     AreaCode.Equals(other.AreaCode)
                 ) &&
                 (
                     Number == other.Number ||
                     Number != null &&
                     Number.Equals(other.Number)
                 ));
        }
        /// <summary>
        /// Returns true if PhoneChannelPhone instances are equal
        /// </summary>
        /// <param name="other">Instance of PhoneChannelPhone to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PhoneChannelPhone other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CountryCallingCode == other.CountryCallingCode ||
                     CountryCallingCode != null &&
                     CountryCallingCode.Equals(other.CountryCallingCode)
                     ) &&
                 (
                     AreaCode == other.AreaCode ||
                     AreaCode != null &&
                     AreaCode.Equals(other.AreaCode)
                 ) &&
                 (
                     Number == other.Number ||
                     Number != null &&
                     Number.Equals(other.Number)
                 ) &&
                 (
                     AdditionalInfo == other.AdditionalInfo ||
                     AdditionalInfo != null &&
                     AdditionalInfo.Equals(other.AdditionalInfo)
                 ));
        }
示例#3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (CountryCallingCode != null)
         {
             hashCode = hashCode * 59 + CountryCallingCode.GetHashCode();
         }
         if (AreaCode != null)
         {
             hashCode = hashCode * 59 + AreaCode.GetHashCode();
         }
         if (Number != null)
         {
             hashCode = hashCode * 59 + Number.GetHashCode();
         }
         return(hashCode);
     }
 }
        private void SetNumberSwiss(MatchCollection matches)
        {
            GroupCollection groups      = matches[0].Groups;
            var             phoneNumber = groups[0].Value;

            if (phoneNumber.StartsWith("00") || phoneNumber.StartsWith("+"))
            {
                InternationAreaCode = groups[1].Value;
                AreaCode            = groups[2].Value;
                if (!groups[2].Value.Contains("("))
                {
                    AreaCode = AreaCode.Insert(0, "0");
                }

                var numberWithoutAreaCodes = MyRegex.IsSwissAreaCode.Replace(phoneNumber, "");
                CallNumber = numberWithoutAreaCodes.Trim();
                if (CallNumber.Contains("-"))
                {
                    SplitCallNumberAndDirectialingIn(CallNumber);
                }
            }
            else
            {
                InternationAreaCode = ConstantValue.InternationAreCodeSwiss;
                AreaCode            = phoneNumber.Substring(0, 3);
                CallNumber          = phoneNumber.Substring(3);
                CallNumber          = CallNumber.Trim();
                if (CallNumber.Contains("-"))
                {
                    SplitCallNumberAndDirectialingIn(CallNumber);
                }
            }
        }
示例#5
0
        protected void grdCities_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            AreaCode areaCode = areaCodes[e.RowIndex];

            client.DeleteAreaCode(areaCode);
            Response.Redirect(Request.RawUrl);
        }
示例#6
0
        private bool Validate(string code)
        {
            if (!new FiscalCodeValidator().Validate(code))
            {
                return(false);
            }

            var tokens =
                code
                .Token(FiscalCodeTokens.Lastname, 3)
                .Token(FiscalCodeTokens.Firstname, 3)
                .Token(FiscalCodeTokens.Year, 2)
                .Token(FiscalCodeTokens.Month, 1)
                .Token(FiscalCodeTokens.Day, 2)
                .Token(FiscalCodeTokens.Area, 4)
                .Token(FiscalCodeTokens.Control, 1)
                .Tokens;

            LastName  = new LastNameCode(tokens[FiscalCodeTokens.Lastname]).ToString();
            FirstName = new FirstNameCode(tokens[FiscalCodeTokens.Firstname]).ToString();
            AssignBirthDateAndSex(tokens);
            Area    = new AreaCode(tokens[FiscalCodeTokens.Area]).ToString();
            Control = ControlCode.GetControlCode(code.Substring(0, 15)).ToInvariant();

            return(true);
        }
示例#7
0
 public Area(AreaCode code, float size = -1, string name = null)
 {
     this.Code        = code;
     this.Connections = new List <IAreaConnector>();
     this.Name        = name;
     this.size        = size;
 }
示例#8
0
 public HitTestResult(AreaCode areaCode, double relativeX, int?activityIndex = null, object trigger = null)
 {
     Area          = areaCode;
     RelativeX     = relativeX;
     ActivityIndex = activityIndex;
     Trigger       = trigger;
 }
示例#9
0
    public void Dispatch(MessageBase msg)
    {
        AreaCode areaCode = msg.GetMessageID();

        switch (areaCode)
        {
        case AreaCode.UIManager:
            UIManager.Instance.ExcutingMessage(msg);
            break;

        case AreaCode.GameManager:
            GameManager.Instance.ExcutingMessage(msg);
            break;

        case AreaCode.AudioManager:
            break;

        case AreaCode.NPCManager:
            break;

        case AreaCode.CharacterManager:
            break;

        case AreaCode.NetManager:
            break;

        case AreaCode.AssetManager:
            break;

        default:
            break;
        }
    }
示例#10
0
文件: Place.cs 项目: shdamon/GBFDATA
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (CompanyId.Length != 0)
                    {
                        hash ^= CompanyId.GetHashCode();
                    }
                    if (CompanyName.Length != 0)
                    {
                        hash ^= CompanyName.GetHashCode();
                    }
                    if (Status != 0)
                    {
                        hash ^= Status.GetHashCode();
                    }
                    if (AreaCode.Length != 0)
                    {
                        hash ^= AreaCode.GetHashCode();
                    }
                    if (CreateTime.Length != 0)
                    {
                        hash ^= CreateTime.GetHashCode();
                    }
                    if (Address.Length != 0)
                    {
                        hash ^= Address.GetHashCode();
                    }
                    return(hash);
                }
示例#11
0
        /// <summary>
        /// Provides information about the intersection of two circles.
        /// </summary>
        /// <param name="circle1">circle 1</param>
        /// <param name="circle2">circle 2</param>
        /// <returns>
        /// <see cref="Kanji.DesktopApp.Interfaces.AreaCode.Unknown"/> if status is unknown.
        /// <see cref="Kanji.DesktopApp.Interfaces.AreaCode.Disjoint"/> if the circles don't touch anywhere.
        /// <see cref="Kanji.DesktopApp.Interfaces.AreaCode.Overlap"/> if there is an overlapping area.
        /// Additionally to Overlap: <see cref="Kanji.DesktopApp.Interfaces.AreaCode.AEnclosesB"/> if circle2 lies completely inside circle1 and doesn't intersect.
        /// Additionally to Overlap: <see cref="Kanji.DesktopApp.Interfaces.AreaCode.BEnclosesA"/> if circle1 lies completely inside circle2 and doesn't intersect.
        /// Additionally to Overlap and AEnclosesB/BEnclosesA: <see cref="Kanji.DesktopApp.Interfaces.AreaCode.Identical"/> if the centre points are equal and the radius is equal.
        /// <see cref="Kanji.DesktopApp.Interfaces.AreaCode.Tangents"/> if the outer edge of circle1 touches the outer edge of circle2.
        /// </returns>
        public static AreaCode Intersect(Circle2D circle1, Circle2D circle2)
        {
            AreaCode retval = AreaCode.Unknown;

            // the circles are identical
            if (circle1.Equals(circle2))
            {
                retval =
                    AreaCode.AEnclosesB |
                    AreaCode.BEnclosesA |
                    AreaCode.Identical |
                    AreaCode.Intersect;
            }
            // the circles are not identical
            else
            {
                double distance = circle1.Centre.Distance(circle2.Centre);

                // the distance between the centres equals the sum of the radii
                // so the circles are tangents of each other
                if (distance == circle1.Radius + circle2.Radius)
                {
                    retval = AreaCode.Tangents;
                }
                // the distance between the centres is greater than the sum of the radii
                // therefore the circles must be disjoint
                else if (distance > circle1.Radius + circle2.Radius)
                {
                    retval = AreaCode.Disjoint;
                }

                // the distance between the centres is lower than the sum of the radii
                // therefore they must overlap in some way
                else if (distance < circle1.Radius + circle2.Radius)
                {
                    retval = AreaCode.Overlap;

                    // the sum of the distance and radius B is lower than radius A
                    // therefore: A encloses B
                    if (distance + circle2.Radius < circle1.Radius)
                    {
                        retval = retval | AreaCode.AEnclosesB;
                    }

                    // the sum of the distance and radius A is lower than radius B
                    // therefore: B encloses A
                    else if (distance + circle1.Radius < circle2.Radius)
                    {
                        retval = retval | AreaCode.BEnclosesA;
                    }
                    // no other possibility holds, the circles intersect
                    else
                    {
                        retval = retval | AreaCode.Intersect;
                    }
                }
            }
            return(retval);
        }
示例#12
0
 public List <Line> LinesNotPickedIn(AreaCode inArea)
 {
     return(LineIsPickedStatuses
            .Where(l => l.Value == false)
            .Select(kvp => kvp.Key)
            .Where(l => l.Article.AreaCode == inArea)
            .ToList());
 }
        public ActionResult DeleteConfirmed(byte id)
        {
            AreaCode areaCode = db.AreaCodes.Find(id);

            db.AreaCodes.Remove(areaCode);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#14
0
        public bool DeleteAreaCode(AreaCode areaCode)
        {
            AreaCodes areaCodes = new AreaCodes();

            areaCodes.SelectAll();
            areaCodes.Delete(areaCode);
            return(areaCodes.Save());
        }
 public ActionResult Edit([Bind(Include = "Id,Name")] AreaCode areaCode)
 {
     if (ModelState.IsValid)
     {
         db.Entry(areaCode).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(areaCode));
 }
示例#16
0
 private void SendToArea(OrderBox orderBox, AreaCode areaCode)
 {
     // If orderBox has been in areaCode already - throw exception
     if (orderBox.AreasVisited[areaCode])
     {
         throw new ArgumentException("Area has already been visited.");
     }
     // Send orderBox to area
     Areas[areaCode].ReceiveOrderBox(orderBox);
 }
示例#17
0
 public ControlCode(
     LastNameCode lastNameCode,
     FirstNameCode firstNameCode,
     YearCode yearCode,
     MonthCode monthCode,
     DayCode dayCode,
     AreaCode areaCode)
 {
     partialCode = string.Concat(lastNameCode, firstNameCode, yearCode, monthCode, dayCode, areaCode);
 }
示例#18
0
		internal ControlCode(
			LastNameCode lastNameCode,
			FirstNameCode firstNameCode,
			YearCode yearCode,
			MonthCode monthCode,
			DayCode dayCode,
			AreaCode areaCode)
		{
			partialCode = string.Concat(lastNameCode, firstNameCode, yearCode, monthCode, dayCode, areaCode);
		}
示例#19
0
        public bool Find(string toFind)
        {
            toFind = toFind.ToLower();
            string fullNumber = AreaCode + Number;

            return(PhoneType.ToString().ToLower() == toFind ||
                   AreaCode.ToLower() == toFind ||
                   Number.ToLower() == toFind ||
                   fullNumber.ToLower() == toFind);
        }
示例#20
0
        protected void grdCities_RowEditing(object sender, GridViewEditEventArgs e)
        {
            AreaCode areaCode = areaCodes[e.NewEditIndex];

            pnlCity.Visible = true;
            txtCity.Text    = areaCode.Name;

            Session["EDITMODE"]    = true;
            Session["OLDAREACODE"] = areaCode;
            grdCities.EditIndex    = -1;
        }
示例#21
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (CountryCode != null ? CountryCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AreaCode != null ? AreaCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Number != null ? Number.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#22
0
        public static Dictionary <AreaCode, BaseManager> dicManager = new Dictionary <AreaCode, BaseManager>(); //5

        public static void Dispatch(AreaCode areaCode, int eventCode, params object[] message)
        {
            if (dicManager.ContainsKey(areaCode))
            {
                dicManager[areaCode].Execute(eventCode, message);
            }
            else
            {
                Debug.LogWarning("MsgCenter.Dispatch:  this manager is not init");
            }
        }
        public ActionResult Create([Bind(Include = "Id,Name")] AreaCode areaCode)
        {
            if (ModelState.IsValid)
            {
                db.AreaCodes.Add(areaCode);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(areaCode));
        }
示例#24
0
        private OrderBoxProgress PackToOrderboxProgress(OrderBox orderBox, AreaCode area)
        {
            // Estimate time based on Loop Flow and areas
            int timeToSpend = EstimateTimeInSeconds(area);

            // Create new OrderBoxProgress based on orderbox and time.
            var orderBoxProgress =
                new OrderBoxProgress(orderBox, EstimateTimeInSeconds(area));

            // Return the new OrderBoxProgress.
            return(orderBoxProgress);
        }
示例#25
0
        public static Order ConstructOrder()
        {
            var            fixture   = new Fixture();
            const AreaCode startArea = AreaCode.Area21;
            var            areas     = new Dictionary <AreaCode, bool> {
                { startArea, false }, { AreaCode.Area25, false }, { AreaCode.Area27, false }, { AreaCode.Area28, false }
            };

            var order = fixture.Build <Order>().With(o => o.Areas, areas).Create();

            return(order);
        }
示例#26
0
        public Station(string name, int maxShelfBoxes, int maxOrderBoxes, AreaCode areaCode)
        {
            ShelfBoxes         = new List <ShelfBox>(maxShelfBoxes);
            OrderBoxes         = new List <OrderBox>(maxOrderBoxes);
            Name               = name ?? throw new ArgumentNullException(nameof(name));
            MaxShelfBoxes      = maxShelfBoxes;
            MaxOrderBoxes      = maxOrderBoxes;
            _areaCode          = areaCode;
            _shelfBoxWaitCount = 0;

            TimeKeeper.Tick += TickLoop;
        }
示例#27
0
        public override int GetHashCode()
        {
            const int hashSeed       = 7;
            const int hashMultiplier = 13;

            var hash = hashSeed;

            hash = (hash * hashMultiplier) ^ (AreaCode is null ? 0 : AreaCode.GetHashCode());
            hash = (hash * hashMultiplier) ^ (Exchange is null ? 0 : Exchange.GetHashCode());
            hash = (hash * hashMultiplier) ^ (SubscriberNumber is null ? 0 : SubscriberNumber.GetHashCode());

            return(hash);
        }
示例#28
0
        public Area(AreaCode areaCode, List <Article> availableWares, Station[] stations, ShelfSpace shelfSpace, ITimeKeeper timeKeeper)
        {
            AreaCode       = areaCode;
            AvailableWares = availableWares ?? throw new ArgumentNullException(nameof(availableWares));
            Stations       = stations ?? throw new ArgumentNullException(nameof(stations));
            ShelfSpace     = shelfSpace ?? throw new ArgumentNullException(nameof(shelfSpace));

            // Subscribe to each Station order complete event
            foreach (Station station in Stations)
            {
                station.OnOrderBoxFinishedAtStation += StationOrderCompleted;
            }
        }
示例#29
0
 public override int GetHashCode()
 {
     unchecked
     {
         const int hashingBase       = (int)2166136261;
         const int hashingMultiplier = 16777619;
         var       hash = hashingBase;
         hash = (hash * hashingMultiplier) ^ (AreaCode?.GetHashCode() ?? 0);
         hash = (hash * hashingMultiplier) ^ (Exchange?.GetHashCode() ?? 0);
         hash = (hash * hashingMultiplier) ^ (SubscriberNumber?.GetHashCode() ?? 0);
         return(hash);
     }
 }
        public virtual void Validate(ValidationResult result)
        {
            AreaCode.ValidateRequired(result, nameof(AreaCode));

            AreaCode.ValidateMaxLength(result, nameof(AreaCode), 3);

            Exchange.ValidateRequired(result, nameof(Exchange));

            Exchange.ValidateMaxLength(result, nameof(Exchange), 3);

            Number.ValidateRequired(result, nameof(Number));

            Number.ValidateMaxLength(result, nameof(Number), 4);
        }
        // GET: AreaCodes1/Delete/5
        public ActionResult Delete(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AreaCode areaCode = db.AreaCodes.Find(id);

            if (areaCode == null)
            {
                return(HttpNotFound());
            }
            return(View(areaCode));
        }
示例#32
0
		internal FiscalCode(
			LastNameCode lastNameCode,
			FirstNameCode firstNameCode,
			YearCode yearCode,
			MonthCode monthCode,
			DayCode dayCode,
			AreaCode areaCode,
			ControlCode controlCode)
			: this(
				lastNameCode.ToString(),
				firstNameCode.ToString(),
				yearCode.ToString(),
				monthCode.ToString(),
				dayCode.ToString(),
				areaCode.ToString(),
				controlCode.ToString())
		{
		}
示例#33
0
		public FiscalCode Calculate(NaturalPerson naturalPerson, AreaCode areaCode)
		{
			Enforce.Argument(() => areaCode);

			var lastName = new LastNameCode(naturalPerson.LastName.Replace(" ", null));

			var firstName = new FirstNameCode(naturalPerson.FirstName.Replace(" ", null));

			var year = new YearCode(naturalPerson.BirthDate);

			var month = new MonthCode(naturalPerson.BirthDate);

			var day = new DayCode(naturalPerson.BirthDate, naturalPerson.Sex);

			var control = new ControlCode(lastName, firstName, year, month, day, areaCode);

			var fiscalCode = new FiscalCode(lastName, firstName, year, month, day, areaCode, control);

			return fiscalCode;
		}