Пример #1
0
 /// <summary>
 /// 新增仓库数据
 /// </summary>
 /// <param name="data"></param>
 /// <param name="nOpStaffId"></param>
 /// <param name="strOpStaffName"></param>
 /// <param name="strErrText"></param>
 /// <returns></returns>
 public bool InsertWarehouse(Warehouse data, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     try
     {
         using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
         {
             using (DDDAO dao = new DDDAO())
             {
                 if (!dao.InsertWarehouse(data, nOpStaffId, strOpStaffName, out strErrText))
                     return false;
             }
             transScope.Complete();
         }
         return true;
     }
     catch (Exception e)
     {
         strErrText = e.Message;
         return false;
     }
 }
Пример #2
0
        /// <summary>
        /// 新增仓库数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool InsertWarehouse(Warehouse data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(NAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.Name),
                    MakeParam(ISLEASE_PARAM, SqlDbType.Bit, 1, ParameterDirection.Input, (object)data.IsLease),
                    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)
                };

            if (Execute("InsertWarehouse", Params, out strErrText) >= 0)
                return true;
            else
                return false;
        }
Пример #3
0
        public ActionResult NewWarehouse(WarehouseViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Warehouse data = new Warehouse();
                data.Name = model.Name;
                data.IsLease = model.IsLease;
                data.Remark = model.Remark;

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