Inheritance: System.Web.UI.Page
Esempio n. 1
0
 public Piece(Height height, Shape shape, Top top, Color color, int location, long pieceId, bool isSelected)
 {
     Initialize(height, shape, top, color);
     Location = location;
     PieceId = pieceId;
     IsSelected = isSelected;
 }
Esempio n. 2
0
 public Shield()
 {
     Front frontPanel = new Front();
     Rear rearPanel = new Rear();
     Top topPanel = new Top();
     Bottom bottomPanel = new Bottom();
     Right rightPanel = new Right();
     Left leftPanel = new Left();
 }
Esempio n. 3
0
        public void PushMessage(Top.Tmc.Message msg)
        {
            try
            {
                //按照卖家名称将消息分发给客户端,如果该卖家不在系统中,则忽略该消息。
                using (var db = new ApplicationDbContext())
                {
                    if (db.UserTaoOAuths.Any(x => x.taobao_user_nick == msg.UserNick))
                    {
                        var connections = db.Connections.Where(x => x.Connected && x.User.UserName == msg.UserNick);
                        var connIds = connections.Select(x => x.ConnectionID).ToList();
                        if (connIds.Any())
                        {
                            var mInfoName = "";
                            var mInfoNames = new List<string>();
                            try
                            {
                                foreach (dynamic item in this)
                                {
                                    var proxyInstance = (object)item.Clients(connIds);
                                    var type = proxyInstance.GetType();
                                    var methodInfos = type.GetMethods();
                                    mInfoNames.AddRange(methodInfos.Select(x => x.Name));
                                    var methodName = new string(msg.Topic.Skip(msg.Topic.LastIndexOf("_") + 1).ToArray());
                                    var method = methodInfos.FirstOrDefault(x => x.Name == methodName);
                                    if (method != null)
                                    {
                                        mInfoName = method.Name;
                                        method.Invoke(proxyInstance, BindingFlags.Default, null, new object[] { msg }, Thread.CurrentThread.CurrentCulture);
                                        return;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Clients.Clients(connIds).OnMessage("动态调用方法" + mInfoName + "时发生错误,错误信息:" + ex.Message);
                            }
                            //Clients.Clients(connIds).OnMessage("消息" + msg.Topic + "未处理。找过的处理方法有:" + string.Join(",", mInfoNames));
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }
Esempio n. 4
0
        public object Any(Top request)
        {
            TableRepository tableRepository = new TableRepository();
            var questions = tableRepository.GetTable(Tables.Questions).CreateQuery<QuestionEntry>().ToArray().Take(10);

            // "No similar question found... yet !"
            return new TopResponse
            {
                Questions = questions.Select(k => new TopQuestionResponse
                {
                    Id = k.GetId(),
                    Title = k.Title,
                    Votes = k.Votes,
                    Answers = k.Answers,
                    Views = k.Views
                }).ToArray()
            };
        }
        /// <summary>
        /// Factory method for creating commands
        /// </summary>
        /// <param name="inputCommand">User input string</param>
        /// <returns>ICommand object</returns>
        public ICommand CreateCommand(string inputCommand)
        {
            inputCommand = inputCommand.ToLower();
            if (this.commandDictionary.ContainsKey(inputCommand))
            {
                return this.commandDictionary[inputCommand];
            }
            else
            {
                ICommand command;

                switch (inputCommand)
                {
                    case "help":
                        command = new Help();
                        break;
                    case "top":
                        command = new Top();
                        break;
                    case "restart":
                        command = new Restart();
                        break;
                    case "exit":
                        command = new Exit();
                        break;
                    default:
                        if (inputCommand.Length != 1 || string.IsNullOrWhiteSpace(inputCommand))
                        {
                            throw new ArgumentException(GlobalMessages.IncorrectGuessOrCommand);
                        }

                        command = new LetterGuess(inputCommand);
                        break;
                }

                return command;
            }
        }
Esempio n. 6
0
        public void Insert(Top.Entity.Top top)
        {
            DBMaster dbMaster = new DBMaster();
            dbMaster.OpenConnection();
            try
            {
                MySqlCommand command = dbMaster.GetConnection().CreateCommand();

                foreach (var lineTop in top.GetDictionaryTops())
                {
                    command.CommandText = "INSERT INTO tops (id_group, count, data, id_user) "
                                          + "VALUES (" + lineTop.Key + ", " + lineTop.Value
                                          + ", DATE_FORMAT(CURRENT_DATE(), '%Y-%m-%d'), " +  top.GetUserID() + ")";
                    command.ExecuteNonQuery();
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            dbMaster.CloseConnection();
        }
 public override string ToString()
 {
     return("DataGridViewAdvancedBorderStyle { All=" + All.ToString() + ", Left=" + Left.ToString() + ", Right=" + Right.ToString() + ", Top=" + Top.ToString() + ", Bottom=" + Bottom.ToString() + " }");
 }
Esempio n. 8
0
        public override IQueryable ApplyTo(IQueryable query, ODataQuerySettings querySettings)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }

            if (querySettings == null)
            {
                throw new ArgumentNullException(nameof(querySettings));
            }

            var result = query;

            // Construct the actual query and apply them in the following order: filter, orderby, skip, top
            if (Filter != null)
            {
                result = Filter.ApplyTo(result, querySettings, assembliesResolver);
            }

            if (InlineCount != null && Request.ODataProperties().TotalCount == null)
            {
                long?count = InlineCount.GetEntityCount(result);
                if (count.HasValue)
                {
                    Request.ODataProperties().TotalCount = count.Value;
                }
            }

            OrderByQueryOption orderBy = OrderBy;

            // $skip or $top require a stable sort for predictable results.
            // Result limits require a stable sort to be able to generate a next page link.
            // If either is present in the query and we have permission,
            // generate an $orderby that will produce a stable sort.
            if (querySettings.EnsureStableOrdering &&
                (Skip != null || Top != null || querySettings.PageSize.HasValue))
            {
                // If there is no OrderBy present, we manufacture a default.
                // If an OrderBy is already present, we add any missing
                // properties necessary to make a stable sort.
                // Instead of failing early here if we cannot generate the OrderBy,
                // let the IQueryable backend fail (if it has to).
                orderBy = orderBy == null
                            ? GenerateDefaultOrderBy(Context)
                            : EnsureStableSortOrderBy(orderBy, Context);
            }

            if (orderBy != null)
            {
                result = orderBy.ApplyTo(result, querySettings);
            }

            if (Skip != null)
            {
                result = Skip.ApplyTo(result, querySettings);
            }

            if (Top != null)
            {
                result = Top.ApplyTo(result, querySettings);
            }

            if (querySettings.PageSize.HasValue)
            {
                bool resultsLimited;
                result = LimitResults(result, querySettings.PageSize.Value, out resultsLimited);
                if (resultsLimited && Request.RequestUri != null && Request.RequestUri.IsAbsoluteUri && Request.ODataProperties().NextLink == null)
                {
                    Uri nextPageLink = GetNextPageLink(Request, querySettings.PageSize.Value);
                    Request.ODataProperties().NextLink = nextPageLink;
                }
            }

            return(result);
        }
Esempio n. 9
0
        public calc0_direct(string src,TextWriter FerrOut)
			: base(src,FerrOut)
        {
            top= new Top();

        }
Esempio n. 10
0
 private void Window_LocationChanged(object sender, EventArgs e)
 {
     cfg.AppSettings.Settings["LocationX"].Value = Left.ToString();
     cfg.AppSettings.Settings["LocationY"].Value = Top.ToString();
     cfg.Save();
 }
Esempio n. 11
0
 /// <summary>
 /// Returns the hash code of the structure.
 /// </summary>
 /// <returns>A hash code for this instance of <see cref="T:System.Windows.Thickness" />.</returns>
 public override int GetHashCode()
 {
     return(Left.GetHashCode() ^ Top.GetHashCode() ^ Right.GetHashCode() ^ Bottom.GetHashCode());
 }
Esempio n. 12
0
 public CSharp3()
     : base()
 {
     top= new Top();
 }
Esempio n. 13
0
        public override void Setup()
        {
            const string IdenticalSign = "\u2261";
            const string ArrowUpSign   = "\u2191";
            const string ArrowDownSign = "\u2193";
            const string EllipsesSign  = "\u2026";
            const string StashSign     = "\u205E";

            //string text = "Hello world, how are you today? Pretty neat!\nSecond line\n\nFourth Line.";
            string unicode = "Τὴ γλῶσσα μοῦ ἔδωσαν ἑλληνικὴ\nτὸ σπίτι φτωχικὸ στὶς ἀμμουδιὲς τοῦ Ὁμήρου.\nΜονάχη ἔγνοια ἡ γλῶσσα μου στὶς ἀμμουδιὲς τοῦ Ὁμήρου.";

            string gitString = $"gui.cs master {IdenticalSign} {ArrowDownSign}18 {ArrowUpSign}10 {StashSign}1 {EllipsesSign}";

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_Файл", new MenuItem [] {
                    new MenuItem("_Создать", "Creates new file", null),
                    new MenuItem("_Открыть", "", null),
                    new MenuItem("Со_хранить", "", null),
                    new MenuItem("_Выход", "", () => Application.RequestStop())
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.ControlQ, "~^Q~ Выход", () => Application.RequestStop()),
                new StatusItem(Key.Unknown, "~F2~ Создать", null),
                new StatusItem(Key.Unknown, "~F3~ Со_хранить", null),
            });

            Top.Add(statusBar);

            var label = new Label("Label:")
            {
                X = 0, Y = 1
            };

            Win.Add(label);
            var testlabel = new Label(gitString)
            {
                X = 20, Y = Pos.Y(label), Width = Dim.Percent(50),
            };

            Win.Add(testlabel);

            label = new Label("Label (CanFocus):")
            {
                X = Pos.X(label), Y = Pos.Bottom(label) + 1
            };
            Win.Add(label);
            testlabel = new Label("Стоял &он, дум великих полн")
            {
                X = 20, Y = Pos.Y(label), Width = Dim.Percent(50), CanFocus = true, HotKeySpecifier = new System.Rune('&')
            };
            Win.Add(testlabel);

            label = new Label("Button:")
            {
                X = Pos.X(label), Y = Pos.Bottom(label) + 1
            };
            Win.Add(label);
            var button = new Button("A123456789♥♦♣♠JQK")
            {
                X = 20, Y = Pos.Y(label)
            };

            Win.Add(button);

            label = new Label("CheckBox:")
            {
                X = Pos.X(label), Y = Pos.Bottom(label) + 1
            };
            Win.Add(label);
            var checkBox = new CheckBox(gitString)
            {
                X = 20, Y = Pos.Y(label), Width = Dim.Percent(50)
            };

            Win.Add(checkBox);

            label = new Label("ComboBox:")
            {
                X = Pos.X(label), Y = Pos.Bottom(label) + 1
            };
            Win.Add(label);
            var comboBox = new ComboBox()
            {
                X     = 20,
                Y     = Pos.Y(label),
                Width = Dim.Percent(50)
            };

            comboBox.SetSource(new List <string> ()
            {
                gitString, "Со_хранить"
            });

            Win.Add(comboBox);
            comboBox.Text = gitString;

            label = new Label("HexView:")
            {
                X = Pos.X(label), Y = Pos.Bottom(label) + 2
            };
            Win.Add(label);
            var hexView = new HexView(new System.IO.MemoryStream(Encoding.ASCII.GetBytes(gitString + " Со_хранить")))
            {
                X      = 20,
                Y      = Pos.Y(label),
                Width  = Dim.Percent(60),
                Height = 5
            };

            Win.Add(hexView);

            label = new Label("ListView:")
            {
                X = Pos.X(label), Y = Pos.Bottom(hexView) + 1
            };
            Win.Add(label);
            var listView = new ListView(new List <string> ()
            {
                "item #1", gitString, "Со_хранить", unicode
            })
            {
                X      = 20,
                Y      = Pos.Y(label),
                Width  = Dim.Percent(60),
                Height = 3,
            };

            Win.Add(listView);

            label = new Label("RadioGroup:")
            {
                X = Pos.X(label), Y = Pos.Bottom(listView) + 1
            };
            Win.Add(label);
            var radioGroup = new RadioGroup(new ustring [] { "item #1", gitString, "Со_хранить" }, selected: 0)
            {
                X     = 20,
                Y     = Pos.Y(label),
                Width = Dim.Percent(60),
            };

            Win.Add(radioGroup);

            label = new Label("TextField:")
            {
                X = Pos.X(label), Y = Pos.Bottom(radioGroup) + 1
            };
            Win.Add(label);
            var textField = new TextField(gitString + " = Со_хранить")
            {
                X = 20, Y = Pos.Y(label), Width = Dim.Percent(60)
            };

            Win.Add(textField);

            label = new Label("TextView:")
            {
                X = Pos.X(label), Y = Pos.Bottom(textField) + 1
            };
            Win.Add(label);
            var textView = new TextView()
            {
                X      = 20,
                Y      = Pos.Y(label),
                Width  = Dim.Percent(60),
                Height = 5,
                Text   = unicode,
            };

            Win.Add(textView);
        }
Esempio n. 14
0
 private void RefundHub_RefundBuyerReturnGoods(Top.Tmc.Message msg)
 {
     AppendText(msg.Topic);
     AppendText(msg.Content);
 }
Esempio n. 15
0
 private async void ItemHub_ItemUpshelf(Top.Tmc.Message msg)
 {
     //AppendText(msg.Topic);
     //AppendText(msg.Content);
     var def = new { num_iid = 522569629924 };
     var d = JsonConvert.DeserializeAnonymousType(msg.Content, def);
     var product = await FindProductById(d.num_iid).ConfigureAwait(false);
     if (product != null)
     {
         AppendText("上架了商品【{0}】", product.ItemName);
         product.OnUpshelf(AppDatabase.db.ProductItems);
     }
     BindDGViewProduct();
 }
Esempio n. 16
0
        public BERTree(byte[] src,TextWriter FerrOut)
			: base(src,FerrOut)
        {
            top= new Top();

        }
Esempio n. 17
0
        private async void TradeHub_TradeClose(Top.Tmc.Message msg)
        {
            //AppendText(msg.Topic);
            //AppendText(msg.Content);

            var definition = new { buyer_nick = "", payment = "", oid = 0L, tid = 0L, type = "guarantee_trade", seller_nick = "" };
            //var content = @"{'buyer_nick':'包花呗','payment':'9.56','oid':1316790655492656,'tid':1316790655492656,'type':'guarantee_trade','seller_nick':'红指甲与高跟鞋'}";
            var d = JsonConvert.DeserializeAnonymousType(msg.Content, definition);
            var result = await this.InvokeTask(client.TradeHub.GetTradeStatus, d.tid);
            if (result.Success)
            {
                var trade = AppDatabase.db.TopTrades.FindById(d.tid);
                if (trade != null)
                {
                    trade.Status = result.Data;
                    AppDatabase.db.TopTrades.Update(trade);
                    CloseTradeQueue.Enqueue(trade.Tid, CloseTradeIfPossible, OnCloseTradeExecuted);
                }
            }
        }
Esempio n. 18
0
        public BERTree()
            : base()
        {
            top= new Top();

        }
Esempio n. 19
0
        public void OnDeserializedRule_IsAppliedToMappingFilter()
        {
            var fluentMappingFilter = GetMappingFilter();

            var onDeserializedHook = fluentMappingFilter.GetOnDeserializedHook(typeof(Top));
            Assert.That(onDeserializedHook, Is.Not.Null);
            var top = new Top();
            onDeserializedHook(top);
            Assert.That(top.DeserializeHookWasRun, Is.True);
        }
Esempio n. 20
0
 public CSharp3(string src,TextWriter FerrOut)
     : base(src,FerrOut)
 {
     top= new Top();
 }
Esempio n. 21
0
 public string ToString(string format, IFormatProvider formatProvider)
 => $"[{Left.ToString(format, formatProvider)}, {Top.ToString(format, formatProvider)} x " +
 $"[{Right.ToString(format, formatProvider)}, {Bottom.ToString(format, formatProvider)}";
Esempio n. 22
0
 public static List<T_ERP_TaoBao_PromotionDetail> CastPromot(Top.Api.Domain.Trade trd, Guid gidTrad)
 {
     if (null == trd || trd.PromotionDetails == null) return null;
     List<T_ERP_TaoBao_PromotionDetail> ret = new List<T_ERP_TaoBao_PromotionDetail>(trd.PromotionDetails.Count);
     trd.PromotionDetails.ForEach(t =>
     {
         ret.Add(new T_ERP_TaoBao_PromotionDetail
         {
             Tid = trd.Tid,
             DiscountFee = t.DiscountFee.ToDecimal(),
             GiftItemId = t.GiftItemId,
             GiftItemName = t.GiftItemName,
             GiftItemNum = t.GiftItemNum.ToDecimal(),
             Guid = gidTrad,
             PromotionDesc = t.PromotionDesc,
             PromotionId = t.PromotionId,
             PromotionName = t.PromotionName,
         });
     });
     return ret;
 }
Esempio n. 23
0
 private void ItemHub_ItemAdd(Top.Tmc.Message msg)
 {
     //AppendText(msg.Topic);
     //AppendText(msg.Content);
     //var def = new { num = 999999, title = "QQ币1个直充", price = "0.97", nick = "cendart", num_iid = 523042737153 };
     //var d = DynamicJson.Parse(msg.Content);
     //AppendText("新增了商品【{0}】", d.title);
     //var product = await FindProductById((long)d.num_iid);
     //if (product == null)
     //{
     //    product = new ProductItem { Id = d.num_iid, ItemName = d.title, 一口价 = d.price, StockQty = d.num };
     //    AppDatabase.db.ProductItems.Upsert((ProductItem)product, (string)d.num_iid);
     //}
     //BindDGViewProduct();
 }
Esempio n. 24
0
        public static List<T_ERP_Taobao_ServiceOrder> CastServiceOrder(Top.Api.Domain.Trade trd, Guid gidTrade)
        {
            if (null == trd || trd.ServiceOrders == null) return null;
            var ret = new List<T_ERP_Taobao_ServiceOrder>(trd.ServiceOrders.Count);
            trd.ServiceOrders.ForEach(t =>
            {
                ret.Add(new T_ERP_Taobao_ServiceOrder
                {
                    Tid = trd.Tid,
                    BuyerNick = t.BuyerNick,
                    Guid = gidTrade,
                    ItemOid = t.ItemOid,
                    Num = t.Num,
                    Oid = t.Oid,
                    Payment = t.Payment.ToDecimal(),
                    PicPath = t.PicPath,
                    Price = t.Price.ToDecimal(),
                    RefundId = t.RefundId,
                    SellerNick = t.SellerNick.IsEmpty() ? trd.SellerNick : t.SellerNick,
                    ServiceDetailUrl = t.ServiceDetailUrl,
                    ServiceId = t.ServiceId,
                    Title = t.Title,
                    TotalFee = t.TotalFee.ToDecimal()
                });
            });

            return ret;
        }
Esempio n. 25
0
 private void RefundHub_RefundTimeoutRemind(Top.Tmc.Message msg)
 {
     AppendText(msg.Topic);
     AppendText(msg.Content);
 }
Esempio n. 26
0
        public override string ToString()
        {
            var enUS = new System.Globalization.CultureInfo("en-US");

            return("%%BoundingBox: " + Left.ToString(enUS) + " " + Bottom.ToString(enUS) + " " + Right.ToString(enUS) + " " + Top.ToString(enUS));
        }
Esempio n. 27
0
 private void RefundHub_RefundBlockMessage(Top.Tmc.Message msg)
 {
     AppendText(msg.Topic);
     AppendText(msg.Content);
 }
Esempio n. 28
0
 public override int GetHashCode() => Left.GetHashCode() ^ Top.GetHashCode() ^ Right.GetHashCode()& Bottom.GetHashCode();
Esempio n. 29
0
        private async void ItemHub_ItemStockChanged(Top.Tmc.Message msg)
        {
            //AppendText(msg.Topic);
            //AppendText(msg.Content);
            //页面新增商品后会触发此消息
            var def = new { increment = 999999, num = 999999, num_iid = 523021091186 };
            var d = JsonConvert.DeserializeAnonymousType(msg.Content, def);
            var product = await FindProductById(d.num_iid);
            if (product != null && product.StockQty != d.num)
            {
                //更新库存
                product.StockQty = d.num;
                AppDatabase.db.ProductItems.Update(product);
                BindDGViewProduct();
                //await SetItemQty(product);
            }

        }
Esempio n. 30
0
 public override IEnumerable <WeightedTop> CalculateRule(Top agent, Top previousTarget, IList <Top> others)
 {
     return(others.Select(t => new WeightedTop(t, t == previousTarget ? 1 : 0)));
 }
Esempio n. 31
0
 public override string ToString()
 {
     return(Left.ToInvariantString() + ", " + Top.ToInvariantString() + ", " +
            Width.ToInvariantString() + ", " + Height.ToInvariantString());
 }
Esempio n. 32
0
 /// <include file='doc\Padding.uex' path='docs/doc[@for="Padding.ToString"]/*' />
 public override string ToString()
 {
     return("{Left=" + Left.ToString(CultureInfo.CurrentCulture) + ",Top=" + Top.ToString(CultureInfo.CurrentCulture) + ",Right=" + Right.ToString(CultureInfo.CurrentCulture) + ",Bottom=" + Bottom.ToString(CultureInfo.CurrentCulture) + "}");
 }
Esempio n. 33
0
 public bool Equals(RectI obj)
 {
     return(Left.Equals(obj.Left) && Top.Equals(obj.Top) && Right.Equals(obj.Right) && Bottom.Equals(obj.Bottom));
 }
Esempio n. 34
0
        public Menu() : base(ModContent.GetTexture(texturePath + "Background"))
        {
            Width.Set(172, 0);
            Height.Set(46, 0);
            Left.Set(275f, 0);
            Top.Set(255f, 0);

            OnMouseDown += (element, listener) =>
            {
                Vector2 MenuPosition = new Vector2(Left.Pixels, Top.Pixels);
                Vector2 clickPos     = Vector2.Subtract(element.MousePosition, MenuPosition);
                canDrag = !isLocked && clickPos.X >= 10 && clickPos.Y >= 10;
            };

            elements = new UIImage[5];
            for (int i = 0; i < elements.Length - 1; i++)
            {
                int     index = i;
                UIImage temp  = new UIImage(ModContent.GetTexture(texturePath + names[index]))
                {
                    Width  = { Pixels = 28 },
                    Height = { Pixels = 28 },
                    Left   = { Pixels = offset[index] },
                    Top    = { Pixels = 14 }
                };
                temp.OnClick     += (__, _) => Click(index);
                temp.OnMouseOver += (__, _) => Hover(index, true);
                temp.OnMouseOut  += (__, _) => Hover(index, false);

                elements[index] = temp;
                Append(temp);
            }

            loadoutText = new UIText("")
            {
                Width  = { Pixels = 12 },
                Height = { Pixels = 18 },
                Left   = { Pixels = 85 },
                Top    = { Pixels = 19 }
            };
            Append(loadoutText);

            UIImage dragLock = new UIImage(ModContent.GetTexture(texturePath + "Lock0"))
            {
                Width  = { Pixels = 22 },
                Height = { Pixels = 22 },
                Left   = { Pixels = 2 },
                Top    = { Pixels = 2 }
            };

            dragLock.OnMouseOver += (__, _) => LockHover(true);
            dragLock.OnMouseOut  += (__, _) => LockHover(false);
            dragLock.OnClick     += (__, _) =>
            {
                Main.PlaySound(SoundID.Unlock);
                isLocked = !isLocked;
                string lockName = "Lock" + (isLocked ? "0" : "1") + "Hover";
                dragLock.SetImage(ModContent.GetTexture(texturePath + lockName));

                if (isLocked)
                {
                    Main.LocalPlayer.GetModPlayer <ELPlayer>().menuOffset =
                        new Vector2((int)Left.Pixels, (int)Top.Pixels);
                }
            };
            elements[4] = dragLock;
            Append(dragLock);

            isLocked = Visible = true;
        }
Esempio n. 35
0
 public override Vector3 CalculateRule(Top agent, Top target, IList <Top> others)
 {
     return(target.transform.position - agent.transform.position);
 }
Esempio n. 36
0
 public abstract void Top(Top top);
Esempio n. 37
0
        public string GetRetrieveUrl(Uri apiUri)
        {
            if (apiUri == null)
            {
                throw new WebApiException("ApiUri can't be null");
            }

            var uriBuilder = new UriBuilder(apiUri);
            var query      = HttpUtility.ParseQueryString(uriBuilder.Query);

            if (!string.IsNullOrWhiteSpace(Filter))
            {
                query["$filter"] = Filter;
            }

            if (Select?.Length > 0)
            {
                query["$select"] = String.Join(",", Select);
            }

            if (OrderBy?.Length > 0)
            {
                query["$orderby"] = String.Join(",", OrderBy);
            }

            if (Top > 0)
            {
                query["$top"] = Top.ToString();
            }

            if (Skip > 0)
            {
                query["$skip"] = Skip.ToString();
            }

            if (IncludeCount)
            {
                query["$count"] = "true";
            }


            if (!string.IsNullOrEmpty(TrackChangesLink))
            {
            }

            //TODO: Advanced options?
            if (SavedQuery != Guid.Empty)
            {
                query["savedQuery"] = SavedQuery.ToString();
            }
            else if (UserQuery != Guid.Empty)
            {
                query["userQuery"] = UserQuery.ToString();
            }
            else if (!string.IsNullOrWhiteSpace(FetchXml))
            {
                query["fetchXml"] = FetchXml;
            }

            //END: Advanced options?

            uriBuilder.Query = query.ToString();
            return(uriBuilder.ToString());
        }
Esempio n. 38
0
        public void MultiTable()
        {
            ISession     s     = OpenSession();
            ITransaction t     = s.BeginTransaction();
            Multi        multi = new Multi();

            multi.ExtraProp = "extra";
            multi.Name      = "name";
            Top simp = new Top();

            simp.Date = DateTime.Now;
            simp.Name = "simp";
            object mid;
            object sid;

            if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect))
            {
                mid = s.Save(multi);
                sid = s.Save(simp);
            }
            else
            {
                mid = 123L;
                sid = 1234L;
                s.Save(multi, mid);
                s.Save(simp, sid);
            }
            SubMulti sm = new SubMulti();

            sm.Amount = 66.5f;
            object smid;

            if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect))
            {
                smid = s.Save(sm);
            }
            else
            {
                smid = 2L;
                s.Save(sm, smid);
            }
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            multi.ExtraProp = multi.ExtraProp + "2";
            multi.Name      = "new name";
            s.Update(multi, mid);
            simp.Name = "new name";
            s.Update(simp, sid);
            sm.Amount = 456.7f;
            s.Update(sm, smid);
            t.Commit();
            s.Close();

            s     = OpenSession();
            t     = s.BeginTransaction();
            multi = (Multi)s.Load(typeof(Multi), mid);
            Assert.AreEqual("extra2", multi.ExtraProp);
            multi.ExtraProp = multi.ExtraProp + "3";
            Assert.AreEqual("new name", multi.Name);
            multi.Name = "newer name";
            sm         = (SubMulti)s.Load(typeof(SubMulti), smid);
            Assert.AreEqual(456.7f, sm.Amount);
            sm.Amount = 23423f;
            t.Commit();
            s.Close();

            s     = OpenSession();
            t     = s.BeginTransaction();
            multi = (Multi)s.Load(typeof(Top), mid);
            simp  = (Top)s.Load(typeof(Top), sid);
            Assert.IsFalse(simp is Multi);
            Assert.AreEqual("extra23", multi.ExtraProp);
            Assert.AreEqual("newer name", multi.Name);
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            IEnumerator enumer        = s.CreateQuery("select\n\ns from s in class Top where s.Count>0").Enumerable().GetEnumerator();
            bool        foundSimp     = false;
            bool        foundMulti    = false;
            bool        foundSubMulti = false;

            while (enumer.MoveNext())
            {
                object o = enumer.Current;
                if ((o is Top) && !(o is Multi))
                {
                    foundSimp = true;
                }
                if ((o is Multi) && !(o is SubMulti))
                {
                    foundMulti = true;
                }
                if (o is SubMulti)
                {
                    foundSubMulti = true;
                }
            }
            Assert.IsTrue(foundSimp);
            Assert.IsTrue(foundMulti);
            Assert.IsTrue(foundSubMulti);

            s.CreateQuery("from m in class Multi where m.Count>0 and m.ExtraProp is not null").List();
            s.CreateQuery("from m in class Top where m.Count>0 and m.Name is not null").List();
            s.CreateQuery("from m in class Lower where m.Other is not null").List();
            s.CreateQuery("from m in class Multi where m.Other.id = 1").List();
            s.CreateQuery("from m in class SubMulti where m.Amount > 0.0").List();

            Assert.AreEqual(2, s.CreateQuery("from m in class Multi").List().Count);

            //if( !(dialect is Dialect.HSQLDialect) )
            //{
            Assert.AreEqual(1, s.CreateQuery("from m in class Multi where m.class = SubMulti").List().Count);
            Assert.AreEqual(1, s.CreateQuery("from m in class Top where m.class = Multi").List().Count);
            //}

            Assert.AreEqual(3, s.CreateQuery("from s in class Top").List().Count);
            Assert.AreEqual(0, s.CreateQuery("from ls in class Lower").List().Count);
            Assert.AreEqual(1, s.CreateQuery("from sm in class SubMulti").List().Count);

            if (IsClassicParser)
            {
                s.CreateQuery("from ls in class Lower, s in ls.Bag.elements where s.id is not null").List();
                s.CreateQuery("from ls in class Lower, s in ls.Set.elements where s.id is not null").List();
                s.CreateQuery("from sm in class SubMulti where exists sm.Children.elements").List();
            }
            else
            {
                s.CreateQuery("from ls in class Lower, s in elements(ls.Bag) where s.id is not null").List();
                s.CreateQuery("from ls in class Lower, s in elements(ls.Set) where s.id is not null").List();
                s.CreateQuery("from sm in class SubMulti where exists elements(sm.Children)").List();
            }

            t.Commit();
            s.Close();

            s     = OpenSession();
            t     = s.BeginTransaction();
            multi = (Multi)s.Load(typeof(Top), mid, LockMode.Upgrade);
            simp  = (Top)s.Load(typeof(Top), sid);
            s.Lock(simp, LockMode.UpgradeNoWait);
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            s.Update(multi, mid);
            s.Delete(multi);
            Assert.AreEqual(2, s.Delete("from s in class Top"));
            t.Commit();
            s.Close();
        }
Esempio n. 39
0
        public calc0_direct()
            : base()
        {
            top= new Top();

        }
Esempio n. 40
0
        public void MultiTableGeneratedId()
        {
            ISession     s     = OpenSession();
            ITransaction t     = s.BeginTransaction();
            Multi        multi = new Multi();

            multi.ExtraProp = "extra";
            multi.Name      = "name";
            Top simp = new Top();

            simp.Date = DateTime.Now;
            simp.Name = "simp";
            object   multiId = s.Save(multi);
            object   simpId  = s.Save(simp);
            SubMulti sm      = new SubMulti();

            sm.Amount = 66.5f;
            object smId = s.Save(sm);

            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            multi.ExtraProp += "2";
            multi.Name       = "new name";
            s.Update(multi, multiId);
            simp.Name = "new name";
            s.Update(simp, simpId);
            sm.Amount = 456.7f;
            s.Update(sm, smId);
            t.Commit();
            s.Close();

            s     = OpenSession();
            t     = s.BeginTransaction();
            multi = (Multi)s.Load(typeof(Multi), multiId);
            Assert.AreEqual("extra2", multi.ExtraProp);
            multi.ExtraProp += "3";
            Assert.AreEqual("new name", multi.Name);
            multi.Name = "newer name";
            sm         = (SubMulti)s.Load(typeof(SubMulti), smId);
            Assert.AreEqual(456.7f, sm.Amount);
            sm.Amount = 23423f;
            t.Commit();
            s.Close();

            s     = OpenSession();
            t     = s.BeginTransaction();
            multi = (Multi)s.Load(typeof(Top), multiId);
            simp  = (Top)s.Load(typeof(Top), simpId);
            Assert.IsFalse(simp is Multi);
            // Can't see the point of this test since the variable is declared as Multi!
            //Assert.IsTrue( multi is Multi );
            Assert.AreEqual("extra23", multi.ExtraProp);
            Assert.AreEqual("newer name", multi.Name);
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            IEnumerable enumer        = s.CreateQuery("select\n\ns from s in class Top where s.Count>0").Enumerable();
            bool        foundSimp     = false;
            bool        foundMulti    = false;
            bool        foundSubMulti = false;

            foreach (object obj in enumer)
            {
                if ((obj is Top) && !(obj is Multi))
                {
                    foundSimp = true;
                }
                if ((obj is Multi) && !(obj is SubMulti))
                {
                    foundMulti = true;
                }
                if (obj is SubMulti)
                {
                    foundSubMulti = true;
                }
            }
            Assert.IsTrue(foundSimp);
            Assert.IsTrue(foundMulti);
            Assert.IsTrue(foundSubMulti);

            s.CreateQuery("from m in class Multi where m.Count>0 and m.ExtraProp is not null").List();
            s.CreateQuery("from m in class Top where m.Count>0 and m.Name is not null").List();
            s.CreateQuery("from m in class Lower where m.Other is not null").List();
            s.CreateQuery("from m in class Multi where m.Other.id = 1").List();
            s.CreateQuery("from m in class SubMulti where m.Amount > 0.0").List();

            Assert.AreEqual(2, s.CreateQuery("from m in class Multi").List().Count);
            Assert.AreEqual(3, s.CreateQuery("from s in class Top").List().Count);
            Assert.AreEqual(0, s.CreateQuery("from s in class Lower").List().Count);
            Assert.AreEqual(1, s.CreateQuery("from sm in class SubMulti").List().Count);

            if (IsClassicParser)
            {
                s.CreateQuery("from ls in class Lower, s in ls.Bag.elements where s.id is not null").List();
                s.CreateQuery("from sm in class SubMulti where exists sm.Children.elements").List();
            }
            else
            {
                s.CreateQuery("from ls in class Lower, s in elements(ls.Bag) where s.id is not null").List();
                s.CreateQuery("from sm in class SubMulti where exists elements(sm.Children)").List();
            }

            t.Commit();
            s.Close();

            s     = OpenSession();
            t     = s.BeginTransaction();
            multi = (Multi)s.Load(typeof(Top), multiId, LockMode.Upgrade);
            simp  = (Top)s.Load(typeof(Top), simpId);
            s.Lock(simp, LockMode.UpgradeNoWait);
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            s.Update(multi, multiId);
            s.Delete(multi);
            Assert.AreEqual(2, s.Delete("from s in class Top"));
            t.Commit();
            s.Close();
        }
Esempio n. 41
0
 public void KomsuKaldir(Top t)
 {
     Komsular.Remove(t);
 }
Esempio n. 42
0
        public void MultiTableCollections()
        {
            if (Dialect is MySQLDialect)
            {
                return;
            }

            ISession     s = OpenSession();
            ITransaction t = s.BeginTransaction();

            Assert.AreEqual(0, s.CreateQuery("from s in class Top").List().Count);
            Multi multi = new Multi();

            multi.ExtraProp = "extra";
            multi.Name      = "name";
            Top simp = new Top();

            simp.Date = DateTime.Now;
            simp.Name = "simp";
            object mid;
            object sid;

            if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect))
            {
                mid = s.Save(multi);
                sid = s.Save(simp);
            }
            else
            {
                mid = 123L;
                sid = 1234L;
                s.Save(multi, mid);
                s.Save(simp, sid);
            }
            Lower ls = new Lower();

            ls.Other      = ls;
            ls.Another    = ls;
            ls.YetAnother = ls;
            ls.Name       = "Less Simple";
            ISet dict = new HashedSet();

            ls.Set = dict;
            dict.Add(multi);
            dict.Add(simp);
            object id;

            if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect))
            {
                id = s.Save(ls);
            }
            else
            {
                id = 2L;
                s.Save(ls, id);
            }
            t.Commit();
            s.Close();
            Assert.AreSame(ls, ls.Other);
            Assert.AreSame(ls, ls.Another);
            Assert.AreSame(ls, ls.YetAnother);

            s  = OpenSession();
            t  = s.BeginTransaction();
            ls = (Lower)s.Load(typeof(Lower), id);
            Assert.AreSame(ls, ls.Other);
            Assert.AreSame(ls, ls.Another);
            Assert.AreSame(ls, ls.YetAnother);
            Assert.AreEqual(2, ls.Set.Count);

            int foundMulti  = 0;
            int foundSimple = 0;

            foreach (object obj in ls.Set)
            {
                if (obj is Top)
                {
                    foundSimple++;
                }
                if (obj is Multi)
                {
                    foundMulti++;
                }
            }
            Assert.AreEqual(2, foundSimple);
            Assert.AreEqual(1, foundMulti);
            Assert.AreEqual(3, s.Delete("from s in class Top"));
            t.Commit();
            s.Close();
        }
Esempio n. 43
0
 bool Equals(Thickness other)
 {
     return(Left.Equals(other.Left) && Top.Equals(other.Top) && Right.Equals(other.Right) && Bottom.Equals(other.Bottom));
 }
Esempio n. 44
0
        public void MultiTableManyToOne()
        {
            if (Dialect is MySQLDialect)
            {
                return;
            }

            ISession     s = OpenSession();
            ITransaction t = s.BeginTransaction();

            Assert.AreEqual(0, s.CreateQuery("from s in class Top").List().Count);
            Multi multi = new Multi();

            multi.ExtraProp = "extra";
            multi.Name      = "name";
            Top simp = new Top();

            simp.Date = DateTime.Now;
            simp.Name = "simp";
            object mid;

            if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect))
            {
                mid = s.Save(multi);
            }
            else
            {
                mid = 123L;
                s.Save(multi, mid);
            }
            Lower ls = new Lower();

            ls.Other      = ls;
            ls.Another    = multi;
            ls.YetAnother = ls;
            ls.Name       = "Less Simple";
            object id;

            if ((Dialect is SybaseDialect) || (Dialect is MsSql2000Dialect))
            {
                id = s.Save(ls);
            }
            else
            {
                id = 2L;
                s.Save(ls, id);
            }
            t.Commit();
            s.Close();

            Assert.AreSame(ls, ls.Other);
            Assert.AreSame(multi, ls.Another);
            Assert.AreSame(ls, ls.YetAnother);

            s  = OpenSession();
            t  = s.BeginTransaction();
            ls = (Lower)s.Load(typeof(Lower), id);
            Assert.AreSame(ls, ls.Other);
            Assert.AreSame(ls, ls.YetAnother);
            Assert.AreEqual("name", ls.Another.Name);
            Assert.IsTrue(ls.Another is Multi);
            s.Delete(ls);
            s.Delete(ls.Another);
            t.Commit();
            s.Close();
        }
