Exemple #1
0
        public FrmMyBoxDetail(List <PajkGetMyBoxDetailItem> list) : this()
        {
            this.label2.Text = list.Count.ToString();

            for (int i = 0; i < list.Count; i++)
            {
                var item        = list[i];
                var itemControl = new ItemControl();
                itemControl.SetImage(this.imageList1.Images[0]);
                itemControl.SetTitle(item.BoxGiftList[0].GiftName);
                itemControl.SetDecription(item.BoxCode + PapdHelper.ConvertFromUnixTime(item.BoxDate));
                itemControl.Visible = true;
                this.flowLayoutPanel1.Controls.Add(itemControl);
            }
        }
        private void Init(OrderDetailInfo info)
        {
            object[] values = new object[]
            {
                info.tradeOrder.GetOrderStatus(),
                     info.address == null?string.Empty:info.address.mobile,
                     info.tradeOrder.items[0].itemTitle,
                     info.tradeOrder.items.Length,
                     info.tradeOrder.bizType,
                "¥" + info.tradeOrder.useGold * 0.01,
                "¥" + info.tradeOrder.postFee,
                "¥" + info.tradeOrder.tradeItemTotalFee * 0.01,
                     info.tradeOrder.tradeId,
                     PapdHelper.ConvertFromUnixTime(info.tradeOrder.createTime),
                info.tradeOrder.payTime == 0? "无" : PapdHelper.ConvertFromUnixTime(info.tradeOrder.payTime).ToString()
            };
            Type type = this.GetType();

            for (int i = 0; i < values.Length; i++)
            {
                FieldInfo textBoxField = type.GetField("textBox" + (i + 1), BindingFlags.Instance | BindingFlags.NonPublic);
                if (textBoxField != null)
                {
                    TextBox txt = (TextBox)textBoxField.GetValue(this);
                    if (txt != null)
                    {
                        txt.Text = values[i].ToString();
                    }
                }
            }

            if (info.IsNeedAddress())
            {
                this.label10.Text  = "收货信息:";
                this.label10.Left  = 10;
                this.textBox2.Text = info.address.ToString();
                StringBuilder builder = new StringBuilder();
                builder.AppendLine("收件人:" + info.address.name);
                builder.AppendLine("收货地址:" + info.address.detail);
                builder.AppendLine("收件人手机号:" + info.address.mobile);
                this.toolTip1.SetToolTip(this.textBox2, builder.ToString());
            }
        }
Exemple #3
0
 public DateTime GetExpireTime()
 {
     return(PapdHelper.ConvertFromUnixTime(this.Expire));
 }
Exemple #4
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (this.listView1.CheckedItems.Count < 1)
            {
                MsgBox.ShowInfo("请勾选账号!");
                return;
            }

            List <int> checkedRows = new List <int>();

            for (int i = 0; i < this.listView1.CheckedItems.Count; i++)
            {
                checkedRows.Add(this.listView1.CheckedItems[i].Index);
            }

            ThreadPool.QueueUserWorkItem(o =>
            {
                SetControlEnabled(this.toolStrip1, false);
                for (int i = 0; i < checkedRows.Count; i++)
                {
                    int index     = checkedRows[i];
                    string cookie = GetListViewItemValue(this.listView1, index, 3);

                    #region 查询余额
                    try
                    {
                        var goldInfo = PH.GetGoldInfo(cookie);
                        SetListViewItemValue(this.listView1, index, 5, goldInfo.balance + "金");
                    }
                    catch (Exception ex)
                    {
                        SetListViewItemValue(this.listView1, index, 5, "余额查询失败");
                    }
                    #endregion

                    #region 查询下次可抢购时间

                    try
                    {
                        var orders = PH.QueryOrders(cookie, OrderType.ALL, 1);
                        if (orders.Count > 0)
                        {
                            DateTime lastOrderCreateTime = PapdHelper.ConvertFromUnixTime(orders[0].createTime);
                            DateTime nextOrderCreateTime = lastOrderCreateTime.AddDays(GlobalContext.CurrentConfigInfo.CreateOrderTimespan);
                            var leftDays = Math.Round((nextOrderCreateTime - DateTime.Now).TotalDays, 1);
                            var msg      = string.Format("{0},下次抢购时间:{1}",
                                                         leftDays > 0 ? ("还有" + leftDays + "天") : "可抢",
                                                         nextOrderCreateTime.ToString("yyyy/MM/dd HH:mm:ss dddd"));
                            SetListViewItemValue(this.listView1, index, 6, msg);
                        }
                        else
                        {
                            SetListViewItemValue(this.listView1, index, 6, "可抢");
                        }
                    }
                    catch (Exception ex)
                    {
                        SetListViewItemValue(this.listView1, index, 6, "查询下次抢购时间失败");
                    }
                    #endregion
                }
                SetControlEnabled(this.toolStrip1, true);
            });
        }