Exemplo n.º 1
0
 /// <summary>
 /// 新增岗位
 /// </summary>
 /// <param name="data"></param>
 /// <param name="nOpStaffId">操作员工编码</param>
 /// <param name="strOpStaffName">操作员工姓名</param>
 /// <param name="strErrText">出错信息</param>
 /// <returns>成功返回True,否则返回False</returns>
 public bool InsertPosition(Position data, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     try
     {
         using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
         {
             using (PositionDAO dao = new PositionDAO())
             {
                 if (!dao.InsertPosition(data, nOpStaffId, strOpStaffName, out strErrText))
                     return false;
             }
             transScope.Complete();
         }
         return true;
     }
     catch (Exception e)
     {
         strErrText = e.Message;
         return false;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 读取指定岗位记录
        /// </summary>
        /// <param name="nPositionId"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public Position LoadPosition(long nPositionId, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                Position dataResult = null;
                strErrText = String.Empty;

                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (PositionDAO dao = new PositionDAO())
                    {
                        dataResult = dao.LoadPosition(nPositionId, nOpStaffId, strOpStaffName, out strErrText);
                    }
                    transScope.Complete();
                }
                return dataResult;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return null;
            }
        }