コード例 #1
0
        public virtual SystemUser Copy()
        {
            SystemUser user = new SystemUser();

            user.UserCode         = this.UserCode;
            user.OriginalUserCode = this.OriginalUserCode;
            user.UserID           = this.UserID;
            user.UserName         = this.UserName;
            user.OwnName          = this.OwnName;
            user.PassWord         = this.PassWord;
            user.Sex             = this.Sex;
            user.Phone           = this.Phone;
            user.MailBox         = this.MailBox;
            user.Note            = this.Note;
            user.BirthDay        = this.BirthDay;
            user.PhoneHome       = this.PhoneHome;
            user.Address         = this.Address;
            user.Mobile          = this.Mobile;
            user.Fax             = this.Fax;
            user.Status          = this.Status;
            user.LastProjectCode = this.LastProjectCode;
            user.SortID          = this.SortID;
            user.ShortUserName   = this.ShortUserName;
            user.AcceptChanges();
            return(user);
        }
コード例 #2
0
        public override bool Update(TransactionManager transactionManager, SystemUser entity)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.SystemUser_Update", this._useStoredProcedure);

            database.AddInParameter(command, "@UserCode", DbType.AnsiString, entity.UserCode);
            database.AddInParameter(command, "@OriginalUserCode", DbType.AnsiString, entity.OriginalUserCode);
            database.AddInParameter(command, "@UserID", DbType.AnsiString, entity.UserID);
            database.AddInParameter(command, "@UserName", DbType.AnsiString, entity.UserName);
            database.AddInParameter(command, "@OwnName", DbType.AnsiString, entity.OwnName);
            database.AddInParameter(command, "@PassWord", DbType.AnsiString, entity.PassWord);
            database.AddInParameter(command, "@Sex", DbType.AnsiString, entity.Sex);
            database.AddInParameter(command, "@Phone", DbType.AnsiString, entity.Phone);
            database.AddInParameter(command, "@MailBox", DbType.AnsiString, entity.MailBox);
            database.AddInParameter(command, "@Note", DbType.AnsiString, entity.Note);
            database.AddInParameter(command, "@BirthDay", DbType.DateTime, entity.BirthDay.HasValue ? ((object)entity.BirthDay) : ((object)DBNull.Value));
            database.AddInParameter(command, "@PhoneHome", DbType.AnsiString, entity.PhoneHome);
            database.AddInParameter(command, "@Address", DbType.AnsiString, entity.Address);
            database.AddInParameter(command, "@Mobile", DbType.AnsiString, entity.Mobile);
            database.AddInParameter(command, "@Fax", DbType.AnsiString, entity.Fax);
            database.AddInParameter(command, "@Status", DbType.Int32, entity.Status.HasValue ? ((object)entity.Status) : ((object)DBNull.Value));
            database.AddInParameter(command, "@LastProjectCode", DbType.AnsiString, entity.LastProjectCode);
            database.AddInParameter(command, "@SortID", DbType.AnsiString, entity.SortID);
            database.AddInParameter(command, "@ShortUserName", DbType.AnsiString, entity.ShortUserName);
            int num = 0;

            if (transactionManager != null)
            {
                num = Utility.ExecuteNonQuery(transactionManager, command);
            }
            else
            {
                num = Utility.ExecuteNonQuery(database, command);
            }
            if (DataRepository.Provider.EnableEntityTracking)
            {
                EntityManager.StopTracking(entity.EntityTrackingKey);
            }
            entity.OriginalUserCode = entity.UserCode;
            entity.AcceptChanges();
            return(Convert.ToBoolean(num));
        }