Example #1
0
        /// <summary>
        /// 新增客户结算价格数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool InsertCustomerTransportPrice(CustomerTransportPrice data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(CUSTOMERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.CustomerId),
                    MakeParam(STARTCOUNTRY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.StartCountry),
                    MakeParam(STARTPROVINCE_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.StartProvince),
                    MakeParam(STARTCITY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.StartCity),
                    MakeParam(DESTCOUNTRY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DestCountry),
                    MakeParam(DESTPROVINCE_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DestProvince),
                    MakeParam(DESTCITY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DestCity),
                    MakeParam(MINTUNNAGESORPILES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.MinTunnagesOrPiles),
                    MakeParam(MAXTUNNAGESORPILES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.MaxTunnagesOrPiles),
                    MakeParam(STARTTIME_PARAM, SqlDbType.DateTime, 8, ParameterDirection.Input, (object)data.StartTime),
                    MakeParam(ENDTIME_PARAM, SqlDbType.DateTime, 8, ParameterDirection.Input, (object)data.EndTime),
                    MakeParam(CARTYPE_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.CarType??string.Empty),
                    MakeParam(TRANSPORTPRICE_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.TransportPrice),
                    MakeParam(RIVERCROSSINGCHARGES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.RiverCrossingCharges),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName),
                };

            if (Execute("InsertCustomerTransportPrice", Params, out strErrText) >= 0)
                return true;
            else
                return false;
        }
Example #2
0
        public ActionResult NewCustomer(CustomerViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Customer data = new Customer();
                data.Name = model.Name;
                data.FullName = model.FullName;
                data.WarningStock = model.WarningStock;
                data.StopStock = model.StopStock;
                data.SettlementExpression = model.SettlementExpression;
                data.ValuationMode = model.ValuationMode;
                data.GrossWeightRate = decimal.Parse(model.GrossWeightRate);
                data.OwnOrganId = model.OwnOrganId;
                data.Remark = model.Remark ?? string.Empty;

                List<CustomerTransportPrice> listTransportPrice = new List<CustomerTransportPrice>();
                if (model.TransportPrices != null)
                {
                    foreach (CustomerTransportPriceViewModel m in model.TransportPrices)
                    {
                        CustomerTransportPrice p = new CustomerTransportPrice();
                        p.CustomerId = m.CustomerId;
                        p.StartCountry = m.StartCountry;
                        p.StartProvince = m.StartProvince;
                        p.StartCity = m.StartCity;
                        p.DestCountry = m.DestCountry;
                        p.DestProvince = m.DestProvince;
                        p.DestCity = m.DestCity;
                        p.MinTunnagesOrPiles = m.MinTunnagesOrPiles;
                        p.MaxTunnagesOrPiles = m.MaxTunnagesOrPiles;
                        p.StartTime = DateTime.Parse(m.StartTime);
                        p.EndTime = DateTime.Parse(m.EndTime);
                        p.CarType = m.CarType;
                        p.TransportPrice = m.TransportPrice;
                        p.RiverCrossingCharges = m.RiverCrossingCharges;
                        listTransportPrice.Add(p);
                    }
                }

                List<CustomerForceFeePrice> listForceFeePrice = new List<CustomerForceFeePrice>();
                if (model.ForceFeePrices != null)
                {
                    foreach (CustomerForceFeePriceViewModel m in model.ForceFeePrices)
                    {
                        CustomerForceFeePrice p = new CustomerForceFeePrice();
                        p.CustomerId = m.CustomerId;
                        p.StartTime = DateTime.Parse(m.ForceFeePriceStartTime);
                        p.EndTime = DateTime.Parse(m.ForceFeePriceEndTime);
                        p.LoadingForceFeePrice = m.LoadingForceFeePrice;
                        p.UnloadingForceFeePrice = m.UnloadingForceFeePrice;
                        listForceFeePrice.Add(p);
                    }
                }

                List<CustomerStorageFeePrice> listStorageFeePrice = new List<CustomerStorageFeePrice>();
                if (model.StorageFeePrices != null)
                {
                    foreach (CustomerStorageFeePriceViewModel m in model.StorageFeePrices)
                    {
                        CustomerStorageFeePrice p = new CustomerStorageFeePrice();
                        p.CustomerId = m.CustomerId;
                        p.StartTime = DateTime.Parse(m.StorageFeePriceStartTime);
                        p.EndTime = DateTime.Parse(m.StorageFeePriceEndTime);
                        p.StorageFeePrice = m.StorageFeePrice;
                        listStorageFeePrice.Add(p);
                    }
                }

                //保存数据
                string strErrText;
                CustomerSystem customer = new CustomerSystem();
                if (customer.InsertCustomer(data, listTransportPrice, listForceFeePrice, listStorageFeePrice, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }