/// <summary> /// 操作商品細項 /// </summary> /// <param name="pe">需要操作的商品條件</param> /// <returns>操作是否成功</returns> public bool UpdateProductExt(List<ProductExtCustom> lists , Caller _caller,string controlId) { bool flag = true; IFunctionImplMgr _functionMgr = new FunctionMgr(conStr); //用於找到控件的function信息 ITableHistoryImplMgr _tableHistoryMgr; //用於歷史記錄保存的類 IProductExtImplMgr _productExtMgr = new ProductExtMgr(conStr); try { Function fun = _functionMgr.QueryFunction(controlId, "/ProductParticulars/Index"); ArrayList aList = new ArrayList(); _tableHistoryMgr = new TableHistoryMgr(conStr);//實例化歷史記錄的類 HistoryBatch batch = new HistoryBatch { functionid = fun.RowId }; Int64 n_Time = CommonFunction.GetPHPTime(); batch.kuser = _caller.user_email; foreach (ProductExtCustom item in lists) { aList.Add(pei.UpdateProductExt(item)); batch.batchno = n_Time + "_" + "2" + "_" + item.Product_id;//add by wwei0216w 2015/7/6 註:將item_id改為product_id 統一使用product_id查詢 flag = _tableHistoryMgr.SaveHistory<ProductExtCustom>(item, batch, aList); if(flag == false) { throw new Exception("ProductExtMgr-->UpdateProductExt Exception!" ); } } return flag; } catch (Exception ex) { throw new Exception("ProductExtMgr-->UpdateProductExt-->" + ex.Message, ex); } }
public bool UpdateIpodCheck(IpodQuery query,IpoNvdQuery ipoNvd_query) { Boolean result = false; try { ArrayList aList = new ArrayList(); ITableHistoryImplMgr _tableHistoryMgr = new TableHistoryMgr(conStr);//實例化歷史記錄的類 Int64 n_Time = BLL.gigade.Common.CommonFunction.GetPHPTime(); Function myFun = new Function(); myFun.FunctionCode = "/WareHouse/Check"; List<Function> funList = _functionMgr.Query(myFun); int functionid = funList.Count == 0 ? 0 : funList[0].RowId; HistoryBatch batch = new HistoryBatch { functionid = functionid }; batch.kuser = query.user_email; //獲取添加IpoNvd的SQL string ipoNvdSql = _IpodDao.GetInsertIpoNvdSql(ipoNvd_query); aList.Add(ipoNvdSql); //獲取歷史記錄SQL string Check = _IpodDao.UpdateIpodCheck(query); //獲取修改庫存SQL string Stock = string.Empty; ProductItem item = new ProductItem(); item = _IpodDao.GetStockHistorySql(query, out Stock); batch.batchno = n_Time + "_" + query.change_user + "_" + item.Product_Id; if (item != null) { item.Item_Stock = query.item_stock; aList.Add(Stock); aList.Add(Check); result = _tableHistoryMgr.SaveHistory<ProductItem>(item, batch, aList); } //獲取修改商品Ignore SQL string Ignore_Stock = string.Empty; Product product = new Product(); product = _IpodDao.GetIgnoreHistorySql(query, out Ignore_Stock); if (product != null) { product.Ignore_Stock = 0; aList.Clear(); aList.Add(Ignore_Stock); result = _tableHistoryMgr.SaveHistory<Product>(product, batch, aList); } return result; } catch (Exception ex) { throw new Exception("IpoMgr-->UpdateIpodCheck-->" + ex.Message, ex); } }
public int UpdateItemStock(ProductItem query,string path,BLL.gigade.Model.Caller user) { Boolean result = false; try { ArrayList aList = new ArrayList(); ITableHistoryImplMgr _tableHistoryMgr = new TableHistoryMgr(connectionStr);//實例化歷史記錄的類 Int64 n_Time = BLL.gigade.Common.CommonFunction.GetPHPTime(); Function myFun = new Function(); myFun.FunctionCode = path; List<Function> funList = _functionMgr.Query(myFun); int functionid = funList.Count == 0 ? 0 : funList[0].RowId; HistoryBatch batch = new HistoryBatch { functionid = functionid }; batch.kuser = user.user_email; //獲取歷史記錄SQL string Check = productItemDao.UpdateItemStock(query); //獲取修改庫存SQL ProductItem item = new ProductItem(); item = productItemDao.Query(query).Count > 0 ? productItemDao.Query(query)[0] : item; batch.batchno = n_Time + "_" + user.user_id + "_" + item.Product_Id; if (item != null) { item.Item_Stock = item.Item_Stock +query.Item_Stock; aList.Add(Check); result = _tableHistoryMgr.SaveHistory<ProductItem>(item, batch, aList); } ////獲取修改商品Ignore SQL //string Ignore_Stock = string.Empty; //Product product = new Product(); //product = productItemDao.GetTaxByItem(query.Item_Id); //if (product != null) //{ // product.Ignore_Stock = 0; // aList.Clear(); // aList.Add(Ignore_Stock); // result = _tableHistoryMgr.SaveHistory<Product>(product, batch, aList); //} return 1; } catch (Exception ex) { throw new Exception("ProductItemMgr-->UpdateItemStock" + ex.Message, ex); } }
/// <summary> /// 修改商品站台價格表(price_master)信息時,申請審核以及保存價格審核記錄 /// </summary> /// <param name="priceMasters">price_master列表</param> /// <param name="caller"></param> /// <returns>返品錯誤信息</returns> public bool UpdatePriceMasters(List<Model.PriceMaster> priceMasters, Caller caller, out string msg) { msg = string.Empty; bool result = false; try { string batchNo = CommonFunction.GetPHPTime().ToString() + "_" + caller.user_id + "_"; PriceMasterTsMgr _priceMasterTsMgr = new PriceMasterTsMgr(connectionString); HistoryBatch batch = new HistoryBatch(); batch.kuser = caller.user_email; //價格修改 申請審核 PriceUpdateApply priceUpdateApply = new PriceUpdateApply(); priceUpdateApply.apply_user = (uint)caller.user_id; //價格審核記錄 PriceUpdateApplyHistory applyHistroy = new PriceUpdateApplyHistory(); applyHistroy.user_id = (int)priceUpdateApply.apply_user; //applyHistroy.price_status = 1; //applyHistroy.type = 3; applyHistroy.price_status = 1; //edit by wwei0216w 2014/12/16 價格修改時 price_status為 2申請審核 applyHistroy.type = 1;//edit by wwei0216w 所作操作為 1:申請審核的操作 PriceUpdateApplyMgr _priceUpdateApplyMgr = new PriceUpdateApplyMgr(connectionString); PriceUpdateApplyHistoryMgr _priceUpdateApplyHistoryMgr = new PriceUpdateApplyHistoryMgr(connectionString); TableHistoryMgr _tableHistoryMgr = new TableHistoryMgr(connectionString); foreach (var pM in priceMasters) { ArrayList excuteSql = new ArrayList(); priceUpdateApply.price_master_id = pM.price_master_id; int apply_id = _priceUpdateApplyMgr.Save(priceUpdateApply); if (apply_id != -1) { pM.apply_id = (uint)apply_id; pM.price_status = 2;//申請審核 applyHistroy.apply_id = apply_id; batch.batchno = batchNo + pM.product_id;//批號 excuteSql.Add(_priceMasterTsMgr.UpdateTs(pM));//將修改數據保存至price_master_ts表 excuteSql.Add(_priceUpdateApplyHistoryMgr.SaveSql(applyHistroy));//保存審核記錄 if (!_tableHistoryMgr.SaveHistory<PriceMaster>(pM, batch, excuteSql)) msg += pM.product_id.ToString() + ";"; else { result = true; } } } } catch (Exception e) { msg += e.Message; } return result; }