Esempio n. 1
0
        public static string GetItemAllName(OrderDetailInfo inoutDetailInfo)
        {
            string display_name = string.Empty;

            display_name = string.Format("{0}/{1}",
                                         inoutDetailInfo.item_code, inoutDetailInfo.item_name);
            if (inoutDetailInfo.prop_1_detail_name != null)
            {
                display_name += "/" + inoutDetailInfo.prop_1_detail_name;
            }
            if (inoutDetailInfo.prop_2_detail_name != null)
            {
                display_name += "/" + inoutDetailInfo.prop_2_detail_name;
            }
            if (inoutDetailInfo.prop_3_detail_name != null)
            {
                display_name += "/" + inoutDetailInfo.prop_3_detail_name;
            }
            if (inoutDetailInfo.prop_4_detail_name != null)
            {
                display_name += "/" + inoutDetailInfo.prop_4_detail_name;
            }
            if (inoutDetailInfo.prop_5_detail_name != null)
            {
                display_name += "/" + inoutDetailInfo.prop_5_detail_name;
            }

            return(display_name);
        }
Esempio n. 2
0
        public OrderDetailInfo ReadOrderDetail(int id)
        {
            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int) };
            pt[0].Value = id;
            OrderDetailInfo info = new OrderDetailInfo();

            using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadOrderDetail", pt))
            {
                if (reader.Read())
                {
                    info.ID            = reader.GetInt32(0);
                    info.OrderID       = reader.GetInt32(1);
                    info.ProductID     = reader.GetInt32(2);
                    info.ProductName   = reader[3].ToString();
                    info.ProductWeight = reader.GetDecimal(4);
                    info.SendPoint     = reader.GetInt32(5);
                    info.ProductPrice  = reader.GetDecimal(6);
                    info.BuyCount      = reader.GetInt32(7);
                    info.FatherID      = reader.GetInt32(8);
                    info.RandNumber    = reader[9].ToString();
                    info.GiftPackID    = reader.GetInt32(10);
                }
            }
            return(info);
        }
Esempio n. 3
0
        /// <summary>
        /// 修改某条订单明细
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public async Task <Result <int> > update(OrderDetailInfo t)
        {
            Result <int> result = new Result <int>();

            try
            {
                using (LayerDbContext context = new LayerDbContext())
                {
                    var model = await Task.Factory.StartNew(() => context.orderDetailInfo.Where(x => x.id == t.id).Single());

                    float supplementCount = t.num - model.num;
                    model.factory         = t.factory;
                    model.lastUpdatedDate = t.lastUpdatedDate;
                    model.lastUpdatedBy   = t.lastUpdatedBy;
                    model.num             = t.num;

                    var orderInfoModel = await context.orderInfo.FindAsync(model.orderNo);

                    orderInfoModel.lastUpdatedBy   = model.lastUpdatedBy;
                    orderInfoModel.lastUpdatedDate = model.lastUpdatedDate;
                    orderInfoModel.sumPrice       += model.materialInfo.referencePriceIn * supplementCount;

                    await context.SaveChangesAsync();
                }
            }
            catch (Exception err)
            {
                result.addError(err.Message);
            }
            return(result);
        }
Esempio n. 4
0
        public OrderDetailInfo GetInfo(int id)
        {
            OrderDetailInfo info = null;

            SqlParameter[] param =
            {
                new SqlParameter("@id", id)
            };
            var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_OrderDetail_GetById", param);

            if (r != null)
            {
                info = new OrderDetailInfo();
                while (r.Read())
                {
                    info.id          = Int32.Parse(r["id"].ToString());
                    info.OrderId     = Int32.Parse(r["OrderId"].ToString());
                    info.ProductId   = Int32.Parse(r["ProductId"].ToString());
                    info.ProductName = r["ProductName"].ToString();
                    info.price       = Int32.Parse(r["price"].ToString());
                    info.Number      = Int32.Parse(r["Number"].ToString());
                    info.size        = r["size"].ToString();
                }
                r.Close();
                r.Dispose();
            }
            return(info);
        }
Esempio n. 5
0
        /// <summary>
        /// 添加订单产品
        /// </summary>
        /// <param name="orderID"></param>
        protected void AddOrderProduct(int orderID)
        {
            List <CartInfo> cartList = CartBLL.ReadList(base.UserId);

            //读取产品
            checkCart = HttpUtility.UrlDecode(CookiesHelper.ReadCookieValue("CheckCart"));
            int[] cartIds = Array.ConvertAll <string, int>(checkCart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));

            cartList = CartBLL.ReadList(base.UserId);
            cartList = cartList.Where(k => cartIds.Contains(k.Id)).ToList();

            string strProductID = string.Empty;

            foreach (CartInfo cart in cartList)
            {
                if (strProductID == string.Empty)
                {
                    strProductID = cart.ProductId.ToString();
                }
                else
                {
                    strProductID += "," + cart.ProductId.ToString();
                }
            }
            List <ProductInfo> productList = new List <ProductInfo>();

            if (strProductID != string.Empty)
            {
                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.InProductId = strProductID;
                productList = ProductBLL.SearchList(productSearch);
            }
            //会员价格
            //List<MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID);
            //添加订单产品
            Dictionary <string, bool> cartDic            = new Dictionary <string, bool>();
            Dictionary <int, int>     cartOrderDetailDic = new Dictionary <int, int>();

            foreach (CartInfo cart in cartList)
            {
                ProductInfo     product     = ProductBLL.ReadProductByProductList(productList, cart.ProductId);
                OrderDetailInfo orderDetail = new OrderDetailInfo();
                orderDetail.OrderId       = orderID;
                orderDetail.ProductId     = cart.ProductId;
                orderDetail.ProductName   = cart.ProductName;
                orderDetail.ProductWeight = product.Weight;
                orderDetail.SendPoint     = product.SendPoint;

                orderDetail.ProductPrice = ProductBLL.GetCurrentPriceWithStandard(product.Id, base.GradeID, cart.StandardValueList);

                orderDetail.BuyCount = cart.BuyCount;

                orderDetail.RandNumber = cart.RandNumber;
                int orderDetailID = OrderDetailBLL.Add(orderDetail);
                cartOrderDetailDic.Add(cart.Id, orderDetailID);
            }

            CartBLL.Delete(cartIds, base.UserId);
            //CartBLL.Clear(base.UserId);
        }
Esempio n. 6
0
        /// <summary>
        /// 增加一条
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public async Task <Result <int> > add(OrderDetailInfo t)
        {
            Result <int> result = new Result <int>();

            try
            {
                using (LayerDbContext context = new LayerDbContext())
                {
                    var containFlag = context.orderDetailInfo.Where(x => x.orderNo == t.orderNo).Select(x => x.materialId).Contains(t.materialId);
                    if (containFlag)
                    {
                        result.addError("订单中已包含本产品");
                    }
                    else
                    {
                        context.orderDetailInfo.Add(t);
                        var materialModel = await Task.Factory.StartNew(() => context.materialInfos.Where(x => x.id == t.materialId).Single());

                        var orderInfoModel = await context.orderInfo.FindAsync(t.orderNo);

                        orderInfoModel.sumPrice       += t.num * materialModel.referencePriceIn;
                        orderInfoModel.lastUpdatedBy   = t.createdBy;
                        orderInfoModel.lastUpdatedDate = t.createdDate;

                        await context.SaveChangesAsync();
                    }
                }
            }
            catch (Exception err)
            {
                result.addError(err.Message);
            }
            return(result);
        }
Esempio n. 7
0
        /// <summary>
        /// 计算本次退款的可退数量
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="orderDetail">退商品时可用,如果是退订单可不传参</param>
        /// <param name="refundCount">退商品时可用,退款商品的数量</param>
        /// <returns></returns>
        private static JWRefundMsg CanRefundCount(OrderInfo order, OrderDetailInfo orderDetail = null, int refundCount = 0)
        {
            JWRefundMsg refundMsg = new JWRefundMsg {
                CanRefund = false
            };

            //退商品
            if (orderDetail != null && orderDetail.Id > 0)
            {
                //退款数量必须大于0
                if (refundCount < 1)
                {
                    refundMsg.ErrorCode = JWRefundErrorCode.REFUND_COUNT_MUST_GT0_ERROR;
                    return(refundMsg);
                }

                refundMsg.CanRefundCount = orderDetail.BuyCount - orderDetail.RefundCount;
            }
            //退订单
            else
            {
                var orderDetailList = OrderDetailBLL.ReadList(order.Id);
                refundMsg.CanRefundCount = orderDetailList.Sum(k => k.BuyCount - k.RefundCount);
            }

            //是否超过最大可退数量,并且保证还有商品可以退款
            if (refundMsg.CanRefundCount < 1 || refundCount > refundMsg.CanRefundCount)
            {
                refundMsg.ErrorCode = JWRefundErrorCode.CAN_REFUND_COUNT_ERROR;
                return(refundMsg);
            }

            refundMsg.CanRefund = true;
            return(refundMsg);
        }
Esempio n. 8
0
 public void UpdateOrderDetail(OrderDetailInfo orderDetail)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@buyCount", SqlDbType.Int) };
     pt[0].Value = orderDetail.ID;
     pt[1].Value = orderDetail.BuyCount;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateOrderDetail", pt);
 }
Esempio n. 9
0
        public static bool ModifyOrderDetail(OrderDetailEntity entity)
        {
            long result = 0;

            if (entity != null)
            {
                OrderDetailRepository mr = new OrderDetailRepository();

                OrderDetailInfo OrderDetailInfo = TranslateOrderDetailInfo(entity);

                if (entity.ID > 0)
                {
                    OrderDetailInfo.ID         = entity.ID;
                    OrderDetailInfo.ChangeDate = DateTime.Now;
                    result = mr.ModifyOrderDetail(OrderDetailInfo);
                }
                else
                {
                    OrderDetailInfo.ChangeDate = DateTime.Now;
                    OrderDetailInfo.CreateDate = DateTime.Now;
                    result = mr.CreateNew(OrderDetailInfo);
                }


                List <OrderDetailInfo> miList = mr.GetAllOrderDetail();//刷新缓存
                Cache.Add("OrderDetailALL", miList);
            }
            return(result > 0);
        }
Esempio n. 10
0
        private static OrderDetailInfo TranslateOrderDetailInfo(OrderDetailEntity entity)
        {
            OrderDetailInfo info = new OrderDetailInfo();

            if (entity != null)
            {
                info.ID          = entity.ID;
                info.OrderID     = entity.OrderID;
                info.GoodsID     = entity.GoodsID;
                info.InventoryID = entity.InventoryID;
                info.GoodsNo     = entity.GoodsNo;
                info.GoodsName   = entity.GoodsName;
                info.GoodsModel  = entity.GoodsModel;
                info.Quantity    = entity.Quantity;
                info.Units       = entity.Units;
                info.Weight      = entity.Weight;
                info.TotalWeight = entity.TotalWeight;
                info.BatchNumber = entity.BatchNumber;
                info.ProductDate = entity.ProductDate;
                info.ExceedDate  = entity.ExceedDate;
                info.CreateDate  = entity.CreateDate;
                info.ChangeDate  = entity.ChangeDate;
            }


            return(info);
        }
Esempio n. 11
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        List <OrderDetailInfo> details = OrderBLL.GetAllDetails(OrderNum, MemberUserName);

        if (details.Count == 0)
        {
            BindData();
            return;
        }

        foreach (GridViewRow row in gvData.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                int    id       = (row.FindControl("hfID") as HiddenField).Value.ToArrowInt();
                string realName = (row.FindControl("tbRealName") as TextBox).Text.Trim();
                string sex      = (row.FindControl("ddlSex") as DropDownList).SelectedValue.ToArrowString();
                string idNum    = (row.FindControl("tbIDNum") as TextBox).Text.Trim();
                string mobile   = (row.FindControl("tbPhone") as TextBox).Text.Trim();

                OrderDetailInfo model = details.Find(s => s.ID == id);
                if (model != null)
                {
                    model.RealName  = realName;
                    model.Sex       = sex;
                    model.IDNum     = idNum;
                    model.MobileNum = mobile;
                    OrderBLL.UpdateDetail(model);
                }
            }
        }

        MessageBox.Show("更新成功!");
        BindData();
    }
Esempio n. 12
0
        public long CreateNew(OrderDetailInfo OrderDetail)
        {
            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(OrderDetailStatement.CreateNewOrderDetail, "Text"));

            command.AddInputParameter("@OrderID", DbType.Int32, OrderDetail.OrderID);
            command.AddInputParameter("@GoodsID", DbType.Int32, OrderDetail.GoodsID);
            command.AddInputParameter("@InventoryID", DbType.Int32, OrderDetail.InventoryID);
            command.AddInputParameter("@GoodsNo", DbType.String, OrderDetail.GoodsNo);
            command.AddInputParameter("@GoodsName", DbType.String, OrderDetail.GoodsName);
            command.AddInputParameter("@GoodsModel", DbType.String, OrderDetail.GoodsModel);
            command.AddInputParameter("@Quantity", DbType.Int32, OrderDetail.Quantity);
            command.AddInputParameter("@Units", DbType.String, OrderDetail.Units);
            command.AddInputParameter("@Weight", DbType.String, OrderDetail.Weight);
            command.AddInputParameter("@TotalWeight", DbType.String, OrderDetail.TotalWeight);
            command.AddInputParameter("@BatchNumber", DbType.String, OrderDetail.BatchNumber);
            command.AddInputParameter("@ProductDate", DbType.DateTime, OrderDetail.ProductDate);
            command.AddInputParameter("@ExceedDate", DbType.DateTime, OrderDetail.ExceedDate);

            command.AddInputParameter("@CreateDate", DbType.DateTime, OrderDetail.CreateDate);
            command.AddInputParameter("@ChangeDate", DbType.DateTime, OrderDetail.ChangeDate);

            var o = command.ExecuteScalar <object>();

            return(Convert.ToInt64(o));
        }
Esempio n. 13
0
        /// <summary>
        /// 计算本次退款的可退金额
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="orderDetail">退商品时可用,如果是退订单可不传参</param>
        /// <param name="refundCount">退商品时可用,退款商品的数量</param>
        /// <param name="needRefundMoney">需要退款的金额</param>
        /// <returns></returns>
        private static JWRefundMsg CanRefundMoney(OrderInfo order, OrderDetailInfo orderDetail = null, int refundCount = 0, decimal needRefundMoney = 0)
        {
            var refundMsg = new JWRefundMsg {
                CanRefund = false
            };

            //订单可退金额
            decimal orderRefundMoney = 0;

            //如果订单状态为待审核或配货中,则可退运费(因为商品还未发货)
            if (order.OrderStatus == (int)OrderStatus.WaitCheck || order.OrderStatus == (int)OrderStatus.Shipping)
            {
                orderRefundMoney = order.ProductMoney + order.ShippingMoney + order.OtherMoney - order.PointMoney - order.CouponMoney - order.FavorableMoney;
            }
            //如果订单已发货(是否退还运费视设置而定)
            if (order.OrderStatus == (int)OrderStatus.HasShipping)
            {
                orderRefundMoney = order.ProductMoney + order.OtherMoney - order.PointMoney - order.CouponMoney - order.FavorableMoney;
                if (RefundShippingMoneyWhenHasShipping)
                {
                    orderRefundMoney += order.ShippingMoney;
                }
            }

            //已退款或正在处理中的服务单金额
            var     orderRefundList = OrderRefundBLL.ReadListValid(order.Id);
            decimal hasRefundMoney  = orderRefundList.Sum(k => k.RefundBalance + k.RefundMoney);

            //这里的计算结果就是订单可退的金额
            decimal canRefundMoney = orderRefundMoney - hasRefundMoney;

            refundMsg.CanRefundMoney = canRefundMoney;

            //如果是退单个商品,考虑到订单总价格可能被改变,商品可退金额不能超过订单可退金额
            if (orderDetail != null && orderDetail.Id > 0)
            {
                if (refundCount < 1)
                {
                    refundMsg.ErrorCode = JWRefundErrorCode.REFUND_COUNT_MUST_GT0_ERROR;
                    return(refundMsg);
                }

                refundMsg.CanRefundMoney = orderDetail.ProductPrice * refundCount;
                if (refundMsg.CanRefundMoney > canRefundMoney)
                {
                    refundMsg.CanRefundMoney = canRefundMoney;
                }
            }

            //是否超过最大可退金额,并且保证还有金额可以退款
            if (refundMsg.CanRefundMoney <= 0 || needRefundMoney > refundMsg.CanRefundMoney)
            {
                refundMsg.ErrorCode = JWRefundErrorCode.CAN_REFUND_MONEY_ERROR;
                return(refundMsg);
            }

            refundMsg.CanRefund = true;
            return(refundMsg);
        }
Esempio n. 14
0
        public int AddOrderDetail(int memberId, OrderDetailInfo orderDetail)
        {
            ReqOrderAddDetail request = new ReqOrderAddDetail {
                MemberId = memberId, OrderDetail = orderDetail
            };

            return(Call <ResOrderAddDetail, ReqOrderAddDetail>(request, "AddOrderDetail").OrderDetailId);
        }
Esempio n. 15
0
        public static OrderDetailEntity GetOrderDetailEntityById(long cid)
        {
            OrderDetailEntity     result = new OrderDetailEntity();
            OrderDetailRepository mr     = new OrderDetailRepository();
            OrderDetailInfo       info   = mr.GetOrderDetailByKey(cid);

            result = TranslateOrderDetailEntity(info);
            return(result);
        }
Esempio n. 16
0
        public OrderDetailInfo GetOrderDetailByKey(long gid)
        {
            OrderDetailInfo result  = new OrderDetailInfo();
            DataCommand     command = new DataCommand(ConnectionString, GetDbCommand(OrderDetailStatement.GetOrderDetailByKey, "Text"));

            command.AddInputParameter("@OrderDetailID", DbType.String, gid);
            result = command.ExecuteEntity <OrderDetailInfo>();
            return(result);
        }
Esempio n. 17
0
        public void Update(OrderDetailInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"UPDATE OrderDetail SET OrderId = @OrderId, ProductId = @ProductId, ProductName = @ProductName, StandardValueList = @StandardValueList, ProductWeight = @ProductWeight, SendPoint = @SendPoint, ProductPrice = @ProductPrice, BidPrice = @BidPrice, ActivityPoint = @ActivityPoint, BuyCount = @BuyCount, ParentId = @ParentId, RandNumber = @RandNumber, GiftPackId = @GiftPackId, RefundCount = @RefundCount
                            where Id=@Id";

                conn.Execute(sql, entity);
            }
        }
Esempio n. 18
0
        public int Add(OrderDetailInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"INSERT INTO OrderDetail( OrderId,ProductId,ProductName,StandardValueList,ProductWeight,SendPoint,ProductPrice,BidPrice,ActivityPoint,BuyCount,ParentId,RandNumber,GiftPackId,RefundCount) VALUES(@OrderId,@ProductId,@ProductName,@StandardValueList,@ProductWeight,@SendPoint,@ProductPrice,@BidPrice,@ActivityPoint,@BuyCount,@ParentId,@RandNumber,@GiftPackId,@RefundCount);
                            select SCOPE_IDENTITY()";

                return(conn.Query <int>(sql, entity).Single());
            }
        }
Esempio n. 19
0
        public int UpdateDishCount(OrderDetailInfo odi)
        {
            string sql = "update OrderDetailInfo set Count=@count where OId=@id";

            SQLiteParameter[] ps =
            {
                new SQLiteParameter("@count", odi.Count),
                new SQLiteParameter("@id",    odi.OId)
            };
            return(SqliteHelper.ExecuteNonQuery(sql, ps));
        }
    protected void tbUpdate_Click(object sender, EventArgs e)
    {
        List <OrderDetailInfo> details = OrderBLL.GetAllDetails(OrderNum, CurrentMember.UserName);

        bool isOK = true;;

        foreach (GridViewRow row in gvData.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                int    id       = (row.FindControl("hfID") as HiddenField).Value.ToArrowInt();
                string realName = (row.FindControl("tbRealName") as TextBox).Text.Trim();
                string sex      = (row.FindControl("ddlSex") as DropDownList).SelectedValue.ToArrowString();
                string idNum    = (row.FindControl("tbIDNum") as TextBox).Text.Trim();
                string mobile   = (row.FindControl("tbPhone") as TextBox).Text.Trim();

                if (realName.IsNullOrEmpty() || sex.IsNullOrEmpty() || idNum.IsNullOrEmpty() || mobile.IsNullOrEmpty())
                {
                    isOK = false;
                    break;
                }

                OrderDetailInfo model = details.Find(s => s.ID == id);
                if (model != null)
                {
                    model.RealName  = realName;
                    model.Sex       = sex;
                    model.IDNum     = idNum;
                    model.MobileNum = mobile;
                }
            }
        }

        //检查填写是否完整
        if (!isOK)
        {
            MessageBox.Show("资料填写不完整!");
        }
        else
        {
            //更新资料
            //订单状态设为等待商家确认
            string errMsg  = "";
            bool   success = OrderBLL.UpdateTeammateAndSubmit(OrderNum, CurrentMember.UserName, details, out errMsg);
            if (success)
            {
                MessageBox.Show("操作成功,请等待商家确认!", "MemberOrder.aspx");
            }
            else
            {
                MessageBox.Show(errMsg);
            }
        }
    }
Esempio n. 21
0
        private void dgvOrderDetail_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            OrderDetailInfo odi = new OrderDetailInfo();

            odi.Count = Convert.ToInt32(dgvOrderDetail.SelectedRows[0].Cells["Column7"].Value);
            odi.OId   = Convert.ToInt32(dgvOrderDetail.SelectedRows[0].Cells["Column5"].Value);
            if (oiBll.UpdateDishCount(odi))
            {
                GetSumMoney();
            }
        }
Esempio n. 22
0
 public int Add(OrderDetailInfo info)
 {
     SqlParameter[] param =
     {
         new SqlParameter("@OrderId",     info.OrderId),
         new SqlParameter("@ProductId",   info.ProductId),
         new SqlParameter("@ProductName", info.ProductName),
         new SqlParameter("@price",       info.price),
         new SqlParameter("@Number",      info.Number),
         new SqlParameter("@size",        info.size)
     };
     return(int.Parse(DataHelper.ExecuteScalar(Config.ConnectString, "usp_OrderDetail_Add", param).ToString()));
 }
Esempio n. 23
0
 public int Update(OrderDetailInfo info)
 {
     SqlParameter[] param =
     {
         new SqlParameter("@id",          info.id),
         new SqlParameter("@OrderId",     info.OrderId),
         new SqlParameter("@ProductId",   info.ProductId),
         new SqlParameter("@ProductName", info.ProductName),
         new SqlParameter("@price",       info.price),
         new SqlParameter("@Number",      info.Number),
         new SqlParameter("@size",        info.size)
     };
     return(DataHelper.ExecuteNonQuery(Config.ConnectString, "usp_OrderDetail_Update", param));
 }
Esempio n. 24
0
        public async Task <ActionResult> updateDetail(OrderDetailInfo model)
        {
            model.lastUpdatedBy   = User.Identity.Name;
            model.lastUpdatedDate = DateTime.Now;
            var result = await detailService.updateDetail(model);

            if (!result.success)
            {
                ViewBag.returnUrl = "/OrderDetailInfo/updateDetail?id=" + model.id + "&orderNo=" + model.orderNo;
                return(View("Error", new string[] { "操作失败:" + result.message }));
            }
            ViewBag.returnUrl = "/OrderDetailInfo/update?orderNo=" + model.orderNo;
            ViewBag.Msg       = "修改成功";
            return(View("Success"));
        }
Esempio n. 25
0
 public int AddOrderDetail(OrderDetailInfo orderDetail)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@orderID", SqlDbType.Int), new SqlParameter("@productID", SqlDbType.Int), new SqlParameter("@productName", SqlDbType.NVarChar), new SqlParameter("@productWeight", SqlDbType.Decimal), new SqlParameter("@sendPoint", SqlDbType.Int), new SqlParameter("@productPrice", SqlDbType.Decimal), new SqlParameter("@buyCount", SqlDbType.Int), new SqlParameter("@fatherID", SqlDbType.Int), new SqlParameter("@randNumber", SqlDbType.NVarChar), new SqlParameter("@giftPackID", SqlDbType.Int) };
     pt[0].Value = orderDetail.OrderID;
     pt[1].Value = orderDetail.ProductID;
     pt[2].Value = orderDetail.ProductName;
     pt[3].Value = orderDetail.ProductWeight;
     pt[4].Value = orderDetail.SendPoint;
     pt[5].Value = orderDetail.ProductPrice;
     pt[6].Value = orderDetail.BuyCount;
     pt[7].Value = orderDetail.FatherID;
     pt[8].Value = orderDetail.RandNumber;
     pt[9].Value = orderDetail.GiftPackID;
     return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddOrderDetail", pt)));
 }
Esempio n. 26
0
        /// <summary>
        /// 根据id查询订单一条详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <OrderDetailInfo> searchById(int id)
        {
            OrderDetailInfo result  = new OrderDetailInfo();
            LayerDbContext  context = new LayerDbContext();

            try
            {
                result = await Task.Factory.StartNew(() => context.orderDetailInfo.Where(x => x.id == id).Single());
            }
            catch (Exception)
            {
                result = null;
            }
            return(result);
        }
Esempio n. 27
0
    /// <summary>
    /// 生成虚拟的订单详细信息
    /// </summary>
    /// <param name="addMemberName"></param>
    /// <param name="orderNum"></param>
    /// <param name="groupID"></param>
    /// <param name="lineID"></param>
    /// <returns></returns>
    public static OrderDetailInfo CreateVirtualOrderDetail(string addMemberName, string orderNum, int groupID, int lineID)
    {
        OrderDetailInfo model = new OrderDetailInfo();

        model.AddTime       = DateTime.Now;
        model.GroupID       = groupID;
        model.IDNum         = "";
        model.LineID        = lineID;
        model.MobileNum     = "";
        model.OrderNum      = orderNum;
        model.RealName      = "";
        model.Remarks       = "";
        model.Sex           = "";
        model.AddMemberName = addMemberName;
        return(model);
    }
Esempio n. 28
0
        /// <summary>
        /// 订单或商品能否被退款
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="orderDetail">退商品时可用,如果是退订单可不传参</param>
        /// <param name="refundCount">退商品时可用,退款商品的数量</param>
        /// <param name="needRefundMoney">需要退款的金额</param>
        /// <returns></returns>
        public static JWRefundMsg CanRefund(OrderInfo order, OrderDetailInfo orderDetail = null, int refundCount = 0, decimal needRefundMoney = 0)
        {
            JWRefundMsg refundMsg = new JWRefundMsg {
                CanRefund = false
            };

            if (order.Id < 1)
            {
                refundMsg.ErrorCode = JWRefundErrorCode.ORDER_INVALID;
                return(refundMsg);
            }
            if (orderDetail != null)
            {
                //传递过来的退款商品不为空时,如果Id不大于0,则是无效的
                //同时,如果退款商品所在订单的Id和传递过来的订单Id参数不一致,也是无效的
                if (orderDetail.Id < 1 || orderDetail.OrderId != order.Id)
                {
                    refundMsg.ErrorCode = JWRefundErrorCode.ORDER_DETAIL_INVALID;
                    return(refundMsg);
                }
            }

            //只有订单状态为待审核、待发货和已发货的可以退款
            if (order.OrderStatus != (int)OrderStatus.WaitCheck && order.OrderStatus != (int)OrderStatus.Shipping && order.OrderStatus != (int)OrderStatus.HasShipping)
            {
                refundMsg.ErrorCode = JWRefundErrorCode.ORDER_STATUS_INVALID;
                return(refundMsg);
            }

            //计算本次退款的可退数量
            refundMsg = CanRefundCount(order, orderDetail, refundCount);
            if (!refundMsg.CanRefund)
            {
                return(refundMsg);
            }
            int canRefundCount = refundMsg.CanRefundCount;

            //计算本次退款的可退金额
            refundMsg = CanRefundMoney(order, orderDetail, refundCount, needRefundMoney);
            if (!refundMsg.CanRefund)
            {
                return(refundMsg);
            }
            refundMsg.CanRefundCount = canRefundCount;

            return(refundMsg);
        }
Esempio n. 29
0
 public void PrepareOrderDetailModel(SqlDataReader dr, List <OrderDetailInfo> orderDetailList)
 {
     while (dr.Read())
     {
         OrderDetailInfo item = new OrderDetailInfo();
         item.ID            = dr.GetInt32(0);
         item.OrderID       = dr.GetInt32(1);
         item.ProductID     = dr.GetInt32(2);
         item.ProductName   = dr[3].ToString();
         item.ProductWeight = dr.GetDecimal(4);
         item.SendPoint     = dr.GetInt32(5);
         item.ProductPrice  = dr.GetDecimal(6);
         item.BuyCount      = dr.GetInt32(7);
         item.FatherID      = dr.GetInt32(8);
         item.RandNumber    = dr[9].ToString();
         item.GiftPackID    = dr.GetInt32(10);
         orderDetailList.Add(item);
     }
 }
Esempio n. 30
0
        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());
            }
        }