Exemplo n.º 1
0
        /// <summary>
        /// 添加员工
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <param name="status">状态</param>
        /// <param name="statusMessage">返回状消息</param>
        /// <returns>主键</returns>
        public string AddStaff(BaseUserInfo userInfo, BaseStaffEntity entity, out Status status, out string statusMessage)
        {
            var result = string.Empty;

            var returnCode    = Status.Ok;
            var returnMessage = string.Empty;
            var parameter     = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                // 1.若添加用户成功,添加员工。
                var manager   = new BaseStaffManager(dbHelper, userInfo);
                result        = manager.UniqueAdd(entity, out returnCode);
                returnMessage = manager.GetStateMessage(returnCode);
                // 2.自己不用给自己发提示信息,这个提示信息是为了提高工作效率的
            });
            status        = returnCode;
            statusMessage = returnMessage;
            return(result);
        }