Esempio n. 45
0
 private async void ItemHub_ItemDelete(Top.Tmc.Message msg)
 {
     //貌似不触发这个事件
     //var def = new { num_iid = 522569629924 };
     var d = DynamicJson.Parse(msg.Content);
     var product = await FindProductById((long)d.num_iid);
     AppDatabase.db.ProductItems.Delete(d.num_iid);
     AppendText("删除了商品【{0}】", product.ItemName);
     BindDGViewProduct();
 }
Esempio n. 46
0
 private void SaveWindowSettings()
 {
     Properties.Settings.Default.instancegui_windowsettings = String.Join(";", new string[] { Left.ToString(), Top.ToString(), MaxWidth.ToString(), MaxHeight.ToString() });
     Properties.Settings.Default.instancegui_ispinned       = ispinned;
     Properties.Settings.Default.Save();
 }
Esempio n. 47
0
        private async void TradeHub_TradeCreate(Top.Tmc.Message msg)
        {
            //AppendText(msg.Topic);
            //AppendText(msg.Content);

            //解析内容
            var definition = new { buyer_nick = "", payment = "", oid = 0L, tid = 0L, type = "guarantee_trade", seller_nick = "" };
            //var content = @"{'buyer_nick':'包花呗','payment':'9.56','oid':1316790655492656,'tid':1316790655492656,'type':'guarantee_trade','seller_nick':'红指甲与高跟鞋'}";
            var d = JsonConvert.DeserializeAnonymousType(msg.Content, definition);
            var trade = (await this.InvokeTask(client.TradeHub.GetTrade, d.tid)).Data;
            var product = AppDatabase.db.ProductItems.FindById(trade.NumIid);
            if (product == null)
            {
                AppendText("忽略非平台商品订单{0}", trade.Tid);
                return;
            }


            //更新订单列表
            AppDatabase.db.TopTrades.Upsert(trade, trade.Tid);
            AppendText("[{0}]交易创建:买家:{1}", d.tid, d.buyer_nick);

            //更新统计信息
            var statistic = AppDatabase.db.Statistics.FindById(d.seller_nick) ?? new Statistic { Id = d.seller_nick };
            statistic.BuyCount++;
            AppDatabase.db.Statistics.Upsert(statistic, statistic.Id);
            OnStatisticUpdate(statistic);

            SuplierInfo supplier = null;
            if (!string.IsNullOrEmpty(product.SupplierId))
            {
                supplier = product.GetSuplierInfo();
            }
            else
            {
                await CheckIfLoginRequired();
                using (var wbHelper = new WBHelper(true))
                {
                    try
                    {
                        //查找供应商
                        supplier = await this.InvokeTask(supplierInfo, wbHelper, product.SpuId);
                        if (supplier.profitData != null && supplier.profitData.Any())
                        {
                            product.OnSupplierInfoUpdate(AppDatabase.db.ProductItems, supplier);
                        }
                    }
                    catch (Exception ex)
                    {
                        AppendException(ex);
                    }
                }
            }
            if (supplier != null && supplier.profitData != null && supplier.profitData.Any())
            {
                //5分钟之前的消息即过期的下单信息不处理
                if ((ServerDateTime - trade.Created).TotalMinutes > 5)
                {
                    AppendText("[{0}/{1}]不拦截过期交易。", trade.Tid, trade.NumIid);
                    return;
                }

                var interceptType = AppSetting.UserSetting.Get<string>("拦截模式");
                if (interceptType == InterceptMode.无条件拦截模式)
                {
                    InteceptQueue.Enqueue(new InterceptInfo(supplier, product.SpuId, trade, statistic), InterceptTrade, OnInterceptExecuted);
                    return;
                }
                else if (interceptType == InterceptMode.仅拦截亏本交易)
                {
                    if (supplier.profitMin < 0)
                    {
                        InteceptQueue.Enqueue(new InterceptInfo(supplier, product.SpuId, trade, statistic), InterceptTrade, OnInterceptExecuted);
                    }
                    else
                        AppendText("[{0}/{1}]不拦截-{2}。", trade.Tid, trade.NumIid, interceptType);
                    return;
                }
                else if (interceptType == InterceptMode.智能拦截模式)
                {
                    //若14天内同充值号码
                    var number = new Regex(@"(?<=号码:|用户名:)(\d{5,12})\b").Match(trade.ReceiverAddress ?? "").Value;
                    if (!string.IsNullOrEmpty(number))
                    {
                        var countNumUsed = AppDatabase.db.TopTrades.Count(x => x.ReceiverAddress.Contains(number) && x.NumIid == trade.NumIid);
                        if (countNumUsed > 1)
                        {
                            //AppendText("14天内同充值号码拦截,订单ID={0}", trade.Tid);
                            InteceptQueue.Enqueue(new InterceptInfo(supplier, product.SpuId, trade, statistic), InterceptTrade, OnInterceptExecuted);
                            return;
                        }
                    }

                    //14天内同宝贝付款订单大于1
                    var orderCount = AppDatabase.db.TopTrades.Count(x => x.BuyerNick == trade.BuyerNick && x.NumIid == trade.NumIid);
                    if (orderCount > 1)
                    {
                        //AppendText("14天内同宝贝付款订单大于1拦截,订单ID={0}", trade.Tid);
                        InteceptQueue.Enqueue(new InterceptInfo(supplier, product.SpuId, trade, statistic), InterceptTrade, OnInterceptExecuted);
                        return;
                    }

                    //买家是白名单内买家,不拦截
                    if (AppSetting.UserSetting.Get("买家白名单", new string[0]).Any(x => x == trade.BuyerNick))
                    {
                        AppendText("[{0}/{1}]不拦截-{2}。", trade.Tid, trade.NumIid, interceptType);
                        return;
                    }
                    //黑名单买家一律拦截
                    if (AppSetting.UserSetting.Get<string[]>("买家黑名单", new string[0]).Any(x => x == trade.BuyerNick))
                    {
                        //AppendText("黑名单买家拦截,订单ID={0}", trade.Tid);
                        InteceptQueue.Enqueue(new InterceptInfo(supplier, product.SpuId, trade, statistic), InterceptTrade, OnInterceptExecuted);
                        return;
                    }

                    //购买数量超过1件的拦截
                    if (trade.Num > 1)
                    {
                        //AppendText("购买数量超过1件拦截,订单ID={0}", trade.Tid);
                        InteceptQueue.Enqueue(new InterceptInfo(supplier, product.SpuId, trade, statistic), InterceptTrade, OnInterceptExecuted);
                        return;
                    }
                    AppendText("[{0}/{1}]不拦截-{2}。", trade.Tid, trade.NumIid, interceptType);
                }
            }
            else
            {
                AppendText("[{0}/{1}]交易商品供应商信息未查询到,不拦截。", trade.Tid, trade.NumIid);
            }
        }
Esempio n. 48
0
        protected override void AfterDeserialize(XElement xml)
        {
            base.AfterDeserialize(xml);

            // At one point, a field called "ConvertedFromOld" was introduced instead of increasing Version to 2. The following is a fix for this.
            if (xml.Element("ConvertedFromOld") != null && xml.Element("ConvertedFromOld").Value == "True")
            {
                SavedByVersion = 2;
            }

            // Upgrade to v2
            if (SavedByVersion < 2)
            {
                SavedByVersion = 2;
                AnchorRaw anchor;

                if (LeftAnchor && RightAnchor)
                {
                    X      = ((Left + Right) / 2).ToString();
                    anchor = AnchorRaw.Center;
                }
                else if (LeftAnchor)
                {
                    X      = (Left).ToString();
                    anchor = AnchorRaw.Left;
                }
                else if (RightAnchor)
                {
                    X      = (Right).ToString();
                    anchor = AnchorRaw.Right;
                }
                else
                {
                    X      = (80 / 2).ToString(); // ok to hard-code 80 because that was the IconWidth of all styles as old as this one
                    anchor = AnchorRaw.Center;
                }

                if (TopAnchor && BottomAnchor)
                {
                    Y       = ((Top + Bottom) / 2).ToString();
                    anchor |= AnchorRaw.Mid;
                }
                else if (TopAnchor)
                {
                    Y       = Top.ToString();
                    anchor |= AnchorRaw.Top;
                }
                else if (BottomAnchor)
                {
                    Y       = Bottom.ToString();
                    anchor |= AnchorRaw.Bottom;
                }
                else
                {
                    Y       = (24 / 2).ToString(); // ok to hard-code 24 because that was the IconHeight of all styles as old as this one
                    anchor |= AnchorRaw.Mid;
                }

                Anchor = (Anchor)anchor;

                switch (SizeMode)
                {
                case SizeModeOld.NoChange:
                    SizeMode2 = SizeMode2.NoChange;
                    break;

                case SizeModeOld.ByPercentage:
                    SizeMode2 = SizeMode2.ByPercentage;
                    break;

                case SizeModeOld.BySizeWidthOnly:
                    SizeMode2 = SizeMode2.BySizeWidthOnly;
                    break;

                case SizeModeOld.BySizeHeightOnly:
                    SizeMode2 = SizeMode2.BySizeHeightOnly;
                    break;

                case SizeModeOld.BySizeWidthHeightStretch:
                    SizeMode2 = SizeMode2.BySizeStretch;
                    break;

                case SizeModeOld.ByPosLeftRight:
                    SizeMode2 = SizeMode2.BySizeWidthOnly;
                    Width     = (Right - Left + 1).ToString();
                    break;

                case SizeModeOld.ByPosTopBottom:
                    SizeMode2 = SizeMode2.BySizeHeightOnly;
                    Height    = (Bottom - Top + 1).ToString();
                    break;

                case SizeModeOld.ByPosAllFit:
                    SizeMode2 = SizeMode2.BySizeFit;
                    Width     = (Right - Left + 1).ToString();
                    Height    = (Bottom - Top + 1).ToString();
                    break;

                case SizeModeOld.ByPosAllStretch:
                    SizeMode2 = SizeMode2.BySizeStretch;
                    Width     = (Right - Left + 1).ToString();
                    Height    = (Bottom - Top + 1).ToString();
                    break;
                }
            }

            Left       = Right = Top = Bottom = 0;
            LeftAnchor = RightAnchor = TopAnchor = BottomAnchor = false;
            SizeMode   = default(SizeModeOld);
        }
Esempio n. 49
0
        private async void TradeHub_TradeBuyerPay(Top.Tmc.Message msg)
        {
            //AppendText(msg.Topic);
            //AppendText(msg.Content);

            //解析内容
            var definition = new { buyer_nick = "", payment = "", oid = 0L, tid = 0L, type = "guarantee_trade", seller_nick = "" };
            //var content = @"{'buyer_nick':'包花呗','payment':'9.56','oid':1316790655492656,'tid':1316790655492656,'type':'guarantee_trade','seller_nick':'红指甲与高跟鞋'}";
            var d = JsonConvert.DeserializeAnonymousType(msg.Content, definition);
            var trade = (await this.InvokeTask(client.TradeHub.GetTrade, d.tid)).Data;
            AppDatabase.UpsertTopTrade(trade);
            var product = AppDatabase.db.ProductItems.FindById(trade.NumIid);
            if (product == null)
            {
                AppendText("忽略非平台商品订单{0}", trade.Tid);
                return;
            }
            var statistic = AppDatabase.db.Statistics.FindById(d.seller_nick) ?? new Statistic { Id = d.seller_nick };
            statistic.PayCount++;
            AppDatabase.db.Statistics.Upsert(statistic, statistic.Id);
            OnStatisticUpdate(statistic);
            AppendText("[{0}]交易付款,买家:{1} 创建于{2},付款时间{3}", trade.Tid, trade.BuyerNick, trade.Created.ToString("M月d日 H时m分s秒"), trade.PayTime.Value.ToString("M月d日 H时m分s秒"));
            CloseTradeQueue.Enqueue(trade.Tid, CloseTradeIfPossible, OnCloseTradeExecuted);
        }
Esempio n. 50
0
 public override string ToString()
 {
     return(Left.ToString() + ", " + Top.ToString() + ", " + Right.ToString() + ", " + Bottom.ToString());
 }
Esempio n. 51
0
 private void RefundHub_RefundSellerAgreeAgreement(Top.Tmc.Message msg)
 {
     AppendText(msg.Topic);
     AppendText(msg.Content);
 }
Esempio n. 52
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     return(Left.GetHashCode() ^ 1 + Top.GetHashCode() ^ 2 + Front.GetHashCode() ^ 3 + Right.GetHashCode() ^ 4 + Bottom.GetHashCode() ^ 5 + Behind.GetHashCode());
 }
Esempio n. 53
0
 private void RefundHub_RefundBuyerModifyAgreement(Top.Tmc.Message msg)
 {
     AppendText(msg.Topic);
     AppendText(msg.Content);
 }
        private IEnumerable <QueryOption> GetAllOptions()
        {
            yield return(new QueryOption("$count", IncludeTotalResultCount.ToString().ToLowerInvariant()));

            foreach (string facetExpr in Facets)
            {
                yield return(new QueryOption("facet", Uri.EscapeDataString(facetExpr)));
            }

            if (Filter != null)
            {
                yield return(new QueryOption("$filter", Uri.EscapeDataString(Filter)));
            }

            if (HighlightFields.Any())
            {
                yield return(new QueryOption("highlight", HighlightFields));
            }

            if (HighlightPreTag != null)
            {
                yield return(new QueryOption("highlightPreTag", Uri.EscapeDataString(HighlightPreTag)));
            }

            if (HighlightPostTag != null)
            {
                yield return(new QueryOption("highlightPostTag", Uri.EscapeDataString(HighlightPostTag)));
            }

            if (MinimumCoverage != null)
            {
                yield return(new QueryOption("minimumCoverage", MinimumCoverage.ToString()));
            }

            if (OrderBy.Any())
            {
                yield return(new QueryOption("$orderby", OrderBy));
            }

            foreach (string scoringParameterExpr in ScoringParameters)
            {
                yield return(new QueryOption("scoringParameter", scoringParameterExpr));
            }

            if (ScoringProfile != null)
            {
                yield return(new QueryOption("scoringProfile", ScoringProfile));
            }

            if (SearchFields.Any())
            {
                yield return(new QueryOption("searchFields", SearchFields));
            }

            yield return(new QueryOption("searchMode", SearchIndexClient.SearchModeToString(SearchMode)));

            if (Select.Any())
            {
                yield return(new QueryOption("$select", Select));
            }

            if (Skip != null)
            {
                yield return(new QueryOption("$skip", Skip.ToString()));
            }

            if (Top != null)
            {
                yield return(new QueryOption("$top", Top.ToString()));
            }
        }
Esempio n. 55
0
 private void ItemHub_ItemZeroStock(Top.Tmc.Message msg)
 {
     AppendText(msg.Topic);
     AppendText(msg.Content);
 }
Esempio n. 56
0
        public override void Setup()
        {
            Win.Title  = this.GetName();
            Win.Y      = 1;           // menu
            Win.Height = Dim.Fill(1); // status bar
            Top.LayoutSubviews();

            this.tableView = new TableView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(1),
            };

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_OpenBigExample", "", () => OpenExample(true)),
                    new MenuItem("_OpenSmallExample", "", () => OpenExample(false)),
                    new MenuItem("OpenCharacter_Map", "", () => OpenUnicodeMap()),
                    new MenuItem("_CloseExample", "", () => CloseExample()),
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_View", new MenuItem [] {
                    miAlwaysShowHeaders = new MenuItem("_AlwaysShowHeaders", "", () => ToggleAlwaysShowHeader())
                    {
                        Checked = tableView.Style.AlwaysShowHeaders, CheckType = MenuItemCheckStyle.Checked
                    },
                    miHeaderOverline = new MenuItem("_HeaderOverLine", "", () => ToggleOverline())
                    {
                        Checked = tableView.Style.ShowHorizontalHeaderOverline, CheckType = MenuItemCheckStyle.Checked
                    },
                    miHeaderMidline = new MenuItem("_HeaderMidLine", "", () => ToggleHeaderMidline())
                    {
                        Checked = tableView.Style.ShowVerticalHeaderLines, CheckType = MenuItemCheckStyle.Checked
                    },
                    miHeaderUnderline = new MenuItem("_HeaderUnderLine", "", () => ToggleUnderline())
                    {
                        Checked = tableView.Style.ShowHorizontalHeaderUnderline, CheckType = MenuItemCheckStyle.Checked
                    },
                    miShowHorizontalScrollIndicators = new MenuItem("_HorizontalScrollIndicators", "", () => ToggleHorizontalScrollIndicators())
                    {
                        Checked = tableView.Style.ShowHorizontalScrollIndicators, CheckType = MenuItemCheckStyle.Checked
                    },
                    miFullRowSelect = new MenuItem("_FullRowSelect", "", () => ToggleFullRowSelect())
                    {
                        Checked = tableView.FullRowSelect, CheckType = MenuItemCheckStyle.Checked
                    },
                    miCellLines = new MenuItem("_CellLines", "", () => ToggleCellLines())
                    {
                        Checked = tableView.Style.ShowVerticalCellLines, CheckType = MenuItemCheckStyle.Checked
                    },
                    miExpandLastColumn = new MenuItem("_ExpandLastColumn", "", () => ToggleExpandLastColumn())
                    {
                        Checked = tableView.Style.ExpandLastColumn, CheckType = MenuItemCheckStyle.Checked
                    },
                    miSmoothScrolling = new MenuItem("_SmoothHorizontalScrolling", "", () => ToggleSmoothScrolling())
                    {
                        Checked = tableView.Style.SmoothHorizontalScrolling, CheckType = MenuItemCheckStyle.Checked
                    },
                    new MenuItem("_AllLines", "", () => ToggleAllCellLines()),
                    new MenuItem("_NoLines", "", () => ToggleNoCellLines()),
                    miAlternatingColors = new MenuItem("Alternating Colors", "", () => ToggleAlternatingColors())
                    {
                        CheckType = MenuItemCheckStyle.Checked
                    },
                    miCursor = new MenuItem("Invert Selected Cell First Character", "", () => ToggleInvertSelectedCellFirstCharacter())
                    {
                        Checked = tableView.Style.InvertSelectedCellFirstCharacter, CheckType = MenuItemCheckStyle.Checked
                    },
                    new MenuItem("_ClearColumnStyles", "", () => ClearColumnStyles()),
                }),
                new MenuBarItem("_Column", new MenuItem [] {
                    new MenuItem("_Set Max Width", "", SetMaxWidth),
                    new MenuItem("_Set Min Width", "", SetMinWidth),
                    new MenuItem("_Set MinAcceptableWidth", "", SetMinAcceptableWidth),
                    new MenuItem("_Set All MinAcceptableWidth=1", "", SetMinAcceptableWidthToOne),
                }),
            });


            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.F2, "~F2~ OpenExample", () => OpenExample(true)),
                new StatusItem(Key.F3, "~F3~ CloseExample", () => CloseExample()),
                new StatusItem(Key.F4, "~F4~ OpenSimple", () => OpenSimple(true)),
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            Win.Add(tableView);

            var selectedCellLabel = new Label()
            {
                X             = 0,
                Y             = Pos.Bottom(tableView),
                Text          = "0,0",
                Width         = Dim.Fill(),
                TextAlignment = TextAlignment.Right
            };

            Win.Add(selectedCellLabel);

            tableView.SelectedCellChanged += (e) => { selectedCellLabel.Text = $"{tableView.SelectedRow},{tableView.SelectedColumn}"; };
            tableView.CellActivated       += EditCurrentCell;
            tableView.KeyPress            += TableViewKeyPress;

            SetupScrollBar();

            redColorScheme = new ColorScheme()
            {
                Disabled = Win.ColorScheme.Disabled,
                HotFocus = Win.ColorScheme.HotFocus,
                Focus    = Win.ColorScheme.Focus,
                Normal   = Application.Driver.MakeAttribute(Color.Red, Win.ColorScheme.Normal.Background)
            };

            alternatingColorScheme = new ColorScheme()
            {
                Disabled = Win.ColorScheme.Disabled,
                HotFocus = Win.ColorScheme.HotFocus,
                Focus    = Win.ColorScheme.Focus,
                Normal   = Application.Driver.MakeAttribute(Color.White, Color.BrightBlue)
            };
            redColorSchemeAlt = new ColorScheme()
            {
                Disabled = Win.ColorScheme.Disabled,
                HotFocus = Win.ColorScheme.HotFocus,
                Focus    = Win.ColorScheme.Focus,
                Normal   = Application.Driver.MakeAttribute(Color.Red, Color.BrightBlue)
            };
        }
Esempio n. 57
0
        private async void ItemHub_ItemUpdate(Top.Tmc.Message msg)
        {
            //AppendText(msg.Topic + " " + msg.Content);
            //taobao_item_ItemUpdate
            //{ "nick":"cendart","changed_fields":"","num_iid":522571681053} 
            //被删除时会先触发taobao_item_ItemUpdate消息,如果商品在出售中,还会触发下架消息
            var d = DynamicJson.Parse(msg.Content);
            var product = await FindProductById((long)d.num_iid).ConfigureAwait(false);
            if (product != null)
            {
                //提交了改价的才处理
                if (product.ModifyProfitSubmitted)
                {
                    product.ModifyProfitSubmitted = false;
                    AppDatabase.db.ProductItems.Update(product);
                    BindDGViewProduct();
                    SyncSupplierQueue.Enqueue(product, SyncSupplierInfo, (input, result, ex) =>
                    {
                        BindDGViewProduct();
                    });
                }

                //恢复价格的,已经在关单的时候提交了请求,这里只需要更新供应商利润信息即可
                if (product.NeedResotreProfit)
                {
                    SyncSupplierQueue.Enqueue(product, SyncSupplierInfo, (input, result, ex) =>
                    {
                        BindDGViewProduct();
                    });
                }
            }
        }
Esempio n. 58
0
 public Rectangle Lerp(Rectangle other, float interpolation)
 {
     return(new Rectangle(Left.Lerp(other.Left, interpolation),
                          Top.Lerp(other.Top, interpolation), Width.Lerp(other.Width, interpolation),
                          Height.Lerp(other.Height, interpolation)));
 }
Esempio n. 59
0
        private async void ItemHub_ItemDownshelf(Top.Tmc.Message msg)
        {
            //AppendText(msg.Topic);
            //AppendText(msg.Content);
            //var def = new { num_iid = 522569629924 };
            var d = DynamicJson.Parse(msg.Content);
            var product = await FindProductById((long)d.num_iid);
            if (product != null)
            {
                product.OnDownshelf(AppDatabase.db.ProductItems);
                AppendText("下架了商品【{0}】", product.ItemName);

                if (product.AutoUpshelf)
                {
                    LockUplist(new ProductItem[] { product });
                    WaitUpWaitDownlist.Enqueue(new ProductItem[] { product }, UpProduct, (input, ex) => { });
                }
            }
            BindDGViewProduct();
        }
Esempio n. 60
0
 public override int GetHashCode()
 {
     // ReSharper disable NonReadonlyFieldInGetHashCode
     return(Left.GetHashCode() ^ Top.GetHashCode() ^ Width.GetHashCode() ^ Height.GetHashCode());
 }