public static int CreateProduct(string ProductCode, string Description, string UnitOfMeasure, string Category, float Price, string ImageTitle, string ImagePath, bool IsActive) { ProductDataModel data = new ProductDataModel { ProductCode = ProductCode, Description = Description, UnitOfMeasure = UnitOfMeasure, Category = Category, Price = Price, ImageTitle = ImageTitle, ImagePath = ImagePath, IsActive = IsActive }; string sql = @"INSERT INTO [dbo].[Products] ([ProductCode] ,[Description] ,[UnitOfMeasure] ,[Category] ,[Price] ,[ImageTitle] ,[ImagePath] ,[IsActive]) VALUES (@ProductCode, @Description, @UnitOfMeasure, @Category, @Price, @ImageTitle,@ImagePath, @IsActive);"; return(SQLDataAccess.SaveData(sql, data)); }
public async Task <IActionResult> Create(ProductViewModel product, IFormFile image) { if (image.ContentType == "image/png" || image.ContentType == "image/jpeg") { if (image.Length > 0) { using (var stream = new MemoryStream()) { await image.CopyToAsync(stream); product.Image = stream.ToArray(); } //profilePicture.FileType = file.ContentType; // _profilePictureLogic.UploadPicture(profilePicture, user); } } ProductDataModel productDataModel = new ProductDataModel { Name = product.Name, Description = product.Description, Price = product.Price, Image = product.Image, Stock = product.Stock, VariationType = product.VariationType, VariationValue = product.VariationValue }; _createLogic.CreateNewProduct(productDataModel); return(Redirect("/")); }
public ActionResult CreateProduct(ProductDataModel ProductDataModel) { if (ModelState.IsValid) { if (ProductDataModel.Product.id != 0) { ProductDataModel.Product.UpdatedDate = DateTime.Now; } else { ProductDataModel.Product.CreateDate = DateTime.Now; } if (ProductDataModel.Product.id == 0) { _productServices.Insert(ProductDataModel.Product, "product/createproduct"); } else { _productServices.Update(ProductDataModel.Product, "product/updateproduct"); } return(RedirectToAction("Index")); } else { ProductDataModel.Categories = _categoryServices.GetAll("category/getall") as List <Category>; } return(View(ProductDataModel)); }
private void OpenNumericPad(dynamic s) { _selectedBottle = SelectedBottle = GetProductById(s); NavigateService.Instance.NavigateToBottleReturnNumericKeyPad(); MessengerInstance.Send(SelectedBottle.Quantity.ToString(), "SetQuantiyUsingNumberPad"); Quantity = SelectedBottle.Quantity; }
public ProductDataModel GetById(KeyInputModel inputModel) { var model = new ProductDataModel(); var product = _productRepository.GetByKey(inputModel.Id); if (product == null) { throw new ApplicationException("ProductNotFound"); } model = new ProductDataModel { Id = product.Id, Name = product.Name, Description = product.Description, Barcode = product.Barcode, Price = product.Price, Stock = product.Stock, Images = product.Images.Select(x => new ProductImageDataModel { Id = x.Id, ImageUrl = x.ImageUrl }).ToList() }; return(model); }
private void UpdateProductInSale(ProductDataModel selectedProduct) { var saleLine = Sale.SaleLines .FirstOrDefault(x => x.StockCode == selectedProduct.StockCode); if (saleLine != null) { saleLine.Quantity = selectedProduct.Quantity; saleLine.Amount = (decimal.Parse(saleLine.Price, NumberStyles.Any, CultureInfo.InvariantCulture) * saleLine.Quantity).ToString(); if (saleLine.Quantity == 0) { Sale.SaleLines.Remove(saleLine); } } else { Sale.SaleLines.Add(new BottleReturnSaleLineModel { LineNumber = Sale.SaleLines.Count > 0 ? Sale.SaleLines.Max(x => x.LineNumber) + 1 : 1, Price = selectedProduct.Price.ToString(CultureInfo.InvariantCulture), StockCode = selectedProduct.StockCode, Quantity = selectedProduct.Quantity, Amount = (selectedProduct.Price * selectedProduct.Quantity).ToString(CultureInfo.InvariantCulture), Description = selectedProduct.Description }); } Sale.TotalAmount = Sale.SaleLines.Sum(x => decimal.Parse(x.Amount, NumberStyles.Any, CultureInfo.InvariantCulture)); AmountToDisplay = Sale.TotalAmount.ToString(CultureInfo.InvariantCulture); IsCompleteSaleEnabled = _sale.SaleLines.Count > 0; }
/// <summary> /// Method to add a single product /// </summary> public bool AddProduct(ProductDataModel product) { using (OleDbCommand oleDbCommand = new OleDbCommand()) { // Set the command object properties oleDbCommand.Connection = new OleDbConnection(this.ConnectionString); oleDbCommand.CommandType = CommandType.Text; oleDbCommand.CommandText = ProductScripts.sqlInsertProduct; // Add the input parameters to the parameter collection oleDbCommand.Parameters.AddWithValue("@Brand", product.Brand ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@Model", product.Model ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@VIN", product.VIN ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@EnteriourColour", product.EnteriorColour ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@ExteriourColour", product.ExteriorColour ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@ModelYear", product.ModelYear ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@DLPNetto", product.DLPNetto ?? (object)DBNull.Value); oleDbCommand.Parameters.AddWithValue("@DLPBrutto", product.DLPBrutto ?? (object)DBNull.Value); // Open the connection, execute the query and close the connection oleDbCommand.Connection.Open(); var rowsAffected = oleDbCommand.ExecuteNonQuery(); oleDbCommand.Connection.Close(); return(rowsAffected > 0); } }
public ImagesViewModel(ProductDataModel product) { _product = product; AddCommand = new CommandHandler(o => AddImage(o)); ChangeCommand = new CommandHandler(f => ChangeImage(f)); RemoveCommand = new CommandHandler(o => RemoveImage(o as ProductImageModel)); }
void Start() { ProductDataModel model = GameController.Instance.currentlySelected; GameObject modelOutput = GameObject.Instantiate(model.prefab); modelOutput.transform.parent = modelObject.transform; }
public ProductDataModel GetProducts(int ProductId) { var product = uow.ProductRepository.Get(x => x.ID == ProductId).FirstOrDefault(); var res = new ProductDataModel(product); return(res); }
public static int UpdateProduct(int Id, string ProductCode, string Description, string UnitOfMeasure, string Category, float Price, string ImageTitle, string ImagePath, bool IsActive) { ProductDataModel data = new ProductDataModel { ProductCode = ProductCode, Description = Description, UnitOfMeasure = UnitOfMeasure, Category = Category, Price = Price, ImageTitle = ImageTitle, ImagePath = ImagePath, IsActive = IsActive }; string sql = @"UPDATE [dbo].[Products] SET [ProductCode] = @ProductCode ,[Description] = @Description ,[UnitOfMeasure] = @UnitOfMeasure ,[Category] = @Category ,[Price] = @Price ,[ImageTitle] = @ImageTitle ,[ImagePath] = @ImagePath ,[IsActive] = @IsActive WHERE Id=" + Id; return(SQLDataAccess.SaveData(sql, data)); }
public void TestProductModelData() { Thread.Sleep(100); ProductDataModel testProductDataModel = new ProductDataModel { ProductName = "productName", Id = 1, ProductSeries = "Intellivue", ProductModel = "X33", Weight = 1000, Portable = true, MonitorResolution = "1024*720", ScreenSize = 5, Measurement = new List <string>() { "SPO2", "ECG" } }; Assert.Equal("productName", testProductDataModel.ProductName); Assert.Equal(1, testProductDataModel.Id); Assert.Equal("Intellivue", testProductDataModel.ProductSeries); Assert.Equal("X33", testProductDataModel.ProductModel); Assert.Equal(1000, testProductDataModel.Weight); Assert.True(testProductDataModel.Portable); Assert.Equal("1024*720", testProductDataModel.MonitorResolution); Assert.Equal(5, testProductDataModel.ScreenSize); Assert.NotNull(testProductDataModel.Measurement); }
public ActionResult ProductData(int id) { var context = new ShopConnectorRequestContext { ActionMethod = "About" }; try { if (!_connectorService.SendRequest(context, id)) { return(new ShopConnectorOperationResult(context)); } var model = new ProductDataModel { Id = id }; model.FetchFromDate = _connectorService.ConvertDateTime(context.Connection.LastProductCallUtc, true); model.AvailableCategories = new List <SelectListItem>(); if (System.IO.File.Exists(context.ResponsePath)) { var doc = new XPathDocument(context.ResponsePath); var content = doc.GetContent(); var manus = new List <SelectListItem>(); foreach (XPathNavigator manu in content.Select("Manufacturers/Manufacturer")) { manus.Add(new SelectListItem { Text = manu.GetString("Name"), Value = manu.GetString("Id") }); } model.AvailableManufacturers = new MultiSelectList(manus, "Value", "Text"); foreach (XPathNavigator category in content.Select("Categories/Category")) { model.AvailableCategories.Add(new SelectListItem { Text = category.GetString("Name"), Value = category.GetString("Id") }); } } ViewData["pickTimeFieldIds"] = new List <string> { "FetchFromDate" }; return(PartialView(model)); } catch (Exception ex) { context.ResponseModel = new OperationResultModel(ex); } return(new ShopConnectorOperationResult(context)); }
public ActionResult EditProduct(int id) { ProductDataModel product = service.GetProducts(id); ViewBag.ProductTypeId = new SelectList(service.GetAllProductTypes(), "Id", "Name"); return(View(product)); }
public void Add(ProductDataModel product, int stock) { using ExpressOrdersContext dbContext = new ExpressOrdersContext(); dbContext.Product.Add(new Product { Name = product.Name, Description = "Simple Description", Price = 12.02M, Stock = stock }); dbContext.SaveChanges(); }
/// <summary> /// Updates the data models /// </summary> private void UpdateDataModels() { _paymentDataModel = _salesManagementService.PaymentDataModel; _productDataModel = _salesManagementService.ProductDataModel; _productDeliveryDataModel = _salesManagementService.ProductDeliveryDataModel; _purchasePriceDataModel = _salesManagementService.PurchasePriceDataModel; _sellingPriceDataModel = _salesManagementService.SellingPriceDataModel; _paymentUnitsTable = _salesManagementService.PaymentUnitsTable; }
private void RemoveCashDrawList(ProductDataModel currency) { if (CashDrawModelList.Any(x => x.Tender.Equals(currency.Description))) { var cashDrawModel = CashDrawModelList.FirstOrDefault(x => x.Tender.Equals(currency.Description)); CashDrawModelList.Remove(cashDrawModel); } IsCompleteEnabled = IsCashTenderEmpty(); }
public OffersViewModel(ProductDataModel product) { _product = product; _offer = new SpecialOfferModel() { DateStart = DateTime.Today, DateEnd = DateTime.Today.AddYears(1) }; AddCommand = new CommandHandler(o => AddOffer()); RemoveCommand = new CommandHandler(o => RemoveSpecialOffer(o as SpecialOfferModel)); }
public Product(ProductDataModel dataModel) { id = dataModel.Id; gtin = dataModel.Gtin; gcp = dataModel.Gcp; name = dataModel.Name; weight = (float)dataModel.Weight; lowerThreshold = dataModel.LowerThreshold; discontinued = dataModel.Discontinued == 1; minimumOrderQuantity = dataModel.MinimumOrderQuantity; }
public DiscountsViewModel(ProductDataModel product) { _product = product; _discount = new DiscountModel() { DateStart = DateTime.Today, DateEnd = DateTime.Today.AddYears(1) }; AddCommand = new CommandHandler(o => AddDiscount()); RemoveCommand = new CommandHandler(o => RemoveDiscount(o as DiscountModel)); }
public Product(ProductDataModel dataModel) { Id = dataModel.Id; Gtin = dataModel.Gtin; Gcp = dataModel.Gcp; Name = dataModel.Name; Weight = (float)dataModel.Weight; LowerThreshold = dataModel.LowerThreshold; Discontinued = dataModel.Discontinued == 1; MinimumOrderQuantity = dataModel.MinimumOrderQuantity; }
public void AddProduct(ProductDataModel product) { uow.ProductRepository.Insert(new PRODUCT { COLOR = product.Color, DESCRIPTION = product.Description, NAME = product.Name, PRODUCTTYPEID = product.ProductTypeId, QUANTITY = product.Quantity }); uow.Save(); }
void DetailDataLoad(object id) { try { var res = DBTranHelper.GetData("Product", new DataMap() { { "PRODUCT_ID", id } }); if (res.TranList.Length > 0) { if (res.TranList[0].Data == null) { throw new Exception("조회 데이터가 없습니다."); } ProductDataModel model = (ProductDataModel)res.TranList[0].Data; txtProductId.EditValue = model.PRODUCT_ID; txtProductCode.EditValue = model.PRODUCT_CODE; txtProductName.EditValue = model.PRODUCT_NAME; txtBarcode.EditValue = model.BARCODE; lupProductType.EditValue = model.PRODUCT_TYPE; lupCategory.EditValue = model.CATEGORY; lupUnitType.EditValue = model.UNIT_TYPE; chkUseYn.EditValue = model.USE_YN; memRemarks.EditValue = model.REMARKS; txtInsTime.EditValue = model.INS_TIME; txtInsUserName.EditValue = model.INS_USER_NAME; txtUpdTime.EditValue = model.UPD_TIME; txtUpdUserName.EditValue = model.UPD_USER_NAME; } if (res.TranList.Length > 1) { gridMaterials.DataSource = (res.TranList[1].Data as List <DataMap>).DataMapListToDataTable(); } onProductTypeChanged(); SetToolbarButtons(new ToolbarButtons() { New = true, Refresh = true, Save = true, SaveAndNew = true, Delete = true }); this.EditMode = EditModeEnum.Modify; txtProductName.Focus(); } catch (Exception ex) { ShowErrBox(ex); } }
void Start() { ProductDataModel model = GameController.Instance.currentlySelected; this.sprite.sprite = model.sprite; this.title.text = model.title; this.dimensions.text = model.dimensions; this.materials.text = model.materials; this.cost.text = "$" + model.cost.ToString(); this.shippingHandeling.text = "$" + model.shippingHandeling.ToString(); this.tax.text = "+ $" + (model.cost * 0.1f).ToString(); this.total.text = "$" + (model.cost * 1.1f + model.shippingHandeling).ToString(); }
private ProductDataModel createWoodenChair() { ProductDataModel ret = new ProductDataModel(); ret.title = "Wooden Chair"; ret.dimensions = "25\" L x 25\" D x 36\"H"; ret.materials = "Wood"; ret.cost = 70f; ret.shippingHandeling = 30f; ret.prefab = woodenChairPrefab; ret.sprite = woodenChairSprite; return(ret); }
private ProductDataModel createCabinet() { ProductDataModel ret = new ProductDataModel(); ret.title = "Cabinet"; ret.dimensions = "60\" L x 22\" D x 70\"H"; ret.materials = "Wood, Glass"; ret.cost = 650f; ret.shippingHandeling = 200f; ret.prefab = cabinetPrefab; ret.sprite = cabinetSprite; return(ret); }
private ProductDataModel createSofa() { ProductDataModel ret = new ProductDataModel(); ret.title = "Sofa"; ret.dimensions = "75\" L x 38\" D x 30\"H"; ret.materials = "Wood, Cloth"; ret.cost = 500f; ret.shippingHandeling = 100f; ret.prefab = sofaPrefab; ret.sprite = sofaSprite; return(ret); }
private ProductDataModel createDesk() { ProductDataModel ret = new ProductDataModel(); ret.title = "Desk"; ret.dimensions = "50\" L x 30\" D x 30\"H"; ret.materials = "Wood"; ret.cost = 200f; ret.shippingHandeling = 80f; ret.prefab = deskPrefab; ret.sprite = deskSprite; return(ret); }
public ActionResult EditProduct([Bind(Include = "Id, Name, Description, Color, ProductTypeId, Quantity, ProductType")] ProductDataModel productDataModel) { if (ModelState.IsValid) { service.EditProduct(productDataModel); return(RedirectToAction("Index")); } ViewBag.ProductTypeId = new SelectList(service.GetAllProductTypes(), "Id", "Name"); return(View(productDataModel)); }
private ProductDataModel createNightStand() { ProductDataModel ret = new ProductDataModel(); ret.title = "Night Stand"; ret.dimensions = "24\" L x 24\" D x 24\"H"; ret.materials = "Wood, Brass"; ret.cost = 120f; ret.shippingHandeling = 50f; ret.prefab = nightStandPrefab; ret.sprite = nightStandSprite; return(ret); }