Пример #1
0
        public CommandResponse Execute(GameState game, string[] args)
        {
            var updatedRegions = new Regions();

            // Update visible regions
            for (int i = 0; i < args.Length; i += 3)
            {
                int regionId = int.Parse(args[i]);
                int armies = int.Parse(args[i + 2]);
                string ownerId = args[i + 1];

                Region region = game.Map.Regions[regionId];

                region.Armies = armies;
                region.IsVisible = true;

                if (ownerId == "neutral")
                    region.Owner = null;
                else
                    region.Owner = ownerId == game.Bot.BotPlayer.Id ? game.Bot.BotPlayer : game.Opponents[args[i + 1]];

                updatedRegions.Add(region);
            }

            // Mark invisible regions as such.  Leave the previous info in place for now.
            game.Map.Regions.Except(updatedRegions).ToList().ForEach(r =>
            {
                r.IsVisible = false;
            });

            return new CommandResponse(CommandAction.None);
        }
 public MasterServerRequestBatchPacket(Regions regionCode, string startIp, string filter)
     : base(SteamPacketTypes.A2M_GET_SERVERS_BATCH2)
 {
     Region = regionCode;
     StartIP = startIp;
     Filter = filter;
 }
Пример #3
0
        public static string BuildApiStaticDataUrl(Regions region, Config currentConfiguration)
        {
            string staticDataFormat = "{0}{1}/{2}/{3}";
            string baseUrl = Config.GetBaseUrl(Regions.global);
            string staticDataUrl = string.Format(staticDataFormat, baseUrl, currentConfiguration.StaticData, region, currentConfiguration.ApiLatestStaticDataVersion);

            return staticDataUrl;
        }
Пример #4
0
 public Maticsoft.Model.Shop.Shipping.ShippingAddress GetModel(int ShippingId)
 {
     Regions regions = new Regions();
     Maticsoft.Model.Shop.Shipping.ShippingAddress model = this.dal.GetModel(ShippingId);
     if (model != null)
     {
         model.RegionFullName = regions.GetFullNameById4Cache(model.RegionId);
     }
     return model;
 }
Пример #5
0
 public string GetRegionName(object target)
 {
     string str = string.Empty;
     if (!StringPlus.IsNullOrEmpty(target))
     {
         int id = Globals.SafeInt(target, 0);
         str = new Regions().GetFullNameById4Cache(id);
     }
     return str;
 }
        public CommandResponse Execute(GameState game, string[] args)
        {
            var availableOptions = new Regions();

            for (int i = 1; i < args.Length; i++)
                availableOptions.Add(game.Map.Regions[int.Parse(args[i])]);

            Regions selectedRegions = game.Bot.PickStartingRegions(game.Map, availableOptions);

            return new CommandResponse(CommandAction.SendData,
                string.Join(" ", selectedRegions.Select(r => r.Id.ToString())));
        }
Пример #7
0
        public Regions PickStartingRegions(Map map, Regions availableOptions)
        {
            int numberToPick = availableOptions.Count > GameSettings.StartingRegions ? GameSettings.StartingRegions : availableOptions.Count;

            var selectedRegions = new Regions();

            // Sgt. Stupid picks random regions from the ones he was provided.
            availableOptions.OrderBy(x => _random.Next()).Take(numberToPick)
                .ToList()
                .ForEach(selectedRegions.Add);

            return selectedRegions;
        }
Пример #8
0
        public Regions PickStartingRegions(Map map, Regions availableOptions)
        {
            int numberToPick = availableOptions.Count > 6 ? 6 : availableOptions.Count;

            IEnumerable<RegionScore<StartRegion>> scores = _calc.CalculateStartRegions(map);

            var pickList = new Regions();

            pickList.AddRange(scores
                .OrderByCumulativeScore()
                .Where(r => availableOptions.Contains(r.Region))
                .Select(r => r.Region)
                .Take(numberToPick));

            return pickList;
        }
Пример #9
0
 private void ShowInfo(int ID)
 {
     AccountsPrincipal existingPrincipal = new AccountsPrincipal(ID);
     User user = new User(existingPrincipal);
     UsersExpModel usersExpModel = new UsersExp().GetUsersExpModel(ID);
     if ((user != null) && (usersExpModel != null))
     {
         this.lblUserName.Text = user.UserName;
         this.lblTrueName.Text = user.TrueName;
         this.lblPhone.Text = user.Phone;
         this.lblNickName.Text = user.NickName;
         this.lblEmail.Text = user.Email;
         this.lblAblums.Text = usersExpModel.AblumsCount.ToString();
         this.lblFans.Text = usersExpModel.FansCount.ToString();
         this.lblFav.Text = usersExpModel.FavouritesCount.ToString();
         this.lblFellows.Text = usersExpModel.FellowCount.ToString();
         this.lblProducts.Text = usersExpModel.ProductsCount.ToString();
         this.lblSex.Text = (!string.IsNullOrWhiteSpace(user.Sex) && (user.Sex.Trim() == "0")) ? "女" : "男";
         this.lblActivity.Text = user.Activity ? "正常使用" : "已经冻结";
         this.lblCreTime.Text = user.User_dateCreate.ToString("yyyy-MM-dd HH:mm:ss");
     }
     if (usersExpModel != null)
     {
         Regions regions = new Regions();
         this.imageGra.ImageUrl = string.Format("/Upload/User/Gravatar/{0}.jpg", usersExpModel.UserID);
         string regionNameByRID = regions.GetRegionNameByRID(Globals.SafeInt(usersExpModel.Address, 0));
         if (regionNameByRID.Contains("北京北京"))
         {
             regionNameByRID = regionNameByRID.Replace("北京北京", "北京");
         }
         else if (regionNameByRID.Contains("上海上海"))
         {
             regionNameByRID = regionNameByRID.Replace("上海上海", "上海");
         }
         else if (regionNameByRID.Contains("重庆重庆"))
         {
             regionNameByRID = regionNameByRID.Replace("重庆重庆", "重庆");
         }
         else if (regionNameByRID.Contains("天津天津"))
         {
             regionNameByRID = regionNameByRID.Replace("天津天津", "天津");
         }
         this.lblAddress.Text = string.IsNullOrEmpty(usersExpModel.Address) ? "暂未设置" : regionNameByRID;
         this.lblPoints.Text = usersExpModel.Points.ToString();
         this.lblLoginDate.Text = usersExpModel.LastLoginTime.ToString("yyyy-MM-dd HH:mm:ss");
     }
 }
Пример #10
0
 public List<Maticsoft.Model.Shop.Shipping.ShippingAddress> DataTableToList(DataTable dt)
 {
     Regions regions = new Regions();
     List<Maticsoft.Model.Shop.Shipping.ShippingAddress> list = new List<Maticsoft.Model.Shop.Shipping.ShippingAddress>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Shop.Shipping.ShippingAddress item = this.dal.DataRowToModel(dt.Rows[i]);
             if (item != null)
             {
                 item.RegionFullName = regions.GetFullNameById4Cache(item.RegionId);
                 list.Add(item);
             }
         }
     }
     return list;
 }
Пример #11
0
 public static String GetImageFolder(Regions region)
 {
     //const string basic = @"~/ifd/gallery/";
     string basic = String.Empty;
     switch (region)
     {
         case Regions.CC:
             return basic + Enum.GetName(typeof(Regions), Regions.CC);
         case Regions.NR1:
             return basic + Enum.GetName(typeof(Regions), Regions.NR1);
         case Regions.NR2:
             return basic + Enum.GetName(typeof(Regions), Regions.NR2);
         case Regions.WR1:
             return basic + Enum.GetName(typeof(Regions), Regions.WR1);
         case Regions.WR2:
             return basic + Enum.GetName(typeof(Regions), Regions.WR2);
         case Regions.SR1:
             return basic + Enum.GetName(typeof(Regions), Regions.SR1);
         case Regions.SR2:
             return basic + Enum.GetName(typeof(Regions), Regions.SR2);
         case Regions.ER1:
             return basic + Enum.GetName(typeof(Regions), Regions.ER1);
         case Regions.ER2:
             return basic + Enum.GetName(typeof(Regions), Regions.ER2);
         case Regions.NER:
             return basic + Enum.GetName(typeof(Regions), Regions.NER);
         case Regions.POSCC:
             return basic + Enum.GetName(typeof(Regions), Regions.POSCC);
         case Regions.NRLDC:
             return basic + Enum.GetName(typeof(Regions), Regions.NRLDC);
         case Regions.NERLDC:
             return basic + Enum.GetName(typeof(Regions), Regions.NERLDC);
         case Regions.SRLDC:
             return basic + Enum.GetName(typeof(Regions), Regions.SRLDC);
         case Regions.WRLDC:
             return basic + Enum.GetName(typeof(Regions), Regions.WRLDC);
         case Regions.ERLDC:
             return basic + Enum.GetName(typeof(Regions), Regions.ERLDC);
         default:
             return basic + Enum.GetName(typeof(Regions), Regions.INVALID);
     }
 }
Пример #12
0
        public static bool Match(Value left, Value right, bool required, Block condition, string bindingName = "", bool assigning = false)
        {
            if (left is IMatch matching)
            {
                return(returnMatched(matching.Match(right), required, condition));
            }

            switch (right)
            {
            case BoundValue boundValue:
            {
                var fieldName  = boundValue.Name;
                var realResult = Match(left, boundValue.InnerValue, required, condition, fieldName);
                if (realResult && !(boundValue.InnerValue is Class))
                {
                    Regions.SetBinding(fieldName, left, assigning);
                }

                return(realResult);
            }

            case Block block:
                right = block.Evaluate();
                break;
            }

            if (left is Some leftSome)
            {
                var(someMatched, cargoName, cargo) = leftSome.Match(right);
                if (someMatched && cargoName != "_")
                {
                    Regions.SetBinding(cargoName, cargo, assigning);
                }

                return(returnMatched(someMatched, required, condition));
            }

            if (left.Type == ValueType.None && right.Type == ValueType.None)
            {
                return(returnMatched(true, required, condition));
            }

            switch (left)
            {
            case Failure leftFailure:
            {
                var(someMatched, messageName, message) = leftFailure.Match(right);
                if (someMatched && messageName != "_")
                {
                    Regions.SetBinding(messageName, message, assigning);
                }

                return(returnMatched(someMatched, required, condition));
            }

            case List leftList when right is List rightList:
                return(returnMatched(leftList.Match(rightList), required, condition));

            case List when right.IsNil:
                return(returnMatched(false, required, condition));
            }

            bool leftWasAnObject;
            bool matched;

            if (right.Type != ValueType.Any && right.Type != ValueType.Placeholder)
            {
                matched = matchToLeftObject(left, right, required, condition, out leftWasAnObject, bindingName, assigning);
                if (leftWasAnObject)
                {
                    return(returnMatched(matched, required, condition));
                }
            }

            if (right is Object rightObject)
            {
                var rightClass = rightObject.Class;
                if (rightClass.RespondsTo("match"))
                {
                    left = rightClass.StaticObject.SendToSelf("match", left);
                    if (left?.IsNil ?? true)
                    {
                        return(returnMatched(false, required, condition));
                    }

                    matched = matchToLeftObject(left, right, required, condition, out leftWasAnObject, bindingName, assigning);
                    if (leftWasAnObject)
                    {
                        return(returnMatched(matched, required, condition));
                    }
                }
            }

            if (left is Record leftRecord && right is Record rightRecord)
            {
                return(returnMatched(leftRecord.Match(rightRecord, required), required, condition));
            }

            if (right is AutoInvoker autoInvoker)
            {
                right = autoInvoker.Resolve();
            }

            if (left.IsNil || right.IsNil)
            {
                return(returnMatched(false, required, condition));
            }

            if (right is Alternation alternation)
            {
                alternation.Reset();
                while (true)
                {
                    var value = alternation.Dequeue();
                    if (value.IsNil)
                    {
                        return(returnMatched(false, required, condition));
                    }

                    var result = Match(left, value, required, condition);
                    if (result)
                    {
                        return(returnMatched(true, required, condition));
                    }
                }
            }

            if (left.ID == right.ID)
            {
                return(returnMatched(true, required, condition));
            }

            if (left.Type == ValueType.String && right.Type == ValueType.String)
            {
                return(returnMatched(string.Compare(left.Text, right.Text, StringComparison.Ordinal) == 0, required,
                                     condition));
            }

            switch (right.Type)
            {
            case ValueType.Any:
                return(returnMatched(true, required, condition));

            case ValueType.TypeName:
                return(returnMatched(right.Compare(left) == 0, required, condition));

            case ValueType.Placeholder:
                Regions.SetBinding(right.Text, left, assigning);
                return(returnMatched(true, required, condition));

            case ValueType.Symbol:
                return(returnMatched(string.Compare(right.Text, left.Text, StringComparison.Ordinal) == 0, required,
                                     condition));
            }

            if (right.IsArray)
            {
                var rightArray = (Array)right.SourceArray;
                if (left is Generator generator)
                {
                    return(returnMatched(generator.Match(rightArray, required, assigning), required, condition));
                }

                if (left.IsArray)
                {
                    var leftArray = (Array)left.SourceArray;
                    return(returnMatched(leftArray.MatchArray(rightArray, required, assigning), required, condition));
                }

                var verb = new Equals();
                return(returnMatched(verb.DoComparison(left, rightArray).IsTrue, required, condition));
            }

            if (right.Type == ValueType.Tuple && left.Type == ValueType.Tuple)
            {
                var leftTuple  = (OTuple)left;
                var rightTuple = (OTuple)right;
                return(returnMatched(leftTuple.Match(rightTuple, required, assigning), required, condition));
            }

            switch (right.Type)
            {
            case ValueType.Block:
                return(returnMatched(((Block)right).IsTrue, required, condition));

            case ValueType.Lambda:
                var closure      = (Lambda)right;
                var variableName = closure.Parameters.VariableName(0, State.DefaultParameterNames.ValueVariable);
                Regions.SetBinding(variableName, left, assigning);
                return(returnMatched(closure.Block.Evaluate().IsTrue, required, condition));

            case ValueType.Message:
                var message = (Message)right;
                return(returnMatched(message.MessageName.EndsWith("?") ? SendMessage(left, message).IsTrue :
                                     MessageManager.MessagingState.RespondsTo(left, message.MessageName), required, condition));

            case ValueType.MessagePath:
                var messageChain = (MessagePath)right;
                return(returnMatched(messageChain.Invoke(left).IsTrue, required, condition));

            case ValueType.Null:
                return(returnMatched(left.Type == ValueType.Null, required, condition));

            case ValueType.Set:
                var set = (Set)right;
                return(returnMatched(set.Contains(left), required, condition));
            }

            return(right switch
            {
                Unto unto => returnMatched(unto.CompareTo(left), required, condition),
                Regex regex => returnMatched(regex.Match(left.Text).IsTrue, required, condition),
                _ => returnMatched(right is Pattern pattern ? pattern.MatchAndBind(left.Text) : Runtime.Compare(left, right) == 0, required, condition)
            });
 public EntityService(string subscriptionKey, Regions region)
     : base(subscriptionKey, region)
 {
 }
Пример #14
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("CellFlags", false, out subEle))
            {
                if (CellFlags == null)
                {
                    CellFlags = new SimpleSubrecord <CellFlags>();
                }

                CellFlags.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Grid", false, out subEle))
            {
                if (Grid == null)
                {
                    Grid = new CellGrid();
                }

                Grid.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Lighting", false, out subEle))
            {
                if (Lighting == null)
                {
                    Lighting = new CellLighting();
                }

                Lighting.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("FootstepMaterial", false, out subEle))
            {
                if (FootstepMaterial == null)
                {
                    FootstepMaterial = new FootstepMaterial();
                }

                FootstepMaterial.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LightTemplate", false, out subEle))
            {
                if (LightTemplate == null)
                {
                    LightTemplate = new RecordReference();
                }

                LightTemplate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LightTemplateInherit", false, out subEle))
            {
                if (LightTemplateInherit == null)
                {
                    LightTemplateInherit = new SimpleSubrecord <LightTemplateInheritFlags>();
                }

                LightTemplateInherit.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("WaterHeight", false, out subEle))
            {
                if (WaterHeight == null)
                {
                    WaterHeight = new SimpleSubrecord <Single>();
                }

                WaterHeight.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("WaterNoiseTexture", false, out subEle))
            {
                if (WaterNoiseTexture == null)
                {
                    WaterNoiseTexture = new SimpleSubrecord <String>();
                }

                WaterNoiseTexture.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Regions", false, out subEle))
            {
                if (Regions == null)
                {
                    Regions = new SortedFormArray();
                }

                Regions.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ImageSpace", false, out subEle))
            {
                if (ImageSpace == null)
                {
                    ImageSpace = new RecordReference();
                }

                ImageSpace.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unknown", false, out subEle))
            {
                if (Unknown == null)
                {
                    Unknown = new SimpleSubrecord <Byte>();
                }

                Unknown.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("EncounterZone", false, out subEle))
            {
                if (EncounterZone == null)
                {
                    EncounterZone = new RecordReference();
                }

                EncounterZone.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Climate", false, out subEle))
            {
                if (Climate == null)
                {
                    Climate = new RecordReference();
                }

                Climate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Water", false, out subEle))
            {
                if (Water == null)
                {
                    Water = new RecordReference();
                }

                Water.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Owner", false, out subEle))
            {
                if (Owner == null)
                {
                    Owner = new RecordReference();
                }

                Owner.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("FactionRank", false, out subEle))
            {
                if (FactionRank == null)
                {
                    FactionRank = new SimpleSubrecord <Int32>();
                }

                FactionRank.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("AcousticSpace", false, out subEle))
            {
                if (AcousticSpace == null)
                {
                    AcousticSpace = new RecordReference();
                }

                AcousticSpace.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unused", false, out subEle))
            {
                if (Unused == null)
                {
                    Unused = new SimpleSubrecord <Byte>();
                }

                Unused.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MusicType", false, out subEle))
            {
                if (MusicType == null)
                {
                    MusicType = new RecordReference();
                }

                MusicType.ReadXML(subEle, master);
            }
        }
Пример #15
0
 public override void WriteData(ESPWriter writer)
 {
     if (EditorID != null)
     {
         EditorID.WriteBinary(writer);
     }
     if (Name != null)
     {
         Name.WriteBinary(writer);
     }
     if (CellFlags != null)
     {
         CellFlags.WriteBinary(writer);
     }
     if (Grid != null)
     {
         Grid.WriteBinary(writer);
     }
     if (Lighting != null)
     {
         Lighting.WriteBinary(writer);
     }
     if (FootstepMaterial != null)
     {
         FootstepMaterial.WriteBinary(writer);
     }
     if (LightTemplate != null)
     {
         LightTemplate.WriteBinary(writer);
     }
     if (LightTemplateInherit != null)
     {
         LightTemplateInherit.WriteBinary(writer);
     }
     if (WaterHeight != null)
     {
         WaterHeight.WriteBinary(writer);
     }
     if (WaterNoiseTexture != null)
     {
         WaterNoiseTexture.WriteBinary(writer);
     }
     if (Regions != null)
     {
         Regions.WriteBinary(writer);
     }
     if (ImageSpace != null)
     {
         ImageSpace.WriteBinary(writer);
     }
     if (Unknown != null)
     {
         Unknown.WriteBinary(writer);
     }
     if (EncounterZone != null)
     {
         EncounterZone.WriteBinary(writer);
     }
     if (Climate != null)
     {
         Climate.WriteBinary(writer);
     }
     if (Water != null)
     {
         Water.WriteBinary(writer);
     }
     if (Owner != null)
     {
         Owner.WriteBinary(writer);
     }
     if (FactionRank != null)
     {
         FactionRank.WriteBinary(writer);
     }
     if (AcousticSpace != null)
     {
         AcousticSpace.WriteBinary(writer);
     }
     if (Unused != null)
     {
         Unused.WriteBinary(writer);
     }
     if (MusicType != null)
     {
         MusicType.WriteBinary(writer);
     }
 }
Пример #16
0
 public static Regions CreateRegions(int regionID)
 {
     Regions regions = new Regions();
     regions.RegionID = regionID;
     return regions;
 }
Пример #17
0
        private void GetRelated()
        {
            // Clear related
            Regions.Clear();
            Properties.Clear();
            AttachedContent.Clear();

            // Get group parents
            DisableGroups = SysGroup.GetParents(Page.GroupId);
            DisableGroups.Reverse();

            // Get template & permalink
            Template  = PageTemplate.GetSingle("pagetemplate_id = @0", Page.TemplateId);
            Permalink = Permalink.GetSingle(Page.PermalinkId);
            if (Permalink == null)
            {
                // Get the site tree
                using (var db = new DataContext()) {
                    var sitetree = db.SiteTrees.Where(s => s.Id == Page.SiteTreeId).Single();

                    Permalink = new Permalink()
                    {
                        Id = Guid.NewGuid(), Type = Permalink.PermalinkType.PAGE, NamespaceId = sitetree.NamespaceId
                    };
                    Page.PermalinkId = Permalink.Id;
                }
            }

            // Get placement ref title
            if (!IsSite)
            {
                if (Page.ParentId != Guid.Empty || Page.Seqno > 1)
                {
                    Page refpage = null;
                    if (Page.Seqno > 1)
                    {
                        if (Page.ParentId != Guid.Empty)
                        {
                            refpage = Page.GetSingle("page_parent_id = @0 AND page_seqno = @1", Page.ParentId, Page.Seqno - 1);
                        }
                        else
                        {
                            refpage = Page.GetSingle("page_parent_id IS NULL AND page_seqno = @0", Page.Seqno - 1);
                        }
                    }
                    else
                    {
                        refpage = Page.GetSingle(Page.ParentId, true);
                    }
                    PlaceRef = refpage.Title;
                }
            }

            if (Template != null)
            {
                // Only load regions & properties if this is an original
                if (Page.OriginalId == Guid.Empty)
                {
                    // Get regions
                    var regions = RegionTemplate.Get("regiontemplate_template_id = @0", Template.Id, new Params()
                    {
                        OrderBy = "regiontemplate_seqno"
                    });
                    foreach (var rt in regions)
                    {
                        var reg = Region.GetSingle("region_regiontemplate_id = @0 AND region_page_id = @1 and region_draft = @2",
                                                   rt.Id, Page.Id, Page.IsDraft);
                        if (reg != null)
                        {
                            Regions.Add(reg);
                        }
                        else
                        {
                            Regions.Add(new Region()
                            {
                                InternalId       = rt.InternalId,
                                Name             = rt.Name,
                                Type             = rt.Type,
                                PageId           = Page.Id,
                                RegiontemplateId = rt.Id,
                                IsDraft          = Page.IsDraft,
                                IsPageDraft      = Page.IsDraft
                            });
                        }
                    }

                    // Get Properties
                    foreach (string name in Template.Properties)
                    {
                        Property prp = Property.GetSingle("property_name = @0 AND property_parent_id = @1 AND property_draft = @2",
                                                          name, Page.Id, Page.IsDraft);
                        if (prp != null)
                        {
                            Properties.Add(prp);
                        }
                        else
                        {
                            Properties.Add(new Property()
                            {
                                Name = name, ParentId = Page.Id, IsDraft = Page.IsDraft
                            });
                        }
                    }
                }
            }
            else
            {
                throw new ArgumentException("Could not find page template for page {" + Page.Id.ToString() + "}");
            }

            // Only load attachments if this is an original
            if (Page.OriginalId == Guid.Empty)
            {
                // Get attached content
                if (Page.Attachments.Count > 0)
                {
                    // Content meta data is actually memcached, so this won't result in multiple queries
                    Page.Attachments.ForEach(a => {
                        Models.Content c = Models.Content.GetSingle(a, true);
                        if (c != null)
                        {
                            AttachedContent.Add(c);
                        }
                    });
                }
            }

            // Get page position
            Parents = BuildParentPages(Sitemap.GetStructure(Page.SiteTreeInternalId, false), Page);
            Parents.Insert(0, new PagePlacement()
            {
                Level = 1, IsSelected = Page.ParentId == Guid.Empty
            });
            Siblings = BuildSiblingPages(Page.Id, Page.ParentId, Page.Seqno, Page.ParentId, Page.SiteTreeInternalId);

            // Only load extensions if this is an original
            if (Page.OriginalId == Guid.Empty)
            {
                // Get extensions
                Extensions = Page.GetExtensions();
            }

            // Initialize regions
            foreach (var reg in Regions)
            {
                if (Extend.ExtensionManager.ExtensionTypes.ContainsKey(reg.Type))
                {
                    var m = Extend.ExtensionManager.ExtensionTypes[reg.Type].GetMethod("Init");
                    if (m != null)
                    {
                        m.Invoke(reg.Body, new object[] { this });
                    }
                }
            }

            // Get whether comments should be enabled
            EnableComments = Areas.Manager.Models.CommentSettingsModel.Get().EnablePages;
            if (!Page.IsNew && EnableComments)
            {
                using (var db = new DataContext()) {
                    Comments = db.Comments.
                               Include("CreatedBy").
                               Where(c => c.ParentId == Page.Id && c.ParentIsDraft == false).
                               OrderByDescending(c => c.Created).ToList();
                }
            }

            // Get the site if this is a site page
            if (Permalink.Type == Models.Permalink.PermalinkType.SITE)
            {
                using (var db = new DataContext()) {
                    SiteTree = db.SiteTrees.Where(s => s.Id == Page.SiteTreeId).Single();
                }
            }

            // Check if the page can be published
            if (Page.OriginalId != Guid.Empty)
            {
                CanPublish = Page.GetScalar("SELECT count(*) FROM page WHERE page_id=@0 AND page_draft=0", Page.OriginalId) > 0;
            }
        }
Пример #18
0
        /// <summary>
        /// Saves the page and all of it's related regions.
        /// </summary>
        /// <param name="publish">If the page should be published</param>
        /// <returns>If the operation succeeded</returns>
        public virtual bool SaveAll(bool draft = true)
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    bool permalinkfirst = Page.IsNew;

                    // Save permalink first if the page is new
                    if (permalinkfirst)
                    {
                        if (Permalink.IsNew && String.IsNullOrEmpty(Permalink.Name))
                        {
                            Permalink.Name = Permalink.Generate(!String.IsNullOrEmpty(Page.NavigationTitle) ?
                                                                Page.NavigationTitle : Page.Title);
                            var param = SysParam.GetByName("HIERARCHICAL_PERMALINKS");
                            if (param != null && param.Value == "1" && Page.ParentId != Guid.Empty)
                            {
                                var parent = Page.GetSingle(Page.ParentId, true);
                                Permalink.Name = parent.Permalink + "/" + Permalink.Name;
                            }
                        }
                        Permalink.Save(tx);
                    }

                    // Save page
                    if (draft)
                    {
                        Page.Save(tx);
                    }
                    else
                    {
                        Page.SaveAndPublish(tx);
                    }

                    // Save regions & properties
                    Regions.ForEach(r => {
                        r.IsDraft = r.IsPageDraft = true;
                        r.Save(tx);
                        if (!draft)
                        {
                            if (Region.GetScalar("SELECT COUNT(region_id) FROM region WHERE region_id=@0 AND region_draft=0", r.Id) == 0)
                            {
                                r.IsNew = true;
                            }
                            r.IsDraft = r.IsPageDraft = false;
                            r.Save(tx);
                        }
                    });
                    Properties.ForEach(p => {
                        p.IsDraft = true;
                        p.Save(tx);
                        if (!draft)
                        {
                            if (Property.GetScalar("SELECT COUNT(property_id) FROM property WHERE property_id=@0 AND property_draft=0", p.Id) == 0)
                            {
                                p.IsNew = true;
                            }
                            p.IsDraft = false;
                            p.Save(tx);
                        }
                    });

                    // Save extensions
                    foreach (var ext in Extensions)
                    {
                        ext.ParentId = Page.Id;
                        ext.Save(tx);
                        if (!draft)
                        {
                            if (Extension.GetScalar("SELECT COUNT(extension_id) FROM extension WHERE extension_id=@0 AND extension_draft=0", ext.Id) == 0)
                            {
                                ext.IsNew = true;
                            }
                            ext.IsDraft = false;
                            ext.Save(tx);
                        }
                    }

                    // Save permalink last if the page isn't new
                    if (!permalinkfirst)
                    {
                        Permalink.Save(tx);
                    }

                    // Change global last modified
                    if (!draft)
                    {
                        Web.ClientCache.SetSiteLastModified(tx);
                    }

                    // Clear cache for all post regions if we're publishing
                    if (!draft)
                    {
                        foreach (var reg in Regions)
                        {
                            if (reg.Body is Extend.Regions.PostRegion)
                            {
                                ((Extend.Regions.PostRegion)reg.Body).ClearCache(Page, reg);
                            }
                        }
                    }

                    tx.Commit();

                    if (IsSite)
                    {
                        using (var db = new DataContext()) {
                            var site = db.SiteTrees.Where(s => s.Id == Page.SiteTreeId).Single();
                            site.MetaTitle       = SiteTree.MetaTitle;
                            site.MetaDescription = SiteTree.MetaDescription;
                            db.SaveChanges();
                        }
                        if (!draft)
                        {
                            PageModel.RemoveSitePageFromCache(Page.SiteTreeId);
                            WebPages.WebPiranha.RegisterDefaultHostNames();
                        }
                    }
                } catch { tx.Rollback(); throw; }
            }
            return(true);
        }
Пример #19
0
        private async void mttxtboxUserID_TextChanged(object sender, EventArgs e)
        {
            Regions      regions     = new Regions();
            IUserDetails userdetails = new UserDetails();


            if (!string.IsNullOrWhiteSpace(mttxtboxUserID.Text) && Regex.Match(mttxtboxUserID.Text, "[A-Za-z0-9]+", RegexOptions.CultureInvariant).Success)
            {
                lstViewDefaultPaths.Items.Clear();

                try
                {
                    objPerson = await userdetails.GetUserDetails(Regex.Match(mttxtboxUserID.Text, "[A-Za-z0-9]+", RegexOptions.CultureInvariant).Value);

                    DisplayView(objPerson);


                    if (Directory.Exists($@"C:\Users\{mttxtboxUserID.Text}"))
                    {
                        var dirItems = Directory.EnumerateDirectories($@"C:\users\{mttxtboxUserID.Text}", "*.*", SearchOption.TopDirectoryOnly);

                        if (dirItems.Count() > 0)
                        {
                            foreach (var item in dirItems)
                            {
                                lstViewDefaultPaths.Items.Add(item);
                            }
                        }
                        else
                        {
                            lstViewDefaultPaths.Items.Clear();
                            lstViewDefaultPaths.Items.Add("Nothing found / user profile is empty");
                        }
                    }
                    else
                    {
                        lstViewDefaultPaths.Items.Add("Nothing found / user profile is empty");
                    }
                }
                catch (Exception Ex)
                {
                    InitializeUIException(Ex.Message);
                }
            }
            else
            {
                try
                {
                    objPerson = await userdetails.GetUserDetails(Environment.UserName);

                    if (objPerson != null)
                    {
                        DisplayView(objPerson);
                    }

                    lstViewDefaultPaths.Items.Clear();
                }
                catch (Exception Ex)
                {
                    InitializeUIException(Ex.Message);
                }
            }
        }
Пример #20
0
 // Todo:  Initialize via reflection & injection from configuration
 static DarkestDungeonGame()
 {
     Regions        = GameBot.Plugins.Get <RegionPlugin>();
     CampaignButton = Regions.GetRegion("CampaignButton");
 }
Пример #21
0
 /// <summary>
 /// Returns Base Url to the WoW API
 /// </summary>
 /// <returns></returns>
 internal static string GetBaseUrl(Regions region)
 {
     string regionShortcut = EnumHelper.GetDisplayName<Regions>(region);
     return string.Format(BASE_URL, regionShortcut);
 }
Пример #22
0
        /// <summary>
        /// Geofence plugin iOS implementation
        /// </summary>
        public GeofenceImplementation()
        {
            mGeofenceResults = new Dictionary <string, GeofenceResult>();

            using (var pool = new NSAutoreleasePool())
            {
                pool.InvokeOnMainThread(() => {
                    locationManager = new CLLocationManager();
                    locationManager.DidStartMonitoringForRegion += DidStartMonitoringForRegion;
                    locationManager.RegionEntered     += RegionEntered;
                    locationManager.RegionLeft        += RegionLeft;
                    locationManager.Failed            += OnFailure;
                    locationManager.DidDetermineState += DidDetermineState;
                    locationManager.LocationsUpdated  += LocationsUpdated;
                });
            }
            string priorityType = "Balanced Power";

            switch (CrossGeofence.GeofencePriority)
            {
            case GeofencePriority.HighAccuracy:
                priorityType = "High Accuracy";
                locationManager.DesiredAccuracy = CLLocation.AccuracyBest;
                break;

            case GeofencePriority.AcceptableAccuracy:
                priorityType = "Acceptable Accuracy";
                locationManager.DesiredAccuracy = CLLocation.AccuracyNearestTenMeters;
                break;

            case GeofencePriority.MediumAccuracy:
                priorityType = "Medium Accuracy";
                locationManager.DesiredAccuracy = CLLocation.AccuracyHundredMeters;
                break;

            case GeofencePriority.LowAccuracy:
                priorityType = "Low Accuracy";
                locationManager.DesiredAccuracy = CLLocation.AccuracyKilometer;
                break;

            case GeofencePriority.LowestAccuracy:
                priorityType = "Lowest Accuracy";
                locationManager.DesiredAccuracy = CLLocation.AccuracyThreeKilometers;
                break;

            default:
                locationManager.DesiredAccuracy = CLLocation.AccurracyBestForNavigation;
                break;
            }
            System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}: {2}", CrossGeofence.Id, "Location priority set to", priorityType));

            if (CrossGeofence.SmallestDisplacement > 0)
            {
                locationManager.DistanceFilter = CrossGeofence.SmallestDisplacement;
                System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}: {2} meters", CrossGeofence.Id, "Location smallest displacement set to", CrossGeofence.SmallestDisplacement));
            }



            if (locationManager.MonitoredRegions.Count > 0 && IsMonitoring)
            {
                NSSet monitoredRegions = locationManager.MonitoredRegions;


                foreach (CLCircularRegion region in monitoredRegions)
                {
                    //If not on regions remove on startup since that region was set not persistent
                    if (!Regions.ContainsKey(region.Identifier))
                    {
                        locationManager.StopMonitoring(region);
                    }
                    else
                    {
                        locationManager.RequestState(region);
                    }
                }

                locationManager.StartMonitoringSignificantLocationChanges();

                string message = string.Format("{0} - {1} {2} region(s)", CrossGeofence.Id, "Actually monitoring", locationManager.MonitoredRegions.Count);
                System.Diagnostics.Debug.WriteLine(message);
            }

            SetLastKnownLocation(locationManager.Location);
        }
Пример #23
0
        /*/// <summary>
         * /// Process the Text template.
         * /// </summary>
         * private void ProcessTextTemplate(string content)
         * {
         *  ActiveUp.Net.Mail.Logger.AddEntry("Processing the TEXT template.", 1);
         *
         *  // Initialize strings to be used later
         *  string line = string.Empty, lineUpper = string.Empty;
         *
         *  // Initialize the StringReader to read line per line
         *  StringReader reader = new StringReader(content);
         *
         *  // Initialize the actual body count
         *  int bodyCount = _bodies.Count, lineNumber = 0;
         *
         *  // Read and parse each line. Append the data in the properties.
         *  while (reader.Peek() > -1)
         *  {
         *      ActiveUp.Net.Mail.Logger.AddEntry("Line parsed. Body count: + " + bodyCount.ToString() + ".", 0);
         *
         *      line = reader.ReadLine();
         *      lineNumber++;
         *      lineUpper = line.ToUpper();
         *
         *      // If a property, then set value
         *      if (lineUpper.StartsWith("TO:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("TO property found: + " + line + " (raw).", 0);
         *          this.Message.To.Add(Parser.ParseAddress(ExtractValue(line)));
         *      }
         *      else if (lineUpper.StartsWith("BCC:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BCC property found: + " + line + " (raw).", 0);
         *          this.Message.Bcc.Add(Parser.ParseAddress(ExtractValue(line)));
         *      }
         *      else if (lineUpper.StartsWith("CC:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("CC property found: + " + line + " (raw).", 0);
         *          this.Message.Cc.Add(Parser.ParseAddress(ExtractValue(line)));
         *      }
         *      else if (lineUpper.StartsWith("FROM:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("FROM property found: + " + line + " (raw).", 0);
         *          this.Message.From = Parser.ParseAddress(ExtractValue(line));
         *      }
         *      else if (lineUpper.StartsWith("SUBJECT:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("SUBJECT property found: + " + line + " (raw).", 0);
         *          this.Message.Subject += ExtractValue(line);
         *      }
         *      else if (lineUpper.StartsWith("SMTPSERVER:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("SMTPSERVER property found: + " + line + " (raw).", 0);
         *          this.SmtpServers.Add(ExtractValue(line), 25);
         *      }
         *      else if (lineUpper.StartsWith("BODYTEXT:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BODYTEXT property found: + " + line + " (raw).", 0);
         *          this.Bodies.Add(ExtractValue(line), BodyFormat.Text);
         *          bodyCount++;
         *      }
         *      else if (lineUpper.StartsWith("BODYHTML:"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BODYHTML property found: + " + line + " (raw).", 0);
         *          this.Bodies.Add(ExtractValue(line), BodyFormat.Html);
         *          bodyCount++;
         *      }
         *      else if (lineUpper.StartsWith("FIELDFORMAT:") && lineUpper.IndexOf("=") > -1)
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("FIELDFORMAT property found: + " + line + " (raw).", 0);
         *          this.FieldsFormats.Add(ExtractFormat(line));
         *      }
         *      else if (lineUpper.StartsWith("//"))
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("COMMENT line found: + " + line + " (raw).", 0);
         *          // Line is a comment, so do nothing
         *      }
         *          // If not a property, then it's a message line
         *      else
         *      {
         *          ActiveUp.Net.Mail.Logger.AddEntry("BODY line found: + " + line + " (raw).", 0);
         *          this.Bodies[bodyCount-1].Content += line + "\r\n";
         *      }
         *  }
         * }*/

        /*/// <summary>
         * /// Extract the format options from a text template line.
         * /// </summary>
         * /// <param name="line">The text template line.</param>
         * /// <returns>A FieldFormat object with the options.</returns>
         * private FieldFormat ExtractFormat(string line)
         * {
         *  ActiveUp.Net.Mail.Logger.AddEntry("Extracting FieldFormat from line: + " + line + " (raw).", 0);
         *
         *  FieldFormat fieldFormat = new FieldFormat();
         *  string property, val;
         *
         *  foreach(string format in ExtractValue(line).Split(';'))
         *  {
         *      string[] lineSplit = format.Split('=');
         *
         *      if (lineSplit.Length > 1)
         *      {
         *          property = lineSplit[0];
         *          val = lineSplit[1];
         *
         *          switch (property.ToUpper())
         *          {
         *              case "NAME": fieldFormat.Name = val; break;
         *              case "FORMAT": fieldFormat.Format = val; break;
         *              case "PADDINGDIR":
         *                  if (val.ToUpper() == "LEFT")
         *                      fieldFormat.PaddingDir = PaddingDirection.Left;
         *                  else
         *                      fieldFormat.PaddingDir = PaddingDirection.Right;
         *                  break;
         *              case "TOTALWIDTH":
         *                  try
         *                  {
         *                      fieldFormat.TotalWidth = Convert.ToInt16(val);
         *                  }
         *                  catch
         *                  {
         *                      throw new Exception("Specified Total Width is not a valid number.");
         *                  }
         *                  break;
         *              case "PADDINGCHAR": fieldFormat.PaddingChar = Convert.ToChar(val.Substring(0, 1)); break;
         *          }
         *
         *      }// End if line split length > 1
         *  }
         *
         *  return fieldFormat;
         * }*/

        /// <summary>
        /// Process the Xml template.
        /// </summary>
        private void ProcessXmlTemplate(string content)
        {
            ActiveUp.Net.Mail.Logger.AddEntry("Processing the XML template.", 1);

            StringReader  stringReader = new StringReader(content);
            XmlTextReader reader       = new XmlTextReader(stringReader);

            string element = string.Empty;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    element = reader.Name;
                    ActiveUp.Net.Mail.Logger.AddEntry(string.Format("New element found: {0}", element), 0);

                    switch (element.ToUpper())
                    {
                    case "MESSAGE":
                    {
                        if (reader.GetAttribute("PRIORITY") != null && reader.GetAttribute("PRIORITY") != string.Empty)
                        {
                            this.Message.Priority = (MessagePriority)Enum.Parse(typeof(MessagePriority), reader.GetAttribute("PRIORITY"), true);
                        }
                        else if (reader.GetAttribute("priority") != null && reader.GetAttribute("priority") != string.Empty)
                        {
                            this.Message.Priority = (MessagePriority)Enum.Parse(typeof(MessagePriority), reader.GetAttribute("priority"), true);
                        }
                    } break;

                    case "FIELDFORMAT":
                        if (reader.HasAttributes)
                        {
                            ActiveUp.Net.Mail.Logger.AddEntry("Element has attributes.", 0);
                            FieldFormat fieldFormat = new FieldFormat();

                            if (reader.GetAttribute("NAME") != null && reader.GetAttribute("NAME") != string.Empty)
                            {
                                fieldFormat.Name = reader.GetAttribute("NAME");
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute NAME: {0}", fieldFormat.Name), 0);
                            }

                            else if (reader.GetAttribute("name") != null && reader.GetAttribute("name") != string.Empty)
                            {
                                fieldFormat.Name = reader.GetAttribute("name");
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute name: {0}", fieldFormat.Name), 0);
                            }

                            if (reader.GetAttribute("FORMAT") != null && reader.GetAttribute("FORMAT") != string.Empty)
                            {
                                fieldFormat.Format = reader.GetAttribute("FORMAT");
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute FORMAT: {0}", fieldFormat.Format), 0);
                            }

                            else if (reader.GetAttribute("format") != null && reader.GetAttribute("format") != string.Empty)
                            {
                                fieldFormat.Format = reader.GetAttribute("format");
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute format: {0}", fieldFormat.Format), 0);
                            }

                            if (reader.GetAttribute("PADDINGDIR") != null && reader.GetAttribute("PADDINGDIR") != string.Empty)
                            {
                                if (reader.GetAttribute("PADDINGDIR").ToUpper() == "LEFT")
                                {
                                    fieldFormat.PaddingDir = PaddingDirection.Left;
                                }
                                else
                                {
                                    fieldFormat.PaddingDir = PaddingDirection.Right;
                                }
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute PADDINGDIR: {0}", reader.GetAttribute("PADDINGDIR")), 0);
                            }

                            else if (reader.GetAttribute("paddingdir") != null && reader.GetAttribute("paddingdir") != string.Empty)
                            {
                                if (reader.GetAttribute("paddingdir").ToUpper() == "left")
                                {
                                    fieldFormat.PaddingDir = PaddingDirection.Left;
                                }
                                else
                                {
                                    fieldFormat.PaddingDir = PaddingDirection.Right;
                                }
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute paddingdir: {0}", reader.GetAttribute("paddingdir")), 0);
                            }

                            if (reader.GetAttribute("TOTALWIDTH") != null && reader.GetAttribute("TOTALWIDTH") != string.Empty)
                            {
                                try
                                {
                                    fieldFormat.TotalWidth = Convert.ToInt16(reader.GetAttribute("TOTALWIDTH"));
                                }
                                catch
                                {
                                    throw new Exception("Specified Total Width is not a valid number.");
                                }
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute TOTALWIDTH: {0}", fieldFormat.TotalWidth.ToString()), 0);
                            }

                            else if (reader.GetAttribute("totalwidth") != null && reader.GetAttribute("totalwidth") != string.Empty)
                            {
                                try
                                {
                                    fieldFormat.TotalWidth = Convert.ToInt16(reader.GetAttribute("totalwidth"));
                                }
                                catch
                                {
                                    throw new Exception("Specified Total Width is not a valid number.");
                                }
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute totalwidth: {0}", fieldFormat.TotalWidth.ToString()), 0);
                            }

                            if (reader.GetAttribute("PADDINGCHAR") != null && reader.GetAttribute("PADDINGCHAR") != string.Empty)
                            {
                                fieldFormat.PaddingChar = Convert.ToChar(reader.GetAttribute("PADDINGCHAR").Substring(0, 1));
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute PADDINGCHAR: '{0}'", fieldFormat.PaddingChar), 0);
                            }

                            else if (reader.GetAttribute("paddingchar") != null && reader.GetAttribute("paddingchar") != string.Empty)
                            {
                                fieldFormat.PaddingChar = Convert.ToChar(reader.GetAttribute("paddingchar").Substring(0, 1));
                                ActiveUp.Net.Mail.Logger.AddEntry(string.Format("Attribute paddingchar: '{0}'", fieldFormat.PaddingChar), 0);
                            }

                            this.FieldsFormats.Add(fieldFormat);
                        }

                        break;

                    case "FROM":
                    case "TO":
                    case "CC":
                    case "BCC":
                        if (reader.HasAttributes)
                        {
                            ActiveUp.Net.Mail.Address address = new ActiveUp.Net.Mail.Address();
                            if (reader.GetAttribute("NAME") != null && reader.GetAttribute("NAME") != string.Empty)
                            {
                                address.Name = reader.GetAttribute("NAME");
                            }
                            else if (reader.GetAttribute("name") != null && reader.GetAttribute("name") != string.Empty)
                            {
                                address.Name = reader.GetAttribute("name");
                            }
                            if (reader.GetAttribute("EMAIL") != null && reader.GetAttribute("EMAIL") != string.Empty)
                            {
                                address.Email = reader.GetAttribute("EMAIL");
                            }
                            else if (reader.GetAttribute("email") != null && reader.GetAttribute("email") != string.Empty)
                            {
                                address.Email = reader.GetAttribute("email");
                            }
                            if (element.ToUpper() == "FROM")
                            {
                                if (reader.GetAttribute("REPLYNAME") != null && reader.GetAttribute("REPLYNAME") != string.Empty)
                                {
                                    InitReplyTo();
                                    this.Message.ReplyTo.Name = reader.GetAttribute("REPLYNAME");
                                }
                                else if (reader.GetAttribute("replyname") != null && reader.GetAttribute("replyname") != string.Empty)
                                {
                                    InitReplyTo();
                                    this.Message.ReplyTo.Name = reader.GetAttribute("replyname");
                                }

                                if (reader.GetAttribute("REPLYEMAIL") != null && reader.GetAttribute("REPLYEMAIL") != string.Empty)
                                {
                                    InitReplyTo();
                                    this.Message.ReplyTo.Email = reader.GetAttribute("REPLYEMAIL");
                                }
                                else if (reader.GetAttribute("replyemail") != null && reader.GetAttribute("replyemail") != string.Empty)
                                {
                                    InitReplyTo();
                                    this.Message.ReplyTo.Email = reader.GetAttribute("replyemail");
                                }

                                if (reader.GetAttribute("RECEIPTEMAIL") != null && reader.GetAttribute("RECEIPTEMAIL") != string.Empty)
                                {
                                    this.Message.ReturnReceipt.Email = reader.GetAttribute("RECEIPTEMAIL");
                                }
                                else if (reader.GetAttribute("receiptemail") != null && reader.GetAttribute("receiptemail") != string.Empty)
                                {
                                    this.Message.ReturnReceipt.Email = reader.GetAttribute("receiptemail");
                                }
                            }

                            switch (reader.Name.ToUpper())
                            {
                            case "FROM": /*this.Message.From.Add(address);*/ this.Message.From = address; break;

                            case "TO": this.Message.To.Add(address); break;

                            case "CC": this.Message.Cc.Add(address); break;

                            case "BCC": this.Message.Bcc.Add(address); break;
                            }
                        }
                        break;

                    case "LISTTEMPLATE":
                    {
                        ListTemplate template = new ListTemplate();
                        string       RegionID = string.Empty;
                        string       NullText = string.Empty;
                        if (reader.GetAttribute("REGIONID") != null && reader.GetAttribute("REGIONID") != string.Empty)
                        {
                            RegionID = reader.GetAttribute("REGIONID");
                        }
                        else if (reader.GetAttribute("regionid") != null && reader.GetAttribute("regionid") != string.Empty)
                        {
                            RegionID = reader.GetAttribute("regionid");
                        }

                        if (reader.GetAttribute("NULLTEXT") != null && reader.GetAttribute("NULLTEXT") != string.Empty)
                        {
                            NullText = reader.GetAttribute("NULLTEXT");
                        }
                        else if (reader.GetAttribute("nulltext") != null && reader.GetAttribute("nulltext") != string.Empty)
                        {
                            NullText = reader.GetAttribute("nulltext");
                        }

                        if (reader.HasAttributes && reader.GetAttribute("NAME") != null && reader.GetAttribute("NAME") != string.Empty)
                        {
                            template = new ListTemplate(reader.GetAttribute("NAME"), reader.ReadString());
                        }
                        else if (reader.HasAttributes && reader.GetAttribute("name") != null && reader.GetAttribute("name") != string.Empty)
                        {
                            template = new ListTemplate(reader.GetAttribute("name"), reader.ReadString());
                        }

                        template.RegionID = RegionID;
                        template.NullText = NullText;

                        this.ListTemplates.Add(template);
                    } break;

                    case "SMTPSERVER":
                    {
                        Server server = new Server();

                        if (reader.GetAttribute("SERVER") != null && reader.GetAttribute("SERVER") != string.Empty)
                        {
                            server.Host = reader.GetAttribute("SERVER");
                        }
                        else if (reader.GetAttribute("server") != null && reader.GetAttribute("server") != string.Empty)
                        {
                            server.Host = reader.GetAttribute("server");
                        }

                        if (reader.GetAttribute("PORT") != null && reader.GetAttribute("PORT") != string.Empty)
                        {
                            server.Port = int.Parse(reader.GetAttribute("PORT"));
                        }
                        else if (reader.GetAttribute("port") != null && reader.GetAttribute("port") != string.Empty)
                        {
                            server.Port = int.Parse(reader.GetAttribute("port"));
                        }

                        if (reader.GetAttribute("USERNAME") != null && reader.GetAttribute("USERNAME") != string.Empty)
                        {
                            server.Username = reader.GetAttribute("USERNAME");
                        }
                        else if (reader.GetAttribute("username") != null && reader.GetAttribute("username") != string.Empty)
                        {
                            server.Username = reader.GetAttribute("username");
                        }

                        if (reader.GetAttribute("PASSWORD") != null && reader.GetAttribute("PASSWORD") != string.Empty)
                        {
                            server.Password = reader.GetAttribute("PASSWORD");
                        }
                        else if (reader.GetAttribute("password") != null && reader.GetAttribute("password") != string.Empty)
                        {
                            server.Password = reader.GetAttribute("password");
                        }

                        SmtpServers.Add(server);
                    } break;

                    case "CONDITION":
                    {
                        Condition condition = new Condition();

                        if (reader.GetAttribute("REGIONID") != null && reader.GetAttribute("REGIONID") != string.Empty)
                        {
                            condition.RegionID = reader.GetAttribute("REGIONID");
                        }
                        else if (reader.GetAttribute("regionid") != null && reader.GetAttribute("regionid") != string.Empty)
                        {
                            condition.RegionID = reader.GetAttribute("regionid");
                        }

                        if (reader.GetAttribute("OPERATOR") != null && reader.GetAttribute("OPERATOR") != string.Empty)
                        {
                            condition.Operator = (OperatorType)Enum.Parse(typeof(OperatorType), reader.GetAttribute("OPERATOR"), true);
                        }
                        else if (reader.GetAttribute("operator") != null && reader.GetAttribute("operator") != string.Empty)
                        {
                            condition.Operator = (OperatorType)Enum.Parse(typeof(OperatorType), reader.GetAttribute("operator"), true);
                        }

                        if (reader.GetAttribute("NULLTEXT") != null && reader.GetAttribute("NULLTEXT") != string.Empty)
                        {
                            condition.NullText = reader.GetAttribute("NULLTEXT");
                        }
                        else if (reader.GetAttribute("nulltext") != null && reader.GetAttribute("nulltext") != string.Empty)
                        {
                            condition.NullText = reader.GetAttribute("nulltext");
                        }

                        if (reader.GetAttribute("FIELD") != null && reader.GetAttribute("FIELD") != string.Empty)
                        {
                            condition.Field = reader.GetAttribute("FIELD");
                        }
                        else if (reader.GetAttribute("field") != null && reader.GetAttribute("field") != string.Empty)
                        {
                            condition.Field = reader.GetAttribute("field");
                        }

                        if (reader.GetAttribute("VALUE") != null && reader.GetAttribute("VALUE") != string.Empty)
                        {
                            condition.Value = reader.GetAttribute("VALUE");
                        }
                        else if (reader.GetAttribute("value") != null && reader.GetAttribute("value") != string.Empty)
                        {
                            condition.Value = reader.GetAttribute("value");
                        }

                        if (reader.GetAttribute("CASESENSITIVE") != null && reader.GetAttribute("CASESENSITIVE") != string.Empty)
                        {
                            condition.CaseSensitive = bool.Parse(reader.GetAttribute("CASESENSITIVE"));
                        }
                        else if (reader.GetAttribute("casesensitive") != null && reader.GetAttribute("casesensitive") != string.Empty)
                        {
                            condition.CaseSensitive = bool.Parse(reader.GetAttribute("casesensitive"));
                        }

                        Conditions.Add(condition);
                    } break;

                    case "REGION":
                    {
                        Region region = new Region();

                        if (reader.GetAttribute("REGIONID") != null && reader.GetAttribute("REGIONID") != string.Empty)
                        {
                            region.RegionID = reader.GetAttribute("REGIONID");
                        }
                        else if (reader.GetAttribute("regionid") != null && reader.GetAttribute("regionid") != string.Empty)
                        {
                            region.RegionID = reader.GetAttribute("regionid");
                        }

                        if (reader.GetAttribute("NULLTEXT") != null && reader.GetAttribute("NULLTEXT") != string.Empty)
                        {
                            region.NullText = reader.GetAttribute("NULLTEXT");
                        }
                        else if (reader.GetAttribute("nulltext") != null && reader.GetAttribute("nulltext") != string.Empty)
                        {
                            region.NullText = reader.GetAttribute("nulltext");
                        }

                        if (reader.GetAttribute("URL") != null && reader.GetAttribute("URL") != string.Empty)
                        {
                            region.URL = reader.GetAttribute("URL");
                        }
                        else if (reader.GetAttribute("url") != null && reader.GetAttribute("url") != string.Empty)
                        {
                            region.URL = reader.GetAttribute("url");
                        }

                        Regions.Add(region);
                    } break;
                    }
                    break;

                case XmlNodeType.Text:
                    switch (element.ToUpper())
                    {
                    case "SUBJECT":
                        this.Message.Subject += reader.Value;
                        break;

                    /*case "SMTPSERVER":
                     *  this.SmtpServers.Add(reader.Value, 25);
                     *  break;*/
                    case "BODYHTML":
                        //this.Bodies.Add(reader.Value, BodyFormat.Html);
                        this.Message.BodyHtml.Text += reader.Value;
                        break;

                    case "BODYTEXT":
                        //this.Bodies.Add(reader.Value, BodyFormat.Text);
                        this.Message.BodyText.Text += reader.Value;
                        break;
                    }
                    break;

                case XmlNodeType.EndElement:
                    element = string.Empty;
                    break;
                }
            }
        }
Пример #24
0
 private static string GetRegionAuthentication(Regions region)
 {
     if (region == Regions.US)
         return p_Authenticator_URL_US;
     else
         return p_Authenticator_URL_EU;
 }
Пример #25
0
        private void LoadStore(int storeId, int regionId)
        {
            ViewData["storeId"] = storeId;

            List <SelectListItem> storeRankList = new List <SelectListItem>();

            storeRankList.Add(new SelectListItem()
            {
                Text = "选择店铺等级", Value = "-1"
            });
            foreach (StoreRankInfo storeRankInfo in AdminStoreRanks.GetStoreRankList())
            {
                storeRankList.Add(new SelectListItem()
                {
                    Text = storeRankInfo.Title, Value = storeRankInfo.StoreRid.ToString()
                });
            }
            ViewData["storeRankList"] = storeRankList;


            List <SelectListItem> storeIndustryList = new List <SelectListItem>();

            storeIndustryList.Add(new SelectListItem()
            {
                Text = "选择店铺行业", Value = "-1"
            });
            foreach (StoreIndustryInfo storeIndustryInfo in AdminStoreIndustries.GetStoreIndustryList())
            {
                storeIndustryList.Add(new SelectListItem()
                {
                    Text = storeIndustryInfo.Title, Value = storeIndustryInfo.StoreIid.ToString()
                });
            }
            ViewData["storeIndustryList"] = storeIndustryList;

            List <SelectListItem> themeList = new List <SelectListItem>();
            DirectoryInfo         dir       = new DirectoryInfo(IOHelper.GetMapPath("/themes"));

            foreach (DirectoryInfo themeDir in dir.GetDirectories())
            {
                themeList.Add(new SelectListItem()
                {
                    Text = themeDir.Name, Value = themeDir.Name
                });
            }
            ViewData["themeList"] = themeList;

            RegionInfo regionInfo = Regions.GetRegionById(regionId);

            if (regionInfo != null)
            {
                ViewData["provinceId"] = regionInfo.ProvinceId;
                ViewData["cityId"]     = regionInfo.CityId;
                ViewData["countyId"]   = regionInfo.RegionId;
            }
            else
            {
                ViewData["provinceId"] = -1;
                ViewData["cityId"]     = -1;
                ViewData["countyId"]   = -1;
            }

            string allowImgType = string.Empty;

            string[] imgTypeList = StringHelper.SplitString(BMAConfig.MallConfig.UploadImgType, ",");
            foreach (string imgType in imgTypeList)
            {
                allowImgType += string.Format("{0},", imgType.ToLower());
            }
            allowImgType = allowImgType.Replace(".", "");
            allowImgType = allowImgType.TrimEnd(',');

            string[] sizeList = StringHelper.SplitString(WorkContext.MallConfig.StoreLogoThumbSize);

            ViewData["size"]         = sizeList[sizeList.Length / 2];
            ViewData["allowImgType"] = allowImgType;
            ViewData["maxImgSize"]   = BMAConfig.MallConfig.UploadImgSize;

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
        }
Пример #26
0
 public static RegionalEndPoint GetRegionalEndPointByRegion(Regions region)
 {
     return RegionalEndPoints.FirstOrDefault(x => x.Region == region.ToString());
 }
Пример #27
0
        public ServiceClient(string subscriptionKey, Regions region)
        {
            var baseUrl = $"https://{region.ToString().ToLower()}.api.cognitive.microsoft.com/luis/api/v2.0/";

            _client = HttpClientFactory.Create(baseUrl, subscriptionKey);
        }
 /// <summary>
 /// There are no comments for Regions in the schema.
 /// </summary>
 public void AddToRegions(Regions regions)
 {
     base.AddObject("Regions", regions);
 }
 public IEnumerable<SeasonStats> GetSeason(Platform platform, int seasonId, [Required] [FromQuery(Name = "ids")] string platformIds, [FromQuery(Name = "r")] Regions region = Regions.EMEA)
 {
     var accounts = platformIds.Split(',').ToAccountInfo(platform);
     return _client.GetSeasonStats(accounts, region.ToString(), seasonId);
 }
Пример #30
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "DATA":
                    if (CellFlags == null)
                    {
                        CellFlags = new SimpleSubrecord <CellFlags>();
                    }

                    CellFlags.ReadBinary(reader);
                    break;

                case "XCLC":
                    if (Grid == null)
                    {
                        Grid = new CellGrid();
                    }

                    Grid.ReadBinary(reader);
                    break;

                case "XCLL":
                    if (Lighting == null)
                    {
                        Lighting = new CellLighting();
                    }

                    Lighting.ReadBinary(reader);
                    break;

                case "IMPF":
                    if (FootstepMaterial == null)
                    {
                        FootstepMaterial = new FootstepMaterial();
                    }

                    FootstepMaterial.ReadBinary(reader);
                    break;

                case "LTMP":
                    if (LightTemplate == null)
                    {
                        LightTemplate = new RecordReference();
                    }

                    LightTemplate.ReadBinary(reader);
                    break;

                case "LNAM":
                    if (LightTemplateInherit == null)
                    {
                        LightTemplateInherit = new SimpleSubrecord <LightTemplateInheritFlags>();
                    }

                    LightTemplateInherit.ReadBinary(reader);
                    break;

                case "XCLW":
                    if (WaterHeight == null)
                    {
                        WaterHeight = new SimpleSubrecord <Single>();
                    }

                    WaterHeight.ReadBinary(reader);
                    break;

                case "XNAM":
                    if (WaterNoiseTexture == null)
                    {
                        WaterNoiseTexture = new SimpleSubrecord <String>();
                    }

                    WaterNoiseTexture.ReadBinary(reader);
                    break;

                case "XCLR":
                    if (Regions == null)
                    {
                        Regions = new SortedFormArray();
                    }

                    Regions.ReadBinary(reader);
                    break;

                case "XCIM":
                    if (ImageSpace == null)
                    {
                        ImageSpace = new RecordReference();
                    }

                    ImageSpace.ReadBinary(reader);
                    break;

                case "XCET":
                    if (Unknown == null)
                    {
                        Unknown = new SimpleSubrecord <Byte>();
                    }

                    Unknown.ReadBinary(reader);
                    break;

                case "XEZN":
                    if (EncounterZone == null)
                    {
                        EncounterZone = new RecordReference();
                    }

                    EncounterZone.ReadBinary(reader);
                    break;

                case "XCCM":
                    if (Climate == null)
                    {
                        Climate = new RecordReference();
                    }

                    Climate.ReadBinary(reader);
                    break;

                case "XCWT":
                    if (Water == null)
                    {
                        Water = new RecordReference();
                    }

                    Water.ReadBinary(reader);
                    break;

                case "XOWN":
                    if (Owner == null)
                    {
                        Owner = new RecordReference();
                    }

                    Owner.ReadBinary(reader);
                    break;

                case "XRNK":
                    if (FactionRank == null)
                    {
                        FactionRank = new SimpleSubrecord <Int32>();
                    }

                    FactionRank.ReadBinary(reader);
                    break;

                case "XCAS":
                    if (AcousticSpace == null)
                    {
                        AcousticSpace = new RecordReference();
                    }

                    AcousticSpace.ReadBinary(reader);
                    break;

                case "XCMT":
                    if (Unused == null)
                    {
                        Unused = new SimpleSubrecord <Byte>();
                    }

                    Unused.ReadBinary(reader);
                    break;

                case "XCMO":
                    if (MusicType == null)
                    {
                        MusicType = new RecordReference();
                    }

                    MusicType.ReadBinary(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
Пример #31
0
        private void GetRelated()
        {
            // Clear related
            Regions.Clear();
            Properties.Clear();
            AttachedContent.Clear();

            // Get group parents
            DisableGroups = SysGroup.GetParents(Page.GroupId);
            DisableGroups.Reverse();

            // Get placement ref title
            if (Page.ParentId != Guid.Empty || Page.Seqno > 1)
            {
                Page refpage = null;
                if (Page.Seqno > 1)
                {
                    if (Page.ParentId != Guid.Empty)
                    {
                        refpage = Page.GetSingle("page_parent_id = @0 AND page_seqno = @1", Page.ParentId, Page.Seqno - 1);
                    }
                    else
                    {
                        refpage = Page.GetSingle("page_parent_id IS NULL AND page_seqno = @0", Page.Seqno - 1);
                    }
                }
                else
                {
                    refpage = Page.GetSingle(Page.ParentId, true);
                }
                PlaceRef = refpage.Title;
            }

            // Get template & permalink
            Template  = PageTemplate.GetSingle("pagetemplate_id = @0", Page.TemplateId);
            Permalink = Permalink.GetSingle(Page.PermalinkId);
            if (Permalink == null)
            {
                Permalink = new Permalink()
                {
                    Id = Guid.NewGuid(), Type = Permalink.PermalinkType.PAGE, NamespaceId = new Guid("8FF4A4B4-9B6C-4176-AAA2-DB031D75AC03")
                };
                Page.PermalinkId = Permalink.Id;
            }

            if (Template != null)
            {
                // Get regions
                var regions = RegionTemplate.Get("regiontemplate_template_id = @0", Template.Id, new Params()
                {
                    OrderBy = "regiontemplate_seqno"
                });
                foreach (var rt in regions)
                {
                    var reg = Region.GetSingle("region_regiontemplate_id = @0 AND region_page_id = @1 and region_draft = @2",
                                               rt.Id, Page.Id, Page.IsDraft);
                    if (reg != null)
                    {
                        Regions.Add(reg);
                    }
                    else
                    {
                        Regions.Add(new Region()
                        {
                            InternalId       = rt.InternalId,
                            Name             = rt.Name,
                            Type             = rt.Type,
                            PageId           = Page.Id,
                            RegiontemplateId = rt.Id,
                            IsDraft          = Page.IsDraft,
                            IsPageDraft      = Page.IsDraft
                        });
                    }
                }

                // Get Properties
                foreach (string name in Template.Properties)
                {
                    Property prp = Property.GetSingle("property_name = @0 AND property_parent_id = @1 AND property_draft = @2",
                                                      name, Page.Id, Page.IsDraft);
                    if (prp != null)
                    {
                        Properties.Add(prp);
                    }
                    else
                    {
                        Properties.Add(new Property()
                        {
                            Name = name, ParentId = Page.Id, IsDraft = Page.IsDraft
                        });
                    }
                }
            }
            else
            {
                throw new ArgumentException("Could not find page template for page {" + Page.Id.ToString() + "}");
            }

            // Get attached content
            if (Page.Attachments.Count > 0)
            {
                // Content meta data is actually memcached, so this won't result in multiple queries
                Page.Attachments.ForEach(a => {
                    Models.Content c = Models.Content.GetSingle(a);
                    if (c != null)
                    {
                        AttachedContent.Add(c);
                    }
                });
            }

            // Get page position
            Parents = BuildParentPages(Sitemap.GetStructure(false), Page);
            Parents.Insert(0, new PagePlacement()
            {
                Level = 1, IsSelected = Page.ParentId == Guid.Empty
            });
            Siblings = BuildSiblingPages(Page.Id, Page.ParentId, Page.Seqno, Page.ParentId);
        }
Пример #32
0
        public override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (EditorID != null)
            {
                ele.TryPathTo("EditorID", true, out subEle);
                EditorID.WriteXML(subEle, master);
            }
            if (Name != null)
            {
                ele.TryPathTo("Name", true, out subEle);
                Name.WriteXML(subEle, master);
            }
            if (CellFlags != null)
            {
                ele.TryPathTo("CellFlags", true, out subEle);
                CellFlags.WriteXML(subEle, master);
            }
            if (Grid != null)
            {
                ele.TryPathTo("Grid", true, out subEle);
                Grid.WriteXML(subEle, master);
            }
            if (Lighting != null)
            {
                ele.TryPathTo("Lighting", true, out subEle);
                Lighting.WriteXML(subEle, master);
            }
            if (FootstepMaterial != null)
            {
                ele.TryPathTo("FootstepMaterial", true, out subEle);
                FootstepMaterial.WriteXML(subEle, master);
            }
            if (LightTemplate != null)
            {
                ele.TryPathTo("LightTemplate", true, out subEle);
                LightTemplate.WriteXML(subEle, master);
            }
            if (LightTemplateInherit != null)
            {
                ele.TryPathTo("LightTemplateInherit", true, out subEle);
                LightTemplateInherit.WriteXML(subEle, master);
            }
            if (WaterHeight != null)
            {
                ele.TryPathTo("WaterHeight", true, out subEle);
                WaterHeight.WriteXML(subEle, master);
            }
            if (WaterNoiseTexture != null)
            {
                ele.TryPathTo("WaterNoiseTexture", true, out subEle);
                WaterNoiseTexture.WriteXML(subEle, master);
            }
            if (Regions != null)
            {
                ele.TryPathTo("Regions", true, out subEle);
                Regions.WriteXML(subEle, master);
            }
            if (ImageSpace != null)
            {
                ele.TryPathTo("ImageSpace", true, out subEle);
                ImageSpace.WriteXML(subEle, master);
            }
            if (Unknown != null)
            {
                ele.TryPathTo("Unknown", true, out subEle);
                Unknown.WriteXML(subEle, master);
            }
            if (EncounterZone != null)
            {
                ele.TryPathTo("EncounterZone", true, out subEle);
                EncounterZone.WriteXML(subEle, master);
            }
            if (Climate != null)
            {
                ele.TryPathTo("Climate", true, out subEle);
                Climate.WriteXML(subEle, master);
            }
            if (Water != null)
            {
                ele.TryPathTo("Water", true, out subEle);
                Water.WriteXML(subEle, master);
            }
            if (Owner != null)
            {
                ele.TryPathTo("Owner", true, out subEle);
                Owner.WriteXML(subEle, master);
            }
            if (FactionRank != null)
            {
                ele.TryPathTo("FactionRank", true, out subEle);
                FactionRank.WriteXML(subEle, master);
            }
            if (AcousticSpace != null)
            {
                ele.TryPathTo("AcousticSpace", true, out subEle);
                AcousticSpace.WriteXML(subEle, master);
            }
            if (Unused != null)
            {
                ele.TryPathTo("Unused", true, out subEle);
                Unused.WriteXML(subEle, master);
            }
            if (MusicType != null)
            {
                ele.TryPathTo("MusicType", true, out subEle);
                MusicType.WriteXML(subEle, master);
            }
        }
Пример #33
0
 public MarketLogInput(Regions regions, OwnedOrders ownedOrders)
 {
     _regions = regions;
     _ownedOrders = ownedOrders;
 }
Пример #34
0
        /// <summary>
        /// 注册
        /// </summary>
        public ActionResult Register()
        {
            string returnUrl = WebHelper.GetQueryString("returnUrl");

            if (returnUrl.Length == 0)
            {
                returnUrl = "/";
            }

            if (WorkContext.MallConfig.RegType.Length == 0)
            {
                return(PromptView(returnUrl, "商城目前已经关闭注册功能!"));
            }
            if (WorkContext.Uid > 0)
            {
                return(PromptView(returnUrl, "您已经是本商城的注册用户,无需再注册!"));
            }
            if (WorkContext.MallConfig.RegTimeSpan > 0)
            {
                DateTime registerTime = Users.GetRegisterTimeByRegisterIP(WorkContext.IP);
                if ((DateTime.Now - registerTime).Minutes <= WorkContext.MallConfig.RegTimeSpan)
                {
                    return(PromptView(returnUrl, "您注册太频繁,请间隔一定时间后再注册!"));
                }
            }

            //get请求
            if (WebHelper.IsGet())
            {
                //string registerType = WebHelper.GetQueryString("registerType");

                ////将注册类型保存到session中
                //Sessions.SetItem(WorkContext.Sid, "registerType", registerType);

                RegisterModel model = new RegisterModel();

                //model.IsEnterprise = registerType == "1" ? 1 : 0;
                model.ReturnUrl    = returnUrl;
                model.ShadowName   = WorkContext.MallConfig.ShadowName;
                model.IsVerifyCode = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages);

                return(View(model));
            }

            //ajax请求
            string accountName = WebHelper.GetFormString(WorkContext.MallConfig.ShadowName).Trim().ToLower();
            string password    = WebHelper.GetFormString("password");
            string confirmPwd  = WebHelper.GetFormString("confirmPwd");
            string verifyCode  = WebHelper.GetFormString("verifyCode");
            //string isEnterprise = WebHelper.GetFormString("isEnterprise");

            StringBuilder errorList = new StringBuilder("[");

            #region 验证

            #region //账号验证
            if (string.IsNullOrWhiteSpace(accountName))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名不能为空", "}");
            }
            else if (accountName.Length < 4 || accountName.Length > 50)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名必须大于3且不大于50个字符", "}");
            }
            else if (accountName.Contains(" "))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含空格", "}");
            }
            else if (accountName.Contains(":"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含冒号", "}");
            }
            else if (accountName.Contains("<"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含'<'符号", "}");
            }
            else if (accountName.Contains(">"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含'>'符号", "}");
            }
            else if ((!SecureHelper.IsSafeSqlString(accountName)))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名已经存在", "}");
            }
            else if (CommonHelper.IsInArray(accountName, WorkContext.MallConfig.ReservedName, "\n"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名已经存在", "}");
            }
            else if (FilterWords.IsContainWords(accountName))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名包含禁止单词", "}");
            }

            #endregion

            //密码验证
            if (string.IsNullOrWhiteSpace(password))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "password", "密码不能为空", "}");
            }
            else if (password.Length < 4 || password.Length > 32)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "password", "密码必须大于3且不大于32个字符", "}");
            }
            else if (password != confirmPwd)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "password", "两次输入的密码不一样", "}");
            }

            //验证码验证
            if (CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages))
            {
                if (string.IsNullOrWhiteSpace(verifyCode))
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "verifyCode", "验证码不能为空", "}");
                }
                else if (verifyCode.ToLower() != Sessions.GetValueString(WorkContext.Sid, "verifyCode"))
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "verifyCode", "验证码不正确", "}");
                }
            }

            //其它验证
            int gender = WebHelper.GetFormInt("gender");
            if (gender < 0 || gender > 2)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "gender", "请选择正确的性别", "}");
            }

            string nickName = WebHelper.GetFormString("nickName");
            if (nickName.Length > 10)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "nickName", "昵称的长度不能大于10", "}");
            }
            else if (FilterWords.IsContainWords(nickName))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "nickName", "昵称中包含禁止单词", "}");
            }

            if (WebHelper.GetFormString("realName").Length > 5)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "realName", "真实姓名的长度不能大于5", "}");
            }

            string bday = WebHelper.GetFormString("bday");
            if (bday.Length == 0)
            {
                string bdayY = WebHelper.GetFormString("bdayY");
                string bdayM = WebHelper.GetFormString("bdayM");
                string bdayD = WebHelper.GetFormString("bdayD");
                bday = string.Format("{0}-{1}-{2}", bdayY, bdayM, bdayD);
            }
            if (bday.Length > 0 && bday != "--" && !ValidateHelper.IsDate(bday))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "bday", "请选择正确的日期", "}");
            }

            string idCard = WebHelper.GetFormString("idCard");
            if (idCard.Length > 0 && !ValidateHelper.IsIdCard(idCard))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "idCard", "请输入正确的身份证号", "}");
            }

            int regionId = WebHelper.GetFormInt("regionId");
            if (regionId > 0)
            {
                if (Regions.GetRegionById(regionId) == null)
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "regionId", "请选择正确的地址", "}");
                }
                if (WebHelper.GetFormString("address").Length > 75)
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "address", "详细地址的长度不能大于75", "}");
                }
            }

            if (WebHelper.GetFormString("bio").Length > 150)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "bio", "简介的长度不能大于150", "}");
            }

            //当以上验证都通过时
            UserInfo userInfo = null;
            if (errorList.Length == 1)
            {
                //if (WorkContext.MallConfig.RegType.Contains("2") && ValidateHelper.IsEmail(accountName))//验证邮箱
                //{
                //    string emailProvider = CommonHelper.GetEmailProvider(accountName);
                //    if (WorkContext.MallConfig.AllowEmailProvider.Length != 0 && (!CommonHelper.IsInArray(emailProvider, WorkContext.MallConfig.AllowEmailProvider, "\n")))
                //    {
                //        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "不能使用'" + emailProvider + "'类型的邮箱", "}");
                //    }
                //    else if (CommonHelper.IsInArray(emailProvider, WorkContext.MallConfig.BanEmailProvider, "\n"))
                //    {
                //        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "不能使用'" + emailProvider + "'类型的邮箱", "}");
                //    }
                //    else if (Users.IsExistEmail(accountName))
                //    {
                //        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "邮箱已经存在", "}");
                //    }
                //    else
                //    {
                //        userInfo = new UserInfo();
                //        userInfo.UserName = string.Empty;
                //        userInfo.Email = accountName;
                //        userInfo.Mobile = string.Empty;
                //    }
                //}
                //else if (WorkContext.MallConfig.RegType.Contains("3") && ValidateHelper.IsMobile(accountName))//验证手机
                //{
                //    if (Users.IsExistMobile(accountName))
                //    {
                //        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "手机号已经存在", "}");
                //    }
                //    else
                //    {
                //        userInfo = new UserInfo();
                //        userInfo.UserName = string.Empty;
                //        userInfo.Email = string.Empty;
                //        userInfo.Mobile = accountName;
                //    }
                //}
                //else
                if (WorkContext.MallConfig.RegType.Contains("1"))//验证用户名
                {
                    if (NStore.Services.Users.IsExistUserName(accountName))
                    {
                        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "用户名已经存在", "}");
                    }
                    else
                    {
                        userInfo          = new UserInfo();
                        userInfo.UserName = accountName;
                        userInfo.Email    = string.Empty;
                        userInfo.Mobile   = string.Empty;
                    }
                }
                else
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账号类型不正确", "}");
                }
            }

            #endregion

            if (errorList.Length > 1)//验证失败
            {
                return(AjaxResult("error", errorList.Remove(errorList.Length - 1, 1).Append("]").ToString(), true));
            }
            else//验证成功
            {
                #region 绑定用户信息

                userInfo.Salt     = Randoms.CreateRandomValue(6);
                userInfo.Password = Users.CreateUserPassword(password, userInfo.Salt);
                userInfo.UserRid  = UserRanks.GetLowestUserRank().UserRid;
                userInfo.StoreId  = 0;
                userInfo.MallAGid = 1;//非管理员组
                if (nickName.Length > 0)
                {
                    userInfo.NickName = WebHelper.HtmlEncode(nickName);
                }
                else
                {
                    userInfo.NickName = "ngh" + Randoms.CreateRandomValue(7);
                }
                userInfo.Avatar       = "";
                userInfo.PayCredits   = 0;
                userInfo.RankCredits  = 0;
                userInfo.VerifyEmail  = 0;
                userInfo.VerifyMobile = 0;
                userInfo.UserType     = Sessions.GetValueInt(WorkContext.Sid, "registerType");
                userInfo.VerifyRank   = 0;

                userInfo.LastVisitIP   = WorkContext.IP;
                userInfo.LastVisitRgId = WorkContext.RegionId;
                userInfo.LastVisitTime = DateTime.Now;
                userInfo.RegisterIP    = WorkContext.IP;
                userInfo.RegisterRgId  = WorkContext.RegionId;
                userInfo.RegisterTime  = DateTime.Now;

                userInfo.Gender          = WebHelper.GetFormInt("gender");
                userInfo.RealName        = WebHelper.HtmlEncode(WebHelper.GetFormString("realName"));
                userInfo.Bday            = bday.Length > 0 ? TypeHelper.StringToDateTime(bday) : new DateTime(1900, 1, 1);
                userInfo.IdCard          = WebHelper.GetFormString("idCard");
                userInfo.RegionId        = WebHelper.GetFormInt("regionId");
                userInfo.Address         = WebHelper.HtmlEncode(WebHelper.GetFormString("address"));
                userInfo.Bio             = WebHelper.HtmlEncode(WebHelper.GetFormString("bio"));
                userInfo.LinkName        = string.Empty;
                userInfo.Company         = string.Empty;
                userInfo.CreditCode      = string.Empty;
                userInfo.BusinessLicense = string.Empty;

                #endregion

                //创建用户
                userInfo.Uid = Users.CreateUser(userInfo);

                //添加用户失败
                if (userInfo.Uid < 1)
                {
                    return(AjaxResult("exception", "创建用户失败,请联系管理员"));
                }

                //发放注册积分
                Credits.SendRegisterCredits(ref userInfo, DateTime.Now);
                //更新购物车中用户id
                Carts.UpdateCartUidBySid(userInfo.Uid, WorkContext.Sid);
                //将用户信息写入cookie
                MallUtils.SetUserCookie(userInfo, 0);

                ////发送注册欢迎信息
                //if (WorkContext.MallConfig.IsWebcomeMsg == 1)
                //{
                //    if (userInfo.Email.Length > 0)
                //        Emails.SendWebcomeEmail(userInfo.Email);
                //    if (userInfo.Mobile.Length > 0)
                //        SMSes.SendWebcomeSMS(userInfo.Mobile);
                //}

                ////同步上下文
                //WorkContext.Uid = userInfo.Uid;
                //WorkContext.UserType = userInfo.UserType;
                //WorkContext.VerifyRank = userInfo.VerifyRank;
                //WorkContext.UserName = userInfo.UserName;
                //WorkContext.UserEmail = userInfo.Email;
                //WorkContext.UserMobile = userInfo.Mobile;
                //WorkContext.NickName = userInfo.NickName;

                //return AjaxResult("success", "注册成功");
                return(AjaxResult("success", Url.Action("Authentication", new RouteValueDictionary {
                    { "uid", userInfo.Uid }
                })));
            }
        }
Пример #35
0
        public Account(string username, string password, Regions region)
        {
            Username = username;

            //* encrypt password
            using (Aes aes = Aes.Create())
            {
                aes.GenerateIV();
                aes.GenerateKey();

                p_Key = aes.Key;
                p_IV = aes.IV;
            }

            p_Password = Cryptography.EncryptStringToBytes_Aes(password, p_Key, p_IV);

            Region = region;
        }
Пример #36
0
 public Region CurrentRegion(int tick) => Regions.First((r) => r.Tick <= tick && tick < r.Tick + r.Length);
Пример #37
0
 public void then_nation_should_be_in_region(string nation, Regions region)
 {
     GetTeamByNationName(nation).Region.ShouldEqual(region);
 }
Пример #38
0
        public void Search(DataContext db)
        {
            if (!ShopList.Any())
            {
                Result = new List <Order>();
                return;
            }



            IQueryable <Order> result = null;

            if (ListOverride != null && ListOverride.Any())
            {
                Result = db.Orders.Where(x => ListOverride.Contains(x.ID)).ToList();
                return;
            }
            if (!ShopID.HasValue)
            {
                ShopID = HttpContext.Current.Request.QueryString["ShopID"].ToNullInt();
            }
            if (!ShopID.HasValue)
            {
                ShopID = ShopList.First().Value.ToInt();
            }
            if (CurrentUser.UserRoles.Contains("ShopOwner"))
            {
                var orderAuthors =
                    db.ShopManagers.Where(x => x.Manager.ShopOwnerID == CurrentUser.ID)
                    .Select(x => x.Manager.ManagerUserID)
                    .ToList();
                orderAuthors.Add(CurrentUser.ID);

                result = db.Orders.Where(x => orderAuthors.Contains(x.AddedByID));
                result =
                    result.Where(x => x.ShopID == ShopID.Value || (!x.ShopID.HasValue && x.AddedByID == CurrentUser.ID));
                var contracted =
                    db.ContractedOrders.Where(
                        x => x.Contractor.UserBy == CurrentUser.ShopOwnerID && x.Contractor.ShopID == ShopID).Select(x => x.Order);
                result = result.Concat(contracted);
            }
            else if (CurrentUser.UserRoles.Contains("Manager"))
            {
                var orderAuthors =
                    db.ShopManagers.Where(x => x.Manager.ShopOwnerID == CurrentUser.ManagerProfiles.First().ShopOwnerID)
                    .Select(x => x.Manager.ManagerUserID)
                    .ToList();

                orderAuthors.Add(CurrentUser.ManagerProfiles.First().ShopOwnerID);

                var shids = db.ShopManagers.Where(x => x.Manager.ManagerUserID == CurrentUser.ID).Select(x => x.ShopID).ToList();

                result = db.Orders.Where(x => orderAuthors.Contains(x.AddedByID) && shids.Contains(x.ShopID));
                result =
                    result.Where(x => x.ShopID == ShopID.Value || (!x.ShopID.HasValue && x.AddedByID == CurrentUser.ID));
                var contracted =
                    db.ContractedOrders.Where(
                        x => x.Contractor.UserFor == CurrentUser.ShopOwnerID && x.Contractor.ShopID == ShopID)
                    .Select(x => x.Order);
                result = result.Concat(contracted);
            }
            else if (CurrentUser.UserRoles.Contains("Operator"))
            {
                var shds = db.OperatorShops.Where(x => x.UserID == CurrentUser.ID).Select(x => x.ShopID).ToList();
                result = db.Orders.Where(x => shds.Contains(x.ShopID ?? 0));
            }
            else
            {
                result = db.Orders.Where(x => x.AddedByID == CurrentUser.ID);
            }
            if (MinDate.HasValue)
            {
                result =
                    result.Where(
                        x =>
                        x.CreateDate.Date >= MinDate.Value);
            }
            if (MaxDate.HasValue)
            {
                result =
                    result.Where(
                        x =>
                        x.CreateDate <= MaxDate.Value);
            }

            if (MinDateDelivery.HasValue)
            {
                result =
                    result.Where(x => x.DeliveryDate.HasValue && x.DeliveryDate.Value.Date >= MinDateDelivery.Value.Date);
            }

            if (MaxDateDelivery.HasValue)
            {
                result =
                    result.Where(x => x.DeliveryDate.HasValue && x.DeliveryDate.Value.Date <= MaxDateDelivery.Value.Date);
            }

            if (LoginOrName.IsFilled())
            {
                result =
                    result.Where(
                        x => x.Consumer != null && (
                            SqlMethods.Like(x.Consumer.Name.ToLower(), LoginOrNameLike) ||
                            SqlMethods.Like(x.Consumer.Surname.ToLower(), LoginOrNameLike) ||
                            SqlMethods.Like(x.Consumer.Phone.ToLower(), LoginOrNameLike)));
            }

            if (Status.HasValue)
            {
                result = result.Where(x => x.Status == Status.Value);
            }


            var chars =
                DB.ShopProductChars.Where(
                    x => x.UserID == CurrentUser.ShopOwnerID && (!x.ShopID.HasValue || x.ShopID == ShopID) && x.IsMain)
                .OrderBy(x => x.Name).ToList();

            ShopChars = chars.ToList();


            if (Overage)
            {
                result = result.Where(x => x.Marks.Any() && x.Marks.First().MarkDate > DateTime.Now.AddDays(-14));
            }

            if (ExactDateDelivery.HasValue)
            {
                result =
                    result.Where(
                        x => x.DeliveryDate.HasValue && x.DeliveryDate.Value.Date == ExactDateDelivery.Value.Date);
            }

            if (Regions.Any())
            {
                IQueryable <Order> filtered = null;
                foreach (var region in Regions)
                {
                    if (filtered == null)
                    {
                        filtered =
                            result.Where(
                                x => x.OrderDelivery != null && x.OrderDelivery.Region.ToLower() == region.ToLower());
                    }
                    else
                    {
                        filtered = filtered.Concat(result.Where(
                                                       x => x.OrderDelivery != null && x.OrderDelivery.Region.ToLower() == region.ToLower()));
                    }
                }
                result = filtered;
            }

            Result = result.OrderByDescending(x => x.Status).ThenByDescending(x => x.ID).Take(2000).ToList();



            if (CurrentUser.UserRoles.Contains("Operator"))
            {
                Result = Result.Where(x => x.Status == 100 && x.DeliveryDate.HasValue).OrderBy(x => x.Marks.Any()).ThenBy(x => x.DeliveryDate).ToList();
            }
        }
Пример #39
0
 public MenuItemClickedEventArgs(string pCorrelatedModule, Regions pCorrelatedRegion)
 {
     CorrelatedView = pCorrelatedModule;
     CorrelatedRegion = pCorrelatedRegion;
 }
Пример #40
0
        /// <summary>
        /// Saves the page and all of it's related regions.
        /// </summary>
        /// <param name="publish">Weather the page should be published</param>
        /// <returns>Weather the operation succeeded</returns>
        public virtual bool SaveAll(bool draft = true)
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    bool permalinkfirst = Page.IsNew;

                    // Save permalink first if the page is new
                    if (permalinkfirst)
                    {
                        if (Permalink.IsNew)
                        {
                            Permalink.Name = Permalink.Generate(!String.IsNullOrEmpty(Page.NavigationTitle) ?
                                                                Page.NavigationTitle : Page.Title);
                        }
                        Permalink.Save(tx);
                    }

                    // Save page
                    if (draft)
                    {
                        Page.Save(tx);
                    }
                    else
                    {
                        Page.SaveAndPublish(tx);
                    }

                    // Save regions & properties
                    Regions.ForEach(r => {
                        r.IsDraft = r.IsPageDraft = true;
                        r.Save(tx);
                        if (!draft)
                        {
                            if (Region.GetScalar("SELECT COUNT(region_id) FROM region WHERE region_id=@0 AND region_draft=0", r.Id) == 0)
                            {
                                r.IsNew = true;
                            }
                            r.IsDraft = r.IsPageDraft = false;
                            r.Save(tx);
                        }
                    });
                    Properties.ForEach(p => {
                        p.IsDraft = true;
                        p.Save(tx);
                        if (!draft)
                        {
                            if (Property.GetScalar("SELECT COUNT(property_id) FROM property WHERE property_id=@0 AND property_draft=0", p.Id) == 0)
                            {
                                p.IsNew = true;
                            }
                            p.IsDraft = false;
                            p.Save(tx);
                        }
                    });

                    // Save permalink last if the page isn't new
                    if (!permalinkfirst)
                    {
                        Permalink.Save(tx);
                    }

                    // Change global last modified
                    if (!draft)
                    {
                        Web.ClientCache.SetSiteLastModified(tx);
                    }

                    tx.Commit();
                } catch { tx.Rollback(); throw; }
            }
            return(true);
        }
Пример #41
0
        private static string GetRegionURL(Regions region, bool login)
        {
            if (region == Regions.US)
                return (login) ? p_Login_URL_US : p_Account_URL_US;
            else if (region == Regions.EU)
                return (login) ? p_Login_URL_EU : p_Account_URL_EU;

            return null;
        }
Пример #42
0
        public render_model(CacheBase Cache, int Address)
        {
            cache = Cache;
            EndianReader Reader = Cache.Reader;

            Reader.SeekTo(Address);

            Name  = Cache.Strings.GetItemByID(Reader.ReadInt32());
            Flags = new Bitmask(Reader.ReadInt32());

            #region Regions Block
            Reader.SeekTo(Address + 12);
            int iCount  = Reader.ReadInt32();
            int iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                Regions.Add(new Region(Cache, iOffset + 16 * i));
            }
            #endregion

            Reader.SeekTo(Address + 28);
            InstancedGeometryIndex = Reader.ReadInt32();

            #region Instanced Geometry Block
            Reader.SeekTo(Address + 32);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                GeomInstances.Add(new InstancedGeometry(Cache, iOffset + 60 * i));
            }
            #endregion

            #region Nodes Block
            Reader.SeekTo(Address + 48);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                Nodes.Add(new Node(Cache, iOffset + 112 * i));
            }
            #endregion

            #region MarkerGroups Block
            Reader.SeekTo(Address + 60);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                MarkerGroups.Add(new MarkerGroup(Cache, iOffset + 16 * i));
            }
            #endregion

            #region Shaders Block
            Reader.SeekTo(Address + 72);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                Shaders.Add(new Shader(Cache, iOffset + 44 * i));
            }
            #endregion

            #region ModelSections Block
            Reader.SeekTo(Address + 312);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                ModelSections.Add(new ModelSection(Cache, iOffset + 112 * i));
            }
            #endregion

            #region BoundingBox Block
            Reader.SeekTo(Address + 336);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                BoundingBoxes.Add(new BoundingBox(Cache, iOffset + 52 * i));
            }
            #endregion

            #region NodeMapGroup Block
            Reader.SeekTo(Address + 396);
            iCount  = Reader.ReadInt32();
            iOffset = Reader.ReadInt32() - Cache.Magic;
            for (int i = 0; i < iCount; i++)
            {
                NodeIndexGroups.Add(new NodeIndexGroup(Cache, iOffset + 12 * i));
            }
            #endregion

            Reader.SeekTo(Address + 444);
            RawID = Reader.ReadInt32();
        }
Пример #43
0
 public Region(Regions region)
 {
     this.region = region;
 }
Пример #44
0
 public Region(Regions region)
 {
     this.region = region;
 }
Пример #45
0
        public IList <WhoWasNotUpdatedField> Find(bool forExcel)
        {
            var regionMask = SecurityContext.Administrator.RegionMask;

            if (Regions != null && Regions.Any())
            {
                ulong mask = 0;
                foreach (var region in Regions)
                {
                    mask |= region;
                }
                regionMask &= mask;
            }

            var result = Session.CreateSQLQuery($@"
drop temporary table if exists Customers.UserSource;
create temporary table Customers.UserSource (
	UserId int unsigned,
	primary key(UserId)
) engine = memory;

INSERT INTO customers.UserSource
select u.Id
from Customers.Users u
	join usersettings.AssignedPermissions ap on ap.UserId = u.id
	join Customers.Clients c on c.Id = u.ClientId
		join Usersettings.RetClientsSet rcs on rcs.ClientCode = c.Id
where ap.PermissionId in (1, 81)
	and u.Enabled = 1
	and u.PayerId <> 921
	and u.ExcludeFromManagerReports = 0
	and c.Status = 1
	and rcs.ServiceClient = 0
	and rcs.InvisibleOnFirm = 0
	and rcs.OrderRegionMask & u.OrderRegionMask & :RegionCode > 0
group by u.Id;

drop temporary table if exists Customers.UserSource2;
create temporary table Customers.UserSource2 (
	UserId int unsigned,
	primary key(UserId)
) engine = memory;
insert into Customers.UserSource2
select * from Customers.UserSource;

DROP TEMPORARY TABLE IF EXISTS customers.oneUserDate;
CREATE TEMPORARY TABLE customers.oneUserDate (
UserId INT unsigned,
AddressId INT unsigned) engine=MEMORY;

INSERT
INTO customers.oneUserDate
SELECT u1.id, ua1.AddressId
FROM customers.Users U1
	join Customers.UserSource us on us.UserId = u1.Id
	join customers.UserAddresses ua1 on ua1.UserId = u1.id
	join customers.Addresses a1 on a1.id = ua1.AddressId
	join usersettings.UserUpdateInfo uu1 on uu1.userid = u1.id
where uu1.UpdateDate < :beginDate
group by u1.id
having count(a1.id) = 1;

DROP TEMPORARY TABLE IF EXISTS customers.oneUser;

CREATE TEMPORARY TABLE customers.oneUser (
UserId INT unsigned,
AddressId INT unsigned) engine=MEMORY ;

INSERT
INTO customers.oneUser

SELECT u1.id, ua1.AddressId
FROM customers.Users U1
	join Customers.UserSource us on us.UserId = u1.Id
	join customers.UserAddresses ua1 on ua1.UserId = u1.id
	join customers.Addresses a1 on a1.id = ua1.AddressId
group by u1.id
having count(a1.id) = 1;

SELECT
	c.id as ClientId,
	c.Name as ClientName,
	reg.Region as RegionName,
	u.Id as UserId,
	u.Name as UserName,
	c.Registrant as Registrant,
	uu.UpdateDate as UpdateDate,
	IF(IFNULL(ad.AFTime, '0000-00-00') < IFNULL(ad.AFNetTime, '0000-00-00'), ad.AFNetTime, ad.AFTime) as LastUpdateDate
FROM customers.Users U
	join Customers.UserSource us on us.UserId = u.Id
	join customers.UserAddresses ua on ua.UserId = u.id
	join customers.Addresses a on a.id = ua.AddressId
	join usersettings.UserUpdateInfo uu on uu.userid = u.id
	join customers.Clients c on c.id = u.ClientId and c.Status = 1
	join farm.Regions reg on reg.RegionCode = c.RegionCode
	join logs.authorizationdates ad on ad.UserId = u.Id
	left join Customers.AnalitFNetDatas nd on nd.UserId = u.Id
where uu.UpdateDate < :beginDate
	and ifnull(nd.LastUpdateAt, '2000-01-01') < :beginDate
	and c.RegionCode & :RegionCode > 0
group by u.id
having count(a.id) > 1

union

SELECT
	c.id as ClientId,
	c.Name as ClientName,
	reg.Region as RegionName,
	u.Id as UserId,
	u.Name as UserName,
	if (reg.ManagerName is not null, reg.ManagerName, c.Registrant) as Registrant,
	uu.UpdateDate as UpdateDate,
	IF(IFNULL(ad.AFTime, '0000-00-00') < IFNULL(ad.AFNetTime, '0000-00-00'), ad.AFNetTime, ad.AFTime) as LastUpdateDate
FROM customers.Users U
	join Customers.UserSource2 us on us.UserId = u.Id
	join customers.UserAddresses ua on ua.UserId = u.id
	join customers.Addresses a on a.id = ua.AddressId
	join usersettings.UserUpdateInfo uu on uu.userid = u.id
	join customers.Clients c on c.id = u.ClientId and c.Status = 1
	join logs.authorizationdates ad on ad.UserId = u.Id
	left join accessright.regionaladmins reg on reg.UserName = c.Registrant
	join farm.Regions reg on reg.RegionCode = c.RegionCode
	left join Customers.AnalitFNetDatas nd on nd.UserId = u.Id
where uu.UpdateDate < :beginDate
	and ifnull(nd.LastUpdateAt, '2000-01-01') < :beginDate
	and c.RegionCode & :RegionCode > 0
	and
	u.id in
	(
		select if ((select count(oud.UserId)
				from
					customers.oneUserDate oud
				where
					oud.AddressId = uaddr.AddressId
			) = (
				select count(ou.UserId)
				from
					customers.oneUser ou
				where
					ou.AddressId = uaddr.AddressId)
				, uaddr.UserId, 0
		)
		from customers.UserAddresses as uaddr
		where uaddr.UserId = u.id
	)
group by u.id
having count(a.id) = 1
order by {SortBy} {SortDirection};")
                         .SetParameter("beginDate", BeginDate)
                         .SetParameter("RegionCode", regionMask)
                         .ToList <WhoWasNotUpdatedField>();

            RowsCount = result.Count;

            if (forExcel)
            {
                return(result.ToList());
            }
            else
            {
                return(result.Skip(CurrentPage * PageSize).Take(PageSize).ToList());
            }
        }
Пример #46
0
 public Account(string username, byte[] password, Regions region, byte[] key, byte[] iv)
 {
     Username = username;
     p_Password = password;
     Region = region;
     p_Key = key;
     p_IV = iv;
 }
Пример #47
0
        public TreeNode[] GetAllLocationsTreeNodes(Font defaultFont, bool mainform)
        {
            if (mainformTreeRootNode != null)
            {
                return(BuildTreeNodeArray(mainform));
            }

            mainformTreeRootNode = new TreeNode();
            placesTreeRootNode   = new TreeNode();
            Font regularFont = new Font(defaultFont, FontStyle.Regular);
            Font boldFont    = new Font(defaultFont, FontStyle.Bold);

            foreach (FactLocation location in FamilyTree.Instance.AllDisplayPlaces)
            {
                string[] parts    = location.GetParts();
                TreeNode currentM = mainformTreeRootNode;
                TreeNode currentP = placesTreeRootNode;
                foreach (string part in parts)
                {
                    if (part.Length == 0 && !Properties.GeneralSettings.Default.AllowEmptyLocations)
                    {
                        break;
                    }
                    TreeNode childM = currentM.Nodes.Find(part, false).FirstOrDefault();
                    TreeNode childP = currentP.Nodes.Find(part, false).FirstOrDefault();
                    if (childM == null)
                    {
                        TreeNode child = new TreeNode((part.Length == 0 ? "<blank>" : part))
                        {
                            Name        = part,
                            Tag         = location,
                            ToolTipText = "Geocoding Status : " + location.Geocoded
                        };
                        SetTreeNodeImage(location, child);
                        // Set everything other than known countries and known regions to regular
                        if ((currentM.Level == 0 && Countries.IsKnownCountry(part)) ||
                            (currentM.Level == 1 && Regions.IsKnownRegion(part)))
                        {
                            child.NodeFont = boldFont;
                        }
                        else
                        {
                            child.NodeFont = regularFont;
                        }
                        childM = child;
                        childP = (TreeNode)child.Clone();
                        currentM.Nodes.Add(childM);
                        currentP.Nodes.Add(childP);
                    }
                    currentM = childM;
                    currentP = childP;
                }
            }
            if (Properties.GeneralSettings.Default.AllowEmptyLocations)
            { // trim empty end nodes
                bool recheck = true;
                while (recheck)
                {
                    TreeNode[] emptyNodes = mainformTreeRootNode.Nodes.Find(string.Empty, true);
                    recheck = false;
                    foreach (TreeNode node in emptyNodes)
                    {
                        if (node.FirstNode == null)
                        {
                            node.Remove();
                            recheck = true;
                        }
                    }
                }
            }
            foreach (TreeNode node in mainformTreeRootNode.Nodes)
            {
                node.Text += "         "; // force text to be longer to fix bold bug
            }
            foreach (TreeNode node in placesTreeRootNode.Nodes)
            {
                node.Text += "         "; // force text to be longer to fix bold bug
            }
            return(BuildTreeNodeArray(mainform));
        }
Пример #48
0
 public MenuItem(string pCaption, string pCorrelatedView, Regions pRegion)
 {
     Caption = pCaption;
     CorrelatedRegion = pRegion;
     CorrelatedView = pCorrelatedView;
 }
Пример #49
0
        public Value Apply()
        {
            var argument = Arguments.ApplyValue;
            var variable = Arguments.ApplyVariable;

            State.PushPatternManager();
            var    isVariable = variable != null;
            var    isReadOnly = isVariable && Regions.IsReadOnly(variable.Name) || !isVariable;
            string input;

            if (argument is PatternResult patternResult)
            {
                if (patternResult.Success)
                {
                    input      = patternResult.Text;
                    variable   = patternResult.Variable;
                    isVariable = variable != null;
                }
                else
                {
                    return(PatternResult.Failure());
                }
            }
            else
            {
                input = argument.Text;
            }

            var matched = Scan(input);
            var text    = State.Input.Copy();

            if (isReadOnly)
            {
                State.PopPatternManager();
                return(matched ? new Some(text.Drop(startIndex).Keep(stopIndex - startIndex)) : new None());
            }

            var result = matched ? new PatternResult
            {
                Input      = input,
                Text       = text,
                Value      = argument,
                Success    = true,
                StartIndex = startIndex,
                StopIndex  = stopIndex,
                Variable   = variable
            } : PatternResult.Failure();

            if (isVariable && result.IsTrue)
            {
                variable.Value = text;
            }

            if (State.Result != null)
            {
                var managerResult = State.Result;
                State.Result = null;
                State.PopPatternManager();

                return(managerResult);
            }

            State.PopPatternManager();
            return(result);
        }
Пример #50
0
 public WowApiProxy(Regions region)
 {
     this.Region = region;
 }
Пример #51
0
        public Value ApplyWhile()
        {
            var argument = Arguments.ApplyValue;
            var variable = Arguments.ApplyVariable;

            State.PushPatternManager();
            State.Multi = true;
            var    isVariable = variable != null;
            var    isReadOnly = isVariable && Regions.IsReadOnly(variable.Name);
            var    array      = new Array();
            string input;

            switch (argument)
            {
            case PatternResult {
                    Success: true
            } patternResult:
                input      = patternResult.Text;
                variable   = patternResult.Variable;
                isVariable = variable != null;
                break;

            case PatternResult:
                return(PatternResult.Failure());

            default:
                input = argument.Text;
                break;
            }

            var oneSuccess = false;

            for (var i = 0; i < MAX_LOOP && withinLimit(i); i++)
            {
                if (Scan(input))
                {
                    State.Alternates.Clear();
                    if (withinNth(i))
                    {
                        oneSuccess = true;
                    }
                }
                else
                {
                    break;
                }

                input = State.Input;
                if (isReadOnly)
                {
                    array.Add(input.Drop(startIndex).Keep(stopIndex - startIndex));
                }
            }

            if (isReadOnly)
            {
                State.PopPatternManager();
                return(oneSuccess ? array : new Array());
            }

            var result = oneSuccess ? new PatternResult
            {
                Input      = input,
                Text       = State.Input.Copy(),
                Value      = argument,
                Success    = true,
                StartIndex = startIndex,
                StopIndex  = stopIndex,
                Variable   = variable
            } : PatternResult.Failure();

            if (isVariable && result.IsTrue)
            {
                variable.Value = State.Input.Copy();
            }

            if (State.Result != null)
            {
                var managerResult = State.Result;
                State.Result = null;
                State.PopPatternManager();

                return(managerResult);
            }

            State.PopPatternManager();
            return(result);
        }
Пример #52
0
 public EveCacheInput()
 {
     _regions = new Regions();
 }
Пример #53
0
 public static RegionalEndPoint GetRegionalEndPointByRegion(Regions region)
 {
     return(RegionalEndPoints.FirstOrDefault(x => x.Region == region.ToString()));
 }
Пример #54
0
    public static void RedirectToHome(Regions region)
    {
        HttpResponse Response = HttpContext.Current.Response;

        switch (region)
        {
            case Regions.CC:
                Response.Redirect("user/cc");
                break;
            case Regions.NR1:
                Response.Redirect("user/nr1");
                break;
            case Regions.NR2:
                Response.Redirect("user/nr2");
                break;
            case Regions.ER1:
                Response.Redirect("user/er1");
                break;
            case Regions.ER2:
                Response.Redirect("user/er2");
                break;
            case Regions.WR1:
                Response.Redirect("user/wr1");
                break;
            case Regions.WR2:
                Response.Redirect("user/wr2");
                break;
            case Regions.SR1:
                Response.Redirect("user/sr1");
                break;
            case Regions.SR2:
                Response.Redirect("user/sr2");
                break;
            case Regions.NER:
                Response.Redirect("user/ner");
                break;
            case Regions.POSCC:
                Response.Redirect("user/poscc");
                break;
            case Regions.NRLDC:
                Response.Redirect("user/nrldc");
                break;
            case Regions.NERLDC:
                Response.Redirect("user/nerldc");
                break;
            case Regions.WRLDC:
                Response.Redirect("user/wrldc");
                break;
            case Regions.SRLDC:
                Response.Redirect("user/srldc");
                break;
            case Regions.ERLDC:
                Response.Redirect("user/erldc");
                break;
        }
    }
Пример #55
0
        private void DataGridRegions_Loaded(object sender, RoutedEventArgs e)
        {
            List <Region> regions = Regions.List();

            DataGridRegions.ItemsSource = regions;
        }
 /// <summary>
 /// Create a new Regions object.
 /// </summary>
 /// <param name="regionID">Initial value of RegionID.</param>
 /// <param name="regionDescription">Initial value of RegionDescription.</param>
 public static Regions CreateRegions(long regionID, string regionDescription)
 {
     Regions regions = new Regions();
     regions.RegionID = regionID;
     regions.RegionDescription = regionDescription;
     return regions;
 }
Пример #57
0
 public string GetAsPlainText()
 {
     return(Regions?.SelectMany(x => x.Lines).SelectMany(x => x.Words).Aggregate("", (i, j) => i + " " + j.Text).Trim() ?? "");
 }
Пример #58
0
 public bool TextFound()
 {
     return(Regions != null && Regions.Any());
 }
Пример #59
0
 public static string GetBaseUrl(Regions region)
 {
     string baseUrl = string.Format(BaseUrl, region.ToString());
     return baseUrl;
 }