コード例 #1
0
ファイル: ViewOrder.cs プロジェクト: a864610877/src
        public void Read()
        {
            var    account = this.AccountService.GetById(InnerObject.AccountId);
            string myName  = "无会员信息";
            var    my      = AccountService.QueryAccountWithOwner(new Services.AccountRequest()
            {
                Ids = new int[] { InnerObject.AccountId }
            }).FirstOrDefault();

            if (my != null)
            {
                myName = my.OwnerDisplayName;
            }
            OrderId            = InnerObject.OrderId;
            TotalMoney         = InnerObject.TotalMoney.ToString("C");
            CreateDate         = InnerObject.createDate.ToString("yyyy-MM-dd HH:mm:ss");
            Creater            = InnerObject.Creater;
            AccountName        = account.Name;
            AccountDiaplayName = myName;
            Phone   = InnerObject.Phone;
            Address = InnerObject.Address;
            State   = ModelHelper.GetBoundText(InnerObject, x => x.State);
            Sender  = (string.IsNullOrWhiteSpace(InnerObject.Sender)?"无派送信息":InnerObject.Sender);
            detials = OrderService.GetByorderId(InnerObject.OrderId).Select(x => new OrderDetialBase(x)).ToList();
            foreach (var item in detials)
            {
                var good = CommodityService.GetById(item.GoodId);
                item.GoodName    = good.Name;
                item.DisplayName = good.DisplayName;
            }
        }
コード例 #2
0
        public void loadForm(bool isDeleteMU)
        {
            numbTotalBefore     = 0m;
            shouldRemoveRow     = isDeleteMU;
            btnUpdateMu.Enabled = false;
            dgvMiniUnits.Rows.Clear();
            string cmdtyCode;
            string gradeCode;
            string custName;
            {
                var withBlock = My.MyProject.Forms.FrmEditAddRailList;
                if (isDeleteMU == false)
                {
                    tempDt = withBlock.miniUnitDT;
                }
                else
                {
                    tempDt = tempDeletedMUDT;
                }
                // Populate dgv
                string totalbStr;
                foreach (var mu in tempDt)
                {
                    if (withBlock.cboCargoType.Text.Equals("BULK"))
                    {
                        mu.TotalBilled = Convert.ToDecimal(mu.TotalBilled);
                    }
                    // totalbStr = FormatNumber(mu.TotalBilled.ToString, 3)
                    else
                    {
                        mu.TotalBilled = Convert.ToInt32(mu.TotalBilled);
                        // totalbStr = FormatNumber(mu.TotalBilled.ToString, 0)
                    }

                    cmdtyCode = CommodityService.GetById(mu.CommodityId).CommodityCode;
                    gradeCode = GradeService.GetById(mu.GradeId).GradeCode;
                    custName  = CompanyService.GetVWById(mu.CustomerId).CompanyName;
                    dgvMiniUnits.Rows.Add(withBlock.txtUnitNumber.Text + "(" + MdlBookingManagement.digitToLetter((object)mu.MiniUnitOrder).ToUpper() + ")", custName, cmdtyCode + " " + gradeCode, (object)mu.TotalBilled);
                    numbTotalBefore = (decimal)(numbTotalBefore + mu.TotalBilled);
                }

                // Set texts.
                if (withBlock.cboCargoType.Text.Equals("BULK"))
                {
                    labelTotalSomething.Text = "Total Weight:";
                    lbltotalNumber.Text      = withBlock.nudTotalBilledWeight.Value.ToString("0.###");
                    numbToReassign           = withBlock.nudTotalBilledWeight.Value - numbTotalBefore;
                    lblTotaltoBeAsgn.Text    = numbToReassign.ToString("0.###");
                    nucTotal.DecimalPlaces   = 3;
                }
                else
                {
                    labelTotalSomething.Text = "Total Pieces:";
                    lbltotalNumber.Text      = withBlock.nudTotalBilledWeight.Value.ToString("#");
                    numbToReassign           = withBlock.nudTotalBilledWeight.Value - numbTotalBefore;
                    lblTotaltoBeAsgn.Text    = numbToReassign.ToString("#");
                    nucTotal.DecimalPlaces   = 0;
                }
            }
        }
コード例 #3
0
 private void frmEditCommodity_Load(object sender, EventArgs e)
 {
     if (CommodityId != 0)
     {
         var L = CommodityService.GetById(CommodityId);
         txtCommodity.Text     = L.CommodityName;
         txtCommodityCode.Text = L.CommodityCode;
     }
 }
コード例 #4
0
        public CommodityDetail GetByCommodity(int id)
        {
            // Load();
            var item = CommodityService.GetById(id);

            if (item != null && item.commodityState == CommodityStates.putaway)
            {
                var list = new List <SpecificationAndSpecificationDetail>();
                if (!string.IsNullOrWhiteSpace(item.specificationId))
                {
                    string[] spIds = item.specificationId.Split(',');
                    for (int i = 0; i < spIds.Count(); i++)
                    {
                        int specificationId = 0;
                        int.TryParse(spIds[i], out specificationId);
                        var specification = SpecificationService.GetSpecificationAndSpecificationDetailById(specificationId);
                        if (specification != null)
                        {
                            list.Add(specification);
                        }
                    }
                    //return new CommodityDetail(item, ImageUrl, list,null);
                }
                //int userId = 0;
                //var user = _securityHelper.GetCurrentUser();
                //if (user != null)
                //    userId = user.CurrentUser.UserId;
                //var request = new ReviewRequest();
                //request.CommodityId = item.commodityId;
                //request.State = ReviewStates.Show;
                //request.UserId = userId;
                ////request.State = ReviewStates.Show;
                //ListReviewView ListRv = new ListReviewView();
                //var Review = ReviewService.MicroMallQuery(request);
                //if(Review!=null)
                //{
                //    ListRv.TotalCount = Review.TotalCount;
                //    int TotalPage = Math.Max((Review.TotalCount + request.PageSize - 1) / request.PageSize, 1);
                //    if (1 == TotalPage)
                //    {
                //        ListRv.NextPage = 0;
                //    }
                //    else if (1 < TotalPage)
                //    {
                //        ListRv.NextPage = 2;
                //    }
                //    ListRv.List = Review.ModelList.Select(x => new ReviewView() {Content=x.Content, ReviewId=x.ReviewId, SubmitTime=x.SubmitTime.ToString(), UserId=x.UserId, UserName=x.UserName }).ToList();
                //}
                var site = SiteService.Query(new SiteRequest()).FirstOrDefault();
                if (site != null)
                {
                    ImageUrl = site.imageUrl;
                }
                return(new CommodityDetail(item, ImageUrl, list, null));
            }
            return(new CommodityDetail(null, "", null, null));
        }
コード例 #5
0
ファイル: EditCommodity.cs プロジェクト: a864610877/src
        public void Save()
        {
            var serialNo = SerialNoHelper.Create();
            var item     = CommodityService.GetById(CommodityId);

            if (item != null)
            {
                item.DisplayName = DisplayName;
                item.Name        = Name;
                item.Price       = Price;
                CommodityService.Update(item);
                AddMessage("success", item.DisplayName);
                Logger.LogWithSerialNo(LogTypes.CommodityEdit, serialNo, item.CommodityId, item.DisplayName);
            }
        }
コード例 #6
0
        /// <summary>
        /// 购物车列表
        /// </summary>
        /// <param name="openId"></param>
        /// <returns></returns>
        public ListCartDetail GetShoppingCart(int userId)
        {
            //var tran = TransactionHelper.BeginTransaction();
            var model = new ListCartDetail();

            try
            {
                var GetShoppingCart = ShoppingCartService.GetByAccountId(userId);//检测完毕后第二次获取信息
                if (GetShoppingCart != null && GetShoppingCart.ModelList != null && GetShoppingCart.ModelList.Count > 0)
                {
                    foreach (var item in GetShoppingCart.ModelList)
                    {
                        var model1 = new CartDetailsModel();
                        var comm   = CommodityService.GetById(item.commodityId);
                        if (comm != null)
                        {
                            model1.commodityId    = comm.commodityId;
                            model1.Freight        = comm.commodityFreight;
                            model1.Id             = item.shoppingCartId;
                            model1.Image          = GetFirstImage(comm.images);
                            model1.Price          = comm.commodityPrice;
                            model1.quantity       = item.quantity;
                            model1.CommodityStock = comm.commodityInventory;
                            model1.specification  = item.specification;
                            model1.Title          = comm.commodityName;
                            model.CartDetailsList.Add(model1);
                            //model.TotalAmt += model1.Price * model1.quantity;
                            //model.Freight += model1.Freight;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logService.Insert(ex);
                return(null);
            }

            return(model);
        }
コード例 #7
0
        public ResultMessage AddReview(string content, int commodityId, string orderNo, int userId)
        {
            //var user = _securityHelper.GetCurrentUser();
            //if (user == null)
            //    return new ResultMessage() { Code = -1, Msg = "您还没有登录" };
            var item = CommodityService.GetById(commodityId);

            if (item == null)
            {
                return new ResultMessage()
                       {
                           Code = -1, Msg = "商品不存在"
                       }
            }
            ;
            Review model = new Review();

            model.CommodityId = commodityId;
            model.Content     = content;
            model.State       = ReviewStates.StayCheck;
            model.SubmitTime  = DateTime.Now;
            model.UserId      = userId;
            model.ReviewId    = ReviewService.Insert(model);
            var order = OrderService.GetOrderNo(orderNo);

            if (order != null && order.orderState == OrderStates.complete)
            {
                order.orderState = OrderStates.completePJ;

                OrderService.Update(order);
            }
            return(new ResultMessage()
            {
                Code = 0, Msg = model.ReviewId.ToString()
            });
        }
コード例 #8
0
ファイル: EditCommodity.cs プロジェクト: a864610877/src
 public void Read(int id)
 {
     this.SetInnerObject(CommodityService.GetById(id));
 }
コード例 #9
0
ファイル: AddShoppingCarts.cs プロジェクト: a864610877/MEINUO
        public ResultMessage  Save()
        {
            try
            {
                var user = _securityHelper.GetCurrentUser();
                if (user == null)
                {
                    return new ResultMessage()
                           {
                               Code = -1, Msg = "您还没有登录呢!"
                           }
                }
                ;
                //if(user.CurrentUser.State!=UserStates.Normal)
                //    return new ResultMessage() { Code = -1, Msg = "您还没有登录呢!" };
                var commodity = CommodityService.GetById(id);
                if (commodity == null)
                {
                    return new ResultMessage()
                           {
                               Code = -1, Msg = "商品不存在!"
                           }
                }
                ;
                if (commodity.commodityState == CommodityStates.soldOut)
                {
                    return new ResultMessage()
                           {
                               Code = -1, Msg = "商品已下架!"
                           }
                }
                ;
                var Cart = ShoppingCartService.GetByUserIdAndCommodityId(user.CurrentUser.UserId, id);
                if (Cart != null)
                {
                    Cart.quantity = num;

                    Cart.specification = attribute;
                    Cart.submitTime    = DateTime.Now;
                    ShoppingCartService.Update(Cart);
                }
                else
                {
                    var item = new ShoppingCart();
                    item.commodityId   = commodity.commodityId;
                    item.quantity      = num;
                    item.specification = attribute;
                    item.submitTime    = DateTime.Now;
                    item.userId        = user.CurrentUser.UserId;
                    ShoppingCartService.Insert(item);
                }
                return(new ResultMessage()
                {
                    Code = 0
                });
            }
            catch (Exception ex)
            {
                logService.Insert(ex);
                return(new ResultMessage()
                {
                    Code = -1, Msg = "系统错误!请联系管理员"
                });
            }
        }
コード例 #10
0
ファイル: OrderSubmitm.cs プロジェクト: a864610877/MEINUO
        public ResultMessage Save()
        {
            var user = _securityHelper.GetCurrentUser();

            if (user != null)
            {
                decimal dk = 1;
                if (Commoditys != null && Commoditys.Count > 0)
                {
                    Order model = new Order();
                    model.orderNo           = string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now) + user.CurrentUser.UserId;
                    model.orderState        = OrderStates.awaitPay;
                    model.payState          = PayStates.non_payment;
                    model.submitTime        = DateTime.Now;
                    model.userId            = user.CurrentUser.UserId;
                    model.distributionstate = DistributionStates.unfilled;
                    decimal amount = 0;
                    //model.orderId = OrderService.Insert(model);
                    TransactionHelper.BeginTransaction();
                    foreach (var item in Commoditys)
                    {
                        var Commodity = CommodityService.GetById(item.commodityId);
                        if (Commodity != null)
                        {
                            if (Commodity.commodityInventory < item.Num)
                            {
                                return new ResultMessage()
                                       {
                                           Code = -1, Msg = string.Format("{0}库存不足", item.commodityName)
                                       }
                            }
                            ;
                            var orderDetail = new OrderDetail();
                            orderDetail.commodityId   = Commodity.commodityId;
                            orderDetail.commodityName = Commodity.commodityName;
                            orderDetail.orderNo       = model.orderNo;
                            orderDetail.price         = Commodity.commodityPrice;
                            orderDetail.quantity      = item.Num;
                            orderDetail.specification = item.Attribute;
                            amount += orderDetail.price * orderDetail.quantity;
                            OrderDetailService.Insert(orderDetail);
                        }
                        if (item.shoppingCartId > 0)
                        {
                            var shoppingCart = ShoppingCartService.GetById(item.shoppingCartId);
                            ShoppingCartService.Delete(shoppingCart);
                        }
                    }
                    model.amount    = amount;
                    model.payAmount = 0;
                    OrderService.Insert(model);
                    TransactionHelper.Commit();
                    return(new ResultMessage()
                    {
                        Code = 0, Msg = model.orderNo
                    });
                }
                else
                {
                    return(new ResultMessage()
                    {
                        Code = -1, Msg = "请选择商品!"
                    });
                }
            }
            else
            {
                return(new ResultMessage()
                {
                    Code = -1, Msg = "您还没有登录!"
                });
            }
        }