Exemple #1
0
 /// <summary>
 /// 新增冲帐记录
 /// </summary>
 /// <param name="data"></param>
 /// <param name="listDetail"></param>
 /// <param name="nOpStaffId"></param>
 /// <param name="strOpStaffName"></param>
 /// <param name="strErrText"></param>
 /// <returns></returns>
 public long InsertContractReverse(ContractReverse data, List<ContractReverseDetail> listDetail, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     ContractRule rule = new ContractRule();
     return rule.InsertContractReverse(data, listDetail, nOpStaffId, strOpStaffName, out strErrText);
 }
Exemple #2
0
        /// <summary>
        /// 新增冲帐记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="listDetail"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long InsertContractReverse(ContractReverse data, List<ContractReverseDetail> listDetail, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            long nReverseId = 0;

            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (ContractDAO dao = new ContractDAO())
                    {
                        //新增冲帐数据
                        nReverseId = dao.InsertContractReverse(data, nOpStaffId, strOpStaffName, out strErrText);
                        if (nReverseId <= 0)
                            return 0;

                        //新增冲帐明细数据
                        foreach (ContractReverseDetail detail in listDetail)
                        {
                            detail.ReverseId = nReverseId;

                            if (!dao.InsertContractReverseDetail(detail, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return 0;
                            }
                        }
                    }
                    transScope.Complete();
                }
                return nReverseId;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return 0;
            }
        }
Exemple #3
0
        public ActionResult ReverseContracts(ContractReverseViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                ContractReverse data = new ContractReverse();
                data.Id = model.Id;
                data.ReverseAmount = model.ReverseAmount;
                data.WithholdAmount = model.WithholdAmount;
                data.FactpaymentAmount = model.FactpaymentAmount;
                data.CreatorId = model.CreatorId;
                data.CreatorName = model.CreatorName;

                List<ContractReverseDetail> listDetail = new List<ContractReverseDetail>();
                if (model.Details != null)
                {
                    foreach (ContractReverseDetailViewModel m in model.Details)
                    {
                        ContractReverseDetail d = new ContractReverseDetail();
                        d.Id = m.Id;
                        d.ReverseId = 0;
                        d.ContractId = m.ContractId;
                        d.ReverseAmount = m.ReverseAmount;
                        d.WithholdAmount = m.WithholdAmount;
                        d.FactpaymentAmount = m.FactpaymentAmount;
                        listDetail.Add(d);
                    }
                }

                //保存数据
                string strErrText;
                ContractSystem contract = new ContractSystem();
                if (contract.InsertContractReverse(data, listDetail, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Exemple #4
0
        /// <summary>
        /// 新增冲帐记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long InsertContractReverse(ContractReverse data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.InputOutput, (object)data.Id),
                    MakeParam(REVERSEAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.ReverseAmount),
                    MakeParam(WITHHOLDAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.WithholdAmount),
                    MakeParam(FACTPAYMENTAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.FactpaymentAmount),
                    MakeParam(CREATORID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.CreatorId),
                    MakeParam(CREATORNAME_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.CreatorName),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName),
                };

            SqlParameterCollection outParams;
            if (Execute("InsertContractReverse", Params, out outParams, out strErrText) < 0)
            {
                return 0;
            }
            else
            {
                return (long)outParams[ID_PARAM].Value;
            }
        }