コード例 #1
0
ファイル: ContractRule.cs プロジェクト: zjchenxk/SYLS
        /// <summary>
        /// 修改合同发货数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="listGoods"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool UpdateContractDeliverPlan(ContractDeliverPlan data, List<ContractGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (ContractDAO dao = new ContractDAO())
                    {
                        if (!dao.UpdateContractDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }

                        foreach (ContractGoods goods in listGoods)
                        {
                            if (!dao.UpdateContractGoods(goods, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }
                        }
                    }

                    using (DispatchDAO dao = new DispatchDAO())
                    {
                        //检查调度单数据
                        if (!dao.CheckDispatchBill(data.DispatchBillId, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                    }
                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }