public void DeleteProduct(Int32 id) { if (GetProduct(id) != null) { SourseDbFactory.GetSourseDB().DeleteProduct(id); } }
public void PerformOperation(OperationModel operation) { MembershipUser mu = Membership.GetUser(); Guid userId = (Guid)mu.ProviderUserKey; operation.OperationId = Convert.ToInt32(operation.OperationId); this.UpdateProductAfterOperation(operation); SourseDbFactory.GetSourseDB().AddNewOperation(operation, userId, DateTime.Now); }
public List <ProductModel> GetPageProduct(String groupName, String sortType) { List <ProductModel> list = SourseDbFactory.GetSourseDB().GetRangeSortedProducts(GetStartPosition(), CountRowsInPage, groupName, sortType); for (int i = 0; i < list.Count; i++) { list[i] = PreparationModel(list[i]); } return(list); }
private void UpdateProductAfterOperation(OperationModel operation) { ProductModel product = SourseDbFactory.GetSourseDB().GetProductById(operation.ProductId); if (operation.OperationId == GetOperationId("arrival")) { product.Quantity = product.Quantity + operation.Quantity; } if (operation.OperationId == GetOperationId("expense")) { product.Quantity = product.Quantity - operation.Quantity; } SourseDbFactory.GetSourseDB().UpdateProduct(product); }
public void AddNewProduct(ProductModel product) { SourseDbFactory.GetSourseDB().AddNewProduct(product); }
public Boolean UpdateProduct(ProductModel product) { SourseDbFactory.GetSourseDB().UpdateProduct(product); return(true); }
public ProductModel GetProduct(int id) { return(PreparationModel(SourseDbFactory.GetSourseDB().GetProductById(id))); }
public Int32 GetCountProductOperations(Int32 id) { return(SourseDbFactory.GetSourseDB().GetCountOperationWithProduct(id)); }
public Int32 GetCountProduct() { return(SourseDbFactory.GetSourseDB().GetCountProduct()); }
public ProductManager(Int32 page, Int32 countRowsInPage) : base(page, countRowsInPage, SourseDbFactory.GetSourseDB().GetCountProduct()) { }
public List <OperationDataModel> GetPageProductOperation(Int32 productId, String groupName, String sortType) { List <OperationDataModel> list = SourseDbFactory.GetSourseDB().GetStatisticsProduct(productId, GetStartPosition(), CountRowsInPage, groupName, sortType); return(list); }
public Int32 GetCountRecords(Int32 productId) { return(SourseDbFactory.GetSourseDB().GetCountOperationWithProduct(productId)); }
public OperationManager(Int32 productId, Int32 page, Int32 countRowsInPage) : base(page, countRowsInPage, SourseDbFactory.GetSourseDB().GetCountOperationWithProduct(productId)) { int i = SourseDbFactory.GetSourseDB().GetCountOperationWithProduct(productId); }