/// <summary> /// Created by Michael Takrama /// Created on 2017-02-10 /// /// Creates a new Product /// </summary> /// <param name="product">Product Object to be created</param> /// <returns>Success integer</returns> public int CreateProduct(Product product) { int result = 0; result = ProductAccessor.CreateProductAndRetrieveProductId(product); return(result); }
/// <summary> /// Robert Forbes /// 2017/04/13 /// /// Retrieves all routes with assigned dates for today or after /// </summary> /// <param name="driverId"></param> /// <returns></returns> public List <Route> RetrieveFutureRoutesForDriver(int?driverId) { List <Route> routes = new List <Route>(); try { List <Route> routesToRemove = new List <Route>(); //Getting all the routes routes = RouteAccessor.RetrieveFutureRoutesForDriver(driverId); foreach (Route r in routes) { //Getting all the deliveries for each route List <Delivery> deliveriesToRemove = new List <Delivery>(); r.Deliveries = DeliveryAccessor.RetrieveDeliveriesForRoute(r.RouteId); foreach (Delivery d in r.Deliveries) { if (d.StatusId == "Delivered") { deliveriesToRemove.Add(d); } //Getting the address for each delivery d.Address = DeliveryAccessor.RetrieveUserAddressForDelivery(d.DeliveryId); //Getting the packages for each delivery d.PackageList = PackageAccessor.RetrieveAllPackagesInDelivery(d.DeliveryId); foreach (Package p in d.PackageList) { //Getting all the lines for each package p.PackageLineList = PackageLineAccessor.RetrievePackageLinesInPackage(p.PackageId); foreach (PackageLine line in p.PackageLineList) { //Getting the name of each product for each package line line.ProductName = ProductAccessor.RetrieveProductNameFromProductLotId(line.ProductLotId); } } } foreach (Delivery d in deliveriesToRemove) { r.Deliveries.Remove(d); } if (r.Deliveries.Count == 0) { routesToRemove.Add(r); } } foreach (Route r in routesToRemove) { routes.Remove(r); } } catch (Exception) { throw; } return(routes); }
/// <summary> /// William Flood /// Created 2017/04/14 /// </summary> /// <param name="productId"></param> /// <returns></returns> public List <ProductGradePrice> RetrieveGradeForProduct(int productId) { try { return(ProductAccessor.RetrievePriceOptionsForProduct(productId)); } catch (SqlException ex) { throw new ApplicationException("An error occured: ", ex); } }
/// <summary> /// Natacha Ilunga /// Created: 03/29/2017 /// /// Retrieves Products by supplier id to view model /// </summary> /// /// <remarks> /// Aaron Usher /// Updated: 04/06/2017 /// /// Added very basic exception handling logic. /// </remarks> /// /// <param name="id"></param> /// <returns></returns> public List <BrowseProductViewModel> RetrieveProductsBySupplierId(int id) { try { return(ProductAccessor.RetrieveProductsBySupplierIdToViewModel(id)); } catch (Exception) { throw; } }
/// <summary> /// Mason Allen /// Created on 5/2/17 /// Creates a new product record and returns the generated product id /// </summary> /// <param name="product"></param> /// <returns></returns> public int CreateProductReturnProductId(Product product) { int productId = 0; try { productId = ProductAccessor.CreateProductAndRetrieveProductId(product); } catch (Exception) { throw; } return(productId); }
/// <summary> /// Laura Simmonds /// Created on 2017/02/20 /// /// Retrieves a product from the database /// </summary> /// <param name="productID"></param> /// <returns>product</returns> public DataObjects.Product RetrieveProductById(int productId) { Product products = null; try { products = ProductAccessor.RetrieveProduct(productId); } catch (Exception ex) { throw new ApplicationException("There was a problem retrieving the product details.", ex); } return(products); }
/// <summary> /// Redudant with RetrieveProducts; should be removed entirely. /// </summary> /// <returns></returns> public List <Product> ListProducts() { List <Product> products = null; try { products = ProductAccessor.RetrieveProductList(); } catch (SqlException) { throw; } return(products); }
/// <summary> /// 删除SKU /// </summary> /// <param name="SKU"></param> /// <returns></returns> //public bool DelSKUProduct(string ID) //{ // bool bo = true; // try // { // bo = new ProductAccessor().DelSKUProduct(ID); // } // catch (Exception ex) // { // LogError(ex); // } // return bo; //} /// <summary> /// 添加SKU明细 /// </summary> /// <param name="ProductDetail"></param> /// <returns></returns> public bool AddProductDetail(AddProductExeclRequest ProductDetail) { bool Result = false; try { Result = new ProductAccessor().AddProductDetail(ProductDetail.InfoDetail, ProductDetail.UserName); } catch (Exception ex) { LogError(ex); } return(Result); }
/// <summary> /// Christian Lopez /// Created 2017/03/08 /// /// Tries to get a list of products from the accessor /// </summary> /// <returns></returns> public List <Product> RetrieveProducts() { try { return(ProductAccessor.RetrieveProductList()); } catch (SqlException ex) { throw new ApplicationException("There was a database error.", ex); } catch (Exception ex) { throw new ApplicationException("There was an unknown error.", ex); } }
/// <summary> /// 添加SKU明细 /// </summary> /// <param name="ProductDetail"></param> /// <returns></returns> public bool DelProductDetail(string ID) { bool Result = false; try { Result = new ProductAccessor().DelProductDetail(ID); } catch (Exception ex) { LogError(ex); } return(Result); }
/// <summary> /// 删除SKU /// </summary> /// <param name="SKU"></param> /// <returns></returns> public bool DelSKUProduct(string ID) { bool bo = false; try { bo = new ProductAccessor().DelSKUProduct(ID); } catch (Exception ex) { LogError(ex); } return(bo); }
public IEnumerable <WMS_Customer> Get_WMS_CustomerByNumbers(IEnumerable <string> nums) { IEnumerable <WMS_Customer> stores = new List <WMS_Customer>(); try { stores = new ProductAccessor().Get_WMS_CustomerByNumbers(nums); } catch (Exception ex) { LogError(ex); } return(stores); }
// コマンド処理 public override void Execute(StoreSystemState state) { // 全商品を取得する List <Product> products; using (var accessor = new ProductAccessor()) { products = accessor.SelectProducts(); } // 在庫が存在する情報を取得する List <Stock> stocksInStock; using (var accessor = new StockAccessor()) { stocksInStock = accessor.SelectStocks().Where(elm => elm.Quantity >= 1).ToList(); } var results = from P in products join S in stocksInStock on P.ID equals S.ProductId orderby P.ID ascending select new { ID = P.ID, Name = P.Name, Volume = P.Volume, Price = P.Price, Quantity = S.Quantity, }; // ヘッダを表示する List <string> colNames = new List <string> { "製品名称", "製品内容量(ml)", "販売価格(円)", "在庫数" }; Console.WriteLine(string.Join("|", colNames)); List <int> colByteLength = colNames.Select( elm => Encoding.GetEncoding("Shift_JIS").GetByteCount(elm) ).ToList(); List <int> colLength = colNames.Select(elm => elm.Length).ToList(); // 内容を表示する results.ToList().ForEach(elm => Console.WriteLine($"{elm.Name}|{elm.Volume}|{elm.Price}|{elm.Quantity}")); }
/// <summary> /// 根据sku 得到产品名称和产品类型 /// </summary>add by hujiaoqiang201511111 /// <param name="sku"></param> /// <returns></returns> //public IEnumerable<ProductStorer> GetGoodsNameAndGoodsTypeBySKU(string sku) { // } public string UpdateProductAndArticleDetail(IEnumerable <ProductStorerInfo> list1, IEnumerable <WMS_ArticleDetail> list2) { string Result = ""; try { Result = new ProductAccessor().UpdateProductAndArticleDetail(list1, list2); } catch (Exception ex) { Result = ex.ToString(); LogError(ex); } return(Result); }
public IEnumerable <ArticleSearch> GetSearchArticle(long CustomerID, List <ArticleSearch> ArticleSearch, string type) { IEnumerable <ArticleSearch> response; // Response<EditSKUProductRequest> response = new Response<EditSKUProductRequest>(); // response.Result = new EditSKUProductRequest(); //结果集初始化 try { response = new ProductAccessor().GetSearchArticle(CustomerID, ArticleSearch, type); } catch (Exception ex) { response = null; } return(response); }
///<summary> ///Dan Brown ///Created on 2017/03/10 /// /// Delete an individual product from the product table (following documentation guidlines) ///</summary> ///<param name="productID"> The ID field of the product to be deleted </param> ///<returns> Returns rows affected (int) </returns> ///<exception cref="System.ApplicationException"> Thrown if 'ProductAccessor.DeleteProduct' returns 0 rows affected </exception> ///<exception cref="System.Exception"> Thrown if there is an error connecting to the 'ProductAccessor' class </exception> public int DeleteProduct(int productID) { int result = 0; try { if (1 == ProductAccessor.DeleteProduct(productID)) { result = 1; } else { throw new ApplicationException("Product matching that productID was not found. No Product deleted"); } } catch (Exception) { throw; } return(result); }
/// <summary> /// Robert Forbes /// 2017/04/13 /// </summary> /// <param name="driverId"></param> /// <returns></returns> public List <Pickup> RetrievePickupsForDriver(int?driverId) { List <Pickup> pickups = new List <Pickup>(); try { pickups = PickupAccessor.RetrievePickupsForDriver(driverId); foreach (Pickup p in pickups) { p.PickupLineList = PickupLineAccessor.RetrievePickupLinesForPickup(p.PickupId); foreach (PickupLine line in p.PickupLineList) { line.productName = ProductAccessor.RetrieveProduct((int)line.ProductId).Name; } p.address = SupplierAccessor.RetrieveUserAddressBySupplier(p.SupplierId); } } catch { throw; } return(pickups); }
/// <summary> /// Created by Natacha Ilunga /// Created on 2/10/2017 /// /// Retrieves Product List /// </summary> /// <returns></returns> public List <BrowseProductViewModel> RetrieveProductsToBrowseProducts() { var productList = ProductAccessor.RetrieveProductsToBrowseProducts(); return(productList); }
public override bool Business() { try { SFTPHelper fTPHelper = new SFTPHelper(SFTPIP, SFTPort, SFTPUser, SFTPPwd); //读取文件列表 string[] receivefiles = Directory.GetFiles(SFTPConstants.ReceiveFilePath); LogHelper.WriteLog(typeof(string), "开始处理文件", LogHelper.LogLevel.INFO); if (receivefiles.Length > 0) { //TextHelper txthelper = new TextHelper(); for (int i = 0; i < receivefiles.Length; i++) { LogModel log = new LogModel(); log.SourceFileName = receivefiles[i]; FileInfo file = new FileInfo(receivefiles[i]); string filename = file.Name; string result = "";//解析的错误提示 string externumber = ""; try { List <string> txtlists = TextHelper.ReadTextFileToList(receivefiles[i]);//读取成list //没有数据 if (txtlists.Count() > 0) { //可以处理多个接口文件 switch (txtlists[0].ToString().Substring(0, 9).Trim()) { case "WMSSKU": //PUMA推给我们的 log.Type = "WMSSKU"; result = new ProductAccessor().AddProduct(txtlists, out externumber); break; case "WMSASN": //PUMA推给我们的 入库单 log.Type = "WMSASN"; result = new ASNAccessor().GetInbound_ASNHD(txtlists, out externumber); break; case "WMSORD": //PUMA推给我们的 出库单 log.Type = "WMSORD"; result = new ASNAccessor().GetInbound_ORDHD(txtlists, out externumber); break; default: log.Type = ""; result = "未能从文件中识别出对应的接口"; break; } if (result == "200") { //解析成功,移动到success文件夹 log.ToFileName = SFTPConstants.SuccessFilePath + @"\" + log.Type + @"\" + filename; log.ResultDesc = "解析成功"; log.Externumber = externumber; log.Flag = "Y"; if (log.Type == "WMSSKU") { fTPHelper.Delete(OUT_MASTER + "//" + filename); } else { fTPHelper.Delete(OUT_TRANSACTION + "//" + filename); } } else { if (log.Type != "") { if (result.Contains("数据库插入失败")) { log.ToFileName = "";// SFTPConstants.SuccessFilePath + @"\" + log.Type + @"\" + filename; log.ResultDesc = "解析失败:" + result; log.Externumber = externumber; log.Flag = "E"; } else { log.ToFileName = SFTPConstants.FaildFilePath + @"\" + log.Type + @"\" + filename;//移动到解析失败文件夹 log.ResultDesc = "解析失败:" + result; log.Externumber = externumber; log.Flag = "N"; } } else { log.ToFileName = SFTPConstants.ErrorFilePath + @"\" + filename; log.ResultDesc = "解析失败:" + result; log.Externumber = externumber; log.Flag = "N"; } } } else { log.ToFileName = SFTPConstants.ErrorFilePath + @"\" + filename; log.Flag = "N"; log.ResultDesc = "解析失败:文档中无数据"; } } catch (Exception ex) { //报错了放到error文件 log.ToFileName = SFTPConstants.ErrorFilePath + @"\" + filename; log.Flag = "N"; log.ResultDesc = "解析报错:" + ex.Message.ToString(); } if (log.Flag == "E") {//数据库失败再解析一次 } else { LocalFileHelper.MoveToCover(log.SourceFileName, log.ToFileName); } } } } catch (Exception ex) { LogHelper.WriteLog(typeof(string), "处理文件错误" + ex.ToString(), LogHelper.LogLevel.INFO); //throw; } return(true); }