public List<VProduct> SearchByCriteria(string productName, string productCode) { List<VProduct> bDProductCollection = new List<VProduct>(); foreach (POS.DataLayer.VProduct _bDProduct in POS.DataLayer.VProduct.SearcByCriteria(productName, productCode)) { _vProduct = new VProduct(); _vProduct.ProductID = _bDProduct.ProductID; _vProduct.ProductName = _bDProduct.ProductName; _vProduct.ProductCode = _bDProduct.ProductCode; _vProduct.ProductGroupID = _bDProduct.ProductGroupID; _vProduct.IsAcceptBatch = _bDProduct.IsAcceptBatch; _vProduct.ProductPrice = _bDProduct.ProductPrice; _vProduct.IsFixedPrice = _bDProduct.IsFixedPrice; _vProduct.HasDiscount = _bDProduct.HasDiscount; _vProduct.DiscountAmount = _bDProduct.DiscountAmount; _vProduct.DescountRatio = _bDProduct.DescountRatio; _vProduct.Notes = _bDProduct.Notes; _vProduct.ProductGroupName = _bDProduct.ProductGroupName; _vProduct.IsActive = _bDProduct.IsActive; bDProductCollection.Add(_vProduct); } return bDProductCollection; }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table. /// </summary> /// /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// /// <returns>list of objects of class VProduct in the form of an object of class VProductCollection </returns> public VProductCollection SelectAllPaged(int?pageSize, int?skipPages, string orderByStatement) { VProductCollection vProductCollection = new VProductCollection(); foreach (POS.DataLayer.VProduct _vProduct in POS.DataLayer.VProductBase.SelectAllPaged(pageSize, skipPages, orderByStatement)) { _vProductWCF = new VProduct(); _vProductWCF.ProductID = _vProduct.ProductID; _vProductWCF.ProductName = _vProduct.ProductName; _vProductWCF.ProductGroupID = _vProduct.ProductGroupID; _vProductWCF.ProductCode = _vProduct.ProductCode; _vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch; _vProductWCF.ProductPrice = _vProduct.ProductPrice; _vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice; _vProductWCF.HasDiscount = _vProduct.HasDiscount; _vProductWCF.DiscountAmount = _vProduct.DiscountAmount; _vProductWCF.DescountRatio = _vProduct.DescountRatio; _vProductWCF.IsActive = _vProduct.IsActive; _vProductWCF.Notes = _vProduct.Notes; _vProductWCF.ProductGroupName = _vProduct.ProductGroupName; _vProductWCF.Expr1 = _vProduct.Expr1; vProductCollection.Add(_vProductWCF); } return(vProductCollection); }
/// <summary> /// This method will return a list of objects representing all records in the table. /// </summary> /// /// <returns>list of objects of class VProduct in the form of object of VProductCollection </returns> public VProductCollection SelectAll() { VProductCollection vProductCollection = new VProductCollection(); foreach (POS.DataLayer.VProduct _vProduct in POS.DataLayer.VProductBase.SelectAll()) { _vProductWCF = new VProduct(); _vProductWCF.ProductID = _vProduct.ProductID; _vProductWCF.ProductName = _vProduct.ProductName; _vProductWCF.ProductGroupID = _vProduct.ProductGroupID; _vProductWCF.ProductCode = _vProduct.ProductCode; _vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch; _vProductWCF.ProductPrice = _vProduct.ProductPrice; _vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice; _vProductWCF.HasDiscount = _vProduct.HasDiscount; _vProductWCF.DiscountAmount = _vProduct.DiscountAmount; _vProductWCF.DescountRatio = _vProduct.DescountRatio; _vProductWCF.IsActive = _vProduct.IsActive; _vProductWCF.Notes = _vProduct.Notes; _vProductWCF.ProductGroupName = _vProduct.ProductGroupName; _vProductWCF.Expr1 = _vProduct.Expr1; vProductCollection.Add(_vProductWCF); } return(vProductCollection); }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table /// using the value of the field specified /// </summary> /// /// <param name="field" type="string">Field of the class VProduct</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <param name="fieldValue2" type="object">Value for the field specified.</param> /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// /// <returns>List of object of class VProduct in the form of an object of class VProductCollection</returns> public VProductCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement) { VProductCollection vProductCollection = new VProductCollection(); foreach (POS.DataLayer.VProduct _vProduct in POS.DataLayer.VProductBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement)) { _vProductWCF = new VProduct(); _vProductWCF.ProductID = _vProduct.ProductID; _vProductWCF.ProductName = _vProduct.ProductName; _vProductWCF.ProductGroupID = _vProduct.ProductGroupID; _vProductWCF.ProductCode = _vProduct.ProductCode; _vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch; _vProductWCF.ProductPrice = _vProduct.ProductPrice; _vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice; _vProductWCF.HasDiscount = _vProduct.HasDiscount; _vProductWCF.DiscountAmount = _vProduct.DiscountAmount; _vProductWCF.DescountRatio = _vProduct.DescountRatio; _vProductWCF.IsActive = _vProduct.IsActive; _vProductWCF.Notes = _vProduct.Notes; _vProductWCF.ProductGroupName = _vProduct.ProductGroupName; _vProductWCF.Expr1 = _vProduct.Expr1; vProductCollection.Add(_vProductWCF); } return(vProductCollection); }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// </summary> /// /// <param name="field" type="string">Field of the class VProduct</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <param name="fieldValue2" type="object">Value for the field specified.</param> /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param> /// /// <returns>List of object of class VProduct in the form of an object of class VProductCollection</returns> public VProductCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation) { VProductCollection vProductCollection = new VProductCollection(); foreach (POS.DataLayer.VProduct _vProduct in POS.DataLayer.VProductBase.SelectByField(field, fieldValue, fieldValue2, typeOperation)) { _vProductWCF = new VProduct(); _vProductWCF.ProductID = _vProduct.ProductID; _vProductWCF.ProductName = _vProduct.ProductName; _vProductWCF.ProductGroupID = _vProduct.ProductGroupID; _vProductWCF.ProductCode = _vProduct.ProductCode; _vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch; _vProductWCF.ProductPrice = _vProduct.ProductPrice; _vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice; _vProductWCF.HasDiscount = _vProduct.HasDiscount; _vProductWCF.DiscountAmount = _vProduct.DiscountAmount; _vProductWCF.DescountRatio = _vProduct.DescountRatio; _vProductWCF.IsActive = _vProduct.IsActive; _vProductWCF.Notes = _vProduct.Notes; _vProductWCF.MinPrice = _vProduct.MinPrice; _vProductWCF.MaxPrice = _vProduct.MaxPrice; _vProductWCF.ProductGroupName = _vProduct.ProductGroupName; vProductCollection.Add(_vProductWCF); } return(vProductCollection); }
public List <VProduct> SearchByCriteria(string productName, string productCode) { List <VProduct> bDProductCollection = new List <VProduct>(); foreach (POS.DataLayer.VProduct _bDProduct in POS.DataLayer.VProduct.SearcByCriteria(productName, productCode)) { _vProduct = new VProduct(); _vProduct.ProductID = _bDProduct.ProductID; _vProduct.ProductName = _bDProduct.ProductName; _vProduct.ProductCode = _bDProduct.ProductCode; _vProduct.ProductGroupID = _bDProduct.ProductGroupID; _vProduct.IsAcceptBatch = _bDProduct.IsAcceptBatch; _vProduct.ProductPrice = _bDProduct.ProductPrice; _vProduct.IsFixedPrice = _bDProduct.IsFixedPrice; _vProduct.HasDiscount = _bDProduct.HasDiscount; _vProduct.DiscountAmount = _bDProduct.DiscountAmount; _vProduct.DescountRatio = _bDProduct.DescountRatio; _vProduct.Notes = _bDProduct.Notes; _vProduct.ProductGroupName = _bDProduct.ProductGroupName; _vProduct.IsActive = _bDProduct.IsActive; _vProduct.Expr1 = _bDProduct.Expr1; bDProductCollection.Add(_vProduct); } return(bDProductCollection); }
public ActionResult ProductEdit(VProduct product) { //保存成功后跳转到列表页面 return(RedirectToAction("ProductAdd")); //保存不成功跳转到错误页面 //return View("Error"); }
private Product CustomMappingToActualModel(Product dbModel, VProduct vProduct) { dbModel.ProductName = vProduct.ProductName; dbModel.Title = vProduct.Title; dbModel.BrandId = vProduct.BrandId; dbModel.CategoryId = vProduct.CategoryId; dbModel.SubCategoryId = vProduct.SubCategoryId; dbModel.AvailabilityDate = vProduct.AvailabilityDate; dbModel.IsAvailable = vProduct.IsAvailable; dbModel.Description = vProduct.Description; return(dbModel); }
public IActionResult Index() { var storeDBContext = _context.Product.Include(p => p.Brand).Include(p => p.Category).Include(p => p.SubCategory); var itemList = new List <VProduct>(); foreach (var item in storeDBContext) { var vItem = new VProduct(); itemList.Add(CustomMappingToViewModel(vItem, item)); } return(View(itemList.ToList())); }
private VProduct CustomMappingToViewModel(VProduct vModel, Product dbModel) { vModel.ProductName = dbModel.ProductName; vModel.Title = dbModel.Title; vModel.BrandId = dbModel.BrandId; vModel.BrandName = dbModel.Brand.Name; vModel.CategoryId = dbModel.CategoryId; vModel.CategoryName = dbModel.Category.Name; vModel.SubCategoryId = dbModel.SubCategoryId; vModel.SubCategoryName = dbModel.SubCategory.Name; vModel.AvailabilityDate = dbModel.AvailabilityDate; vModel.ImageData = dbModel.Image; vModel.IsAvailable = dbModel.IsAvailable; vModel.Description = dbModel.Description; return(vModel); }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="VProductPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class VProduct</returns> public VProduct SelectOne(VProductPrimaryKey pk) { _vProductWCF = new VProduct(); _vProduct = POS.DataLayer.VProductBase.SelectOne(new POS.DataLayer.VProductPrimaryKey(pk.ProductID)); _vProductWCF.ProductID = _vProduct.ProductID; _vProductWCF.ProductName = _vProduct.ProductName; _vProductWCF.ProductGroupID = _vProduct.ProductGroupID; _vProductWCF.ProductCode = _vProduct.ProductCode; _vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch; _vProductWCF.ProductPrice = _vProduct.ProductPrice; _vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice; _vProductWCF.HasDiscount = _vProduct.HasDiscount; _vProductWCF.DiscountAmount = _vProduct.DiscountAmount; _vProductWCF.DescountRatio = _vProduct.DescountRatio; _vProductWCF.IsActive = _vProduct.IsActive; _vProductWCF.Notes = _vProduct.Notes; _vProductWCF.ProductGroupName = _vProduct.ProductGroupName; _vProductWCF.Expr1 = _vProduct.Expr1; return(_vProductWCF); }
public async Task <IActionResult> Create([Bind("Id,ProductName,Title,BrandId,CategoryId,SubCategoryId,AvailabilityDate,IsAvailable,Image,Description")] VProduct vProduct) { if (ModelState.IsValid) { var dbModel = new Product(); //copy byte stream to actual model byte[] data; using (var memoryStream = new MemoryStream()) { vProduct.Image.OpenReadStream().CopyTo(memoryStream); data = memoryStream.ToArray(); } dbModel = CustomMappingToActualModel(dbModel, vProduct); dbModel.Image = data; _context.Add(dbModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.Brand, "Id", "Name", vProduct.BrandId); ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", vProduct.CategoryId); ViewData["SubCategoryId"] = new SelectList(_context.SubCategory, "Id", "Name", vProduct.SubCategoryId); return(View(vProduct)); }