示例#1
0
        public virtual SystemProcess UpdateSystemProcess(SystemProcess entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            SystemProcess other = GetSystemProcess(entity.SystemProcessId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update SystemProcess set  [Name]=@Name
							, [Description]=@Description
							, [Enabled]=@Enabled
							, [DisplayOrder]=@DisplayOrder
							, [Ip]=@Ip
							, [Port]=@Port 
							 where SystemProcessID=@SystemProcessID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@Description", entity.Description ?? (object)DBNull.Value)
                , new SqlParameter("@Enabled", entity.Enabled)
                , new SqlParameter("@DisplayOrder", entity.DisplayOrder)
                , new SqlParameter("@Ip", entity.Ip ?? (object)DBNull.Value)
                , new SqlParameter("@Port", entity.Port ?? (object)DBNull.Value)
                , new SqlParameter("@SystemProcessID", entity.SystemProcessId)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetSystemProcess(entity.SystemProcessId));
        }