public void InsertOperator(EntityModel.Customer getcustomer) { #region Define the Base Insert Operator By Serviceconfig f**k this shit _getDaoManager.BeginTransaction(); try { _getbaseService.InsertOperator(getcustomer); _getDaoManager.CommitTransaction(); } catch { _getDaoManager.RollBackTransaction(); throw; } #endregion #region the Base Handle //if (_getsqlmaper != null) //{ // _getsqlmaper.BeginTransaction(); // try // { // _getsqlmaper.Insert("InsertCustomer", getcustomer); // _getsqlmaper.CommitTransaction(); // } // catch // { // _getsqlmaper.RollBackTransaction(); // throw; // } //} #endregion }
public string UpdateReducedGoodsQty(IList <GoodsCheckStock> goodsCheckStockList) { string goodsName = string.Empty; _daoManager.BeginTransaction(); try { foreach (GoodsCheckStock item in goodsCheckStockList) { int result = _goodsDao.UpdateReducedGoodsQty(item.GoodsID, item.ReducedQuantity); if (result != 1) { goodsName = item.GoodsName; break; } } if (string.IsNullOrEmpty(goodsName)) { _daoManager.CommitTransaction(); } else { _daoManager.RollBackTransaction(); } } catch (Exception exception) { LogHelper.GetInstance().Error(string.Format("[UpdateReducedGoodsQty]参数:goodsCheckStockList_{0}", JsonConvert.SerializeObject(goodsCheckStockList)), exception); _daoManager.RollBackTransaction(); } return(goodsName); }
public bool CreatePrePayOrder(PayingOrder payingOrder) { bool returnValue = false; _daoManager.BeginTransaction(); try { if (payingOrder != null) { //日结 string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo(); //更新Order if (_orderDao.UpdatePrePayOrder(payingOrder.order)) { //更新OrderDetails foreach (OrderDetails item in payingOrder.orderDetailsList) { _orderDetailsDao.UpdateOrderDetailsDiscount(item); } //插入OrderDiscount if (payingOrder.orderDiscountList != null && payingOrder.orderDiscountList.Count > 0) { foreach (OrderDiscount item in payingOrder.orderDiscountList) { item.DailyStatementNo = dailyStatementNo; _orderDiscountDao.CreateOrderDiscount(item); } } returnValue = true; } } _daoManager.CommitTransaction(); } catch (Exception exception) { LogHelper.GetInstance().Error(string.Format("[CreatePrePayOrder]参数:payingOrder_{0}", JsonConvert.SerializeObject(payingOrder)), exception); _daoManager.RollBackTransaction(); returnValue = false; } return(returnValue); }
public void TestTransactionRollback() { IAccountDao accountDao = (IAccountDao)daoManager[typeof(IAccountDao)]; Account account = NewAccount(); daoManager.OpenConnection(); Account account2 = accountDao.GetAccountById(1); daoManager.CloseConnection(); account2.EmailAddress = "*****@*****.**"; try { daoManager.BeginTransaction(); accountDao.Create(account); accountDao.Update(account2); throw new Exception("BOOM!"); //daoManager.CommitTransaction(); } catch { daoManager.RollBackTransaction(); } finally { } daoManager.OpenConnection(); account = accountDao.GetAccountById(account.Id); account2 = accountDao.GetAccountById(1); daoManager.CloseConnection(); Assert.IsNull(account); Assert.AreEqual("*****@*****.**", account2.EmailAddress); }
/// <summary> /// 插入news /// </summary> /// <param name="news">news</param> public void InsertNews(News news) { try { _daoManager.BeginTransaction(); _iNewsDao.InsertNews(news); _daoManager.CommitTransaction(); } catch (Exception ex) { _daoManager.RollBackTransaction(); throw ex; } }
/// <summary> /// 插入tag /// </summary> /// <param name="tag">tag</param> public void InsertTag(Tag tag) { try { _daoManager.BeginTransaction(); _iTagDao.InsertTag(tag); _daoManager.CommitTransaction(); } catch (Exception ex) { _daoManager.RollBackTransaction(); throw ex; } }
public bool ModifyForOrder(ModifiedPaidOrder modifiedOrder) { bool returnValue = false; _daoManager.BeginTransaction(); try { if (modifiedOrder != null) { //日结 string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo(); //更新Order if (_orderDao.UpdatePaidOrderPrice(modifiedOrder.order)) { //更新OrderDetails foreach (OrderDetails item in modifiedOrder.orderDetailsList) { _orderDetailsDao.UpdateOrderDetailsDiscount(item); } if (modifiedOrder.orderDiscountList != null && modifiedOrder.orderDiscountList.Count > 0) { foreach (OrderDiscount item in modifiedOrder.orderDiscountList) { //删除OrderDiscount _orderDiscountDao.DeleteOrderSingleDiscount(item.OrderDetailsID); //插入OrderDiscount item.DailyStatementNo = dailyStatementNo; _orderDiscountDao.CreateOrderDiscount(item); } } _orderPayoffDao.DeleteOrderPayoff(modifiedOrder.order.OrderID); //插入OrderPayoff foreach (OrderPayoff item in modifiedOrder.orderPayoffList) { item.DailyStatementNo = dailyStatementNo; _orderPayoffDao.CreateOrderPayoff(item); } returnValue = true; } } _daoManager.CommitTransaction(); } catch (Exception exception) { LogHelper.GetInstance().Error(string.Format("[ModifyForOrder]参数:modifiedOrder_{0}", JsonConvert.SerializeObject(modifiedOrder)), exception); _daoManager.RollBackTransaction(); returnValue = false; } return(returnValue); }
/// <summary> /// 插入sysdiagrams /// </summary> /// <param name="sysdiagrams">sysdiagrams</param> public void InsertSysdiagrams(Sysdiagrams sysdiagrams) { try { _daoManager.BeginTransaction(); _iSysdiagramsDao.InsertSysdiagrams(sysdiagrams); _daoManager.CommitTransaction(); } catch (Exception ex) { _daoManager.RollBackTransaction(); throw ex; } }
public bool OrderDeskOperate(DeskChange deskChange) { bool returnValue = false; _daoManager.BeginTransaction(); try { SystemConfig systemConfig = _sysConfigDao.GetSystemConfigInfo(); if (systemConfig.IncludeKitchenPrint) { //添加打印任务 _printTaskDao.InsertDeskOperatePrint(deskChange); } // 转台 if (deskChange.OrderID1st != Guid.Empty && deskChange.OrderID2nd == Guid.Empty) { //分单号 Int32 curSubOrderNo = _orderDao.GetCurrentSubOrderNo(deskChange.DeskName); if (curSubOrderNo > 0) { curSubOrderNo++; } else { curSubOrderNo = 1; } Order order = new Order(); order.OrderID = deskChange.OrderID1st; order.DeskName = deskChange.DeskName; order.SubOrderNo = curSubOrderNo; returnValue = _orderDao.UpdateOrderDeskName(order); } // 合并 if (deskChange.OrderID1st != Guid.Empty && deskChange.OrderID2nd != Guid.Empty) { returnValue = _orderDao.MergeSalesOrder(deskChange); } _daoManager.CommitTransaction(); } catch (Exception exception) { LogHelper.GetInstance().Error(string.Format("[OrderDeskOperate]参数:deskChange_{0}", JsonConvert.SerializeObject(deskChange)), exception); _daoManager.RollBackTransaction(); returnValue = false; } return(returnValue); }
/// <summary> /// 插入type_group /// </summary> /// <param name="typegroup">type_group</param> public void InsertTypeGroup(TypeGroup typegroup) { try { _daoManager.BeginTransaction(); _iTypeGroupDao.InsertTypeGroup(typegroup); if (typegroup.NewsType != null) { foreach (NewsType newstype in typegroup.NewsType) { _iNewsTypeDao.InsertNewsType(newstype); } } _daoManager.CommitTransaction(); } catch (Exception ex) { _daoManager.RollBackTransaction(); throw ex; } }
/// <summary> /// 插入news_type /// </summary> /// <param name="newstype">news_type</param> public void InsertNewsType(NewsType newstype) { try { _daoManager.BeginTransaction(); _iNewsTypeDao.InsertNewsType(newstype); if (newstype.News != null) { foreach (News news in newstype.News) { _iNewsDao.InsertNews(news); } } _daoManager.CommitTransaction(); } catch (Exception ex) { _daoManager.RollBackTransaction(); throw ex; } }
//插入数据 public virtual int Insert(T t) { int keyId = -1; _daoManager.BeginTransaction(); try { keyId = dao.Insert(t); _daoManager.CommitTransaction(); } catch (Exception e) { _daoManager.RollBackTransaction(); System.Diagnostics.Debug.Write(e.Message); } return(keyId); }
public bool UpdateTakeoutOrderStatus(CustomerOrder customerOrder) { bool returnValue = false; _daoManager.BeginTransaction(); try { if (!string.IsNullOrEmpty(customerOrder.Telephone)) { //更新外送人员 _customerOrderDao.CreateOrUpdateCustomerOrder(customerOrder); } _orderDao.DeliveryTakeoutOrder(customerOrder.OrderID, customerOrder.DeliveryEmployeeNo); returnValue = true; _daoManager.CommitTransaction(); } catch (Exception exception) { _daoManager.RollBackTransaction(); returnValue = false; LogHelper.GetInstance().Error(string.Format("[UpdateTakeoutOrderStatus]参数:customerOrder_{0}", JsonConvert.SerializeObject(customerOrder)), exception); } return(returnValue); }
public Int32 CreateDailyBalance(DailyBalance dailyBalance, out string unCheckDeviceNo) { unCheckDeviceNo = string.Empty; int returnValue; //日结失败 _daoManager.BeginTransaction(); try { //日结号 string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo(); //更新日结信息 DailyStatement dailyStatement = dailyBalance.dailyStatement; dailyStatement.DailyStatementNo = dailyStatementNo; returnValue = _dailyStatementDao.UpdateDailyStatement(dailyStatement, out unCheckDeviceNo); if (returnValue == 1) { //插入日结金额 DailyTurnover dailyTurnover = dailyBalance.dailyTurnover; dailyTurnover.DailyStatementNo = dailyStatementNo; _dailyTurnoverDao.CreateDailyTurnover(dailyTurnover); //创建新的日结 DailyStatement item = new DailyStatement(); item.DailyStatementID = Guid.NewGuid(); item.DailyStatementNo = DateTime.Now.ToString("yyMMddHHmmssff"); _dailyStatementDao.CreateDailyStatement(item); } _daoManager.CommitTransaction(); } catch (Exception exception) { _daoManager.RollBackTransaction(); returnValue = 0; LogHelper.GetInstance().Error(string.Format("[CreateDailyBalance]参数:dailyBalance_{0}", JsonConvert.SerializeObject(dailyBalance)), exception); } return(returnValue); }
public bool CreateHandover(HandoverInfo handover) { bool returnValue = false; _daoManager.BeginTransaction(); try { //日结号 string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo(); if (!string.IsNullOrEmpty(dailyStatementNo)) { //交班记录 HandoverRecord handoverRecord = handover.handoverRecord; handoverRecord.DailyStatementNo = dailyStatementNo; _handoverRecord.CreateHandoverRecord(handoverRecord); //交班金额列表 if (handover.handoverTurnoverList != null && handover.handoverTurnoverList.Count > 0) { foreach (HandoverTurnover item in handover.handoverTurnoverList) { item.DailyStatementNo = dailyStatementNo; _handoverTurnover.CreateHandoverTurnover(item); } } returnValue = true; } _daoManager.CommitTransaction(); } catch (Exception exception) { LogHelper.GetInstance().Error(string.Format("[CreateHandover]参数:handover_{0}", JsonConvert.SerializeObject(handover)), exception); _daoManager.RollBackTransaction(); returnValue = false; } return(returnValue); }
public Int32 CreateSalesOrder(SalesOrder salesOrder) { Int32 tranSequence = 0; _daoManager.BeginTransaction(); try { //日结号 string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo(); if (!string.IsNullOrEmpty(dailyStatementNo)) { Order order = salesOrder.order; order.DailyStatementNo = dailyStatementNo; //分单号 Int32 curSubOrderNo = _orderDao.GetCurrentSubOrderNo(order.DeskName); if (curSubOrderNo > 0) { curSubOrderNo++; } else { curSubOrderNo = 1; } order.SubOrderNo = curSubOrderNo; //流水号 order.TranSequence = tranSequence = _sysDictionary.GetCurrentTranSequence(); string orderNo = _orderDao.CreateOrder(order); order.OrderNo = orderNo; //菜单品项序号 int seqNumber = _orderDetailsDao.GetSequenceNum(order.OrderID); foreach (OrderDetails item in salesOrder.orderDetailsList) { item.DailyStatementNo = dailyStatementNo; item.OrderBy = seqNumber; _orderDetailsDao.CreateOrderDetails(item); seqNumber++; } //折扣信息 if (salesOrder.orderDiscountList != null && salesOrder.orderDiscountList.Count > 0) { foreach (OrderDiscount item in salesOrder.orderDiscountList) { item.DailyStatementNo = dailyStatementNo; _orderDiscountDao.CreateOrderDiscount(item); } } //添加打印任务 SystemConfig systemConfig = _sysConfigDao.GetSystemConfigInfo(); if (systemConfig.IncludeKitchenPrint) { IList <PrintTask> printTaskList = PrintTaskService.GetInstance().GetPrintTaskList(salesOrder, systemConfig.PrintStyle, systemConfig.FollowStyle, systemConfig.PrintType, 1, string.Empty); foreach (PrintTask printTask in printTaskList) { _printTaskDao.InsertPrintTask(printTask); } } } _daoManager.CommitTransaction(); } catch (Exception exception) { LogHelper.GetInstance().Error(string.Format("[CreateSalesOrder]参数:salesOrder_{0}", JsonConvert.SerializeObject(salesOrder)), exception); tranSequence = 0; _daoManager.RollBackTransaction(); } return(tranSequence); }
public bool DeleteSingleOrder(DeletedSingleOrder deletedSingleOrder) { bool returnValue = false; _daoManager.BeginTransaction(); try { Order order = new Order { OrderID = deletedSingleOrder.OrderID, TotalSellPrice = deletedSingleOrder.TotalSellPrice, ActualSellPrice = deletedSingleOrder.ActualSellPrice, DiscountPrice = deletedSingleOrder.DiscountPrice, CutOffPrice = deletedSingleOrder.CutOffPrice }; if (_orderDao.UpdateOrderPrice(order)) { foreach (DeletedOrderDetails item in deletedSingleOrder.deletedOrderDetailsList) { _orderDetailsDao.DeleteSingleOrderDetails(item); } //获取打印任务列表 Order tempOrder = _orderDao.GetOrder(deletedSingleOrder.OrderID); if (tempOrder != null) { SalesOrder salesOrder = new SalesOrder(); salesOrder.order = tempOrder; IList <OrderDetails> tempOrderDetailsList = new List <OrderDetails>(); string cancelReason = string.Empty; foreach (DeletedOrderDetails item in deletedSingleOrder.deletedOrderDetailsList) { OrderDetails orderDetails = _orderDetailsDao.GetOrderDetails(item.OrderDetailsID); orderDetails.ItemQty = item.DeletedQuantity; tempOrderDetailsList.Add(orderDetails); if (string.IsNullOrEmpty(cancelReason) && !string.IsNullOrEmpty(item.CancelReasonName)) { cancelReason = item.CancelReasonName; } } salesOrder.orderDetailsList = tempOrderDetailsList; //添加打印任务 SystemConfig systemConfig = _sysConfigDao.GetSystemConfigInfo(); if (systemConfig.IncludeKitchenPrint) { IList <PrintTask> printTaskList = PrintTaskService.GetInstance().GetPrintTaskList(salesOrder, systemConfig.PrintStyle, systemConfig.FollowStyle, systemConfig.PrintType, 2, cancelReason); foreach (PrintTask printTask in printTaskList) { _printTaskDao.InsertPrintTask(printTask); } } } returnValue = true; } _daoManager.CommitTransaction(); } catch (Exception exception) { _daoManager.RollBackTransaction(); returnValue = false; LogHelper.GetInstance().Error(string.Format("[DeleteSingleOrder]参数:deletedSingleOrder_{0}", JsonConvert.SerializeObject(deletedSingleOrder)), exception); } return(returnValue); }