Example #1
0
        public ActionResult NewCustomerStorageAndForceFeeSettlement(CustomerStorageAndForceFeeSettlementViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                CustomerStorageAndForceFeeSettlement data = new CustomerStorageAndForceFeeSettlement();
                data.StartTime = DateTime.Parse(model.StartTime);
                data.EndTime = DateTime.Parse(model.EndTime);
                data.InvoiceNo = model.InvoiceNo;
                data.CustomerId = model.CustomerId;
                data.CustomerName = model.CustomerName;
                data.InvoiceType = model.InvoiceType;
                data.InvoiceAmount = model.InvoiceAmount;
                data.Remark = model.Remark;

                //保存数据
                string strErrText;
                StockSystem stock = new StockSystem();
                if (stock.InsertCustomerStorageAndForceFeeSettlement(data, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Example #2
0
        /// <summary>
        /// 新增仓储力支费结算数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long InsertCustomerStorageAndForceFeeSettlement(CustomerStorageAndForceFeeSettlement data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Output, (object)data.Id),
                    MakeParam(STARTTIME_PARAM, SqlDbType.DateTime, 8, ParameterDirection.Input, (object)data.StartTime),
                    MakeParam(ENDTIME_PARAM, SqlDbType.DateTime, 8, ParameterDirection.Input, (object)data.EndTime),
                    MakeParam(INVOICENO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.InvoiceNo),
                    MakeParam(CUSTOMERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.CustomerId),
                    MakeParam(CUSTOMERNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.CustomerName),
                    MakeParam(INVOICETYPE_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.InvoiceType),
                    MakeParam(INVOICEAMOUNT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.InvoiceAmount),
                    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("InsertCustomerStorageAndForceFeeSettlement", Params, out outParams, out strErrText) < 0)
            {
                return 0;
            }
            else
            {
                return (long)outParams[ID_PARAM].Value;
            }
        }
Example #3
0
        /// <summary>
        /// 新增仓储力支费结算数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long InsertCustomerStorageAndForceFeeSettlement(CustomerStorageAndForceFeeSettlement data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            long nId = 0;

            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (StockDAO dao = new StockDAO())
                    {
                        nId = dao.InsertCustomerStorageAndForceFeeSettlement(data, nOpStaffId, strOpStaffName, out strErrText);
                        if (nId <= 0)
                            return 0;
                    }
                    transScope.Complete();
                }
                return nId;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return 0;
            }
        }