示例#1
0
        /// <summary>
        /// 新增承运单位结算记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long InsertCarrierTransportChargesSettlement(CarrierTransportChargesSettlement data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Output, (object)data.Id),
                    MakeParam(CARRIERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.CarrierId),
                    MakeParam(CARRIERNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.CarrierName),
                    MakeParam(SETTLEMENTAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.SettlementAmount),
                    MakeParam(WITHHOLDAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.WithholdAmount),
                    MakeParam(FACTPAYMENTAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.FactpaymentAmount),
                    MakeParam(REMARK_PARAM, SqlDbType.NVarChar, 100, ParameterDirection.Input, (object)data.Remark??System.DBNull.Value),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName),
                };

            SqlParameterCollection outParams;
            if (Execute("InsertCarrierTransportChargesSettlement", Params, out outParams, out strErrText) < 0)
            {
                return 0;
            }
            else
            {
                return (long)outParams[ID_PARAM].Value;
            }
        }
示例#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 InsertCarrierTransportChargesSettlement(CarrierTransportChargesSettlement data, List<CarrierTransportChargesSettlementDetail> listDetail, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            long nCarrierTransportChargesSettlementId = 0;

            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (SettlementDAO dao = new SettlementDAO())
                    {
                        //新增结算数据
                        nCarrierTransportChargesSettlementId = dao.InsertCarrierTransportChargesSettlement(data, nOpStaffId, strOpStaffName, out strErrText);
                        if (nCarrierTransportChargesSettlementId <= 0)
                            return 0;

                        //新增结算明细数据
                        foreach (CarrierTransportChargesSettlementDetail detail in listDetail)
                        {
                            detail.CarrierTransportChargesSettlementId = nCarrierTransportChargesSettlementId;

                            if (!dao.InsertCarrierTransportChargesSettlementDetail(detail, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return 0;
                            }
                        }
                    }
                    transScope.Complete();
                }
                return nCarrierTransportChargesSettlementId;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return 0;
            }
        }
示例#3
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 InsertCarrierTransportChargesSettlement(CarrierTransportChargesSettlement data, List<CarrierTransportChargesSettlementDetail> listDetail, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     SettlementRule rule = new SettlementRule();
     return rule.InsertCarrierTransportChargesSettlement(data, listDetail, nOpStaffId, strOpStaffName, out strErrText);
 }
示例#4
0
        public ActionResult NewCarrierTransportChargesSettlement(CarrierTransportChargesSettlementViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                CarrierTransportChargesSettlement data = new CarrierTransportChargesSettlement();
                data.CarrierId = model.CarrierId;
                data.CarrierName = model.CarrierName;
                data.SettlementAmount = model.SettlementAmount;
                data.WithholdAmount = model.WithholdAmount;
                data.FactpaymentAmount = model.FactpaymentAmount;
                data.Remark = model.Remark;

                List<CarrierTransportChargesSettlementDetail> listDetail = new List<CarrierTransportChargesSettlementDetail>();
                foreach (CarrierTransportChargesSettlementDetailViewModel m in model.Details)
                {
                    CarrierTransportChargesSettlementDetail d = new CarrierTransportChargesSettlementDetail();
                    d.CarrierTransportChargesSettlementId = m.CarrierTransportChargesSettlementId;
                    d.DeliverBillId = m.DeliverBillId;
                    d.TransportCharges = m.TransportCharges;
                    listDetail.Add(d);
                }

                //保存数据
                string strErrText;
                SettlementSystem settlement = new SettlementSystem();
                if (settlement.InsertCarrierTransportChargesSettlement(data, listDetail, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }