コード例 #1
0
            public DangdangOrderListViewItem(DangdangOrder o)
            {
                _order    = o;
                this.Text = _order.OrderId;
                this.SubItems.Add(_order.DealTime.ToString("yyyy/MM/dd HH:mm:ss"));
                this.SubItems.Add(_order.PayTime.ToString("yyyy/MM/dd HH:mm:ss"));

                ProductInfo pi = ProductInfo.GetProductByDangdangCode(_order.UniqueProductCode);

                if (null != pi)
                {
                    this.SubItems.Add(ProductInfo.GetProductByDangdangCode(_order.UniqueProductCode).ShortName);                     //_order;-));
                }
                else
                {
                    this.SubItems.Add(string.Empty);
                }

                this.SubItems.Add(_order.ActualCount.ToString());
                this.SubItems.Add(_order.Status);
                this.SubItems.Add(_order.RecipientName);
                this.SubItems.Add(_order.IdNumber);
                this.SubItems.Add(_order.Mobile);
                this.SubItems.Add(_order.Address);
                this.SubItems.Add(_order.PaymentId);

                this.UseItemStyleForSubItems = false;
                switch (_order.Status)
                {
                case "等待配货":
                    this.SubItems[5].ForeColor = Color.Blue;
                    break;

                case "等待发货":
                    this.SubItems[5].ForeColor = Color.OrangeRed;
                    break;

                case "已送达":
                    this.UseItemStyleForSubItems = true;
                    this.ForeColor = Color.Green;
                    break;

                case "等待到款":
                case "取消":
                    this.UseItemStyleForSubItems = true;
                    this.ForeColor = Color.LightGray;
                    break;
                }
            }
コード例 #2
0
        private void tsbtnImportDangdangOrders_Click(object sender, EventArgs e)
        {
            if (lvwOrders.Items.Count > 0)
            {
                DialogResult dr = MessageBox.Show(this, "当前列表中的订单信息将会被清除.\n是否加载订单文件?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (DialogResult.No == dr)
                {
                    return;
                }
            }

            Cursor.Current = Cursors.WaitCursor;

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Excel Files(*.xlsx)|*.xlsx|Excel Files 97-2003(*.xls)|*.xls|All Files(*.*)|*.*";
            if (DialogResult.OK == ofd.ShowDialog(this))
            {
                Egode.Excel excel = null;
                try
                {
                    excel = new Egode.Excel(ofd.FileName, Excel.OledbVersions.OLEDB12);
                    DataSet ds = excel.Get("Sheet0", string.Empty);
                    lvwOrders.Items.Clear();
                    for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
                    {
                        DataRow  row             = ds.Tables[0].Rows[i];
                        string   orderId         = row.ItemArray[1].ToString();
                        string   sellerId        = row.ItemArray[2].ToString();
                        string   recipientName   = row.ItemArray[3].ToString();
                        string   idNumber        = row.ItemArray[4].ToString();
                        string   mobile          = row.ItemArray[5].ToString();
                        string   address         = row.ItemArray[6].ToString();
                        string   deliveryType    = row.ItemArray[7].ToString();
                        string   deliveryTime    = row.ItemArray[8].ToString();
                        string   paymentType     = row.ItemArray[9].ToString();
                        float    totalMoney      = float.Parse(row.ItemArray[10].ToString());                 ///
                        DateTime dealTime        = DateTime.Parse(row.ItemArray[15].ToString());
                        DateTime payTime         = string.IsNullOrEmpty(row.ItemArray[16].ToString()) ? DateTime.MinValue : DateTime.Parse(row.ItemArray[16].ToString());
                        string   invoice         = row.ItemArray[20].ToString();
                        string   status          = row.ItemArray[24].ToString();
                        float    fee             = float.Parse(row.ItemArray[26].ToString());
                        float    tax             = float.Parse(row.ItemArray[28].ToString());
                        string   productCode     = row.ItemArray[29].ToString();
                        int      count           = int.Parse(row.ItemArray[30].ToString());
                        float    price           = float.Parse(row.ItemArray[31].ToString());
                        string   paymentId       = row.ItemArray[32].ToString();
                        string   device          = row.ItemArray[33].ToString();
                        DateTime consigningTime  = string.IsNullOrEmpty(row.ItemArray[17].ToString()) ? DateTime.MinValue : DateTime.Parse(row.ItemArray[17].ToString());
                        string   shipmentCompany = row.ItemArray[21].ToString();
                        string   shipmentNumber  = row.ItemArray[22].ToString();

                        DangdangOrder o = new DangdangOrder(
                            orderId, sellerId,
                            recipientName, idNumber, mobile, address,
                            deliveryType, deliveryTime, paymentType, totalMoney,
                            dealTime, payTime, invoice, status, fee, tax, productCode, count, price,
                            paymentId,
                            device,
                            consigningTime, shipmentCompany, shipmentNumber);
                        lvwOrders.Items.Add(new DangdangOrderListViewItem(o));
                    }
                }
                finally
                {
                    if (null != excel && excel.Opened)
                    {
                        excel.Close();
                    }
                }
            }

            Cursor.Current = Cursors.Default;
        }
コード例 #3
0
 public DangdangOrderDetailsForm(DangdangOrder order)
 {
     _dangdangOrder = order;
     InitializeComponent();
 }