protected int _AddCart(string pno, int qty) { int ret = 0; if (!string.IsNullOrEmpty(pno) && CurrentUser != null) { Domain.Models.Product.PROD_MASTER prod = PROD_MASTERService.GetProduct(pno); if (prod != null) { if (CurrentUser.AccountInfo != null) { string unitPriceType = string.Empty; double uPrice = 0; PROD_MASTERService.GetSellingPrice(prod.ProductNo, CurrentUser.AccountInfo.Account_no, out uPrice, out unitPriceType); if (uPrice == 0) { uPrice = (double)prod.ListPrice; } var model = new SALES_EBASKETModel { ID = Quick.Framework.Tool.CombHelper.NewComb().ToString(), ContactID = CurrentUser.Id, CreateDate = DateTime.Now, Creator = CurrentUser.AccountInfo.Account_no, CustomerID = CurrentUser.AccountInfo.Account_no,//request ModiDate = DateTime.Now, Modifier = CurrentUser.AccountInfo.Account_no, ProductNo = prod.ProductNo, Quantity = Convert.ToDouble(qty), Unit = prod.BaseUOFM, UnitPrice = uPrice, UnitPType = unitPriceType, Status = 0, MakeOrderID = "", }; if ((bool)CurrentUser.IsContractLimit && unitPriceType != "L") //only to purchase contract goods { if (unitPriceType == "S") //Special Price { bool hasContractPrice = SALES_CONTRACTPRICEService.IsExist(CurrentUser.AccountInfo.Account_no, prod.ProductNo); if (!hasContractPrice) { return(-10); //return Json(new { success = false, message = "You need to purchase contract goods." }); } } } ret = SALES_EBASKETService.ModificationCart(model); //成功了 //ret = SALES_EBASKETService.ModificationByProce(model);//有问题不可以使用 } } } return(ret); }
private void GetProductPrice(ProductDetailModel info) { if (info != null && info.ID != null) { info.SellPrice = (double)info.ListPrice; if (base.CurrentUser != null && base.CurrentUser.AccountInfo != null) { string custnmbr = base.CurrentUser.AccountInfo.Account_no; double price = 0; string ptype = string.Empty; PROD_MASTERService.GetSellingPrice(info.ProductNo, custnmbr, out price, out ptype); info.PriceType = ptype; info.SellPrice = price; } else { if (info.SpecialPrice > 0 && info.SpecialPrice < info.ListPrice) { info.PriceType = "S"; info.SellPrice = (double)info.SpecialPrice; } } string cla = ""; switch (info.PriceType) { case "S": cla = "prod_price_sp"; break; case "C": cla = "prod_price_cp"; break; case "I": cla = "prod_price_ip"; break; case "L": break; } info.PriceTypeCss = cla; } }