Пример #1
0
 private void OrderCreateData(Alading.Entity.TradeOrder createOrder, DataRow row, string customTid)
 {
     Alading.Entity.Item item = ItemService.GetItem(p => p.outer_id == row["OuterID"].ToString()).FirstOrDefault();
     createOrder.CustomTid           = customTid;
     createOrder.iid                 = string.Empty;
     createOrder.sku_id              = item == null ? string.Empty : item.iid;
     createOrder.TradeOrderCode      = Guid.NewGuid().ToString();
     createOrder.oid                 = createOrder.TradeOrderCode;
     createOrder.outer_sku_id        = string.Empty;
     createOrder.outer_iid           = string.Empty;
     createOrder.sku_properties_name = row["SkuProps_Str"].ToString();
     createOrder.price               = double.Parse(row["price"].ToString());
     createOrder.total_fee           = double.Parse(row["orderTotalFee"].ToString());
     createOrder.discount_fee        = 0.0;//淘宝系统优惠价  为 0. 0
     createOrder.adjust_fee          = 0 - double.Parse(row["orderTotalFee"].ToString()) * (1 - double.Parse(txtDiscountRate.Text));
     createOrder.payment             = double.Parse(row["orderTotalFee"].ToString()) * double.Parse(txtDiscountRate.Text);
     createOrder.item_meal_name      = string.Empty;
     createOrder.num                 = int.Parse(row["num"].ToString());
     createOrder.title               = row["Name"].ToString();
     createOrder.pic_path            = string.Empty;
     createOrder.seller_nick         = cmbSeller.SelectedText;
     createOrder.buyer_nick          = cmbConsumerName.SelectedText;
     createOrder.created             = dateCreateTrade.DateTime;
     createOrder.refund_status       = Alading.Core.Enum.RefundStatus.NO_REFUND;
     createOrder.status              = TradeEnum.WAIT_SELLER_SEND_GOODS;
     createOrder.snapshot_url        = string.Empty;
     createOrder.snapshot            = string.Empty;
     createOrder.timeout_action_time = DateTime.MinValue;
     createOrder.OrderType           = Alading.Core.Enum.emumOrderType.SellGoods;//系统配置订单类型
     createOrder.type                = string.Empty;
     createOrder.seller_type         = cmbSeller.EditValue.ToString();
     createOrder.HouseCode           = string.Empty;
     createOrder.LayoutCode          = string.Empty;
 }
Пример #2
0
        /// 通过传iid来绑定商品属性到面板
        private void ShowItemPropValue(string iid, string sku_props_name)
        {
            Alading.Entity.Item vsItem = ItemService.GetItem(iid);
            if (vsItem == null) //如果为空 则不绑定
            {
                return;
            }
            ShopItem sItem = new ShopItem();

            sItem.cid            = vsItem.cid;
            sItem.input_pids     = vsItem.input_pids;
            sItem.input_str      = vsItem.input_str;
            sItem.property_alias = vsItem.property_alias;
            sItem.props          = vsItem.props;
            sItem.SkuProps       = string.Empty;
            sItem.SkuProps_Str   = sku_props_name;

            UIHelper.ShowItemPropValue(sItem, categoryRowKeyProps, categoryRowSaleProps, categoryRowNotKeyProps, categoryRowStockProps);
        }
Пример #3
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            ItemTask itemTask = e.Argument as ItemTask;
            List <Taobao.Entity.Item> items  = itemTask.ItemList;
            BackgroundWorker          worker = (BackgroundWorker)sender;

            for (int i = 0; i < items.Count; i++)
            {
                if (worker.CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }

                try
                {
                    ItemRsp myrsp = TopService.ItemGet(SystemHelper.GetSessionKey(items[i].Nick), items[i].Nick, items[i].Iid, string.Empty);
                    if (myrsp != null && myrsp.Item != null)
                    {
                        Alading.Entity.Item item = new Alading.Entity.Item();
                        UIHelper.ItemCopyData(item, myrsp.Item);
                        //添加到数据库,如果存在则更新,否则添加
                        ReturnType result = ItemService.AddItem(item);

                        //计算进度条值
                        int progress = (int)((float)(i + 1) / (float)items.Count * 100);
                        if (result == ReturnType.Success)
                        {
                            UserState state = new UserState();
                            state.Index         = i + 1;
                            state.Iid           = items[i].Iid;
                            state.ItemTaskIndex = itemTask.Index;

                            worker.ReportProgress(progress, state);
                        }
                        else
                        {
                            UserState state = new UserState();
                            state.Message       = "数据库存储发生错误。";
                            state.Index         = i + 1;
                            state.Iid           = items[i].Iid;
                            state.ItemTaskIndex = itemTask.Index;

                            //发生数据库错误的报告
                            worker.ReportProgress(-1, state);
                        }
                    }
                }
                catch (Exception ex)
                {
                    UserState state = new UserState();
                    state.Message       = ex.Message;
                    state.Index         = i + 1;
                    state.Iid           = items[i].Iid;
                    state.ItemTaskIndex = itemTask.Index;

                    //发生下载错误的报告
                    worker.ReportProgress(-1, state);
                }
            }


            e.Result = itemTask.Index;
        }