示例#1
0
文件: DDDAO.cs 项目: zjchenxk/SYLS
        /// <summary>
        /// 新增货物类别
        /// </summary>
        /// <param name="data">货物类别数据集</param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns></returns>
        public bool InsertGoodsType(GoodsType data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(NAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.Name),
                    MakeParam(PARENTID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.ParentId),
                    MakeParam(REMARK_PARAM, SqlDbType.NVarChar, 100, ParameterDirection.Input, (object)data.Remark),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName)
                };

            if (Execute("InsertGoodsType", Params, out strErrText) >= 0)
                return true;
            else
                return false;
        }
示例#2
0
        public ActionResult NewGoodsType(GoodsTypeViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                GoodsType data = new GoodsType();
                data.Name = model.Name;
                data.ParentId = model.ParentId;
                data.Remark = model.Remark ?? string.Empty;

                //保存数据
                string strErrText;
                DDSystem dd = new DDSystem();
                if (dd.InsertGoodsType(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
示例#3
0
文件: DDSystem.cs 项目: zjchenxk/SYLS
 /// <summary>
 /// 新增货物类别
 /// </summary>
 /// <param name="data">货物类别数据集</param>
 /// <param name="nOpStaffId">操作员工编码</param>
 /// <param name="strOpStaffName">操作员工姓名</param>
 /// <param name="strErrText">出错信息</param>
 /// <returns></returns>
 public bool InsertGoodsType(GoodsType 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.InsertGoodsType(data, nOpStaffId, strOpStaffName, out strErrText))
                     return false;
             }
             transScope.Complete();
         }
         return true;
     }
     catch (Exception e)
     {
         strErrText = e.Message;
         return false;
     }
 }