Beispiel #1
0
        /// <summary>
        /// 新增收货单位距离数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool InsertReceiverDistance(ReceiverDistance data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(RECEIVERNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.ReceiverName),
                    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(KM_PARAM, SqlDbType.Int, 4, ParameterDirection.Input, (object)data.KM),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName),
                };

            if (Execute("InsertReceiverDistance", Params, out strErrText) >= 0)
                return true;
            else
                return false;
        }
Beispiel #2
0
        public ActionResult NewReceiver(ReceiverViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Receiver data = new Receiver();
                data.Name = model.Name;
                data.Country = model.Country;
                data.Province = model.Province;
                data.City = model.City;
                data.Address = model.Address;
                data.Contact = model.Contact;
                data.ContactTel = model.ContactTel;

                List<ReceiverDistance> listDistance = new List<ReceiverDistance>();
                if (model.Distances != null)
                {
                    foreach (ReceiverDistanceViewModel m in model.Distances)
                    {
                        ReceiverDistance d = new ReceiverDistance();
                        d.ReceiverName = model.Name;
                        d.StartCountry = m.StartCountry;
                        d.StartProvince = m.StartProvince;
                        d.StartCity = m.StartCity;
                        d.KM = m.KM;
                        listDistance.Add(d);
                    }
                }

                //保存数据
                string strErrText;
                DDSystem dd = new DDSystem();
                if (dd.InsertReceiver(data, listDistance, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }