public void ResetShippingOrderQuentityStock(int userID) { var _res = _productShoppingTempRepository.GetAll(rk => rk.ShippingPaymentID != null && rk.UserID == userID && rk.IsProcessed.Value == true).ToList(); foreach (var res in _res) { DLModel.Product _product = new DLModel.Product(); _product = _productRepository.GetById(res.ProductID); _product.ProductCurrentBalance = _product.ProductCurrentBalance.Value + res.Quantity; _productRepository.Update(_product); DLModel.ProductShoppingTemp _productShoppingTemp = new DLModel.ProductShoppingTemp(); _productShoppingTemp = _productShoppingTempRepository.GetById(res.ProductShoppingTempID); _productShoppingTemp.ShippingPaymentID = null; _productShoppingTemp.IsProcessed = null; _productShoppingTemp.ProcessedDate = null; _productShoppingTempRepository.Update(_productShoppingTemp); } var _res1 = _educationShoppingTempRepository.GetAll(rk => rk.ShippingPaymentID != null && rk.UserID == userID).ToList(); foreach (var res in _res1) { DLModel.EducationShoppingTemp _educationShoppingTemp = new DLModel.EducationShoppingTemp(); _educationShoppingTemp = _educationShoppingTempRepository.GetById(res.EducationShoppingTempID); _educationShoppingTemp.ShippingPaymentID = null; _educationShoppingTemp.ProcessedDate = null; _educationShoppingTempRepository.Update(_educationShoppingTemp); } }
public void UpdateEducationShoppingCartTempByShippingPaymentID(int _educationShoppingTempID, int _shippingPaymentID, string PType) { if (PType.ToLower().Contains("online")) { Data.Model.EducationShoppingTemp _educationShoppingTemp = new DLModel.EducationShoppingTemp(); _educationShoppingTemp = _educationShoppingTempRepository.GetById(_educationShoppingTempID); _educationShoppingTemp.ShippingPaymentID = _shippingPaymentID; _educationShoppingTemp.ProcessedDate = DateTime.Now; _educationShoppingTempRepository.Update(_educationShoppingTemp); } else { Data.Model.ProductShoppingTemp _productShoppingTemp = new DLModel.ProductShoppingTemp(); _productShoppingTemp = _productShoppingTempRepository.getProductShoppingTempByID(_educationShoppingTempID); _productShoppingTemp.ShippingPaymentID = _shippingPaymentID; _productShoppingTemp.IsProcessed = true; _productShoppingTemp.ProcessedDate = DateTime.Now; _productShoppingTempRepository.Update(_productShoppingTemp); } }